mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Small cleanup
This commit is contained in:
parent
5c60d69fd1
commit
32d4a08db1
@ -25,19 +25,19 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
public class FastQueue_1_7 extends SlowQueue {
|
public class FastQueue_1_7 extends SlowQueue {
|
||||||
|
|
||||||
public final RefClass classBlock = getRefClass("{nms}.Block");
|
private final RefClass classBlock = getRefClass("{nms}.Block");
|
||||||
public final RefClass classChunk = getRefClass("{nms}.Chunk");
|
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
public final RefClass classWorld = getRefClass("{nms}.World");
|
private final RefClass classWorld = getRefClass("{nms}.World");
|
||||||
public final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||||
public final RefMethod methodGetHandle;
|
private final RefMethod methodGetHandle;
|
||||||
public final RefMethod methodGetChunkAt;
|
private final RefMethod methodGetChunkAt;
|
||||||
public final RefMethod methodA;
|
private final RefMethod methodA;
|
||||||
public final RefMethod methodGetById;
|
private final RefMethod methodGetById;
|
||||||
public final RefMethod methodInitLighting;
|
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 {
|
public FastQueue_1_7() throws NoSuchMethodException, RuntimeException {
|
||||||
methodGetHandle = classCraftWorld.getMethod("getHandle");
|
methodGetHandle = classCraftWorld.getMethod("getHandle");
|
||||||
|
@ -27,14 +27,14 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
public class FastQueue_1_8 extends SlowQueue {
|
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 classBlock = getRefClass("{nms}.Block");
|
||||||
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
|
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
|
||||||
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
|
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
|
||||||
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
private final RefClass classWorld = getRefClass("{nms}.World");
|
private final RefClass classWorld = getRefClass("{nms}.World");
|
||||||
private final RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
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 methodGetHandle;
|
||||||
private RefMethod methodGetChunkAt;
|
private RefMethod methodGetChunkAt;
|
||||||
private RefMethod methodA;
|
private RefMethod methodA;
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package com.plotsquared.bukkit.util.block;
|
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.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
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.RefClass;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
|
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.SetQueue.ChunkWrapper;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -20,14 +26,17 @@ import org.bukkit.block.Biome;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
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 java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
public class FastQueue_1_8_3 extends SlowQueue {
|
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 classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||||
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||||
private final RefClass classPacket = getRefClass("{nms}.Packet");
|
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 RefField mustSave = classChunk.getField("mustSave");
|
||||||
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
|
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
|
||||||
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
|
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 RefMethod methodGetHandleChunk;
|
||||||
private RefConstructor MapChunk;
|
private RefConstructor MapChunk;
|
||||||
private RefMethod methodInitLighting;
|
private RefMethod methodInitLighting;
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package com.plotsquared.bukkit.util.block;
|
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.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
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.RefClass;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
|
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.SetQueue.ChunkWrapper;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -20,14 +26,17 @@ import org.bukkit.block.Biome;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
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 java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
public class FastQueue_1_9 extends SlowQueue {
|
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 classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||||
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
private final RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||||
private final RefClass classPacket = getRefClass("{nms}.Packet");
|
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 classChunkSection = getRefClass("{nms}.ChunkSection");
|
||||||
private final RefClass classBlock = getRefClass("{nms}.Block");
|
private final RefClass classBlock = getRefClass("{nms}.Block");
|
||||||
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
|
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 RefMethod methodGetHandleChunk;
|
||||||
private RefConstructor MapChunk;
|
private RefConstructor MapChunk;
|
||||||
private RefMethod methodInitLighting;
|
private RefMethod methodInitLighting;
|
||||||
|
@ -20,15 +20,16 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.config;
|
package com.intellectualcrafters.plot.config;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Configuration Utility
|
* Main Configuration Utility
|
||||||
*
|
*
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
|
|
||||||
@ -124,14 +125,8 @@ public class Configuration {
|
|||||||
public static final SettingValue<PlotBlock> BLOCK = new SettingValue<PlotBlock>("BLOCK") {
|
public static final SettingValue<PlotBlock> BLOCK = new SettingValue<PlotBlock>("BLOCK") {
|
||||||
@Override
|
@Override
|
||||||
public boolean validateValue(final String string) {
|
public boolean validateValue(final String string) {
|
||||||
try {
|
final StringComparison<PlotBlock>.ComparisonResult value = WorldUtil.IMP.getClosestBlock(string);
|
||||||
final StringComparison<PlotBlock>.ComparisonResult value = WorldUtil.IMP.getClosestBlock(string);
|
return !((value == null) || (value.match > 1));
|
||||||
if ((value == null) || (value.match > 1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (final Exception e) {}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,7 +154,7 @@ public class Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (final Exception e) {
|
} catch (NumberFormatException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +186,8 @@ public class Configuration {
|
|||||||
if ((result != null) && (result.match < 2)) {
|
if ((result != null) && (result.match < 2)) {
|
||||||
values[i] = result.best;
|
values[i] = result.best;
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {}
|
} catch (NumberFormatException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final int gcd = gcd(counts);
|
final int gcd = gcd(counts);
|
||||||
for (int i = 0; i < counts.length; i++) {
|
for (int i = 0; i < counts.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user