30 lines
1.1 KiB
Java
30 lines
1.1 KiB
Java
![]() |
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());
|
||
|
}
|
||
|
}
|