Small cleanup

This commit is contained in:
Matt 2016-03-04 19:53:31 -05:00
parent 5c60d69fd1
commit 32d4a08db1
5 changed files with 52 additions and 38 deletions

View File

@ -25,19 +25,19 @@ import java.util.Map.Entry;
public class FastQueue_1_7 extends SlowQueue {
public final RefClass classBlock = getRefClass("{nms}.Block");
public final RefClass classChunk = getRefClass("{nms}.Chunk");
public final RefClass classWorld = getRefClass("{nms}.World");
public final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
public final RefMethod methodGetHandle;
public final RefMethod methodGetChunkAt;
public final RefMethod methodA;
public final RefMethod methodGetById;
public final RefMethod methodInitLighting;
private final RefClass classBlock = getRefClass("{nms}.Block");
private final RefClass classChunk = getRefClass("{nms}.Chunk");
private final RefClass classWorld = getRefClass("{nms}.World");
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
private final RefMethod methodGetHandle;
private final RefMethod methodGetChunkAt;
private final RefMethod methodA;
private final RefMethod methodGetById;
private final RefMethod methodInitLighting;
public final SendChunk chunksender;
private final SendChunk chunksender;
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
public FastQueue_1_7() throws NoSuchMethodException, RuntimeException {
methodGetHandle = classCraftWorld.getMethod("getHandle");

View File

@ -27,14 +27,14 @@ import java.util.Map.Entry;
public class FastQueue_1_8 extends SlowQueue {
public final RefMethod methodInitLighting;
private final RefMethod methodInitLighting;
private final RefClass classBlock = getRefClass("{nms}.Block");
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
private final RefClass classChunk = getRefClass("{nms}.Chunk");
private final RefClass classWorld = getRefClass("{nms}.World");
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private RefMethod methodGetHandle;
private RefMethod methodGetChunkAt;
private RefMethod methodA;

View File

@ -1,14 +1,20 @@
package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.util.*;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
import com.intellectualcrafters.plot.util.SetQueue;
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Chunk;
@ -20,14 +26,17 @@ import org.bukkit.block.Biome;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.util.Set;
public class FastQueue_1_8_3 extends SlowQueue {
public final SendChunk chunksender;
private final SendChunk chunksender;
private final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
private final RefClass classPacket = getRefClass("{nms}.Packet");
@ -39,7 +48,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
private final RefField mustSave = classChunk.getField("mustSave");
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private RefMethod methodGetHandleChunk;
private RefConstructor MapChunk;
private RefMethod methodInitLighting;

View File

@ -1,14 +1,20 @@
package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.util.*;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
import com.intellectualcrafters.plot.util.SetQueue;
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Chunk;
@ -20,14 +26,17 @@ import org.bukkit.block.Biome;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.util.Set;
public class FastQueue_1_9 extends SlowQueue {
public final SendChunk chunksender;
private final SendChunk chunksender;
private final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
private final RefClass classPacket = getRefClass("{nms}.Packet");
@ -41,7 +50,7 @@ public class FastQueue_1_9 extends SlowQueue {
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
private final RefClass classBlock = getRefClass("{nms}.Block");
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private RefMethod methodGetHandleChunk;
private RefConstructor MapChunk;
private RefMethod methodInitLighting;

View File

@ -20,15 +20,16 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config;
import java.util.ArrayList;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.WorldUtil;
import java.util.ArrayList;
/**
* Main Configuration Utility
*
*/
public class Configuration {
@ -124,14 +125,8 @@ public class Configuration {
public static final SettingValue<PlotBlock> BLOCK = new SettingValue<PlotBlock>("BLOCK") {
@Override
public boolean validateValue(final String string) {
try {
final StringComparison<PlotBlock>.ComparisonResult value = WorldUtil.IMP.getClosestBlock(string);
if ((value == null) || (value.match > 1)) {
return false;
}
return true;
} catch (final Exception e) {}
return false;
final StringComparison<PlotBlock>.ComparisonResult value = WorldUtil.IMP.getClosestBlock(string);
return !((value == null) || (value.match > 1));
}
@Override
@ -159,7 +154,7 @@ public class Configuration {
}
}
return true;
} catch (final Exception e) {
} catch (NumberFormatException e) {
return false;
}
}
@ -191,7 +186,8 @@ public class Configuration {
if ((result != null) && (result.match < 2)) {
values[i] = result.best;
}
} catch (final Exception e) {}
} catch (NumberFormatException e) {
}
}
final int gcd = gcd(counts);
for (int i = 0; i < counts.length; i++) {