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