commands, ...
This commit is contained in:
parent
66421e806e
commit
75f91dbf4c
44 changed files with 1035 additions and 631 deletions
29
java/src/game/command/commands/CommandRevoke.java
Normal file
29
java/src/game/command/commands/CommandRevoke.java
Normal 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());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue