Few more style cleanups

By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-10-11 02:16:44 +01:00
parent ad38184dc2
commit b50b4ca047
7 changed files with 34 additions and 28 deletions

View File

@ -139,7 +139,7 @@ public interface Block {
*/
void setData(byte data);
void setData(byte data, boolean applyPhyiscs);
void setData(byte data, boolean applyPhysics);
/**
* Sets the type of this block
@ -158,7 +158,7 @@ public interface Block {
boolean setTypeId(int type, boolean applyPhysics);
boolean setTypeIdAndData(int type, byte data, boolean applyPhyiscs);
boolean setTypeIdAndData(int type, byte data, boolean applyPhysics);
/**
* Gets the face relation of this block compared to the given block<br />

View File

@ -190,13 +190,16 @@ public class SimpleCommandMap implements CommandMap {
for (String alias : values.keySet()) {
String[] targetNames = values.get(alias);
List<Command> targets = new ArrayList<Command>();
String bad = "";
StringBuilder bad = new StringBuilder();
for (String name : targetNames) {
Command command = getCommand(name);
if (command == null) {
bad += name + ", ";
if (bad.length() > 0) {
bad.append(", ");
}
bad.append(name);
} else {
targets.add(command);
}
@ -211,7 +214,6 @@ public class SimpleCommandMap implements CommandMap {
}
if (bad.length() > 0) {
bad = bad.substring(0, bad.length() - 2);
server.getLogger().warning("The following command(s) could not be aliased under '" + alias + "' because they do not exist: " + bad);
}
}

View File

@ -1,7 +1,6 @@
package org.bukkit.command.defaults;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -17,17 +16,17 @@ public class ListCommand extends VanillaCommand {
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
String players = "";
StringBuilder players = new StringBuilder();
for (Player player : Bukkit.getOnlinePlayers()) {
if (players.length() > 0) {
players += ", ";
players.append(", ");
}
players += player.getDisplayName();
players.append(player.getDisplayName());
}
sender.sendMessage("Connected players: " + players);
sender.sendMessage("Connected players: " + players.toString());
return true;
}

View File

@ -20,14 +20,17 @@ public class MeCommand extends VanillaCommand {
return false;
}
String message = "";
for (int i = 0; i < args.length; i++) {
if (i > 0) message += " ";
message += args[i];
StringBuilder message = new StringBuilder();
message.append(sender.getName());
if (args.length > 0) {
message.append(args[0]);
for (int i = 1; i < args.length; i++) {
message.append(" ");
message.append(args[i]);
}
}
Bukkit.broadcastMessage("* " + sender.getName() + " " + message);
Bukkit.broadcastMessage("* " + message.toString());
return true;
}

View File

@ -21,11 +21,13 @@ public class SayCommand extends VanillaCommand {
return false;
}
String message = "";
for (int i = 0; i < args.length; i++) {
if (i > 0) message += " ";
message += args[i];
StringBuilder message = new StringBuilder();
if (args.length > 0) {
message.append(args[0]);
for (int i = 1; i < args.length; i++) {
message.append(" ");
message.append(args[i]);
}
}
if (!(sender instanceof ConsoleCommandSender)) {

View File

@ -27,11 +27,11 @@ public class TellCommand extends VanillaCommand {
if (player == null) {
sender.sendMessage("There's no player by that name online.");
} else {
String message = "";
StringBuilder message = new StringBuilder();
for (int i = 1; i < args.length; i++) {
if (i > 1) message += " ";
message += args[i];
if (i > 1) message.append(" ");
message.append(args[i]);
}
String result = ChatColor.GRAY + sender.getName() + " whispers " + message;

View File

@ -39,17 +39,17 @@ public class WhitelistCommand extends VanillaCommand {
} else if (args[0].equalsIgnoreCase("list")) {
if (badPerm(sender, "list")) return true;
String result = "";
StringBuilder result = new StringBuilder();
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) {
if (result.length() > 0) {
result += " ";
result.append(" ");
}
result += player.getName();
result.append(player.getName());
}
sender.sendMessage("White-listed players: " + result);
sender.sendMessage("White-listed players: " + result.toString());
return true;
}
} else if (args.length == 2) {