src/main/java/vpd/bowandaero12/furnacelv/commands/DebugCmd.java aktualisiert

This commit is contained in:
2025-11-26 15:43:32 +00:00
parent 95fbdbc526
commit 223fddda10

View File

@@ -1,44 +1,50 @@
package vpd.bowandaero12.furnacelv.commands; package vpd.bowandaero12.furnacelv.commands;
import java.util.HashSet; import org.bukkit.ChatColor;
import java.util.Set;
import java.util.UUID;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import vpd.bowandaero12.furnacelv.FurnaceLevels; import vpd.bowandaero12.furnacelv.FurnaceLevels;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class DebugCmd implements CommandExecutor { public class DebugCmd implements CommandExecutor {
private FurnaceLevels plugin; private final FurnaceLevels plugin;
private final Set<UUID> debugging = new HashSet<>();
private Set<UUID> debugging;
public DebugCmd(FurnaceLevels plugin) {
public DebugCmd(FurnaceLevels plugin) { this.plugin = plugin;
this.debugging = new HashSet<>(); }
this.plugin = plugin;
} @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Player)) {
if (!(sender instanceof Player)) sender.sendMessage("Dieser Befehl kann nur von einem Spieler ausgeführt werden.");
return true; return true;
if (!sender.hasPermission("furnacelevels.debug")) { }
sender.sendMessage(this.plugin.lvmenu.getLangMsg("no-permission", null));
return true; Player player = (Player) sender;
} if (!player.hasPermission("furnacelevels.debug")) {
Player p = (Player)sender; player.sendMessage(ChatColor.RED + "Du hast keine Berechtigung, diesen Befehl zu verwenden.");
UUID uuid = p.getUniqueId(); return true;
if (!this.debugging.contains(uuid)) { }
this.debugging.add(uuid);
p.sendMessage(this.plugin.lvmenu.getLangMsg("debug-enabled", null)); UUID uuid = player.getUniqueId();
return true; if (debugging.contains(uuid)) {
} debugging.remove(uuid);
p.sendMessage(this.plugin.lvmenu.getLangMsg("debug-disabled", null)); player.sendMessage(ChatColor.RED + "Debug-Modus deaktiviert.");
this.debugging.remove(uuid); } else {
return true; debugging.add(uuid);
} player.sendMessage(ChatColor.GREEN + "Debug-Modus aktiviert.");
}
public Set<UUID> getDebugging() {
return this.debugging; return true;
} }
}
public boolean isDebugging(Player player) {
return debugging.contains(player.getUniqueId());
}
}