moved automatic scoreboard update start to EventController

This commit is contained in:
2025-12-19 12:58:10 +01:00
parent 914aaff10b
commit 36520a87f9
3 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -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() {

View File

@@ -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);
} }