From 845aab59375f910ae3d11235322fe0840ce815f7 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 7 Aug 2015 02:41:07 +1000 Subject: [PATCH] Remove debug --- .../com/intellectualcrafters/plot/PS.java | 25 +++++++++++++------ .../plot/commands/MusicSubcommand.java | 4 --- .../plot/database/SQLManager.java | 1 + .../bukkit/object/BukkitPlayer.java | 1 - 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java index 943610c31..fd7a840e3 100644 --- a/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/src/main/java/com/intellectualcrafters/plot/PS.java @@ -536,10 +536,19 @@ public class PS { hardmax = Math.min(hardmax, max); Plot[] cache = new Plot[hardmax + 1]; List overflow = new ArrayList(overflowSize); + ArrayList extra = new ArrayList<>(); for (Plot plot : plots) { int hash = MathMan.getPositiveId(plot.hashCode()); - if (hash < hardmax && hash > -1) { - cache[hash] = plot; + if (hash < hardmax) { + if (hash >= 0) { + cache[hash] = plot; + } + else { + extra.add(plot); + } + } + else if (Math.abs(plot.id.x) > 15446 || Math.abs(plot.id.y) > 15446) { + extra.add(plot); } else { overflow.add(plot); @@ -556,6 +565,9 @@ public class PS { for (Plot plot : overflowArray) { result.add(plot); } + for (Plot plot : extra) { + result.add(plot); + } return result; } @@ -746,8 +758,7 @@ public class PS { * @param input */ public static void sortPlotsByHash(Plot[] input) { - final int SIZE = 100; - List[] bucket = new ArrayList[SIZE]; + List[] bucket = new ArrayList[64]; for (int i = 0; i < bucket.length; i++) { bucket[i] = new ArrayList(); } @@ -757,19 +768,19 @@ public class PS { maxLength = true; for (Plot i : input) { tmp = MathMan.getPositiveId(i.hashCode()) / placement; - bucket[tmp % SIZE].add(i); + bucket[tmp & 63].add(i); if (maxLength && tmp > 0) { maxLength = false; } } int a = 0; - for (int b = 0; b < SIZE; b++) { + for (int b = 0; b < 64; b++) { for (Plot i : bucket[b]) { input[a++] = i; } bucket[b].clear(); } - placement *= SIZE; + placement *= 64; } } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java index 5cc228809..5a03c8f6d 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java @@ -45,10 +45,6 @@ public class MusicSubcommand extends SubCommand { @Override public boolean onCommand(final PlotPlayer player, final String[] args) { - - // TODO FIX PLOT MUSIC AS NPE FROM PLAYER.PLAYEFFECT - System.out.print("TODO MUSIC"); - final Location loc = player.getLocation(); final Plot plot = MainUtil.getPlot(loc); if (plot == null) { diff --git a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 2ea3d887c..40f343b2b 100644 --- a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -2378,6 +2378,7 @@ public class SQLManager implements AbstractDB { // TODO comments // TODO ratings // TODO alias + // TODO unconnected entries from helpers, trusted, denied, comments, settings, rating } for (Entry> entry : database.entrySet()) { diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index f9679113f..d1b190476 100644 --- a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -222,7 +222,6 @@ public class BukkitPlayer extends PlotPlayer { @Override public void playMusic(Location loc, int id) { - System.out.print("RECORD: " + id); player.playEffect(BukkitUtil.getLocation(loc), Effect.RECORD_PLAY, id); }