commands, ...

This commit is contained in:
Sen 2025-03-25 23:10:40 +01:00
parent 66421e806e
commit 75f91dbf4c
44 changed files with 1035 additions and 631 deletions

View file

@ -0,0 +1,29 @@
package game.command.commands;
import game.command.CommandEnvironment;
import game.command.RunException;
import game.command.Command;
import game.command.Executor;
import game.network.NetHandlerPlayServer;
public class CommandRevoke extends Command {
public CommandRevoke() {
super("revoke");
this.addPlayer("player", false);
}
public void exec(CommandEnvironment env, Executor exec, NetHandlerPlayServer player) {
if(!(exec instanceof NetHandlerPlayServer) || !((NetHandlerPlayServer)exec).isLocal())
throw new RunException("Dieser Befehl kann nur vom Host-Spieler ausgeführt werden");
else if(player == exec)
throw new RunException("Du kannst nicht deinen eigenen Admin-Status entfernen");
else if(player.isLocal())
throw new RunException("%s ist der Host-Spieler", player.getUser());
else if(!player.getAdmin())
throw new RunException("%s ist kein Admin", player.getUser());
player.setAdmin(false);
player.logConsole("Der Host hat deine Administatorrechte entfernt");
exec.logConsole("%s ist jetzt kein Admin mehr", player.getUser());
}
}