Fixes some bugs

Fixes the win block type causing a win even when the win location is set.
Fixes the leave command only working for dropper arenas.
Fixes the command listener only cancelling command usage while in a dropper arena.
Fixes only dropper sessions being quit when the server stops.
This commit is contained in:
Kristian Knarvik 2023-04-15 20:52:04 +02:00
parent e21e872e89
commit 8e4737a267
4 changed files with 7 additions and 9 deletions

View File

@ -279,7 +279,7 @@ public final class MiniGames extends JavaPlugin {
public void onDisable() {
// Throw out currently playing players before exiting
for (Player player : getServer().getOnlinePlayers()) {
DropperArenaSession session = dropperArenaPlayerRegistry.getArenaSession(player.getUniqueId());
ArenaSession session = getSession(player.getUniqueId());
if (session != null) {
session.triggerQuit(true);
}

View File

@ -253,7 +253,7 @@ public class ParkourArena implements Arena {
@Override
public boolean willCauseWin(Block block) {
return (this.winLocation != null && this.winLocation.getBlock().equals(block)) ||
this.winBlockType == block.getType();
(this.winLocation == null && this.winBlockType == block.getType());
}
@Override

View File

@ -1,7 +1,7 @@
package net.knarcraft.minigames.command;
import net.knarcraft.minigames.MiniGames;
import net.knarcraft.minigames.arena.dropper.DropperArenaSession;
import net.knarcraft.minigames.arena.ArenaSession;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
@ -25,10 +25,9 @@ public class LeaveArenaCommand implements TabExecutor {
return false;
}
DropperArenaSession existingSession = MiniGames.getInstance().getDropperArenaPlayerRegistry().getArenaSession(
player.getUniqueId());
ArenaSession existingSession = MiniGames.getInstance().getSession(player.getUniqueId());
if (existingSession == null) {
commandSender.sendMessage("You are not in a dropper arena!");
commandSender.sendMessage("You are not in a mini-games arena!");
return false;
}

View File

@ -1,7 +1,7 @@
package net.knarcraft.minigames.listener;
import net.knarcraft.minigames.MiniGames;
import net.knarcraft.minigames.arena.dropper.DropperArenaSession;
import net.knarcraft.minigames.arena.ArenaSession;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -18,8 +18,7 @@ public class CommandListener implements Listener {
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
DropperArenaSession existingSession = MiniGames.getInstance().getDropperArenaPlayerRegistry().getArenaSession(
player.getUniqueId());
ArenaSession existingSession = MiniGames.getInstance().getSession(player.getUniqueId());
if (existingSession == null) {
return;
}