moved automatic scoreboard update start to EventController
This commit is contained in:
@@ -56,8 +56,6 @@ public class Deathrun extends Appliance implements Event, Scorable {
|
|||||||
|
|
||||||
World world = Bukkit.getWorlds().getFirst();
|
World world = Bukkit.getWorlds().getFirst();
|
||||||
world.getWorldBorder().setSize(world.getWorldBorder().getMaxSize());
|
world.getWorldBorder().setSize(world.getWorldBorder().getMaxSize());
|
||||||
|
|
||||||
this.getScoreboardBuilder().startAutomaticUpdates();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class EventController extends Appliance {
|
|||||||
public void startEvent() {
|
public void startEvent() {
|
||||||
if(this.selectedEvent == null) throw new ApplianceCommand.Error("There is no event selected!");
|
if(this.selectedEvent == null) throw new ApplianceCommand.Error("There is no event selected!");
|
||||||
this.selectedEvent.start();
|
this.selectedEvent.start();
|
||||||
|
if(this.selectedEvent instanceof Scorable scorable && scorable.automaticUpdates()) scorable.getScoreboardBuilder().startAutomaticUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopEvent() {
|
public void stopEvent() {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public interface Scorable {
|
public interface Scorable {
|
||||||
String getScoreboardName();
|
String getScoreboardName();
|
||||||
|
default boolean automaticUpdates() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
EventScoreboardBuilder getScoreboardBuilder();
|
EventScoreboardBuilder getScoreboardBuilder();
|
||||||
int getScore(Player p);
|
int getScore(Player p);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user