master-big-events #11
@@ -127,7 +127,7 @@ public class Deathrun extends Appliance implements Event, Scorable {
|
||||
public void stop() {
|
||||
this.getScoreboardBuilder().stopAutomaticUpdates();
|
||||
Title title = Title.title(Component.text("Ende!"), Component.empty());
|
||||
this.pvpTask.cancel();
|
||||
if(this.pvpTask != null) this.pvpTask.cancel();
|
||||
this.pvpDisabled = true;
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
player.showTitle(title);
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -86,7 +87,7 @@ public class EventController extends Appliance {
|
||||
}
|
||||
|
||||
public void scheduleStart(long durationMinutes) {
|
||||
if(this.selectedEvent == null) throw new ApplianceCommand.Error("There is no event selected!");
|
||||
if(!this.hasLoadedEvent()) throw new ApplianceCommand.Error("There is no event selected!");
|
||||
this.durationMinutes = durationMinutes;
|
||||
this.countdown.start();
|
||||
}
|
||||
@@ -188,6 +189,13 @@ public class EventController extends Appliance {
|
||||
return String.format("%02d:%02d:%02d", seconds / 3600, (seconds / 60) % 60, seconds % 60);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<Listener> listeners() {
|
||||
return List.of(
|
||||
new EventPlayerLoginListener()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull List<ApplianceCommand<?>> commands() {
|
||||
return List.of(
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
public class EventPlayerLoginListener extends ApplianceListener<EventController> {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(event.getPlayer().hasPermission("admin")) return;
|
||||
if(event.getPlayer().isOp()) return;
|
||||
if(this.getAppliance().hasLoadedEvent()) return;
|
||||
event.getPlayer().kick(Component.text("Es ist kein Event geladen."));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user