Cleanup comments, formatting, etc
This commit is contained in:
@@ -2,7 +2,6 @@ package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import com.google.common.base.Joiner;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -31,7 +30,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||
|
||||
if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
|
||||
// CraftBukkit start - handle command block commands using Bukkit dispatcher
|
||||
// CraftBukkit start - Handle command block commands using Bukkit dispatcher
|
||||
org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
|
||||
Joiner joiner = Joiner.on(" ");
|
||||
String command = this.b;
|
||||
@@ -41,19 +40,19 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
String[] args = command.split(" ");
|
||||
ArrayList<String[]> commands = new ArrayList<String[]>();
|
||||
|
||||
// block disallowed commands
|
||||
// Block disallowed commands
|
||||
if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
|
||||
args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
|
||||
args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// make sure this is a valid command
|
||||
// Make sure this is a valid command
|
||||
if (commandMap.getCommand(args[0]) == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if the world has no players don't run
|
||||
// If the world has no players don't run
|
||||
if (this.world.players.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
@@ -80,7 +79,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
|
||||
commands.add(args);
|
||||
|
||||
// find positions of command block syntax, if any
|
||||
// Find positions of command block syntax, if any
|
||||
ArrayList<String[]> newCommands = new ArrayList<String[]>();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (PlayerSelector.isPattern(args[i])) {
|
||||
@@ -96,10 +95,10 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
|
||||
|
||||
int completed = 0;
|
||||
|
||||
// now dispatch all of the commands we ended up with
|
||||
// Now dispatch all of the commands we ended up with
|
||||
for (int i = 0; i < commands.size(); i++) {
|
||||
try {
|
||||
if (commandMap.dispatch(sender, joiner.join(Arrays.asList(commands.get(i))))) {
|
||||
if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i))))) {
|
||||
completed++;
|
||||
}
|
||||
} catch (Throwable exception) {
|
||||
|
||||
Reference in New Issue
Block a user