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.getWorldBorder().setSize(world.getWorldBorder().getMaxSize());
|
||||
|
||||
this.getScoreboardBuilder().startAutomaticUpdates();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user