mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-27 17:28:28 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
6caa7ee757
2
.github/CONTRIBUTING.md
vendored
Normal file
2
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
### Bugs
|
||||
Please provide a `/plot debugpaste` if you are reporting a bug.
|
12
.github/ISSUE_TEMPLATE.md
vendored
Normal file
12
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Bug report template (clear for feature request)
|
||||
**Debug paste link**:
|
||||
|
||||
**Description of the problem:**
|
||||
|
||||
**How to replicate**:
|
||||
|
||||
Make sure you've completed the following steps (put X inside of brackets):
|
||||
- [ ] Include `/plot debugpaste`
|
||||
- [ ] Made sure there aren't duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues)
|
||||
- [ ] Made sure you're using an updated version of PlotSquared
|
||||
- [ ] Made sure the bug/error isn't caused by any other plugin
|
@ -1,2 +0,0 @@
|
||||
### Bugs
|
||||
Please provide a `/plot debugpaste` if you are reporting a bug.
|
@ -199,7 +199,7 @@ public class JSONArray {
|
||||
final Object object = get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -217,7 +217,7 @@ public class JSONArray {
|
||||
final Object object = get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ public class JSONArray {
|
||||
final Object object = get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -368,7 +368,7 @@ public class JSONArray {
|
||||
public boolean optBoolean(final int index, final boolean defaultValue) {
|
||||
try {
|
||||
return getBoolean(index);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -397,7 +397,7 @@ public class JSONArray {
|
||||
public double optDouble(final int index, final double defaultValue) {
|
||||
try {
|
||||
return getDouble(index);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -426,7 +426,7 @@ public class JSONArray {
|
||||
public int optInt(final int index, final int defaultValue) {
|
||||
try {
|
||||
return getInt(index);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -480,7 +480,7 @@ public class JSONArray {
|
||||
public long optLong(final int index, final long defaultValue) {
|
||||
try {
|
||||
return getLong(index);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -798,7 +798,7 @@ public class JSONArray {
|
||||
public String toString() {
|
||||
try {
|
||||
return this.toString(0);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
@ -87,7 +88,8 @@ public class JSONObject {
|
||||
for (final String name : names) {
|
||||
try {
|
||||
putOnce(name, jo.opt(name));
|
||||
} catch (final Exception ignore) {}
|
||||
} catch (JSONException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +194,8 @@ public class JSONObject {
|
||||
for (final String name : names) {
|
||||
try {
|
||||
putOpt(name, c.getField(name).get(object));
|
||||
} catch (final Exception ignore) {}
|
||||
} catch (JSONException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +461,8 @@ public class JSONObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception ignore) {}
|
||||
} catch (NumberFormatException ignore) {
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
@ -514,7 +518,7 @@ public class JSONObject {
|
||||
} catch (final Exception e) {
|
||||
throw new JSONException(e);
|
||||
}
|
||||
if (object instanceof String) {
|
||||
if (object != null) {
|
||||
return (String) object;
|
||||
}
|
||||
throw new JSONException("Bad value from toJSONString: " + object);
|
||||
@ -553,18 +557,18 @@ public class JSONObject {
|
||||
return NULL;
|
||||
}
|
||||
if ((object instanceof JSONObject)
|
||||
|| (object instanceof JSONArray)
|
||||
|| NULL.equals(object)
|
||||
|| (object instanceof JSONString)
|
||||
|| (object instanceof Byte)
|
||||
|| (object instanceof Character)
|
||||
|| (object instanceof Short)
|
||||
|| (object instanceof Integer)
|
||||
|| (object instanceof Long)
|
||||
|| (object instanceof Boolean)
|
||||
|| (object instanceof Float)
|
||||
|| (object instanceof Double)
|
||||
|| (object instanceof String)) {
|
||||
|| (object instanceof JSONArray)
|
||||
|| NULL.equals(object)
|
||||
|| (object instanceof JSONString)
|
||||
|| (object instanceof Byte)
|
||||
|| (object instanceof Character)
|
||||
|| (object instanceof Short)
|
||||
|| (object instanceof Integer)
|
||||
|| (object instanceof Long)
|
||||
|| (object instanceof Boolean)
|
||||
|| (object instanceof Float)
|
||||
|| (object instanceof Double)
|
||||
|| (object instanceof String)) {
|
||||
return object;
|
||||
}
|
||||
if (object instanceof Collection) {
|
||||
@ -582,7 +586,7 @@ public class JSONObject {
|
||||
return object.toString();
|
||||
}
|
||||
return new JSONObject(object);
|
||||
} catch (final Exception exception) {
|
||||
} catch (JSONException exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -730,7 +734,7 @@ public class JSONObject {
|
||||
final Object object = get(key);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -748,7 +752,7 @@ public class JSONObject {
|
||||
final Object object = get(key);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
|
||||
}
|
||||
}
|
||||
@ -800,7 +804,7 @@ public class JSONObject {
|
||||
final Object object = get(key);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
|
||||
}
|
||||
}
|
||||
@ -949,7 +953,7 @@ public class JSONObject {
|
||||
public boolean optBoolean(final String key, final boolean defaultValue) {
|
||||
try {
|
||||
return getBoolean(key);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -978,7 +982,7 @@ public class JSONObject {
|
||||
public double optDouble(final String key, final double defaultValue) {
|
||||
try {
|
||||
return getDouble(key);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -1007,7 +1011,7 @@ public class JSONObject {
|
||||
public int optInt(final String key, final int defaultValue) {
|
||||
try {
|
||||
return getInt(key);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -1062,7 +1066,7 @@ public class JSONObject {
|
||||
public long optLong(final String key, final long defaultValue) {
|
||||
try {
|
||||
return getLong(key);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -1123,7 +1127,8 @@ public class JSONObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final Exception ignore) {}
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1365,7 +1370,7 @@ public class JSONObject {
|
||||
public String toString() {
|
||||
try {
|
||||
return this.toString(0);
|
||||
} catch (final Exception e) {
|
||||
} catch (JSONException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1471,7 +1476,7 @@ public class JSONObject {
|
||||
protected final Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (final Exception e) {
|
||||
} catch (CloneNotSupportedException e) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -235,9 +235,7 @@ public class XML {
|
||||
if ("null".equalsIgnoreCase(string)) {
|
||||
return JSONObject.NULL;
|
||||
}
|
||||
// If it might be a number, try converting it, first as a Long, and then
|
||||
// as a
|
||||
// Double. If that doesn't work, return the string.
|
||||
//If it might be a number, try converting it, first as a Long, and then as a Double. If that doesn't work, return the string.
|
||||
try {
|
||||
final char initial = string.charAt(0);
|
||||
if ((initial == '-') || ((initial >= '0') && (initial <= '9'))) {
|
||||
@ -246,13 +244,14 @@ public class XML {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
} catch (final Exception ignore) {
|
||||
} catch (NumberFormatException ignore) {
|
||||
try {
|
||||
final Double value = new Double(string);
|
||||
if (value.toString().equals(string)) {
|
||||
return value;
|
||||
}
|
||||
} catch (final Exception ignoreAlso) {}
|
||||
} catch (NumberFormatException ignoreAlso) {
|
||||
}
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ public class Area extends SubCommand {
|
||||
}
|
||||
RegionWrapper region = area.getRegion();
|
||||
Location center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0, region.minZ + (region.maxZ - region.minZ) / 2);
|
||||
center.setY(WorldUtil.IMP.getHeighestBlock(area.worldname, center.getX(), center.getZ()));
|
||||
center.setY(WorldUtil.IMP.getHighestBlock(area.worldname, center.getX(), center.getZ()));
|
||||
plr.teleport(center);
|
||||
return true;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class Auto extends SubCommand {
|
||||
if (args.length > 1) {
|
||||
schematic = args[1];
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
} catch (NumberFormatException e) {
|
||||
size_x = 1;
|
||||
size_z = 1;
|
||||
schematic = args[0];
|
||||
|
@ -20,6 +20,14 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.database;
|
||||
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
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.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -29,14 +37,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
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.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||
|
||||
/**
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ public interface AbstractDB {
|
||||
void setAlias(final Plot plot, final String alias);
|
||||
|
||||
/**
|
||||
* Purgle a plot
|
||||
* Purge a plot
|
||||
*
|
||||
* @param uniqueIds list of plot id (db) to be purged
|
||||
*/
|
||||
|
@ -20,25 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
@ -60,6 +41,25 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* The plot class
|
||||
*/
|
||||
@ -1089,7 +1089,7 @@ public class Plot {
|
||||
final Location bot = this.getBottomAbs();
|
||||
final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch);
|
||||
if (WorldUtil.IMP.getBlock(loc).id != 0) {
|
||||
loc.setY(Math.max(WorldUtil.IMP.getHeighestBlock(this.area.worldname, loc.getX(), loc.getZ()), bot.getY()));
|
||||
loc.setY(Math.max(WorldUtil.IMP.getHighestBlock(this.area.worldname, loc.getX(), loc.getZ()), bot.getY()));
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
@ -1134,7 +1134,7 @@ public class Plot {
|
||||
x = bot.getX() + this.area.DEFAULT_HOME.x;
|
||||
z = bot.getZ() + this.area.DEFAULT_HOME.z;
|
||||
}
|
||||
final int y = WorldUtil.IMP.getHeighestBlock(plot.area.worldname, x, z);
|
||||
final int y = WorldUtil.IMP.getHighestBlock(plot.area.worldname, x, z);
|
||||
return new Location(plot.area.worldname, x, y + 1, z);
|
||||
}
|
||||
// Side
|
||||
@ -1142,7 +1142,7 @@ public class Plot {
|
||||
final int x = ((largest.maxX - largest.minX) / 2) + largest.minX;
|
||||
final int z = largest.minZ - 1;
|
||||
final PlotManager manager = plot.getManager();
|
||||
final int y = Math.max(WorldUtil.IMP.getHeighestBlock(plot.area.worldname, x, z), manager.getSignLoc(plot.area, plot).getY());
|
||||
final int y = Math.max(WorldUtil.IMP.getHighestBlock(plot.area.worldname, x, z), manager.getSignLoc(plot.area, plot).getY());
|
||||
return new Location(plot.area.worldname, x, y + 1, z);
|
||||
}
|
||||
|
||||
@ -1933,7 +1933,7 @@ public class Plot {
|
||||
* 3 = west<br>
|
||||
* @param max The max number of merges to do
|
||||
* @param uuid The UUID it is allowed to merge with
|
||||
* @param removeRoads Wether to remove roads
|
||||
* @param removeRoads Whether to remove roads
|
||||
* @return true if a merge takes place
|
||||
*/
|
||||
public boolean autoMerge(final int dir, int max, final UUID uuid, final boolean removeRoads) {
|
||||
@ -2355,7 +2355,7 @@ public class Plot {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the corners of the plot (supports non-recangular shapes)<br>
|
||||
* Get all the corners of the plot (supports non-rectangular shapes)<br>
|
||||
* @return
|
||||
*/
|
||||
public List<Location> getAllCorners() {
|
||||
|
@ -453,7 +453,7 @@ public class MainUtil {
|
||||
* @return
|
||||
*/
|
||||
public static int getHeighestBlock(final String world, final int x, final int z) {
|
||||
final int result = WorldUtil.IMP.getHeighestBlock(world, x, z);
|
||||
final int result = WorldUtil.IMP.getHighestBlock(world, x, z);
|
||||
if (result == 0) {
|
||||
return 64;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public abstract class WorldUtil {
|
||||
|
||||
public abstract PlotBlock getBlock(Location location);
|
||||
|
||||
public abstract int getHeighestBlock(String world, int x, int z);
|
||||
public abstract int getHighestBlock(String world, int x, int z);
|
||||
|
||||
public abstract boolean addItems(String world, PlotItem item);
|
||||
|
||||
|
@ -2,6 +2,24 @@ package com.plotsquared.bukkit.chat;
|
||||
|
||||
import static com.plotsquared.bukkit.chat.TextualComponent.rawText;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
|
||||
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.Statistic.Type;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Constructor;
|
||||
@ -18,25 +36,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.Statistic.Type;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
|
||||
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
|
||||
|
||||
/**
|
||||
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>.
|
||||
* This class allows plugins to emulate the functionality of the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>.
|
||||
@ -662,8 +661,11 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
|
||||
}
|
||||
}
|
||||
|
||||
// Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)' than to reflectively call it
|
||||
// Of course, the implementation may change, but fuzzy matches might break with signature changes
|
||||
/*
|
||||
Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)'
|
||||
than to reflectively call it
|
||||
Of course, the implementation may change, but fuzzy matches might break with signature changes
|
||||
*/
|
||||
final Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json, Reflection.getNMSClass("IChatBaseComponent"));
|
||||
|
||||
return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent);
|
||||
@ -699,7 +701,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
|
||||
* Serialization of this message by using this message will include (in this order for each message part):
|
||||
* <ol>
|
||||
* <li>The color of each message part.</li>
|
||||
* <li>The applicable stylizations for each message part.</li>
|
||||
* <li>The applicable stylization for each message part.</li>
|
||||
* <li>The core text of the message part.</li>
|
||||
* </ol>
|
||||
* The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort.
|
||||
@ -748,7 +750,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes a JSON-represented message from a mapping of key-value pairs.
|
||||
* Deserialize a JSON-represented message from a mapping of key-value pairs.
|
||||
* This is called by the Bukkit serialization API.
|
||||
* It is not intended for direct public API consumption.
|
||||
* @param serialized The key-value mapping which represents a fancy message.
|
||||
@ -773,10 +775,10 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
|
||||
private static JsonParser _stringParser = new JsonParser();
|
||||
|
||||
/**
|
||||
* Deserializes a fancy message from its JSON representation. This JSON representation is of the format of
|
||||
* Deserialize a fancy message from its JSON representation. This JSON representation is of the format of
|
||||
* that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
|
||||
* @param json The JSON string which represents a fancy message.
|
||||
* @return A {@code FancyMessage} representing the parameterized JSON message.
|
||||
* @return A {@code FancyMessage} representing the parametrized JSON message.
|
||||
*/
|
||||
public static FancyMessage deserialize(final String json) {
|
||||
final JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
|
||||
|
@ -58,7 +58,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
try {
|
||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
|
||||
r = stmt.executeQuery();
|
||||
} catch (Exception e) {
|
||||
} catch (SQLException e) {
|
||||
PS.debug("========= Table does not exist =========");
|
||||
e.printStackTrace();
|
||||
PS.debug("=======================================");
|
||||
@ -114,9 +114,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
final byte[] bytes = r.getBytes("ownerid");
|
||||
if (bytes != null) {
|
||||
owner = UUID.nameUUIDFromBytes(bytes);
|
||||
if (owner != null) {
|
||||
UUIDHandler.add(new StringWrapper(name), owner);
|
||||
}
|
||||
UUIDHandler.add(new StringWrapper(name), owner);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -148,7 +146,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
PS.log(" - " + plugin + "core_denied");
|
||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_denied`");
|
||||
r = stmt.executeQuery();
|
||||
|
||||
|
||||
while (r.next()) {
|
||||
final int key = r.getInt("plot_id");
|
||||
final Plot plot = plots.get(key);
|
||||
@ -159,11 +157,11 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
final UUID denied = UUID.fromString(r.getString("player"));
|
||||
plot.getDenied().add(denied);
|
||||
}
|
||||
|
||||
|
||||
PS.log(" - " + plugin + "core_allowed");
|
||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_allowed`");
|
||||
r = stmt.executeQuery();
|
||||
|
||||
|
||||
while (r.next()) {
|
||||
final int key = r.getInt("plot_id");
|
||||
final Plot plot = plots.get(key);
|
||||
@ -176,8 +174,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
}
|
||||
r.close();
|
||||
stmt.close();
|
||||
|
||||
} catch (final Exception e) {
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
final HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
||||
|
@ -1,23 +1,22 @@
|
||||
package com.plotsquared.bukkit.generator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
||||
import java.util.Random;
|
||||
|
||||
public class BukkitAugmentedGenerator extends BlockPopulator {
|
||||
|
||||
private static BukkitAugmentedGenerator generator;
|
||||
|
||||
private BukkitAugmentedGenerator() {};
|
||||
|
||||
private BukkitAugmentedGenerator() {}
|
||||
|
||||
public static BukkitAugmentedGenerator get(World world) {
|
||||
for (BlockPopulator poplator : world.getPopulators()) {
|
||||
if (poplator instanceof BukkitAugmentedGenerator) {
|
||||
return (BukkitAugmentedGenerator) poplator;
|
||||
for (BlockPopulator populator : world.getPopulators()) {
|
||||
if (populator instanceof BukkitAugmentedGenerator) {
|
||||
return (BukkitAugmentedGenerator) populator;
|
||||
}
|
||||
}
|
||||
if (generator == null) {
|
||||
|
@ -664,11 +664,11 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
PlotPlayer pp = entry.getValue();
|
||||
Location ploc = pp.getLocation();
|
||||
if (!ploc.getChunkLoc().equals(loc)) {
|
||||
Location pLoc = pp.getLocation();
|
||||
if (!pLoc.getChunkLoc().equals(loc)) {
|
||||
continue;
|
||||
}
|
||||
PlotBlock plotblock = WorldUtil.IMP.getBlock(ploc);
|
||||
PlotBlock plotblock = WorldUtil.IMP.getBlock(pLoc);
|
||||
if (plotblock.id != 0) {
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
pp.teleport(plot.getDefaultHome());
|
||||
|
@ -163,7 +163,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeighestBlock(final String world, final int x, final int z) {
|
||||
public int getHighestBlock(final String world, final int x, final int z) {
|
||||
return getWorld(world).getHighestBlockAt(x, z).getY();
|
||||
}
|
||||
|
||||
|
@ -2,16 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -23,6 +13,15 @@ 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.World;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class FastQueue_1_7 extends SlowQueue {
|
||||
|
||||
@ -91,7 +90,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param pc
|
||||
*/
|
||||
@Override
|
||||
@ -144,7 +143,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param wrap
|
||||
*/
|
||||
@Override
|
||||
@ -165,7 +164,7 @@ public class FastQueue_1_7 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param world
|
||||
* @param locs
|
||||
*/
|
||||
|
@ -2,17 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -25,6 +14,16 @@ 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.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class FastQueue_1_8 extends SlowQueue {
|
||||
|
||||
@ -349,7 +348,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param wrap
|
||||
*/
|
||||
@Override
|
||||
@ -358,7 +357,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param fixAll
|
||||
*/
|
||||
@Override
|
||||
@ -369,7 +368,7 @@ public class FastQueue_1_8 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param locs
|
||||
*/
|
||||
@Override
|
||||
|
@ -2,23 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
@ -34,6 +17,22 @@ 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;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class FastQueue_1_8_3 extends SlowQueue {
|
||||
|
||||
@ -123,7 +122,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param pc
|
||||
*/
|
||||
@Override
|
||||
@ -257,7 +256,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param wrap
|
||||
*/
|
||||
@Override
|
||||
@ -266,7 +265,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param pc
|
||||
*/
|
||||
@Override
|
||||
@ -405,7 +404,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
}
|
||||
|
||||
/**
|
||||
* This should be overriden by any specialized queues
|
||||
* This should be overridden by any specialized queues
|
||||
* @param world
|
||||
* @param locs
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.plotsquared.sponge.events;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.cause.Cause;
|
||||
import org.spongepowered.api.event.impl.AbstractEvent;
|
||||
@ -7,28 +8,27 @@ import org.spongepowered.api.event.impl.AbstractEvent;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
|
||||
public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
||||
private final PlotId id;
|
||||
private final String world;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
private Plot plot;
|
||||
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is cleared
|
||||
*
|
||||
* @param world The world in which the plot was cleared
|
||||
* @param id The plot that was cleared
|
||||
* @param plot The plot that was cleared
|
||||
*/
|
||||
public PlotClearEvent(final String world, final PlotId id) {
|
||||
this.id = id;
|
||||
this.world = world;
|
||||
|
||||
public PlotClearEvent(Plot plot) {
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the PlotId
|
||||
*
|
||||
* @return PlotId
|
||||
*/
|
||||
public PlotId getPlotId() {
|
||||
return id;
|
||||
return plot.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
||||
* @return String
|
||||
*/
|
||||
public String getWorld() {
|
||||
return world;
|
||||
return plot.getArea().worldname;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,23 +1,21 @@
|
||||
package com.plotsquared.sponge.events;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import org.spongepowered.api.event.cause.Cause;
|
||||
import org.spongepowered.api.event.impl.AbstractEvent;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
|
||||
public class PlotDeleteEvent extends AbstractEvent {
|
||||
private final PlotId id;
|
||||
private final String world;
|
||||
|
||||
private final Plot plot;
|
||||
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is deleted
|
||||
*
|
||||
* @param world The world in which the plot was deleted
|
||||
* @param id The ID of the plot that was deleted
|
||||
* @param plot The plot that was deleted
|
||||
*/
|
||||
public PlotDeleteEvent(final String world, final PlotId id) {
|
||||
this.id = id;
|
||||
this.world = world;
|
||||
public PlotDeleteEvent(Plot plot) {
|
||||
this.plot = plot;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,7 +24,7 @@ public class PlotDeleteEvent extends AbstractEvent {
|
||||
* @return PlotId
|
||||
*/
|
||||
public PlotId getPlotId() {
|
||||
return id;
|
||||
return plot.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -35,7 +33,7 @@ public class PlotDeleteEvent extends AbstractEvent {
|
||||
* @return String
|
||||
*/
|
||||
public String getWorld() {
|
||||
return world;
|
||||
return plot.getArea().worldname;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -332,7 +332,7 @@ public class MainListener {
|
||||
Location loc = SpongeUtil.getLocation(worldname, first.getOriginal().getPosition());
|
||||
Plot plot = loc.getPlot();
|
||||
if (plot == null) {
|
||||
if (loc.getPlotAbs() == null /*MainUtil.isPlotAreaAbs(loc)*/) {
|
||||
if (loc.getPlotAbs() == null ) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -392,7 +392,7 @@ public class MainListener {
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
final Text message = event.getMessage().get();
|
||||
final Text message = event.getMessage().orElse(Text.EMPTY);
|
||||
|
||||
// TODO use display name rather than username
|
||||
// - Getting displayname currently causes NPE, so wait until sponge fixes that
|
||||
@ -400,7 +400,7 @@ public class MainListener {
|
||||
final String sender = player.getName();
|
||||
final PlotId id = plot.getId();
|
||||
final String newMessage = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
|
||||
final Text forcedMessage = event.getMessage().get();
|
||||
final Text forcedMessage = event.getMessage().orElse(Text.EMPTY);
|
||||
// String forcedMessage = StringMan.replaceAll(C.PLOT_CHAT_FORCED.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
PlotPlayer user = entry.getValue();
|
||||
@ -450,7 +450,7 @@ public class MainListener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (originPlot == null && current.getPlotAbs() == null /*May not work*/) {
|
||||
if (originPlot == null && current.getPlotAbs() == null) {
|
||||
return;
|
||||
}
|
||||
if (!FlagManager.isPlotFlagTrue(currentPlot, "explosion")) {
|
||||
@ -492,12 +492,6 @@ public class MainListener {
|
||||
public void onBlockBreak(final ChangeBlockEvent.Decay event) {
|
||||
onBlockChange(event);
|
||||
}
|
||||
|
||||
// @Listener
|
||||
// public void onBlockBreak(final ChangeBlockEvent.Fluid event) {
|
||||
// onBlockChange(event);
|
||||
// }
|
||||
|
||||
@Listener
|
||||
public void onBlockBreak(final ChangeBlockEvent.Grow event) {
|
||||
onBlockChange(event);
|
||||
@ -824,7 +818,7 @@ public class MainListener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Integer border = plotworld.getBorder(); //worldBorder.get(worldname); **May not work**
|
||||
final Integer border = plotworld.getBorder();
|
||||
if (border != null) {
|
||||
if (x2 > border) {
|
||||
final Vector3d pos = to.getPosition();
|
||||
@ -858,7 +852,7 @@ public class MainListener {
|
||||
}
|
||||
final PlotManager plotManager = PS.get().getPlotManager(PS.get().getPlot(plotworld, plotworld.getMin()));
|
||||
final PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
final Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
final Plot lastPlot = pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
return;
|
||||
@ -886,7 +880,7 @@ public class MainListener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Integer border = plotworld.getBorder(); //worldBorder.get(worldname); **May not work**
|
||||
final Integer border = plotworld.getBorder();
|
||||
if (border != null) {
|
||||
if (z2 > border) {
|
||||
final Vector3d pos = to.getPosition();
|
||||
|
@ -4,6 +4,7 @@ import java.time.Instant;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.data.key.Keys;
|
||||
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
|
||||
import org.spongepowered.api.data.value.mutable.Value;
|
||||
@ -11,7 +12,6 @@ import org.spongepowered.api.effect.sound.SoundTypes;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.profile.GameProfile;
|
||||
import org.spongepowered.api.service.ban.BanService;
|
||||
import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.text.chat.ChatTypes;
|
||||
@ -25,7 +25,6 @@ import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
|
||||
public class SpongePlayer extends PlotPlayer {
|
||||
@ -95,8 +94,7 @@ public class SpongePlayer extends PlotPlayer {
|
||||
hasPerm.add(perm);
|
||||
return true;
|
||||
}
|
||||
final boolean value = player.hasPermission(perm);
|
||||
return value;
|
||||
return player.hasPermission(perm);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -279,12 +277,12 @@ public class SpongePlayer extends PlotPlayer {
|
||||
|
||||
@Override
|
||||
public void kick(final String message) {
|
||||
player.kick(SpongeUtil.text(message));
|
||||
player.kick(Text.of(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBanned() {
|
||||
BanService service = SpongeMain.THIS.getGame().getServiceManager().provide(BanService.class).get();
|
||||
return service.isBanned((GameProfile) player);
|
||||
BanService service = Sponge.getServiceManager().provide(BanService.class).get();
|
||||
return service.isBanned(player.getProfile());
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
package com.plotsquared.sponge.util;
|
||||
|
||||
import org.spongepowered.api.text.action.TextActions;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.ChatManager;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.text.action.TextActions;
|
||||
|
||||
public class SpongeChatManager extends ChatManager<TextBuilder> {
|
||||
public class SpongeChatManager extends ChatManager<Text.Builder> {
|
||||
|
||||
@Override
|
||||
public TextBuilder builder() {
|
||||
return Texts.builder();
|
||||
public Text.Builder builder() {
|
||||
return Text.builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void color(final PlotMessage m, final String color) {
|
||||
m.$(this).color(Texts.of(color).getColor());
|
||||
m.$(this).color(Text.of(color).getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tooltip(final PlotMessage m, final PlotMessage... tooltips) {
|
||||
final TextBuilder builder = Texts.builder();
|
||||
final Text.Builder builder = Text.builder();
|
||||
boolean lb = false;
|
||||
for (final PlotMessage tooltip : tooltips) {
|
||||
if (lb) {
|
||||
builder.append(Texts.of("\n"));
|
||||
builder.append(Text.of("\n"));
|
||||
}
|
||||
builder.append(tooltip.$(this).build());
|
||||
lb = true;
|
||||
@ -42,13 +42,13 @@ public class SpongeChatManager extends ChatManager<TextBuilder> {
|
||||
|
||||
@Override
|
||||
public void text(final PlotMessage m, final String text) {
|
||||
m.$(this).append(Texts.of(text));
|
||||
m.$(this).append(Text.of(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(final PlotMessage m, final PlotPlayer player) {
|
||||
if (ConsolePlayer.isConsole(player)) {
|
||||
player.sendMessage(Texts.legacy().to(m.$(this).build()));
|
||||
player.sendMessage(m.$(this).build().toPlain());
|
||||
} else {
|
||||
((SpongePlayer) player).player.sendMessage(m.$(this).build());
|
||||
}
|
||||
|
@ -50,17 +50,17 @@ public class SpongeCommand implements CommandCallable {
|
||||
|
||||
@Override
|
||||
public Optional<? extends Text> getShortDescription(final CommandSource cmd) {
|
||||
return Optional.of(Texts.of("Shows plot help"));
|
||||
return Optional.of(Text.of("Shows plot help"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<? extends Text> getHelp(final CommandSource cmd) {
|
||||
return Optional.of(Texts.of("/plot help"));
|
||||
return Optional.of(Text.of("/plot help"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getUsage(final CommandSource cmd) {
|
||||
return Texts.of("/plot <command>");
|
||||
return Text.of("/plot <command>");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import java.math.BigDecimal;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
import org.spongepowered.api.event.Listener;
|
||||
import org.spongepowered.api.Sponge;
|
||||
import org.spongepowered.api.event.cause.Cause;
|
||||
import org.spongepowered.api.event.service.ChangeServiceProviderEvent;
|
||||
import org.spongepowered.api.service.economy.EconomyService;
|
||||
import org.spongepowered.api.service.economy.account.UniqueAccount;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
@ -17,22 +17,22 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeEconHandler extends EconHandler {
|
||||
|
||||
private EconomyService econ;
|
||||
|
||||
@Listener
|
||||
public void onChangeServiceProvider(ChangeServiceProviderEvent event) {
|
||||
if (event.getService().equals(EconomyService.class)) {
|
||||
this.econ = (EconomyService) event.getNewProviderRegistration().getProvider();
|
||||
|
||||
public SpongeEconHandler() {
|
||||
if (Sponge.getServiceManager().isRegistered(EconomyService.class)) {
|
||||
econ = Sponge.getServiceManager().provide(EconomyService.class).get();
|
||||
} else {
|
||||
PS.log("No economy service was registered.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void withdrawMoney(PlotPlayer player, double amount) {
|
||||
if (econ != null) {
|
||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
||||
if (uOpt.isPresent()) {
|
||||
UniqueAccount acc = uOpt.get();
|
||||
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||
if (accOpt.isPresent()) {
|
||||
UniqueAccount acc = accOpt.get();
|
||||
acc.withdraw(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
||||
}
|
||||
}
|
||||
@ -41,9 +41,9 @@ public class SpongeEconHandler extends EconHandler {
|
||||
@Override
|
||||
public void depositMoney(PlotPlayer player, double amount) {
|
||||
if (econ != null) {
|
||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
||||
if (uOpt.isPresent()) {
|
||||
UniqueAccount acc = uOpt.get();
|
||||
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||
if (accOpt.isPresent()) {
|
||||
UniqueAccount acc = accOpt.get();
|
||||
acc.deposit(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
||||
}
|
||||
}
|
||||
@ -52,9 +52,9 @@ public class SpongeEconHandler extends EconHandler {
|
||||
@Override
|
||||
public void depositMoney(OfflinePlotPlayer player, double amount) {
|
||||
if (econ != null) {
|
||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
||||
if (uOpt.isPresent()) {
|
||||
UniqueAccount acc = uOpt.get();
|
||||
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||
if (accOpt.isPresent()) {
|
||||
UniqueAccount acc = accOpt.get();
|
||||
acc.deposit(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
||||
}
|
||||
}
|
||||
@ -79,9 +79,9 @@ public class SpongeEconHandler extends EconHandler {
|
||||
@Override
|
||||
public double getBalance(PlotPlayer player) {
|
||||
if (econ != null) {
|
||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
||||
if (uOpt.isPresent()) {
|
||||
UniqueAccount acc = uOpt.get();
|
||||
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||
if (accOpt.isPresent()) {
|
||||
UniqueAccount acc = accOpt.get();
|
||||
BigDecimal balance = acc.getBalance(econ.getDefaultCurrency());
|
||||
return balance.doubleValue();
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
package com.plotsquared.sponge.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.spongepowered.api.event.Event;
|
||||
import org.spongepowered.api.event.EventManager;
|
||||
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
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;
|
||||
@ -30,6 +25,11 @@ import com.plotsquared.sponge.events.PlotFlagRemoveEvent;
|
||||
import com.plotsquared.sponge.events.PlotMergeEvent;
|
||||
import com.plotsquared.sponge.events.PlotRateEvent;
|
||||
import com.plotsquared.sponge.events.PlotUnlinkEvent;
|
||||
import org.spongepowered.api.event.Event;
|
||||
import org.spongepowered.api.event.EventManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SpongeEventUtil extends EventUtil {
|
||||
|
||||
@ -54,13 +54,13 @@ public class SpongeEventUtil extends EventUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callClear(final String world, final PlotId id) {
|
||||
return callEvent(new PlotClearEvent(world, id));
|
||||
public boolean callClear(final Plot plot) {
|
||||
return callEvent(new PlotClearEvent(plot));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callDelete(final String world, final PlotId id) {
|
||||
callEvent(new PlotDeleteEvent(world, id));
|
||||
public void callDelete(Plot plot) {
|
||||
callEvent(new PlotDeleteEvent(plot));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,13 +74,13 @@ public class SpongeEventUtil extends EventUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callMerge(final String world, final Plot plot, final ArrayList<PlotId> plots) {
|
||||
return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(world), plot, plots));
|
||||
public boolean callMerge(final Plot plot, final ArrayList<PlotId> plots) {
|
||||
return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(plot.getArea().worldname), plot, plots));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean callUnlink(final String world, final ArrayList<PlotId> plots) {
|
||||
return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(world), plots));
|
||||
public boolean callUnlink(final PlotArea area, final ArrayList<PlotId> plots) {
|
||||
return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(area.worldname), plots));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,8 @@ public class SpongeTitleManager extends AbstractTitle {
|
||||
|
||||
@Override
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, final int in, final int delay, final int out) {
|
||||
final Title title = new TitleBuilder().title(SpongeMain.THIS.getText(head)).subtitle(SpongeMain.THIS.getText(sub)).fadeIn(in * 20).stay(delay * 20).fadeOut(out * 20).build();
|
||||
final Title title = Title.builder().title(SpongeMain.THIS.getText(head)).subtitle(SpongeMain.THIS.getText(sub)).fadeIn(in * 20).stay
|
||||
(delay * 20).fadeOut(out * 20).build();
|
||||
((SpongePlayer) player).player.sendTitle(title);
|
||||
}
|
||||
}
|
||||
|
BIN
target/PlotSquared-Bukkit.jar
Normal file
BIN
target/PlotSquared-Bukkit.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user