diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 4ff1ffa662..5d54c2cd9c 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -12,6 +12,8 @@ import java.util.Set; import org.bukkit.Server; import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.util.LongHashset; +import org.bukkit.craftbukkit.util.LongHashtable; import org.bukkit.event.Event.Type; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 6d535a1900..bdaefb3f84 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -8,7 +8,6 @@ import net.minecraft.server.ItemInWorldManager; import net.minecraft.server.Packet; import net.minecraft.server.Packet3Chat; import net.minecraft.server.Packet6SpawnPosition; -import net.minecraft.server.Packet9Respawn; import net.minecraft.server.ServerConfigurationManager; import net.minecraft.server.WorldServer; import org.bukkit.Location; diff --git a/src/main/java/net/minecraft/server/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java similarity index 90% rename from src/main/java/net/minecraft/server/LongHash.java rename to src/main/java/org/bukkit/craftbukkit/util/LongHash.java index 06da49ab34..6dea2679f1 100644 --- a/src/main/java/net/minecraft/server/LongHash.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java @@ -3,13 +3,13 @@ * and open the template in the editor. */ -package net.minecraft.server; +package org.bukkit.craftbukkit.util; /** * * @author Nathan */ -public abstract class LongHash { +public abstract class LongHash { static long toLong(int msw, int lsw) { return ((long)msw << 32) + lsw - Integer.MIN_VALUE; } diff --git a/src/main/java/net/minecraft/server/LongHashset.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashset.java similarity index 96% rename from src/main/java/net/minecraft/server/LongHashset.java rename to src/main/java/org/bukkit/craftbukkit/util/LongHashset.java index 6e65a351da..ecc698316f 100644 --- a/src/main/java/net/minecraft/server/LongHashset.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashset.java @@ -1,8 +1,7 @@ -package net.minecraft.server; -import java.util.ArrayList; +package org.bukkit.craftbukkit.util; import java.util.Arrays; -public class LongHashset extends LongHash { +public class LongHashset extends LongHash { long values[][][] = new long[256][][]; int count = 0; diff --git a/src/main/java/net/minecraft/server/LongHashtable.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java similarity index 90% rename from src/main/java/net/minecraft/server/LongHashtable.java rename to src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java index b9dc00e1d3..5ff9b59514 100644 --- a/src/main/java/net/minecraft/server/LongHashtable.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java @@ -1,7 +1,9 @@ -package net.minecraft.server; +package org.bukkit.craftbukkit.util; import java.util.ArrayList; import java.util.Arrays; +import net.minecraft.server.Chunk; +import net.minecraft.server.MinecraftServer; public class LongHashtable extends LongHash { @@ -35,7 +37,7 @@ public class LongHashtable extends LongHash return value; } - public void put(long key, V value) { + public synchronized void put(long key, V value) { int mainIdx = (int) (key & 255); int outerIdx = (int) ((key >> 32) & 255); Object outer[][] = this.values[mainIdx], inner[]; @@ -58,13 +60,11 @@ public class LongHashtable extends LongHash } } - public V get(long key) { - synchronized(this) { - return containsKey(key) ? (V) cache.value : null; - } + public synchronized V get(long key) { + return containsKey(key) ? (V) cache.value : null; } - public boolean containsKey(long key) { + public synchronized boolean containsKey(long key) { if (cache != null && cache.key == key) return true; int mainIdx = (int) (key & 255); @@ -89,7 +89,7 @@ public class LongHashtable extends LongHash } } - public void remove(long key) { + public synchronized void remove(long key) { Object[][] outer = this.values[(int) (key & 255)]; if (outer == null) return; @@ -115,7 +115,7 @@ public class LongHashtable extends LongHash } } - public ArrayList values() { + public synchronized ArrayList values() { ArrayList ret = new ArrayList(); for (Object[][] outer : this.values) { if (outer == null)