diff --git a/src/de/diddiz/LogBlock/Consumer.java b/src/de/diddiz/LogBlock/Consumer.java index cc975bb..a80dd27 100644 --- a/src/de/diddiz/LogBlock/Consumer.java +++ b/src/de/diddiz/LogBlock/Consumer.java @@ -194,9 +194,7 @@ public class Consumer extends TimerTask public void queueKill(World world, String killerName, String victimName, int weapon) { if (victimName == null || !worlds.containsKey(world.getName().hashCode())) return; - killerName = killerName.replaceAll("[^a-zA-Z0-9_]", ""); - victimName = victimName.replaceAll("[^a-zA-Z0-9_]", ""); - queue.add(new KillRow(world.getName().hashCode(), killerName, victimName, weapon)); + queue.add(new KillRow(world.getName().hashCode(), killerName.replaceAll("[^a-zA-Z0-9_]", ""), victimName.replaceAll("[^a-zA-Z0-9_]", ""), weapon)); } /** @@ -348,10 +346,7 @@ public class Consumer extends TimerTask private void queueBlock(String playerName, Location loc, int typeBefore, int typeAfter, byte data, String signtext, ChestAccess ca) { if (playerName == null || loc == null || typeBefore < 0 || typeAfter < 0 || typeBefore > 255 || typeAfter > 255 || hiddenPlayers.contains(playerName.hashCode()) || !worlds.containsKey(loc.getWorld().getName().hashCode()) || typeBefore != typeAfter && hiddenBlocks.contains(typeBefore) && hiddenBlocks.contains(typeAfter)) return; - playerName = playerName.replaceAll("[^a-zA-Z0-9_]", ""); - if (signtext != null) - signtext = signtext.replace("\\", "\\\\").replace("'", "\\'"); - queue.add(new BlockRow(loc, playerName, typeBefore, typeAfter, data, signtext, ca)); + queue.add(new BlockRow(loc, playerName.replaceAll("[^a-zA-Z0-9_]", ""), typeBefore, typeAfter, data, signtext != null ? signtext.replace("\\", "\\\\").replace("'", "\\'") : null, ca)); } private String playerID(String playerName) { diff --git a/src/de/diddiz/LogBlock/Updater.java b/src/de/diddiz/LogBlock/Updater.java index e8cd1aa..a429173 100644 --- a/src/de/diddiz/LogBlock/Updater.java +++ b/src/de/diddiz/LogBlock/Updater.java @@ -163,7 +163,7 @@ class Updater conn.close(); } - private void createTable(DatabaseMetaData dbm, Statement state, String table, String query) throws SQLException { + private static void createTable(DatabaseMetaData dbm, Statement state, String table, String query) throws SQLException { if (!dbm.getTables(null, null, table, null).next()) { getLogger().log(Level.INFO, "[LogBlock] Creating table " + table + "."); state.execute("CREATE TABLE `" + table + "` " + query); diff --git a/src/de/diddiz/util/BukkitUtils.java b/src/de/diddiz/util/BukkitUtils.java index 12cdd23..cb4749c 100644 --- a/src/de/diddiz/util/BukkitUtils.java +++ b/src/de/diddiz/util/BukkitUtils.java @@ -1,6 +1,7 @@ package de.diddiz.util; import static de.diddiz.util.MaterialName.materialName; +import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -102,8 +103,7 @@ public class BukkitUtils } public static String friendlyWorldname(String worldName) { - worldName = worldName.substring(worldName.lastIndexOf('/') + 1); - return worldName.substring(worldName.lastIndexOf('\\') + 1); + return new File(worldName).getName(); } public static Set> getBlockEquivalents() {