master-big-events #11

Merged
Pupsi merged 4 commits from master-big-events into master 2025-12-23 23:54:14 +00:00
3 changed files with 11 additions and 3 deletions
Showing only changes of commit fc502e3da8 - Show all commits

View File

@@ -127,7 +127,7 @@ public class Deathrun extends Appliance implements Event, Scorable {
public void stop() { public void stop() {
this.getScoreboardBuilder().stopAutomaticUpdates(); this.getScoreboardBuilder().stopAutomaticUpdates();
Title title = Title.title(Component.text("Ende!"), Component.empty()); Title title = Title.title(Component.text("Ende!"), Component.empty());
this.pvpTask.cancel(); if(this.pvpTask != null) this.pvpTask.cancel();
this.pvpDisabled = true; this.pvpDisabled = true;
Bukkit.getOnlinePlayers().forEach(player -> { Bukkit.getOnlinePlayers().forEach(player -> {
player.showTitle(title); player.showTitle(title);

View File

@@ -18,6 +18,7 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.GameRule; import org.bukkit.GameRule;
import org.bukkit.Statistic; import org.bukkit.Statistic;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
@@ -86,7 +87,7 @@ public class EventController extends Appliance {
} }
public void scheduleStart(long durationMinutes) { 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.durationMinutes = durationMinutes;
this.countdown.start(); 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); 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 @Override
protected @NotNull List<ApplianceCommand<?>> commands() { protected @NotNull List<ApplianceCommand<?>> commands() {
return List.of( return List.of(

View File

@@ -8,7 +8,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
public class EventPlayerLoginListener extends ApplianceListener<EventController> { public class EventPlayerLoginListener extends ApplianceListener<EventController> {
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
if(event.getPlayer().hasPermission("admin")) return; if(event.getPlayer().isOp()) return;
if(this.getAppliance().hasLoadedEvent()) return; if(this.getAppliance().hasLoadedEvent()) return;
event.getPlayer().kick(Component.text("Es ist kein Event geladen.")); event.getPlayer().kick(Component.text("Es ist kein Event geladen."));
} }