Add /kick

This commit is contained in:
ayunami2000 2022-08-23 16:57:53 -04:00
parent 2f17ab4a5f
commit 52795a349f
6 changed files with 14094 additions and 14051 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1307,6 +1307,7 @@ commands.banlist.players=There are %d total banned players:
commands.banlist.usage=/banlist [ips|players]
commands.kick.success=Kicked %s from the game
commands.kick.success.reason=Kicked %s from the game: '%s'
commands.kick.owner=You cannot kick the world owner!
commands.kick.usage=/kick <player> [reason ...]
commands.op.success=Opped %s
commands.op.usage=/op <player>

View File

@ -0,0 +1,35 @@
package net.minecraft.src;
public class CommandKick extends CommandBase {
public String getCommandName() {
return "kick";
}
/**
* Return the required permission level for this command.
*/
public int getRequiredPermissionLevel() {
return 2;
}
public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) {
if (par2ArrayOfStr.length == 0) {
throw new WrongUsageException("commands.kick.usage", new Object[0]);
}
EntityPlayerMP target = func_82359_c(par1ICommandSender, par2ArrayOfStr[0]);
if (target.mcServer.getServerOwner().equals(target.username)) {
throw new SyntaxErrorException("commands.kick.owner", new Object[0]);
}
if (par2ArrayOfStr.length == 1) {
target.playerNetServerHandler.kickPlayer("Kicked.");
notifyAdmins(par1ICommandSender, "commands.kick.success",
new Object[] { target.getEntityName() });
} else {
String message = String.join(" ", par2ArrayOfStr);
message = message.substring(message.indexOf(' ') + 1).trim();
target.playerNetServerHandler.kickPlayer(message);
notifyAdmins(par1ICommandSender, "commands.kick.success.reason",
new Object[] { target.getEntityName(), message });
}
}
}

View File

@ -6,6 +6,7 @@ import net.minecraft.server.MinecraftServer;
public class ServerCommandManager extends CommandHandler implements IAdminCommand {
public ServerCommandManager() {
this.registerCommand(new CommandKick());
this.registerCommand(new CommandTime());
this.registerCommand(new CommandGameMode());
this.registerCommand(new CommandDifficulty());