mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Cleanup
This commit is contained in:
parent
8074d041b8
commit
19b6df8268
@ -319,8 +319,7 @@ 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()) {
|
||||
if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) {
|
||||
iter.remove();
|
||||
entity.remove();
|
||||
}
|
||||
@ -328,7 +327,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -169,7 +169,6 @@ public class LikePlotMeConverter {
|
||||
|
||||
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) {
|
||||
|
@ -71,15 +71,13 @@ 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) {
|
||||
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");
|
||||
final int tz = r.getInt("topZ");
|
||||
|
@ -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());
|
||||
|
@ -110,20 +110,15 @@ public class Cookie {
|
||||
*/
|
||||
public static String toString(final JSONObject jo) throws JSONException {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(escape(jo.getString("name")));
|
||||
sb.append("=");
|
||||
sb.append(escape(jo.getString("value")));
|
||||
sb.append(escape(jo.getString("name"))).append("=").append(escape(jo.getString("value")));
|
||||
if (jo.has("expires")) {
|
||||
sb.append(";expires=");
|
||||
sb.append(jo.getString("expires"));
|
||||
sb.append(";expires=").append(jo.getString("expires"));
|
||||
}
|
||||
if (jo.has("domain")) {
|
||||
sb.append(";domain=");
|
||||
sb.append(escape(jo.getString("domain")));
|
||||
sb.append(";domain=").append(escape(jo.getString("domain")));
|
||||
}
|
||||
if (jo.has("path")) {
|
||||
sb.append(";path=");
|
||||
sb.append(escape(jo.getString("path")));
|
||||
sb.append(";path=").append(escape(jo.getString("path")));
|
||||
}
|
||||
if (jo.optBoolean("secure")) {
|
||||
sb.append(";secure");
|
||||
|
@ -925,7 +925,6 @@ public class PS {
|
||||
|
||||
@Deprecated
|
||||
public ArrayList<Plot> sortPlotsByTimestamp(final Collection<Plot> plots) {
|
||||
List<Plot> unknown = new ArrayList<>();
|
||||
int hardmax = 256000;
|
||||
int max = 0;
|
||||
int overflowSize = 0;
|
||||
@ -1351,25 +1350,21 @@ public class PS {
|
||||
IndependentPlotGenerator pg;
|
||||
if (baseGenerator != null && baseGenerator.isFull()) {
|
||||
pg = baseGenerator.getPlotGenerator();
|
||||
}
|
||||
else if (worldSection != null) {
|
||||
} else if (worldSection != null) {
|
||||
String secondaryGeneratorName = worldSection.getString("generator.plugin");
|
||||
GeneratorWrapper<?> secondaryGenerator = IMP.getGenerator(world, secondaryGeneratorName);
|
||||
if (secondaryGenerator != null && secondaryGenerator.isFull()) {
|
||||
pg = secondaryGenerator.getPlotGenerator();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String primaryGeneratorName = worldSection.getString("generator.init");
|
||||
GeneratorWrapper<?> primaryGenerator = IMP.getGenerator(world, primaryGeneratorName);
|
||||
if (primaryGenerator != null && primaryGenerator.isFull()) {
|
||||
pg = primaryGenerator.getPlotGenerator();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// Conventional plot generator
|
||||
@ -1405,10 +1400,7 @@ public class PS {
|
||||
return;
|
||||
}
|
||||
log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
||||
String gen_string = worldSection.getString("generator.plugin");
|
||||
if (gen_string == null) {
|
||||
gen_string = "PlotSquared";
|
||||
}
|
||||
String gen_string = worldSection.getString("generator.plugin", "PlotSquared");
|
||||
if (type == 2) {
|
||||
Set<PlotCluster> clusters = clusters_tmp != null ? clusters_tmp.get(world) : new HashSet<PlotCluster>();
|
||||
if (clusters == null) {
|
||||
@ -1505,10 +1497,7 @@ public class PS {
|
||||
clone.set(key, worldSection.get(key));
|
||||
}
|
||||
}
|
||||
String gen_string = clone.getString("generator.plugin");
|
||||
if (gen_string == null) {
|
||||
gen_string = "PlotSquared";
|
||||
}
|
||||
String gen_string = clone.getString("generator.plugin", "PlotSquared");
|
||||
GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string);
|
||||
if (areaGen == null) {
|
||||
throw new IllegalArgumentException("Invalid Generator: " + gen_string);
|
||||
|
@ -75,8 +75,7 @@ public class Claim extends SubCommand {
|
||||
if (grants > 0) {
|
||||
if (grants == 1) {
|
||||
plr.removePersistentMeta("grantedPlots");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
plr.setPersistentMeta("grantedPlots", ByteArrayUtilities.integerToBytes(grants - 1));
|
||||
}
|
||||
sendMessage(plr, C.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
||||
|
@ -464,12 +464,12 @@ public class Cluster extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[2]);
|
||||
return false;
|
||||
}
|
||||
if (args[1].toLowerCase().equals("add")) {
|
||||
if (args[1].equalsIgnoreCase("add")) {
|
||||
cluster.helpers.add(uuid);
|
||||
DBFunc.setHelper(cluster, uuid);
|
||||
return MainUtil.sendMessage(plr, C.CLUSTER_ADDED_HELPER);
|
||||
}
|
||||
if (args[1].toLowerCase().equals("remove")) {
|
||||
if (args[1].equalsIgnoreCase("remove")) {
|
||||
cluster.helpers.remove(uuid);
|
||||
DBFunc.removeHelper(cluster, uuid);
|
||||
return MainUtil.sendMessage(plr, C.CLUSTER_REMOVED_HELPER);
|
||||
|
@ -12,15 +12,9 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "debugpaste",
|
||||
aliases = { "dp" },
|
||||
usage = "/plot debugpaste",
|
||||
description = "Upload settings.yml & latest.log to HasteBin",
|
||||
permission = "plots.debugpaste",
|
||||
category = CommandCategory.DEBUG)
|
||||
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste", description = "Upload settings.yml & latest.log to HasteBin",
|
||||
permission = "plots.debugpaste", category = CommandCategory.DEBUG)
|
||||
public class DebugPaste extends SubCommand {
|
||||
|
||||
@Override
|
||||
@ -39,11 +33,12 @@ public class DebugPaste extends SubCommand {
|
||||
}
|
||||
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("links.settings_yml: '").append(settingsYML).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("version.server: '").append(Arrays.toString(PS.get().IMP.getServerVersion())).append("'\n");
|
||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper() + ";" + !Settings.OFFLINE_MODE).append("\n");
|
||||
b.append("links.settings_yml: ").append(settingsYML).append("\n");
|
||||
b.append("links.latest_log: ").append(latestLOG).append("\n");
|
||||
b.append("\n# Server Information\n");
|
||||
int[] sVersion = PS.get().IMP.getServerVersion();
|
||||
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:");
|
||||
for (String id : PS.get().IMP.getPluginIds()) {
|
||||
String[] split = id.split(":");
|
||||
|
@ -1,5 +1,10 @@
|
||||
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.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
@ -11,11 +16,6 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
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 static void main(final String[] args) {
|
||||
MainCommand.getInstance().addCommand(new WE_Anywhere());
|
||||
@ -145,7 +145,7 @@ public class GenerateDocs {
|
||||
split = Arrays.copyOfRange(split, 1, split.length);
|
||||
for (String method : split) {
|
||||
String perm = method.split("[,|)]")[1].trim();
|
||||
if (!perm.toLowerCase().equals(perm)) {
|
||||
if (!perm.equalsIgnoreCase(perm)) {
|
||||
if (perm.startsWith("C.")) {
|
||||
perm = C.valueOf(perm.split("\\.")[1]).s();
|
||||
}
|
||||
@ -178,7 +178,7 @@ public class GenerateDocs {
|
||||
split = Arrays.copyOfRange(split, 1, split.length);
|
||||
for (String method : split) {
|
||||
String perm = method.split("[,|)]")[1].trim();
|
||||
if (!perm.toLowerCase().equals(perm)) {
|
||||
if (!perm.equalsIgnoreCase(perm)) {
|
||||
if (perm.startsWith("C.")) {
|
||||
perm = C.valueOf(perm.split("\\.")[1]).s();
|
||||
}
|
||||
|
@ -20,16 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
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.file.YamlConfiguration;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
@ -47,6 +37,16 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
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(
|
||||
command = "template",
|
||||
permission = "plots.admin",
|
||||
@ -161,19 +161,12 @@ public class Template extends SubCommand {
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
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);
|
||||
int type = worldConfig.getInt("generator.type");
|
||||
int terrain = worldConfig.getInt("generator.terrain");
|
||||
|
||||
final int type = worldConfig.getInt("generator.type");
|
||||
final int terrain = worldConfig.getInt("generator.terrain");
|
||||
|
||||
final SetupObject setup = new SetupObject();
|
||||
SetupObject setup = new SetupObject();
|
||||
setup.plotManager = manager;
|
||||
setup.setupGenerator = generator;
|
||||
setup.type = type;
|
||||
|
@ -22,7 +22,6 @@ package com.intellectualcrafters.plot.object;
|
||||
|
||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
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.generator.GridPlotWorld;
|
||||
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 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.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
@ -128,7 +140,7 @@ public abstract class PlotArea {
|
||||
|
||||
/**
|
||||
* Returns the region for this PlotArea
|
||||
* @Nullable
|
||||
*
|
||||
* @return RegionWrapper or null if no applicable region
|
||||
*/
|
||||
public RegionWrapper getRegionAbs() {
|
||||
@ -160,7 +172,7 @@ public abstract class PlotArea {
|
||||
|
||||
/**
|
||||
* Get the implementation independent generator for this area
|
||||
* @Nullable
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IndependentPlotGenerator getGenerator() {
|
||||
@ -230,9 +242,12 @@ public abstract class PlotArea {
|
||||
SCHEMATICS = config.getStringList("schematic.schematics");
|
||||
USE_ECONOMY = config.getBoolean("economy.use") && EconHandler.manager != null;
|
||||
ConfigurationSection priceSection = config.getConfigurationSection("economy.prices");
|
||||
if (USE_ECONOMY) {
|
||||
PRICES = new HashMap<>();
|
||||
for (String key : priceSection.getKeys(false)) {
|
||||
PRICES.put(key, priceSection.getDouble(key));
|
||||
}
|
||||
}
|
||||
PLOT_CHAT = config.getBoolean("chat.enabled");
|
||||
WORLD_BORDER = config.getBoolean("world.border");
|
||||
MAX_BUILD_HEIGHT = config.getInt("world.max_height");
|
||||
@ -744,21 +759,6 @@ public abstract class PlotArea {
|
||||
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) {
|
||||
return plots.remove(id) != null;
|
||||
}
|
||||
|
@ -21,15 +21,15 @@ public abstract class PlotChunk<T> implements Cloneable {
|
||||
this.chunk = chunk;
|
||||
}
|
||||
|
||||
public ChunkWrapper getChunkWrapper() {
|
||||
return this.chunk;
|
||||
}
|
||||
|
||||
public void setChunkWrapper(final ChunkWrapper loc) {
|
||||
this.chunk = loc;
|
||||
this.objChunk = null;
|
||||
}
|
||||
|
||||
public ChunkWrapper getChunkWrapper() {
|
||||
return this.chunk;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return chunk.x;
|
||||
}
|
||||
@ -194,7 +194,7 @@ public abstract class PlotChunk<T> implements Cloneable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof PlotChunk)) {
|
||||
if (!(obj instanceof PlotChunk)) {
|
||||
return false;
|
||||
}
|
||||
return chunk.equals(((PlotChunk) obj).chunk);
|
||||
|
@ -316,7 +316,7 @@ public class ReflectionUtils {
|
||||
} catch (final NoSuchMethodException ignored) {
|
||||
return new RefMethod(clazz.getDeclaredMethod(name, classes));
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ public class ReflectionUtils {
|
||||
} catch (final NoSuchMethodException ignored) {
|
||||
return new RefConstructor(clazz.getDeclaredConstructor(classes));
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -317,14 +317,8 @@ public class SpongeMain implements 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");
|
||||
|
@ -96,16 +96,11 @@ public class SpongeChunkManager extends ChunkManager {
|
||||
mcChunk.onChunkUnload();
|
||||
}
|
||||
Field fieldDroppedChunksSet;
|
||||
try {
|
||||
fieldDroppedChunksSet = chunkServer.getClass().getField("field_73248_b");
|
||||
} catch (Throwable t) {
|
||||
try {
|
||||
fieldDroppedChunksSet = chunkServer.getClass().getField("droppedChunksSet");
|
||||
}
|
||||
catch (Throwable t2) {
|
||||
} catch (Throwable t) {
|
||||
fieldDroppedChunksSet = ReflectionUtils.findField(chunkServer.getClass(), Set.class);
|
||||
}
|
||||
}
|
||||
Set<Long> set = (Set<Long>) fieldDroppedChunksSet.get(chunkServer);
|
||||
set.remove(pos);
|
||||
chunkServer.id2ChunkMap.remove(pos);
|
||||
|
Loading…
Reference in New Issue
Block a user