This commit is contained in:
Robin Kupper
2011-06-10 14:20:34 +02:00
parent 75b4ce7894
commit 574972958a
4 changed files with 8 additions and 31 deletions

View File

@@ -22,11 +22,7 @@ public class HistoryFormatter
final int replaced = rs.getInt("replaced");
final String signtext;
if ((type == 63 || type == 68 || replaced == 63 || replaced == 68) && (signtext = rs.getString("signtext")) != null) {
final String action;
if (type == 0)
action = "destroyed ";
else
action = "created ";
final String action = type == 0 ? "destroyed " : "created ";
if (!signtext.contains("\0"))
msg.append(action + signtext);
else

View File

@@ -35,15 +35,8 @@ class LBToolListener extends PlayerListener
if (tables.get(player.getWorld().getName().hashCode()) != null) {
if (!(type == toolID && event.getClickedBlock().getTypeId() == 26))
event.setCancelled(true);
final QueryParams params;
ToolMode mode;
if (type == toolID) {
params = session.toolQuery;
mode = session.toolMode;
} else {
params = session.toolBlockQuery;
mode = session.toolBlockMode;
}
final QueryParams params = type == toolID ? session.toolQuery : session.toolBlockQuery;
final ToolMode mode = type == toolID ? session.toolMode : session.toolBlockMode;
if (type == toolblockID && action == Action.RIGHT_CLICK_BLOCK)
params.setLocation(event.getClickedBlock().getFace(event.getBlockFace()).getLocation());
else

View File

@@ -46,15 +46,11 @@ public class QueryParams implements Cloneable
}
public static boolean isKeyWord(String param) {
if (keywords.contains(param.toLowerCase().hashCode()))
return true;
return false;
return keywords.contains(param.toLowerCase().hashCode());
}
public String getLimit() {
if (limit == -1)
return "";
return "LIMIT " + limit;
return limit != -1 ? "LIMIT " + limit : "";
}
public String getOrderBy() {
@@ -205,14 +201,8 @@ public class QueryParams implements Cloneable
public void parseArgs(CommandSender sender, List<String> args) throws IllegalArgumentException {
if (args == null || args.size() == 0)
throw new IllegalArgumentException("No parameters specified.");
Player player = null;
if (sender instanceof Player)
player = (Player)sender;
final Session session;
if (!prepareToolQuery)
session = logblock.getSession(getSenderName(sender));
else
session = null;
final Player player = sender instanceof Player ? (Player)sender : null;
final Session session = prepareToolQuery ? null : logblock.getSession(getSenderName(sender));
if (player != null && world == null)
world = player.getWorld();
for (int i = 0; i < args.size(); i++) {

View File

@@ -143,9 +143,7 @@ public class BukkitUtils
}
public static byte rawData(ItemStack item) {
if (item.getData() == null)
return 0;
return item.getData().getData();
return item.getData() != null ? item.getData().getData() : 0;
}
public static class ItemStackComparator implements Comparator<ItemStack>