Code cleanup, fixed doors, chunk entity fetching

By: Tahg <tahgtahv@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2011-03-11 16:25:35 -05:00
parent ff806bfa66
commit a7ed1c966b
9 changed files with 36 additions and 32 deletions

View File

@@ -13,9 +13,9 @@ public class LongHashtable<V> extends LongHash
public void put(int msw, int lsw, V value) {
put(toLong(msw, lsw), value);
if(value instanceof Chunk) {
if (value instanceof Chunk) {
Chunk c = (Chunk)value;
if(msw != c.j || lsw != c.k) {
if (msw != c.j || lsw != c.k) {
MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")");
Throwable x = new Throwable();
x.fillInStackTrace();
@@ -26,9 +26,9 @@ public class LongHashtable<V> extends LongHash
public V get(int msw, int lsw) {
V value = get(toLong(msw, lsw));
if(value instanceof Chunk) {
if (value instanceof Chunk) {
Chunk c = (Chunk)value;
if(msw != c.j || lsw != c.k) {
if (msw != c.j || lsw != c.k) {
MinecraftServer.a.info("Chunk (" + c.j + ", " + c.k +") stored at (" + msw + ", " + lsw + ")");
Throwable x = new Throwable();
x.fillInStackTrace();

View File

@@ -100,13 +100,13 @@ public class SoftMap<K,V> {
private V fastGet(K key) {
SoftMapReference<K,V> ref = map.get(key);
if(ref==null) {
if (ref==null) {
return null;
}
V value = ref.get();
if(value!=null) {
if (value!=null) {
strongReferenceQueue.addFirst(value);
if(strongReferenceQueue.size() > strongReferenceSize) {
if (strongReferenceQueue.size() > strongReferenceSize) {
strongReferenceQueue.removeLast();
}
}
@@ -146,7 +146,7 @@ public class SoftMap<K,V> {
private void fastPut(K key, V value) {
map.put(key, new SoftMapReference<K,V>(key, value, queue));
strongReferenceQueue.addFirst(value);
if(strongReferenceQueue.size() > strongReferenceSize) {
if (strongReferenceQueue.size() > strongReferenceSize) {
strongReferenceQueue.removeLast();
}
}
@@ -167,7 +167,7 @@ public class SoftMap<K,V> {
public V remove(K key) {
emptyQueue();
SoftMapReference<K,V> ref = map.remove(key);
if(ref != null) {
if (ref != null) {
return ref.get();
}
return null;