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 int replaced = rs.getInt("replaced");
final String signtext; final String signtext;
if ((type == 63 || type == 68 || replaced == 63 || replaced == 68) && (signtext = rs.getString("signtext")) != null) { if ((type == 63 || type == 68 || replaced == 63 || replaced == 68) && (signtext = rs.getString("signtext")) != null) {
final String action; final String action = type == 0 ? "destroyed " : "created ";
if (type == 0)
action = "destroyed ";
else
action = "created ";
if (!signtext.contains("\0")) if (!signtext.contains("\0"))
msg.append(action + signtext); msg.append(action + signtext);
else else

View File

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

View File

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

View File

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