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.getWorldBorder().setSize(world.getWorldBorder().getMaxSize());
this.getScoreboardBuilder().startAutomaticUpdates();
}
@Override

View File

@@ -44,6 +44,7 @@ public class EventController extends Appliance {
public void startEvent() {
if(this.selectedEvent == null) throw new ApplianceCommand.Error("There is no event selected!");
this.selectedEvent.start();
if(this.selectedEvent instanceof Scorable scorable && scorable.automaticUpdates()) scorable.getScoreboardBuilder().startAutomaticUpdates();
}
public void stopEvent() {

View File

@@ -5,6 +5,9 @@ import org.bukkit.entity.Player;
public interface Scorable {
String getScoreboardName();
default boolean automaticUpdates() {
return true;
}
EventScoreboardBuilder getScoreboardBuilder();
int getScore(Player p);
}