This commit is contained in:
Matt
2016-03-19 14:07:55 -04:00
parent 8074d041b8
commit 19b6df8268
17 changed files with 115 additions and 192 deletions

View File

@ -319,11 +319,9 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
final Location loc = entity.getLocation();
if (BukkitUtil.getLocation(loc).isPlotRoad()) {
final Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player)) {
if (entity.getMetadata("keep").isEmpty()) {
iter.remove();
entity.remove();
}
if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) {
iter.remove();
entity.remove();
}
}
}
@ -585,15 +583,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
if (world == null) {
// create world
final ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldname);
String manager = worldConfig.getString("generator.plugin");
if (manager == null) {
manager = "PlotSquared";
}
String generator = worldConfig.getString("generator.init");
if (generator == null) {
generator = manager;
}
String manager = worldConfig.getString("generator.plugin", "PlotSquared");
String generator = worldConfig.getString("generator.init", manager);
final int type = worldConfig.getInt("generator.type");
final int terrain = worldConfig.getInt("generator.terrain");
final SetupObject setup = new SetupObject();

View File

@ -105,13 +105,7 @@ public final class Reflection {
public synchronized static Object getHandle(final Object obj) {
try {
return getMethod(obj.getClass(), "getHandle").invoke(obj);
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
} catch (IllegalArgumentException e) {
e.printStackTrace();
return null;
} catch (InvocationTargetException e) {
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
e.printStackTrace();
return null;
}

View File

@ -168,8 +168,7 @@ public class LikePlotMeConverter {
mergeWorldYml(plugin, plotConfig);
sendMessage("Connecting to " + plugin + " DB");
int plotCount = 0;
final ArrayList<Plot> createdPlots = new ArrayList<>();
sendMessage("Collecting plot data");
@ -195,6 +194,7 @@ public class LikePlotMeConverter {
}
}
final HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection);
int plotCount = 0;
for (final Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
plotCount += entry.getValue().size();
}
@ -234,25 +234,13 @@ public class LikePlotMeConverter {
plotsize = 32;
}
PS.get().config.set("worlds." + world + ".plot.size", plotsize);
String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); //
if (wallblock == null) {
wallblock = "44";
}
String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); //
PS.get().config.set("worlds." + world + ".wall.block", wallblock);
String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); //
if (floor == null) {
floor = "2";
}
String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
PS.get().config.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); //
if (filling == null) {
filling = "3";
}
String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
PS.get().config.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock");
if (road == null) {
road = "5";
}
String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
PS.get().config.set("worlds." + world + ".road.block", road);
Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if (height == 0) {

View File

@ -71,14 +71,12 @@ public class PlotMeConnector_017 extends APlotMeConnector {
final PlotId id = new PlotId(r.getInt("plotX"), r.getInt("plotZ"));
final String name = r.getString("owner");
final String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) {
if (merge) {
final int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
final int path = PS.get().config.getInt("worlds." + world + ".road.width");
plotWidth.put(world, plot);
roadWidth.put(world, path);
merges.put(world, new HashMap<PlotId, boolean[]>());
}
if (!plots.containsKey(world) && merge) {
final int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
final int path = PS.get().config.getInt("worlds." + world + ".road.width");
plotWidth.put(world, plot);
roadWidth.put(world, path);
merges.put(world, new HashMap<PlotId, boolean[]>());
}
if (merge) {
final int tx = r.getInt("topX");

View File

@ -1,5 +1,7 @@
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.ChunkManager;
@ -15,6 +17,12 @@ 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;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -24,35 +32,13 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
public class FastQueue_1_9 extends SlowQueue {
final Object air;
private final Object air;
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");
private final RefClass classConnection = getRefClass("{nms}.PlayerConnection");
private final RefClass classChunk = getRefClass("{nms}.Chunk");
private final RefClass classCraftPlayer = getRefClass("{cb}.entity.CraftPlayer");
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
private final RefClass classWorld = getRefClass("{nms}.World");
private final RefField mustSave = classChunk.getField("mustSave");
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
private final RefClass classBlock = getRefClass("{nms}.Block");
private final RefClass classIBlockData = getRefClass("{nms}.IBlockData");
private final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private final RefMethod methodGetHandleChunk;
private final RefConstructor MapChunk;
private final RefMethod methodInitLighting;
private final RefConstructor classBlockPositionConstructor;
private final RefConstructor classChunkSectionConstructor;
@ -68,15 +54,21 @@ public class FastQueue_1_9 extends SlowQueue {
public FastQueue_1_9() throws RuntimeException {
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
RefClass classChunk = getRefClass("{nms}.Chunk");
methodInitLighting = classChunk.getMethod("initLighting");
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class);
RefClass classWorld = getRefClass("{nms}.World");
methodW = classWorld.getMethod("w", classBlockPosition.getRealClass());
fieldSections = classChunk.getField("sections");
fieldWorld = classChunk.getField("world");
RefClass classBlock = getRefClass("{nms}.Block");
RefClass classIBlockData = getRefClass("{nms}.IBlockData");
methodGetCombinedId = classBlock.getMethod("getCombinedId", classIBlockData.getRealClass());
methodGetByCombinedId = classBlock.getMethod("getByCombinedId", int.class);
RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
methodGetBlocks = classChunkSection.getMethod("getBlocks");
methodGetType = classChunkSection.getMethod("getType", int.class, int.class, int.class);
methodSetType = classChunkSection.getMethod("setType", int.class, int.class, int.class, classIBlockData.getRealClass());
@ -91,7 +83,7 @@ public class FastQueue_1_9 extends SlowQueue {
return;
}
int count = 0;
final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
final ArrayList<Chunk> chunks = new ArrayList<>();
final Iterator<Entry<ChunkWrapper, Chunk>> i = toUpdate.entrySet().iterator();
while (i.hasNext() && (count < 128)) {
chunks.add(i.next().getValue());