add some commands
This commit is contained in:
parent
6bf6831360
commit
d5269922b9
5 changed files with 65 additions and 1 deletions
28
java/src/game/command/commands/CommandKick.java
Normal file
28
java/src/game/command/commands/CommandKick.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package game.command.commands;
|
||||
|
||||
import game.command.CommandEnvironment;
|
||||
import game.command.RunException;
|
||||
import game.command.Command;
|
||||
import game.command.Executor;
|
||||
import game.network.Player;
|
||||
|
||||
public class CommandKick extends Command {
|
||||
public CommandKick() {
|
||||
super("kick");
|
||||
|
||||
this.addPlayer("player", false);
|
||||
}
|
||||
|
||||
public void exec(CommandEnvironment env, Executor exec, Player player) {
|
||||
if(!(exec instanceof Player))
|
||||
throw new RunException("Dieser Befehl kann nur von Spielern ausgeführt werden");
|
||||
else if(player == exec)
|
||||
throw new RunException("Du kannst nicht dich nicht selbst vom Server werfen");
|
||||
else if(player.isLocal())
|
||||
throw new RunException("%s ist der Host-Spieler", player.getUser());
|
||||
else if(player.getAdmin())
|
||||
throw new RunException("%s ist ein Admin", player.getUser());
|
||||
player.disconnect();
|
||||
exec.logConsole("%s wurde vom Server geworfen", player.getUser());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue