Merge remote-tracking branch 'IntellectualSites/master' into testing

This commit is contained in:
zomb 2016-03-19 18:11:36 -10:00
commit 015dda21f2
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(); final Location loc = entity.getLocation();
if (BukkitUtil.getLocation(loc).isPlotRoad()) { if (BukkitUtil.getLocation(loc).isPlotRoad()) {
final Entity passenger = entity.getPassenger(); final Entity passenger = entity.getPassenger();
if (!(passenger instanceof Player)) { if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) {
if (entity.getMetadata("keep").isEmpty()) { iter.remove();
iter.remove(); entity.remove();
entity.remove();
}
} }
} }
} }
@ -585,15 +583,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
if (world == null) { if (world == null) {
// create world // create world
final ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldname); final ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldname);
String manager = worldConfig.getString("generator.plugin"); String manager = worldConfig.getString("generator.plugin", "PlotSquared");
if (manager == null) { String generator = worldConfig.getString("generator.init", manager);
manager = "PlotSquared";
}
String generator = worldConfig.getString("generator.init");
if (generator == null) {
generator = manager;
}
final int type = worldConfig.getInt("generator.type"); final int type = worldConfig.getInt("generator.type");
final int terrain = worldConfig.getInt("generator.terrain"); final int terrain = worldConfig.getInt("generator.terrain");
final SetupObject setup = new SetupObject(); final SetupObject setup = new SetupObject();

View File

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

View File

@ -168,8 +168,7 @@ public class LikePlotMeConverter {
mergeWorldYml(plugin, plotConfig); mergeWorldYml(plugin, plotConfig);
sendMessage("Connecting to " + plugin + " DB"); sendMessage("Connecting to " + plugin + " DB");
int plotCount = 0;
final ArrayList<Plot> createdPlots = new ArrayList<>(); final ArrayList<Plot> createdPlots = new ArrayList<>();
sendMessage("Collecting plot data"); sendMessage("Collecting plot data");
@ -195,6 +194,7 @@ public class LikePlotMeConverter {
} }
} }
final HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection); final HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection);
int plotCount = 0;
for (final Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) { for (final Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
plotCount += entry.getValue().size(); plotCount += entry.getValue().size();
} }
@ -234,25 +234,13 @@ public class LikePlotMeConverter {
plotsize = 32; plotsize = 32;
} }
PS.get().config.set("worlds." + world + ".plot.size", plotsize); PS.get().config.set("worlds." + world + ".plot.size", plotsize);
String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock"); // String wallblock = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".WallBlock", "44"); //
if (wallblock == null) {
wallblock = "44";
}
PS.get().config.set("worlds." + world + ".wall.block", wallblock); PS.get().config.set("worlds." + world + ".wall.block", wallblock);
String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock"); // String floor = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
if (floor == null) {
floor = "2";
}
PS.get().config.set("worlds." + world + ".plot.floor", Collections.singletonList(floor)); PS.get().config.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock"); // String filling = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
if (filling == null) {
filling = "3";
}
PS.get().config.set("worlds." + world + ".plot.filling", Collections.singletonList(filling)); PS.get().config.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock"); String road = PLOTME_DG_YML.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
if (road == null) {
road = "5";
}
PS.get().config.set("worlds." + world + ".road.block", road); PS.get().config.set("worlds." + world + ".road.block", road);
Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // Integer height = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if (height == 0) { 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 PlotId id = new PlotId(r.getInt("plotX"), r.getInt("plotZ"));
final String name = r.getString("owner"); final String name = r.getString("owner");
final String world = LikePlotMeConverter.getWorld(r.getString("world")); final String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) { if (!plots.containsKey(world) && merge) {
if (merge) { final int plot = PS.get().config.getInt("worlds." + world + ".plot.size");
final int plot = PS.get().config.getInt("worlds." + world + ".plot.size"); final int path = PS.get().config.getInt("worlds." + world + ".road.width");
final int path = PS.get().config.getInt("worlds." + world + ".road.width"); plotWidth.put(world, plot);
plotWidth.put(world, plot); roadWidth.put(world, path);
roadWidth.put(world, path); merges.put(world, new HashMap<PlotId, boolean[]>());
merges.put(world, new HashMap<PlotId, boolean[]>());
}
} }
if (merge) { if (merge) {
final int tx = r.getInt("topX"); final int tx = r.getInt("topX");

View File

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

View File

@ -110,20 +110,15 @@ public class Cookie {
*/ */
public static String toString(final JSONObject jo) throws JSONException { public static String toString(final JSONObject jo) throws JSONException {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append(escape(jo.getString("name"))); sb.append(escape(jo.getString("name"))).append("=").append(escape(jo.getString("value")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) { if (jo.has("expires")) {
sb.append(";expires="); sb.append(";expires=").append(jo.getString("expires"));
sb.append(jo.getString("expires"));
} }
if (jo.has("domain")) { if (jo.has("domain")) {
sb.append(";domain="); sb.append(";domain=").append(escape(jo.getString("domain")));
sb.append(escape(jo.getString("domain")));
} }
if (jo.has("path")) { if (jo.has("path")) {
sb.append(";path="); sb.append(";path=").append(escape(jo.getString("path")));
sb.append(escape(jo.getString("path")));
} }
if (jo.optBoolean("secure")) { if (jo.optBoolean("secure")) {
sb.append(";secure"); sb.append(";secure");

View File

@ -925,7 +925,6 @@ public class PS {
@Deprecated @Deprecated
public ArrayList<Plot> sortPlotsByTimestamp(final Collection<Plot> plots) { public ArrayList<Plot> sortPlotsByTimestamp(final Collection<Plot> plots) {
List<Plot> unknown = new ArrayList<>();
int hardmax = 256000; int hardmax = 256000;
int max = 0; int max = 0;
int overflowSize = 0; int overflowSize = 0;
@ -1351,25 +1350,21 @@ public class PS {
IndependentPlotGenerator pg; IndependentPlotGenerator pg;
if (baseGenerator != null && baseGenerator.isFull()) { if (baseGenerator != null && baseGenerator.isFull()) {
pg = baseGenerator.getPlotGenerator(); pg = baseGenerator.getPlotGenerator();
} } else if (worldSection != null) {
else if (worldSection != null) {
String secondaryGeneratorName = worldSection.getString("generator.plugin"); String secondaryGeneratorName = worldSection.getString("generator.plugin");
GeneratorWrapper<?> secondaryGenerator = IMP.getGenerator(world, secondaryGeneratorName); GeneratorWrapper<?> secondaryGenerator = IMP.getGenerator(world, secondaryGeneratorName);
if (secondaryGenerator != null && secondaryGenerator.isFull()) { if (secondaryGenerator != null && secondaryGenerator.isFull()) {
pg = secondaryGenerator.getPlotGenerator(); pg = secondaryGenerator.getPlotGenerator();
} } else {
else {
String primaryGeneratorName = worldSection.getString("generator.init"); String primaryGeneratorName = worldSection.getString("generator.init");
GeneratorWrapper<?> primaryGenerator = IMP.getGenerator(world, primaryGeneratorName); GeneratorWrapper<?> primaryGenerator = IMP.getGenerator(world, primaryGeneratorName);
if (primaryGenerator != null && primaryGenerator.isFull()) { if (primaryGenerator != null && primaryGenerator.isFull()) {
pg = primaryGenerator.getPlotGenerator(); pg = primaryGenerator.getPlotGenerator();
} } else {
else {
return; return;
} }
} }
} } else {
else {
return; return;
} }
// Conventional plot generator // Conventional plot generator
@ -1405,10 +1400,7 @@ public class PS {
return; return;
} }
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'"); log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
String gen_string = worldSection.getString("generator.plugin"); String gen_string = worldSection.getString("generator.plugin", "PlotSquared");
if (gen_string == null) {
gen_string = "PlotSquared";
}
if (type == 2) { if (type == 2) {
Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>(); Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>();
if (clusters == null) { if (clusters == null) {
@ -1505,10 +1497,7 @@ public class PS {
clone.set(key, worldSection.get(key)); clone.set(key, worldSection.get(key));
} }
} }
String gen_string = clone.getString("generator.plugin"); String gen_string = clone.getString("generator.plugin", "PlotSquared");
if (gen_string == null) {
gen_string = "PlotSquared";
}
GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string); GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string);
if (areaGen == null) { if (areaGen == null) {
throw new IllegalArgumentException("Invalid Generator: " + gen_string); throw new IllegalArgumentException("Invalid Generator: " + gen_string);

View File

@ -75,8 +75,7 @@ public class Claim extends SubCommand {
if (grants > 0) { if (grants > 0) {
if (grants == 1) { if (grants == 1) {
plr.removePersistentMeta("grantedPlots"); plr.removePersistentMeta("grantedPlots");
} } else {
else {
plr.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(grants - 1)); plr.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(grants - 1));
} }
sendMessage(plr, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1)); sendMessage(plr, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));

View File

@ -464,12 +464,12 @@ public class Cluster extends SubCommand {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[2]); MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[2]);
return false; return false;
} }
if (args[1].toLowerCase().equals("add")) { if (args[1].equalsIgnoreCase("add")) {
cluster.helpers.add(uuid); cluster.helpers.add(uuid);
DBFunc.setHelper(cluster, uuid); DBFunc.setHelper(cluster, uuid);
return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER); return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER);
} }
if (args[1].toLowerCase().equals("remove")) { if (args[1].equalsIgnoreCase("remove")) {
cluster.helpers.remove(uuid); cluster.helpers.remove(uuid);
DBFunc.removeHelper(cluster, uuid); DBFunc.removeHelper(cluster, uuid);
return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER); return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER);

View File

@ -12,15 +12,9 @@ import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
@CommandDeclaration( @CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", description = "Upload settings.yml & latest.log to HasteBin",
command = "debugpaste", permission = "plots.debugpaste", category = CommandCategory.DEBUG)
aliases = { "dp" },
usage = "/plot debugpaste",
description = "Upload settings.yml & latest.log to HasteBin",
permission = "plots.debugpaste",
category = CommandCategory.DEBUG)
public class DebugPaste extends SubCommand { public class DebugPaste extends SubCommand {
@Override @Override
@ -39,11 +33,12 @@ public class DebugPaste extends SubCommand {
} }
final StringBuilder b = new StringBuilder(); final StringBuilder b = new StringBuilder();
b.append("# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your problem\n\n# We will start with some informational files\n"); b.append("# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your problem\n\n# We will start with some informational files\n");
b.append("links.settings_yml: '").append(settingsYML).append("'\n"); b.append("links.settings_yml: ").append(settingsYML).append("\n");
b.append("links.latest_log: '").append(latestLOG).append("'\n"); b.append("links.latest_log: ").append(latestLOG).append("\n");
b.append("\n# YAAAS! Now let us move on to the server info\n"); b.append("\n# Server Information\n");
b.append("version.server: '").append(Arrays.toString(PS.get().IMP.getServerVersion())).append("'\n"); int[] sVersion = PS.get().IMP.getServerVersion();
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper() + ";" + !Settings.OFFLINE_MODE).append("\n"); b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1]).append('.').append(sVersion[2]).append("\n");
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(";").append(!Settings.OFFLINE_MODE).append("\n");
b.append("plugins:"); b.append("plugins:");
for (String id : PS.get().IMP.getPluginIds()) { for (String id : PS.get().IMP.getPluginIds()) {
String[] split = id.split(":"); String[] split = id.split(":");

View File

@ -1,5 +1,10 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.Command;
import java.io.File; import java.io.File;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
@ -11,11 +16,6 @@ import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.Command;
public class GenerateDocs { public class GenerateDocs {
public static void main(final String[] args) { public static void main(final String[] args) {
MainCommand.getInstance().addCommand(new WE_Anywhere()); MainCommand.getInstance().addCommand(new WE_Anywhere());
@ -145,7 +145,7 @@ public class GenerateDocs {
split = Arrays.copyOfRange(split, 1, split.length); split = Arrays.copyOfRange(split, 1, split.length);
for (String method : split) { for (String method : split) {
String perm = method.split("[,|)]")[1].trim(); String perm = method.split("[,|)]")[1].trim();
if (!perm.toLowerCase().equals(perm)) { if (!perm.equalsIgnoreCase(perm)) {
if (perm.startsWith("C.")) { if (perm.startsWith("C.")) {
perm = C.valueOf(perm.split("\\.")[1]).s(); perm = C.valueOf(perm.split("\\.")[1]).s();
} }
@ -178,7 +178,7 @@ public class GenerateDocs {
split = Arrays.copyOfRange(split, 1, split.length); split = Arrays.copyOfRange(split, 1, split.length);
for (String method : split) { for (String method : split) {
String perm = method.split("[,|)]")[1].trim(); String perm = method.split("[,|)]")[1].trim();
if (!perm.toLowerCase().equals(perm)) { if (!perm.equalsIgnoreCase(perm)) {
if (perm.startsWith("C.")) { if (perm.startsWith("C.")) {
perm = C.valueOf(perm.split("\\.")[1]).s(); perm = C.valueOf(perm.split("\\.")[1]).s();
} }

View File

@ -20,16 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
@ -47,6 +37,16 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
@CommandDeclaration( @CommandDeclaration(
command = "template", command = "template",
permission = "plots.admin", permission = "plots.admin",
@ -161,19 +161,12 @@ public class Template extends SubCommand {
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
String manager = worldConfig.getString("generator.plugin"); String manager = worldConfig.getString("generator.plugin", "PlotSquared");
if (manager == null) { String generator = worldConfig.getString("generator.init", manager);
manager = "PlotSquared"; int type = worldConfig.getInt("generator.type");
} int terrain = worldConfig.getInt("generator.terrain");
String generator = worldConfig.getString("generator.init");
if (generator == null) { SetupObject setup = new SetupObject();
generator = manager;
}
final int type = worldConfig.getInt("generator.type");
final int terrain = worldConfig.getInt("generator.terrain");
final SetupObject setup = new SetupObject();
setup.plotManager = manager; setup.plotManager = manager;
setup.setupGenerator = generator; setup.setupGenerator = generator;
setup.type = type; setup.type = type;

View File

@ -22,7 +22,6 @@ package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
@ -30,11 +29,24 @@ import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.GridPlotWorld; import com.intellectualcrafters.plot.generator.GridPlotWorld;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator; import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.area.QuadMap; import com.intellectualcrafters.plot.util.area.QuadMap;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
@ -128,7 +140,7 @@ public abstract class PlotArea {
/** /**
* Returns the region for this PlotArea * Returns the region for this PlotArea
* @Nullable *
* @return RegionWrapper or null if no applicable region * @return RegionWrapper or null if no applicable region
*/ */
public RegionWrapper getRegionAbs() { public RegionWrapper getRegionAbs() {
@ -160,7 +172,7 @@ public abstract class PlotArea {
/** /**
* Get the implementation independent generator for this area * Get the implementation independent generator for this area
* @Nullable *
* @return * @return
*/ */
public IndependentPlotGenerator getGenerator() { public IndependentPlotGenerator getGenerator() {
@ -230,8 +242,11 @@ public abstract class PlotArea {
SCHEMATICS = config.getStringList("schematic.schematics"); SCHEMATICS = config.getStringList("schematic.schematics");
USE_ECONOMY = config.getBoolean("economy.use") && EconHandler.manager != null; USE_ECONOMY = config.getBoolean("economy.use") && EconHandler.manager != null;
ConfigurationSection priceSection = config.getConfigurationSection("economy.prices"); ConfigurationSection priceSection = config.getConfigurationSection("economy.prices");
for (String key : priceSection.getKeys(false)) { if (USE_ECONOMY) {
PRICES.put(key, priceSection.getDouble(key)); PRICES = new HashMap<>();
for (String key : priceSection.getKeys(false)) {
PRICES.put(key, priceSection.getDouble(key));
}
} }
PLOT_CHAT = config.getBoolean("chat.enabled"); PLOT_CHAT = config.getBoolean("chat.enabled");
WORLD_BORDER = config.getBoolean("world.border"); WORLD_BORDER = config.getBoolean("world.border");
@ -743,22 +758,7 @@ public abstract class PlotArea {
} }
return true; return true;
} }
public boolean mergePlots(final PlotPlayer player, final ArrayList<PlotId> plotIds) {
if (EconHandler.manager != null && USE_ECONOMY) {
final double cost = plotIds.size() * (PRICES.containsKey("merge") ? PRICES.get("merge") : 0);
if (cost > 0d) {
if (EconHandler.manager.getMoney(player) < cost) {
MainUtil.sendMessage(player, C.CANNOT_AFFORD_MERGE, "" + cost);
return false;
}
EconHandler.manager.withdrawMoney(player, cost);
MainUtil.sendMessage(player, C.REMOVED_BALANCE, cost + "");
}
}
return mergePlots(plotIds, true, true);
}
public boolean removePlot(PlotId id) { public boolean removePlot(PlotId id) {
return plots.remove(id) != null; return plots.remove(id) != null;
} }

View File

@ -20,16 +20,16 @@ public abstract class PlotChunk<T> implements Cloneable {
public PlotChunk(final ChunkWrapper chunk) { public PlotChunk(final ChunkWrapper chunk) {
this.chunk = chunk; this.chunk = chunk;
} }
public ChunkWrapper getChunkWrapper() {
return this.chunk;
}
public void setChunkWrapper(final ChunkWrapper loc) { public void setChunkWrapper(final ChunkWrapper loc) {
this.chunk = loc; this.chunk = loc;
this.objChunk = null; this.objChunk = null;
} }
public ChunkWrapper getChunkWrapper() {
return this.chunk;
}
public int getX() { public int getX() {
return chunk.x; return chunk.x;
} }
@ -194,7 +194,7 @@ public abstract class PlotChunk<T> implements Cloneable {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || !(obj instanceof PlotChunk)) { if (!(obj instanceof PlotChunk)) {
return false; return false;
} }
return chunk.equals(((PlotChunk) obj).chunk); return chunk.equals(((PlotChunk) obj).chunk);

View File

@ -316,7 +316,7 @@ public class ReflectionUtils {
} catch (final NoSuchMethodException ignored) { } catch (final NoSuchMethodException ignored) {
return new RefMethod(clazz.getDeclaredMethod(name, classes)); return new RefMethod(clazz.getDeclaredMethod(name, classes));
} }
} catch (final Exception e) { } catch (NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@ -348,7 +348,7 @@ public class ReflectionUtils {
} catch (final NoSuchMethodException ignored) { } catch (final NoSuchMethodException ignored) {
return new RefConstructor(clazz.getDeclaredConstructor(classes)); return new RefConstructor(clazz.getDeclaredConstructor(classes));
} }
} catch (final Exception e) { } catch (NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }

View File

@ -317,15 +317,9 @@ public class SpongeMain implements IPlotMain {
if (world == null) { if (world == null) {
// create world // create world
final ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldname); final ConfigurationSection worldConfig = PS.get().config.getConfigurationSection("worlds." + worldname);
String manager = worldConfig.getString("generator.plugin"); String manager = worldConfig.getString("generator.plugin", "PlotSquared");
if (manager == null) { String generator = worldConfig.getString("generator.init", manager);
manager = "PlotSquared";
}
String generator = worldConfig.getString("generator.init");
if (generator == null) {
generator = manager;
}
final int type = worldConfig.getInt("generator.type"); final int type = worldConfig.getInt("generator.type");
final int terrain = worldConfig.getInt("generator.terrain"); final int terrain = worldConfig.getInt("generator.terrain");
final SetupObject setup = new SetupObject(); final SetupObject setup = new SetupObject();

View File

@ -97,14 +97,9 @@ public class SpongeChunkManager extends ChunkManager {
} }
Field fieldDroppedChunksSet; Field fieldDroppedChunksSet;
try { try {
fieldDroppedChunksSet = chunkServer.getClass().getField("field_73248_b"); fieldDroppedChunksSet = chunkServer.getClass().getField("droppedChunksSet");
} catch (Throwable t) { } catch (Throwable t) {
try { fieldDroppedChunksSet = ReflectionUtils.findField(chunkServer.getClass(), Set.class);
fieldDroppedChunksSet = chunkServer.getClass().getField("droppedChunksSet");
}
catch (Throwable t2) {
fieldDroppedChunksSet = ReflectionUtils.findField(chunkServer.getClass(), Set.class);
}
} }
Set<Long> set = (Set<Long>) fieldDroppedChunksSet.get(chunkServer); Set<Long> set = (Set<Long>) fieldDroppedChunksSet.get(chunkServer);
set.remove(pos); set.remove(pos);
@ -178,4 +173,4 @@ public class SpongeChunkManager extends ChunkManager {
throw new UnsupportedOperationException("NOT IMPLEMENTED YET"); throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
} }
} }