mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Various changes
This commit is contained in:
parent
ae885eafca
commit
bee6f83e79
@ -623,10 +623,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
PS.get().loadWorld(worldname, (BukkitPlotGenerator) gen);
|
||||
} else if (gen != null) {
|
||||
PS.get().loadWorld(worldname, new BukkitPlotGenerator(worldname, gen));
|
||||
} else {
|
||||
if (PS.get().config.contains("worlds." + worldname)) {
|
||||
PS.get().loadWorld(worldname, null);
|
||||
}
|
||||
} else if (PS.get().config.contains("worlds." + worldname)) {
|
||||
PS.get().loadWorld(worldname, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,12 +51,12 @@ final class MessagePart implements JsonRepresentedObject, ConfigurationSerializa
|
||||
}
|
||||
|
||||
ChatColor color = ChatColor.WHITE;
|
||||
ArrayList<ChatColor> styles = new ArrayList<ChatColor>();
|
||||
ArrayList<ChatColor> styles = new ArrayList<>();
|
||||
String clickActionName = null, clickActionData = null, hoverActionName = null;
|
||||
JsonRepresentedObject hoverActionData = null;
|
||||
TextualComponent text = null;
|
||||
String insertionData = null;
|
||||
ArrayList<JsonRepresentedObject> translationReplacements = new ArrayList<JsonRepresentedObject>();
|
||||
ArrayList<JsonRepresentedObject> translationReplacements = new ArrayList<>();
|
||||
|
||||
MessagePart(final TextualComponent text) {
|
||||
this.text = text;
|
||||
@ -134,7 +134,7 @@ final class MessagePart implements JsonRepresentedObject, ConfigurationSerializa
|
||||
|
||||
@Override
|
||||
public Map<String, Object> serialize() {
|
||||
final HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("text", text);
|
||||
map.put("styles", styles);
|
||||
map.put("color", color.getChar());
|
||||
|
@ -1,18 +1,17 @@
|
||||
package com.plotsquared.bukkit.database.plotme;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class APlotMeConnector {
|
||||
public abstract Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder);
|
||||
@ -69,35 +68,14 @@ public abstract class APlotMeConnector {
|
||||
|
||||
public void setMerged(final HashMap<String, HashMap<PlotId, boolean[]>> merges, final String world, final PlotId id, final int direction) {
|
||||
final HashMap<PlotId, boolean[]> plots = merges.get(world);
|
||||
PlotId id2;
|
||||
switch (direction) {
|
||||
case 0: {
|
||||
id2 = new PlotId(id.x, id.y);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
id2 = new PlotId(id.x, id.y);
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
id2 = new PlotId(id.x, id.y);
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
id2 = new PlotId(id.x, id.y);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
PlotId id2 = new PlotId(id.x, id.y);
|
||||
boolean[] merge1;
|
||||
boolean[] merge2;
|
||||
if (plots.containsKey(id)) {
|
||||
merge1 = plots.get(id);
|
||||
} else {
|
||||
merge1 = new boolean[] { false, false, false, false };
|
||||
}
|
||||
boolean[] merge2;
|
||||
if (plots.containsKey(id2)) {
|
||||
merge2 = plots.get(id2);
|
||||
} else {
|
||||
|
@ -24,7 +24,11 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||
import com.intellectualcrafters.plot.generator.HybridGen;
|
||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
@ -48,9 +52,9 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
private final PseudoRandom random = new PseudoRandom();
|
||||
private final IndependentPlotGenerator plotGenerator;
|
||||
private final List<BlockPopulator> populators = new ArrayList<>();
|
||||
private final ChunkGenerator platformGenerator;
|
||||
private final boolean full;
|
||||
private boolean loaded = false;
|
||||
private ChunkGenerator platformGenerator;
|
||||
private boolean full;
|
||||
|
||||
public BukkitPlotGenerator(IndependentPlotGenerator generator) {
|
||||
this.plotGenerator = generator;
|
||||
@ -58,11 +62,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
populators.add(new BlockPopulator() {
|
||||
@Override
|
||||
public void populate(World world, Random r, Chunk c) {
|
||||
if (!(chunkSetter instanceof GenChunk)) {
|
||||
PS.debug("Current PlotChunk is not relevant to population?");
|
||||
PS.stacktrace();
|
||||
return;
|
||||
}
|
||||
GenChunk result = (GenChunk) chunkSetter;
|
||||
if (result.result_data != null) {
|
||||
for (int i = 0; i < result.result_data.length; i++) {
|
||||
@ -90,7 +89,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName() + " is already a BukkitPlotGenerator!");
|
||||
}
|
||||
this.full = false;
|
||||
PS.get().debug("BukkitPlotGenerator does not fully support: " + cg);
|
||||
PS.debug("BukkitPlotGenerator does not fully support: " + cg);
|
||||
platformGenerator = cg;
|
||||
plotGenerator = new IndependentPlotGenerator() {
|
||||
@Override
|
||||
@ -229,11 +228,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
|
||||
@Override
|
||||
public ChunkData generateChunkData(World world, Random random, int cx, int cz, BiomeGrid grid) {
|
||||
if (!(chunkSetter instanceof GenChunk)) {
|
||||
PS.debug("Current PlotChunk is not relevant to generation?");
|
||||
PS.stacktrace();
|
||||
return null;
|
||||
}
|
||||
GenChunk result = (GenChunk) chunkSetter;
|
||||
// Set the chunk location
|
||||
result.setChunkWrapper(SetQueue.IMP.new ChunkWrapper(world.getName(), cx, cz));
|
||||
@ -278,10 +272,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
|
||||
@Override
|
||||
public short[][] generateExtBlockSections(final World world, final Random r, final int cx, final int cz, final BiomeGrid grid) {
|
||||
if (!(chunkSetter instanceof GenChunk)) {
|
||||
PS.stacktrace();
|
||||
return new short[16][];
|
||||
}
|
||||
GenChunk result = (GenChunk) chunkSetter;
|
||||
// Set the chunk location
|
||||
result.setChunkWrapper(SetQueue.IMP.new ChunkWrapper(world.getName(), cx, cz));
|
||||
|
@ -27,16 +27,6 @@ import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlayerBlockEventType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -115,11 +105,21 @@ import org.bukkit.projectiles.BlockProjectileSource;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Player Events involving plots
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
public class PlayerEvents extends com.plotsquared.listener.PlotListener implements Listener {
|
||||
|
||||
private boolean pistonBlocks = true;
|
||||
@ -353,11 +353,11 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
if (c.equals(cmdLabel.getName())) {
|
||||
break;
|
||||
}
|
||||
PluginCommand p;
|
||||
final String label = cmdLabel.getName().replaceFirst("/", "");
|
||||
if (aliases.contains(label)) {
|
||||
continue;
|
||||
}
|
||||
PluginCommand p;
|
||||
if ((p = Bukkit.getPluginCommand(label)) != null) {
|
||||
for (String a : p.getAliases()) {
|
||||
if (aliases.contains(a)) {
|
||||
|
@ -34,6 +34,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class EntityWrapper {
|
||||
|
||||
private final int hash;
|
||||
public EntityType type;
|
||||
public float yaw;
|
||||
public float pitch;
|
||||
@ -54,8 +55,6 @@ public class EntityWrapper {
|
||||
private HorseStats horse;
|
||||
private ArmorStandStats stand;
|
||||
|
||||
private int hash;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public EntityWrapper(final org.bukkit.entity.Entity entity, final short depth) {
|
||||
hash = entity.getEntityId();
|
||||
@ -153,10 +152,7 @@ public class EntityWrapper {
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case MINECART_CHEST: {
|
||||
storeInventory((InventoryHolder) entity);
|
||||
return;
|
||||
}
|
||||
case MINECART_CHEST:
|
||||
case MINECART_HOPPER: {
|
||||
storeInventory((InventoryHolder) entity);
|
||||
return;
|
||||
@ -508,10 +504,7 @@ public class EntityWrapper {
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case MINECART_CHEST: {
|
||||
restoreInventory((InventoryHolder) entity);
|
||||
return entity;
|
||||
}
|
||||
case MINECART_CHEST:
|
||||
case MINECART_HOPPER: {
|
||||
restoreInventory((InventoryHolder) entity);
|
||||
return entity;
|
||||
|
@ -558,7 +558,7 @@ public class JSONArray {
|
||||
* @return this.
|
||||
*/
|
||||
public JSONArray put(final int value) {
|
||||
this.put(new Integer(value));
|
||||
this.put(Integer.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ public class JSONArray {
|
||||
* @return this.
|
||||
*/
|
||||
public JSONArray put(final long value) {
|
||||
this.put(new Long(value));
|
||||
this.put(Long.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -658,7 +658,7 @@ public class JSONArray {
|
||||
* @throws JSONException If the index is negative.
|
||||
*/
|
||||
public JSONArray put(final int index, final int value) throws JSONException {
|
||||
this.put(index, new Integer(value));
|
||||
this.put(index, Integer.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -674,7 +674,7 @@ public class JSONArray {
|
||||
* @throws JSONException If the index is negative.
|
||||
*/
|
||||
public JSONArray put(final int index, final long value) throws JSONException {
|
||||
this.put(index, new Long(value));
|
||||
this.put(index, Long.valueOf(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ public class JSONObject {
|
||||
return d;
|
||||
}
|
||||
} else {
|
||||
final Long myLong = new Long(string);
|
||||
final Long myLong = Long.valueOf(string);
|
||||
if (string.equals(myLong.toString())) {
|
||||
if (myLong == myLong.intValue()) {
|
||||
return myLong.intValue();
|
||||
|
@ -8,18 +8,19 @@ import java.util.Iterator;
|
||||
* @author JSON.org
|
||||
* @version 2014-05-03
|
||||
*/
|
||||
public class XML {
|
||||
public static final Character AMP = '&';
|
||||
public static final Character APOS = '\'';
|
||||
public static final Character BANG = '!';
|
||||
public static final Character EQ = '=';
|
||||
public static final Character GT = '>';
|
||||
public static final Character LT = '<';
|
||||
public static final Character QUEST = '?';
|
||||
public static final Character QUOT = '"';
|
||||
public static final Character SLASH = '/';
|
||||
|
||||
public static String escape(final String string) {
|
||||
class XML {
|
||||
|
||||
static final Character AMP = '&';
|
||||
static final Character APOS = '\'';
|
||||
static final Character BANG = '!';
|
||||
static final Character EQ = '=';
|
||||
static final Character GT = '>';
|
||||
static final Character LT = '<';
|
||||
static final Character QUEST = '?';
|
||||
static final Character QUOT = '"';
|
||||
static final Character SLASH = '/';
|
||||
|
||||
static String escape(final String string) {
|
||||
final StringBuilder sb = new StringBuilder(string.length());
|
||||
for (int i = 0, length = string.length(); i < length; i++) {
|
||||
final char c = string.charAt(i);
|
||||
@ -53,14 +54,13 @@ public class XML {
|
||||
*
|
||||
* @throws JSONException
|
||||
*/
|
||||
public static void noSpace(final String string) throws JSONException {
|
||||
int i;
|
||||
static void noSpace(final String string) throws JSONException {
|
||||
final int length = string.length();
|
||||
if (length == 0) {
|
||||
throw new JSONException("Empty string.");
|
||||
}
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (Character.isWhitespace(string.charAt(i))) {
|
||||
for (char c : string.toCharArray()) {
|
||||
if (Character.isWhitespace(c)) {
|
||||
throw new JSONException("'" + string + "' contains a space character.");
|
||||
}
|
||||
}
|
||||
@ -78,12 +78,6 @@ public class XML {
|
||||
* @throws JSONException
|
||||
*/
|
||||
private static boolean parse(final XMLTokener x, final JSONObject context, final String name) throws JSONException {
|
||||
char c;
|
||||
int i;
|
||||
JSONObject jsonobject = null;
|
||||
String string;
|
||||
String tagName;
|
||||
Object token;
|
||||
// Test for and skip past these forms:
|
||||
// <!-- ... -->
|
||||
// <! ... >
|
||||
@ -93,10 +87,11 @@ public class XML {
|
||||
// <>
|
||||
// <=
|
||||
// <<
|
||||
token = x.nextToken();
|
||||
Object token = x.nextToken();
|
||||
// <!
|
||||
String string;
|
||||
if (token == BANG) {
|
||||
c = x.next();
|
||||
char c = x.next();
|
||||
if (c == '-') {
|
||||
if (x.next() == '-') {
|
||||
x.skipPast("-->");
|
||||
@ -116,7 +111,7 @@ public class XML {
|
||||
}
|
||||
throw x.syntaxError("Expected 'CDATA['");
|
||||
}
|
||||
i = 1;
|
||||
int i = 1;
|
||||
do {
|
||||
token = x.nextMeta();
|
||||
if (token == null) {
|
||||
@ -149,9 +144,9 @@ public class XML {
|
||||
throw x.syntaxError("Misshaped tag");
|
||||
// Open tag <
|
||||
} else {
|
||||
tagName = (String) token;
|
||||
String tagName = (String) token;
|
||||
token = null;
|
||||
jsonobject = new JSONObject();
|
||||
JSONObject jsonobject = new JSONObject();
|
||||
for (;;) {
|
||||
if (token == null) {
|
||||
token = x.nextToken();
|
||||
@ -225,7 +220,7 @@ public class XML {
|
||||
*
|
||||
* @return A simple JSON value.
|
||||
*/
|
||||
public static Object stringToValue(final String string) {
|
||||
static Object stringToValue(final String string) {
|
||||
if ("true".equalsIgnoreCase(string)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@ -292,12 +287,8 @@ public class XML {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
int i;
|
||||
JSONArray ja;
|
||||
JSONObject jo;
|
||||
String key;
|
||||
Iterator<String> keys;
|
||||
int length;
|
||||
String string;
|
||||
Object value;
|
||||
if (object instanceof JSONObject) {
|
||||
// Emit <tagName>
|
||||
if (tagName != null) {
|
||||
@ -306,11 +297,11 @@ public class XML {
|
||||
sb.append('>');
|
||||
}
|
||||
// Loop thru the keys.
|
||||
jo = (JSONObject) object;
|
||||
keys = jo.keys();
|
||||
JSONObject jo = (JSONObject) object;
|
||||
Iterator<String> keys = jo.keys();
|
||||
while (keys.hasNext()) {
|
||||
key = keys.next();
|
||||
value = jo.opt(key);
|
||||
String key = keys.next();
|
||||
Object value = jo.opt(key);
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
@ -378,7 +369,7 @@ public class XML {
|
||||
}
|
||||
return sb.toString();
|
||||
} else {
|
||||
string = (object == null) ? "null" : escape(object.toString());
|
||||
string = escape(object.toString());
|
||||
return (tagName == null) ? "\"" + string + "\"" :
|
||||
(string.isEmpty()) ? "<" + tagName + "/>" : "<" + tagName + ">" + string + "</" + tagName + ">";
|
||||
}
|
||||
|
@ -7,8 +7,24 @@ import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
||||
import com.intellectualcrafters.plot.generator.HybridGen;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal3;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -16,14 +32,8 @@ import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "area",
|
||||
permission = "plots.area",
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.NONE,
|
||||
description = "Create a new PlotArea",
|
||||
aliases = { "world" },
|
||||
usage = "/plot area <create|info|list|tp|regen>")
|
||||
@CommandDeclaration(command = "area", permission = "plots.area", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
description = "Create a new PlotArea", aliases = "world", usage = "/plot area <create|info|list|tp|regen>")
|
||||
public class Area extends SubCommand {
|
||||
|
||||
@Override
|
||||
@ -48,7 +58,7 @@ public class Area extends SubCommand {
|
||||
case 2: {
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "pos1": { // Set position 1
|
||||
HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
||||
HybridPlotWorld area = plr.getMeta("area_create_area");
|
||||
if (area == null) {
|
||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||
return false;
|
||||
@ -61,13 +71,13 @@ public class Area extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
case "pos2": { // Set position 2 and finish creation for type=2 (partial)
|
||||
final HybridPlotWorld area = plr.<HybridPlotWorld> getMeta("area_create_area");
|
||||
final HybridPlotWorld area = plr.getMeta("area_create_area");
|
||||
if (area == null) {
|
||||
C.COMMAND_SYNTAX.send(plr, "/plot area create [world[:id]] [<modifier>=<value>]...");
|
||||
return false;
|
||||
}
|
||||
Location pos1 = plr.getLocation();
|
||||
Location pos2 = plr.<Location> getMeta("area_pos1");
|
||||
Location pos2 = plr.getMeta("area_pos1");
|
||||
int dx = Math.abs(pos1.getX() - pos2.getX());
|
||||
int dz = Math.abs(pos1.getZ() - pos2.getZ());
|
||||
int numx = Math.max(1, (dx + 1 + area.ROAD_WIDTH + (area.SIZE / 2)) / area.SIZE);
|
||||
|
@ -24,7 +24,13 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
@ -35,13 +41,8 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "cluster",
|
||||
aliases = { "clusters" },
|
||||
category = CommandCategory.ADMINISTRATION,
|
||||
requiredType = RequiredType.NONE,
|
||||
permission = "plots.cluster",
|
||||
description = "Manage a plot cluster")
|
||||
@CommandDeclaration(command = "cluster", aliases = "clusters", category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
permission = "plots.cluster", description = "Manage a plot cluster")
|
||||
public class Cluster extends SubCommand {
|
||||
|
||||
@Override
|
||||
@ -379,7 +380,6 @@ public class Cluster extends SubCommand {
|
||||
for (final Plot plot : new ArrayList<>(PS.get().getPlots(plr.getLocation().getWorld(), uuid))) {
|
||||
final PlotCluster current = plot.getCluster();
|
||||
if ((current != null) && current.equals(cluster)) {
|
||||
plr.getLocation().getWorld();
|
||||
plot.unclaim();
|
||||
}
|
||||
}
|
||||
|
@ -94,12 +94,12 @@ public class Condense extends SubCommand {
|
||||
int size = sizes.get(i);
|
||||
ArrayList<Plot> array = buckets[size];
|
||||
if (array == null) {
|
||||
array = new ArrayList<Plot>();
|
||||
array = new ArrayList<>();
|
||||
buckets[size] = array;
|
||||
}
|
||||
array.add(plot);
|
||||
}
|
||||
final ArrayList<Plot> allPlots = new ArrayList<Plot>(plots.size());
|
||||
final ArrayList<Plot> allPlots = new ArrayList<>(plots.size());
|
||||
for (int i = buckets.length - 1; i >= 0; i--) {
|
||||
ArrayList<Plot> array = buckets[i];
|
||||
if (array != null) {
|
||||
|
@ -44,14 +44,8 @@ import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(
|
||||
command = "rate",
|
||||
permission = "plots.rate",
|
||||
description = "Rate the plot",
|
||||
usage = "/plot rate [#|next]",
|
||||
aliases = {"rt"},
|
||||
category = CommandCategory.INFO,
|
||||
requiredType = RequiredType.NONE)
|
||||
@CommandDeclaration(command = "rate", permission = "plots.rate", description = "Rate the plot", usage = "/plot rate [#|next]", aliases = "rt",
|
||||
category = CommandCategory.INFO, requiredType = RequiredType.NONE)
|
||||
public class Rate extends SubCommand {
|
||||
|
||||
@Override
|
||||
@ -221,21 +215,23 @@ public class Rate extends SubCommand {
|
||||
|
||||
private int value;
|
||||
|
||||
public MutableInt(int i) {
|
||||
MutableInt(int i) {
|
||||
value = i;
|
||||
}
|
||||
public void increment() {
|
||||
|
||||
void increment() {
|
||||
value++;
|
||||
}
|
||||
public void decrement() {
|
||||
|
||||
void decrement() {
|
||||
value--;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void add(Number v) {
|
||||
void add(Number v) {
|
||||
this.value += v.intValue();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,14 @@ import com.intellectualcrafters.plot.object.PlotMessage;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.Rating;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal3;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -97,7 +104,7 @@ public class list extends SubCommand {
|
||||
}
|
||||
|
||||
public void noArgs(final PlotPlayer plr) {
|
||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(plr));
|
||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + Arrays.toString(getArgumentList(plr)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -228,10 +235,9 @@ public class list extends SubCommand {
|
||||
@Override
|
||||
public int compare(final Plot p1, final Plot p2) {
|
||||
double v1 = 0;
|
||||
double v2 = 0;
|
||||
final int p1s = p1.getSettings().ratings != null ? p1.getSettings().ratings.size() : 0;
|
||||
final int p2s = p2.getSettings().ratings != null ? p2.getSettings().ratings.size() : 0;
|
||||
if ((p1.getSettings().ratings != null) && (p1s > 0)) {
|
||||
final int p1s = p1.getSettings().getRatings().size();
|
||||
final int p2s = p2.getRatings().size();
|
||||
if (!p1.getSettings().getRatings().isEmpty()) {
|
||||
for (final Entry<UUID, Rating> entry : p1.getRatings().entrySet()) {
|
||||
final double av = entry.getValue().getAverageRating();
|
||||
v1 += av * av;
|
||||
@ -239,7 +245,8 @@ public class list extends SubCommand {
|
||||
v1 /= p1s;
|
||||
v1 += p1s;
|
||||
}
|
||||
if ((p2.getSettings().ratings != null) && (p2s > 0)) {
|
||||
double v2 = 0;
|
||||
if (!p2.getSettings().getRatings().isEmpty()) {
|
||||
for (final Entry<UUID, Rating> entry : p2.getRatings().entrySet()) {
|
||||
final double av = entry.getValue().getAverageRating();
|
||||
v2 += av * av;
|
||||
@ -414,14 +421,5 @@ public class list extends SubCommand {
|
||||
}
|
||||
}, "/plot list " + args[0], C.PLOT_LIST_HEADER_PAGED.s());
|
||||
}
|
||||
|
||||
private String getArgumentList(final String[] strings) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
String prefix = "";
|
||||
for (final String s : strings) {
|
||||
builder.append(prefix + s);
|
||||
prefix = " | ";
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,6 +20,13 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.config;
|
||||
|
||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandCaller;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
@ -28,13 +35,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandCaller;
|
||||
|
||||
/**
|
||||
* Captions class.
|
||||
*
|
||||
@ -655,9 +655,7 @@ public enum C {
|
||||
*/
|
||||
C(final String d, final boolean prefix, final String cat) {
|
||||
this.d = d;
|
||||
if (s == null) {
|
||||
s = d;
|
||||
}
|
||||
this.s = d;
|
||||
this.prefix = prefix;
|
||||
this.cat = cat.toLowerCase();
|
||||
}
|
||||
|
@ -20,14 +20,14 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
|
||||
/**
|
||||
* Connects to and uses a MySQL database
|
||||
*
|
||||
@ -103,8 +103,9 @@ public class MySQL extends Database {
|
||||
if (checkConnection()) {
|
||||
openConnection();
|
||||
}
|
||||
final Statement statement = connection.createStatement();
|
||||
return statement.executeQuery(query);
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
return statement.executeQuery(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,7 +113,8 @@ public class MySQL extends Database {
|
||||
if (checkConnection()) {
|
||||
openConnection();
|
||||
}
|
||||
final Statement statement = connection.createStatement();
|
||||
return statement.executeUpdate(query);
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
return statement.executeUpdate(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2577,7 +2577,8 @@ public class SQLManager implements AbstractDB {
|
||||
try {
|
||||
BlockLoc loc = BlockLoc.fromString(pos);
|
||||
cluster.settings.setPosition(loc);
|
||||
} catch (final Exception e) {}
|
||||
} catch (final Exception ignored) {
|
||||
}
|
||||
}
|
||||
final Integer m = r.getInt("merged");
|
||||
final boolean[] merged = new boolean[4];
|
||||
|
@ -20,6 +20,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
@ -28,11 +30,10 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
|
||||
/**
|
||||
* Connects to and uses a SQLite database
|
||||
*
|
||||
*
|
||||
|
||||
* @author tips48
|
||||
*/
|
||||
public class SQLite extends Database {
|
||||
@ -94,8 +95,9 @@ public class SQLite extends Database {
|
||||
if (checkConnection()) {
|
||||
openConnection();
|
||||
}
|
||||
final Statement statement = connection.createStatement();
|
||||
return statement.executeQuery(query);
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
return statement.executeQuery(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,8 +105,9 @@ public class SQLite extends Database {
|
||||
if (checkConnection()) {
|
||||
openConnection();
|
||||
}
|
||||
final Statement statement = connection.createStatement();
|
||||
return statement.executeUpdate(query);
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
return statement.executeUpdate(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,16 +97,6 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
case 163:
|
||||
case 164:
|
||||
case 180:
|
||||
data = wrap(data, 0);
|
||||
data = wrap(data, 4);
|
||||
data = wrap(data, 8);
|
||||
data = wrap(data, 12);
|
||||
return data;
|
||||
|
||||
case 26:
|
||||
case 86:
|
||||
data = wrap(data, 0);
|
||||
return data;
|
||||
case 64:
|
||||
case 71:
|
||||
case 193:
|
||||
@ -127,6 +117,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
data = wrap(data, 8);
|
||||
data = wrap(data, 12);
|
||||
return data;
|
||||
|
||||
case 26:
|
||||
case 86:
|
||||
data = wrap(data, 0);
|
||||
return data;
|
||||
case 28:
|
||||
case 66:
|
||||
case 157:
|
||||
|
@ -2069,7 +2069,7 @@ public class Plot {
|
||||
}
|
||||
visited.add(current);
|
||||
Set<Plot> plots;
|
||||
if ((max >= 0) && ((dir == -1) || (dir == 0)) && !current.getMerged(0)) {
|
||||
if ((dir == -1 || (dir == 0)) && !current.getMerged(0)) {
|
||||
final Plot other = current.getRelative(0);
|
||||
if ((other != null)
|
||||
&& other.isOwner(uuid)
|
||||
|
@ -1,41 +1,22 @@
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlotCluster {
|
||||
public PlotArea area;
|
||||
public PlotSettings settings;
|
||||
public UUID owner;
|
||||
public HashSet<UUID> helpers = new HashSet<UUID>();
|
||||
public HashSet<UUID> invited = new HashSet<UUID>();
|
||||
public HashSet<UUID> helpers = new HashSet<>();
|
||||
public HashSet<UUID> invited = new HashSet<>();
|
||||
public int temp;
|
||||
private PlotId pos1;
|
||||
private PlotId pos2;
|
||||
private RegionWrapper region;
|
||||
|
||||
public int temp;
|
||||
|
||||
public PlotId getP1() {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
public PlotId getP2() {
|
||||
return pos2;
|
||||
}
|
||||
|
||||
public void setP1(final PlotId id) {
|
||||
pos1 = id;
|
||||
setRegion();
|
||||
}
|
||||
|
||||
public void setP2(final PlotId id) {
|
||||
pos2 = id;
|
||||
setRegion();
|
||||
}
|
||||
|
||||
public PlotCluster(final PlotArea area, final PlotId pos1, final PlotId pos2, final UUID owner) {
|
||||
this.area = area;
|
||||
this.pos1 = pos1;
|
||||
@ -55,6 +36,24 @@ public class PlotCluster {
|
||||
this.temp = temp;
|
||||
setRegion();
|
||||
}
|
||||
|
||||
public PlotId getP1() {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
public void setP1(final PlotId id) {
|
||||
pos1 = id;
|
||||
setRegion();
|
||||
}
|
||||
|
||||
public PlotId getP2() {
|
||||
return pos2;
|
||||
}
|
||||
|
||||
public void setP2(final PlotId id) {
|
||||
pos2 = id;
|
||||
setRegion();
|
||||
}
|
||||
|
||||
private void setRegion() {
|
||||
region = new RegionWrapper(pos1.x, pos2.x, pos1.y, pos2.y);
|
||||
@ -83,6 +82,14 @@ public class PlotCluster {
|
||||
public int getArea() {
|
||||
return ((1 + pos2.x) - pos1.x) * ((1 + pos2.y) - pos1.y);
|
||||
}
|
||||
|
||||
public void setArea(PlotArea plotarea) {
|
||||
if (this.area != null) {
|
||||
this.area.removeCluster(this);
|
||||
}
|
||||
this.area = plotarea;
|
||||
plotarea.addCluster(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
@ -136,7 +143,7 @@ public class PlotCluster {
|
||||
final PlotId top = getP2();
|
||||
return new PlotId((bot.x + top.x) / 2, (bot.y + top.y) / 2);
|
||||
}
|
||||
|
||||
|
||||
public Plot getCenterPlot() {
|
||||
return area.getPlotAbs(getCenterPlotId());
|
||||
}
|
||||
@ -155,14 +162,6 @@ public class PlotCluster {
|
||||
return (pos1.x <= this.pos2.x) && (pos2.x >= this.pos1.x) && (pos1.y <= this.pos2.y) && (pos2.y >= this.pos1.y);
|
||||
}
|
||||
|
||||
public void setArea(PlotArea plotarea) {
|
||||
if (this.area != null) {
|
||||
this.area.removeCluster(this);
|
||||
}
|
||||
this.area = plotarea;
|
||||
plotarea.addCluster(this);
|
||||
}
|
||||
|
||||
public boolean contains(final PlotId id) {
|
||||
return (pos1.x <= id.x) && (pos1.y <= id.y) && (pos2.x >= id.x) && (pos2.y >= id.y);
|
||||
}
|
||||
|
@ -7,7 +7,14 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotAnalysis;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal2;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@ -20,7 +27,7 @@ public class ExpireManager {
|
||||
public static ExpireManager IMP;
|
||||
|
||||
private static HashSet<Plot> plotsToDelete;
|
||||
private ConcurrentHashMap<UUID, Long> dates_cache = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<UUID, Long> dates_cache = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 0 = stopped, 1 = stopping, 2 = running
|
||||
*/
|
||||
@ -154,7 +161,7 @@ public class ExpireManager {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (plots.size() == 0) {
|
||||
if (plots.isEmpty()) {
|
||||
running = 3;
|
||||
TaskManager.runTaskLater(new Runnable() {
|
||||
@Override
|
||||
@ -165,7 +172,6 @@ public class ExpireManager {
|
||||
}
|
||||
}
|
||||
}, 86400000);
|
||||
return;
|
||||
} else {
|
||||
TaskManager.runTaskLaterAsync(task, Settings.CLEAR_INTERVAL * 20);
|
||||
}
|
||||
|
@ -1,24 +1,56 @@
|
||||
package com.intellectualcrafters.plot.util;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellectualcrafters.jnbt.*;
|
||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.jnbt.IntTag;
|
||||
import com.intellectualcrafters.jnbt.ListTag;
|
||||
import com.intellectualcrafters.jnbt.NBTInputStream;
|
||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
||||
import com.intellectualcrafters.jnbt.ShortTag;
|
||||
import com.intellectualcrafters.jnbt.StringTag;
|
||||
import com.intellectualcrafters.jnbt.Tag;
|
||||
import com.intellectualcrafters.json.JSONArray;
|
||||
import com.intellectualcrafters.json.JSONException;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
||||
import com.intellectualcrafters.plot.object.*;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
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.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
@ -35,7 +67,7 @@ public abstract class SchematicHandler {
|
||||
return false;
|
||||
}
|
||||
exportAll = true;
|
||||
final ArrayList<Plot> plots = new ArrayList<Plot>(collection);
|
||||
final ArrayList<Plot> plots = new ArrayList<>(collection);
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -661,14 +693,14 @@ public abstract class SchematicHandler {
|
||||
getCompoundTag(plot.getArea().worldname, plot.getRegions(), new RunnableVal<CompoundTag>() {
|
||||
@Override
|
||||
public void run(CompoundTag value) {
|
||||
if (plot.getFlags().size() > 0) {
|
||||
if (!plot.getFlags().isEmpty()) {
|
||||
HashMap<String, Tag> flagMap = new HashMap<>();
|
||||
for (Map.Entry<String, Flag> entry : plot.getFlags().entrySet()) {
|
||||
String key = entry.getKey();
|
||||
flagMap.put(key, new StringTag(key, entry.getValue().getValueString()));
|
||||
}
|
||||
CompoundTag tag = new CompoundTag("Flags", flagMap);
|
||||
HashMap<String, Tag> map = new HashMap<String, Tag>(value.getValue());
|
||||
HashMap<String, Tag> map = new HashMap<>(value.getValue());
|
||||
map.put("Flags", tag);
|
||||
value.setValue(map);
|
||||
}
|
||||
@ -716,9 +748,8 @@ public abstract class SchematicHandler {
|
||||
// Lossy but fast
|
||||
private final short[] ids;
|
||||
private final byte[] datas;
|
||||
private Map<String, Tag> flags;
|
||||
|
||||
private final Dimension schematicDimension;
|
||||
private Map<String, Tag> flags;
|
||||
private HashSet<PlotItem> items;
|
||||
|
||||
public Schematic(final short[] i, final byte[] b, final Dimension d, Map<String, Tag> flags) {
|
||||
|
@ -124,7 +124,7 @@ public class StringMan {
|
||||
public static boolean isAlphanumericUnd(final String str) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
final char c = str.charAt(i);
|
||||
if ((c < 0x30) || ((c >= 0x3a) && (c <= 0x40)) || ((c > 0x5a) && (c <= 0x60)) || (c > 0x7a) || (c == '_')) {
|
||||
if (c < 0x30 || (c >= 0x3a) && (c <= 0x40) || (c > 0x5a) && (c <= 0x60) || (c > 0x7a)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -6,16 +6,14 @@ import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.Command;
|
||||
|
||||
public class HelpObject {
|
||||
|
||||
private final Command _command;
|
||||
|
||||
private final String _rendered;
|
||||
|
||||
public HelpObject(final Command command, final String label) {
|
||||
_command = command;
|
||||
_rendered = StringMan.replaceAll(C.HELP_ITEM.s(), "%usage%", _command.getUsage().replaceAll("\\{label\\}", label), "[%alias%]",
|
||||
!_command.getAliases().isEmpty() ? "(" + StringMan.join(_command.getAliases(), "|") + ")" : "", "%desc%", _command.getDescription(),
|
||||
_rendered = StringMan.replaceAll(C.HELP_ITEM.s(), "%usage%", command.getUsage().replaceAll("\\{label\\}", label), "[%alias%]",
|
||||
!command.getAliases().isEmpty() ? "(" + StringMan.join(command.getAliases(), "|") + ")" : "", "%desc%", command.getDescription(),
|
||||
"%arguments%",
|
||||
buildArgumentList(_command.getRequiredArguments()), "{label}", label);
|
||||
buildArgumentList(command.getRequiredArguments()), "{label}", label);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user