mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +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);
|
final Object object = get(index);
|
||||||
try {
|
try {
|
||||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
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.");
|
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ public class JSONArray {
|
|||||||
final Object object = get(index);
|
final Object object = get(index);
|
||||||
try {
|
try {
|
||||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
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.");
|
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ public class JSONArray {
|
|||||||
final Object object = get(index);
|
final Object object = get(index);
|
||||||
try {
|
try {
|
||||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
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.");
|
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) {
|
public boolean optBoolean(final int index, final boolean defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getBoolean(index);
|
return getBoolean(index);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ public class JSONArray {
|
|||||||
public double optDouble(final int index, final double defaultValue) {
|
public double optDouble(final int index, final double defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getDouble(index);
|
return getDouble(index);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ public class JSONArray {
|
|||||||
public int optInt(final int index, final int defaultValue) {
|
public int optInt(final int index, final int defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getInt(index);
|
return getInt(index);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -480,7 +480,7 @@ public class JSONArray {
|
|||||||
public long optLong(final int index, final long defaultValue) {
|
public long optLong(final int index, final long defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getLong(index);
|
return getLong(index);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ public class JSONArray {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
try {
|
try {
|
||||||
return this.toString(0);
|
return this.toString(0);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -87,7 +88,8 @@ public class JSONObject {
|
|||||||
for (final String name : names) {
|
for (final String name : names) {
|
||||||
try {
|
try {
|
||||||
putOnce(name, jo.opt(name));
|
putOnce(name, jo.opt(name));
|
||||||
} catch (final Exception ignore) {}
|
} catch (JSONException ignore) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +194,8 @@ public class JSONObject {
|
|||||||
for (final String name : names) {
|
for (final String name : names) {
|
||||||
try {
|
try {
|
||||||
putOpt(name, c.getField(name).get(object));
|
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;
|
return string;
|
||||||
}
|
}
|
||||||
@ -514,7 +518,7 @@ public class JSONObject {
|
|||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new JSONException(e);
|
throw new JSONException(e);
|
||||||
}
|
}
|
||||||
if (object instanceof String) {
|
if (object != null) {
|
||||||
return (String) object;
|
return (String) object;
|
||||||
}
|
}
|
||||||
throw new JSONException("Bad value from toJSONString: " + object);
|
throw new JSONException("Bad value from toJSONString: " + object);
|
||||||
@ -553,18 +557,18 @@ public class JSONObject {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((object instanceof JSONObject)
|
if ((object instanceof JSONObject)
|
||||||
|| (object instanceof JSONArray)
|
|| (object instanceof JSONArray)
|
||||||
|| NULL.equals(object)
|
|| NULL.equals(object)
|
||||||
|| (object instanceof JSONString)
|
|| (object instanceof JSONString)
|
||||||
|| (object instanceof Byte)
|
|| (object instanceof Byte)
|
||||||
|| (object instanceof Character)
|
|| (object instanceof Character)
|
||||||
|| (object instanceof Short)
|
|| (object instanceof Short)
|
||||||
|| (object instanceof Integer)
|
|| (object instanceof Integer)
|
||||||
|| (object instanceof Long)
|
|| (object instanceof Long)
|
||||||
|| (object instanceof Boolean)
|
|| (object instanceof Boolean)
|
||||||
|| (object instanceof Float)
|
|| (object instanceof Float)
|
||||||
|| (object instanceof Double)
|
|| (object instanceof Double)
|
||||||
|| (object instanceof String)) {
|
|| (object instanceof String)) {
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
if (object instanceof Collection) {
|
if (object instanceof Collection) {
|
||||||
@ -582,7 +586,7 @@ public class JSONObject {
|
|||||||
return object.toString();
|
return object.toString();
|
||||||
}
|
}
|
||||||
return new JSONObject(object);
|
return new JSONObject(object);
|
||||||
} catch (final Exception exception) {
|
} catch (JSONException exception) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -730,7 +734,7 @@ public class JSONObject {
|
|||||||
final Object object = get(key);
|
final Object object = get(key);
|
||||||
try {
|
try {
|
||||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
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.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -748,7 +752,7 @@ public class JSONObject {
|
|||||||
final Object object = get(key);
|
final Object object = get(key);
|
||||||
try {
|
try {
|
||||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
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.");
|
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -800,7 +804,7 @@ public class JSONObject {
|
|||||||
final Object object = get(key);
|
final Object object = get(key);
|
||||||
try {
|
try {
|
||||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
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.");
|
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) {
|
public boolean optBoolean(final String key, final boolean defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getBoolean(key);
|
return getBoolean(key);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -978,7 +982,7 @@ public class JSONObject {
|
|||||||
public double optDouble(final String key, final double defaultValue) {
|
public double optDouble(final String key, final double defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getDouble(key);
|
return getDouble(key);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1007,7 +1011,7 @@ public class JSONObject {
|
|||||||
public int optInt(final String key, final int defaultValue) {
|
public int optInt(final String key, final int defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getInt(key);
|
return getInt(key);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1062,7 +1066,7 @@ public class JSONObject {
|
|||||||
public long optLong(final String key, final long defaultValue) {
|
public long optLong(final String key, final long defaultValue) {
|
||||||
try {
|
try {
|
||||||
return getLong(key);
|
return getLong(key);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return defaultValue;
|
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() {
|
public String toString() {
|
||||||
try {
|
try {
|
||||||
return this.toString(0);
|
return this.toString(0);
|
||||||
} catch (final Exception e) {
|
} catch (JSONException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1471,7 +1476,7 @@ public class JSONObject {
|
|||||||
protected final Object clone() {
|
protected final Object clone() {
|
||||||
try {
|
try {
|
||||||
return super.clone();
|
return super.clone();
|
||||||
} catch (final Exception e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,9 +235,7 @@ public class XML {
|
|||||||
if ("null".equalsIgnoreCase(string)) {
|
if ("null".equalsIgnoreCase(string)) {
|
||||||
return JSONObject.NULL;
|
return JSONObject.NULL;
|
||||||
}
|
}
|
||||||
// If it might be a number, try converting it, first as a Long, and then
|
//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.
|
||||||
// as a
|
|
||||||
// Double. If that doesn't work, return the string.
|
|
||||||
try {
|
try {
|
||||||
final char initial = string.charAt(0);
|
final char initial = string.charAt(0);
|
||||||
if ((initial == '-') || ((initial >= '0') && (initial <= '9'))) {
|
if ((initial == '-') || ((initial >= '0') && (initial <= '9'))) {
|
||||||
@ -246,13 +244,14 @@ public class XML {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception ignore) {
|
} catch (NumberFormatException ignore) {
|
||||||
try {
|
try {
|
||||||
final Double value = new Double(string);
|
final Double value = new Double(string);
|
||||||
if (value.toString().equals(string)) {
|
if (value.toString().equals(string)) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
} catch (final Exception ignoreAlso) {}
|
} catch (NumberFormatException ignoreAlso) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ public class Area extends SubCommand {
|
|||||||
}
|
}
|
||||||
RegionWrapper region = area.getRegion();
|
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);
|
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);
|
plr.teleport(center);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class Auto extends SubCommand {
|
|||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
schematic = args[1];
|
schematic = args[1];
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (NumberFormatException e) {
|
||||||
size_x = 1;
|
size_x = 1;
|
||||||
size_z = 1;
|
size_z = 1;
|
||||||
schematic = args[0];
|
schematic = args[0];
|
||||||
|
@ -20,6 +20,14 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.database;
|
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.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -29,14 +37,6 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
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);
|
void setAlias(final Plot plot, final String alias);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purgle a plot
|
* Purge a plot
|
||||||
*
|
*
|
||||||
* @param uniqueIds list of plot id (db) to be purged
|
* @param uniqueIds list of plot id (db) to be purged
|
||||||
*/
|
*/
|
||||||
|
@ -20,25 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.object;
|
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.google.common.collect.BiMap;
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
@ -60,6 +41,25 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||||
import com.plotsquared.listener.PlotListener;
|
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
|
* The plot class
|
||||||
*/
|
*/
|
||||||
@ -1089,7 +1089,7 @@ public class Plot {
|
|||||||
final Location bot = this.getBottomAbs();
|
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);
|
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) {
|
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;
|
return loc;
|
||||||
}
|
}
|
||||||
@ -1134,7 +1134,7 @@ public class Plot {
|
|||||||
x = bot.getX() + this.area.DEFAULT_HOME.x;
|
x = bot.getX() + this.area.DEFAULT_HOME.x;
|
||||||
z = bot.getZ() + this.area.DEFAULT_HOME.z;
|
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);
|
return new Location(plot.area.worldname, x, y + 1, z);
|
||||||
}
|
}
|
||||||
// Side
|
// Side
|
||||||
@ -1142,7 +1142,7 @@ public class Plot {
|
|||||||
final int x = ((largest.maxX - largest.minX) / 2) + largest.minX;
|
final int x = ((largest.maxX - largest.minX) / 2) + largest.minX;
|
||||||
final int z = largest.minZ - 1;
|
final int z = largest.minZ - 1;
|
||||||
final PlotManager manager = plot.getManager();
|
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);
|
return new Location(plot.area.worldname, x, y + 1, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1933,7 +1933,7 @@ public class Plot {
|
|||||||
* 3 = west<br>
|
* 3 = west<br>
|
||||||
* @param max The max number of merges to do
|
* @param max The max number of merges to do
|
||||||
* @param uuid The UUID it is allowed to merge with
|
* @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
|
* @return true if a merge takes place
|
||||||
*/
|
*/
|
||||||
public boolean autoMerge(final int dir, int max, final UUID uuid, final boolean removeRoads) {
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<Location> getAllCorners() {
|
public List<Location> getAllCorners() {
|
||||||
|
@ -453,7 +453,7 @@ public class MainUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static int getHeighestBlock(final String world, final int x, final int z) {
|
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) {
|
if (result == 0) {
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public abstract class WorldUtil {
|
|||||||
|
|
||||||
public abstract PlotBlock getBlock(Location location);
|
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);
|
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 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.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
@ -18,25 +36,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
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>.
|
* 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>.
|
* 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"));
|
final Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json, Reflection.getNMSClass("IChatBaseComponent"));
|
||||||
|
|
||||||
return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent);
|
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):
|
* Serialization of this message by using this message will include (in this order for each message part):
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>The color of each message part.</li>
|
* <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>
|
* <li>The core text of the message part.</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
* The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort.
|
* 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.
|
* This is called by the Bukkit serialization API.
|
||||||
* It is not intended for direct public API consumption.
|
* It is not intended for direct public API consumption.
|
||||||
* @param serialized The key-value mapping which represents a fancy message.
|
* @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();
|
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.
|
* that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
|
||||||
* @param json The JSON string which represents a fancy message.
|
* @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) {
|
public static FancyMessage deserialize(final String json) {
|
||||||
final JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
|
final JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
|
||||||
|
@ -58,7 +58,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
try {
|
try {
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
} catch (Exception e) {
|
} catch (SQLException e) {
|
||||||
PS.debug("========= Table does not exist =========");
|
PS.debug("========= Table does not exist =========");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("=======================================");
|
PS.debug("=======================================");
|
||||||
@ -114,9 +114,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
final byte[] bytes = r.getBytes("ownerid");
|
final byte[] bytes = r.getBytes("ownerid");
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
owner = UUID.nameUUIDFromBytes(bytes);
|
owner = UUID.nameUUIDFromBytes(bytes);
|
||||||
if (owner != null) {
|
UUIDHandler.add(new StringWrapper(name), owner);
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -148,7 +146,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
PS.log(" - " + plugin + "core_denied");
|
PS.log(" - " + plugin + "core_denied");
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_denied`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_denied`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
|
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
final int key = r.getInt("plot_id");
|
final int key = r.getInt("plot_id");
|
||||||
final Plot plot = plots.get(key);
|
final Plot plot = plots.get(key);
|
||||||
@ -159,11 +157,11 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
final UUID denied = UUID.fromString(r.getString("player"));
|
final UUID denied = UUID.fromString(r.getString("player"));
|
||||||
plot.getDenied().add(denied);
|
plot.getDenied().add(denied);
|
||||||
}
|
}
|
||||||
|
|
||||||
PS.log(" - " + plugin + "core_allowed");
|
PS.log(" - " + plugin + "core_allowed");
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_allowed`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_allowed`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
|
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
final int key = r.getInt("plot_id");
|
final int key = r.getInt("plot_id");
|
||||||
final Plot plot = plots.get(key);
|
final Plot plot = plots.get(key);
|
||||||
@ -176,8 +174,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
|||||||
}
|
}
|
||||||
r.close();
|
r.close();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
|
|
||||||
} catch (final Exception e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
final HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
final HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
import java.util.Random;
|
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BukkitAugmentedGenerator extends BlockPopulator {
|
public class BukkitAugmentedGenerator extends BlockPopulator {
|
||||||
|
|
||||||
private static BukkitAugmentedGenerator generator;
|
private static BukkitAugmentedGenerator generator;
|
||||||
|
|
||||||
private BukkitAugmentedGenerator() {};
|
private BukkitAugmentedGenerator() {}
|
||||||
|
|
||||||
public static BukkitAugmentedGenerator get(World world) {
|
public static BukkitAugmentedGenerator get(World world) {
|
||||||
for (BlockPopulator poplator : world.getPopulators()) {
|
for (BlockPopulator populator : world.getPopulators()) {
|
||||||
if (poplator instanceof BukkitAugmentedGenerator) {
|
if (populator instanceof BukkitAugmentedGenerator) {
|
||||||
return (BukkitAugmentedGenerator) poplator;
|
return (BukkitAugmentedGenerator) populator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (generator == null) {
|
if (generator == null) {
|
||||||
|
@ -664,11 +664,11 @@ public class BukkitChunkManager extends ChunkManager {
|
|||||||
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
|
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
|
||||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||||
PlotPlayer pp = entry.getValue();
|
PlotPlayer pp = entry.getValue();
|
||||||
Location ploc = pp.getLocation();
|
Location pLoc = pp.getLocation();
|
||||||
if (!ploc.getChunkLoc().equals(loc)) {
|
if (!pLoc.getChunkLoc().equals(loc)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PlotBlock plotblock = WorldUtil.IMP.getBlock(ploc);
|
PlotBlock plotblock = WorldUtil.IMP.getBlock(pLoc);
|
||||||
if (plotblock.id != 0) {
|
if (plotblock.id != 0) {
|
||||||
Plot plot = pp.getCurrentPlot();
|
Plot plot = pp.getCurrentPlot();
|
||||||
pp.teleport(plot.getDefaultHome());
|
pp.teleport(plot.getDefaultHome());
|
||||||
|
@ -163,7 +163,7 @@ public class BukkitUtil extends WorldUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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();
|
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 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.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
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.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.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 {
|
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
|
* @param pc
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* @param wrap
|
||||||
*/
|
*/
|
||||||
@Override
|
@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 world
|
||||||
* @param locs
|
* @param locs
|
||||||
*/
|
*/
|
||||||
|
@ -2,17 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
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.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
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.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.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 {
|
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
|
* @param wrap
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* @param fixAll
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* @param locs
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,23 +2,6 @@ package com.plotsquared.bukkit.util.block;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
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.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||||
@ -34,6 +17,22 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
|||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
import com.plotsquared.bukkit.util.SendChunk;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.World.Environment;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.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 {
|
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
|
* @param pc
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* @param wrap
|
||||||
*/
|
*/
|
||||||
@Override
|
@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
|
* @param pc
|
||||||
*/
|
*/
|
||||||
@Override
|
@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 world
|
||||||
* @param locs
|
* @param locs
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.plotsquared.sponge.events;
|
package com.plotsquared.sponge.events;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import org.spongepowered.api.event.Cancellable;
|
import org.spongepowered.api.event.Cancellable;
|
||||||
import org.spongepowered.api.event.cause.Cause;
|
import org.spongepowered.api.event.cause.Cause;
|
||||||
import org.spongepowered.api.event.impl.AbstractEvent;
|
import org.spongepowered.api.event.impl.AbstractEvent;
|
||||||
@ -7,28 +8,27 @@ import org.spongepowered.api.event.impl.AbstractEvent;
|
|||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
|
||||||
public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
||||||
private final PlotId id;
|
|
||||||
private final String world;
|
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
private Plot plot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotDeleteEvent: Called when a plot is cleared
|
* PlotDeleteEvent: Called when a plot is cleared
|
||||||
*
|
*
|
||||||
* @param world The world in which the plot was cleared
|
* @param plot The plot that was cleared
|
||||||
* @param id The plot that was cleared
|
|
||||||
*/
|
*/
|
||||||
public PlotClearEvent(final String world, final PlotId id) {
|
|
||||||
this.id = id;
|
public PlotClearEvent(Plot plot) {
|
||||||
this.world = world;
|
this.plot = plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PlotId
|
* Get the PlotId
|
||||||
*
|
*
|
||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
return id;
|
return plot.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,7 @@ public class PlotClearEvent extends AbstractEvent implements Cancellable {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
return world;
|
return plot.getArea().worldname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
package com.plotsquared.sponge.events;
|
package com.plotsquared.sponge.events;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import org.spongepowered.api.event.cause.Cause;
|
import org.spongepowered.api.event.cause.Cause;
|
||||||
import org.spongepowered.api.event.impl.AbstractEvent;
|
import org.spongepowered.api.event.impl.AbstractEvent;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
|
||||||
public class PlotDeleteEvent extends AbstractEvent {
|
public class PlotDeleteEvent extends AbstractEvent {
|
||||||
private final PlotId id;
|
private final Plot plot;
|
||||||
private final String world;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotDeleteEvent: Called when a plot is deleted
|
* PlotDeleteEvent: Called when a plot is deleted
|
||||||
*
|
*
|
||||||
* @param world The world in which the plot was deleted
|
* @param plot The plot that was deleted
|
||||||
* @param id The ID of the plot that was deleted
|
|
||||||
*/
|
*/
|
||||||
public PlotDeleteEvent(final String world, final PlotId id) {
|
public PlotDeleteEvent(Plot plot) {
|
||||||
this.id = id;
|
this.plot = plot;
|
||||||
this.world = world;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +24,7 @@ public class PlotDeleteEvent extends AbstractEvent {
|
|||||||
* @return PlotId
|
* @return PlotId
|
||||||
*/
|
*/
|
||||||
public PlotId getPlotId() {
|
public PlotId getPlotId() {
|
||||||
return id;
|
return plot.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +33,7 @@ public class PlotDeleteEvent extends AbstractEvent {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
return world;
|
return plot.getArea().worldname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -332,7 +332,7 @@ public class MainListener {
|
|||||||
Location loc = SpongeUtil.getLocation(worldname, first.getOriginal().getPosition());
|
Location loc = SpongeUtil.getLocation(worldname, first.getOriginal().getPosition());
|
||||||
Plot plot = loc.getPlot();
|
Plot plot = loc.getPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (loc.getPlotAbs() == null /*MainUtil.isPlotAreaAbs(loc)*/) {
|
if (loc.getPlotAbs() == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -392,7 +392,7 @@ public class MainListener {
|
|||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Text message = event.getMessage().get();
|
final Text message = event.getMessage().orElse(Text.EMPTY);
|
||||||
|
|
||||||
// TODO use display name rather than username
|
// TODO use display name rather than username
|
||||||
// - Getting displayname currently causes NPE, so wait until sponge fixes that
|
// - Getting displayname currently causes NPE, so wait until sponge fixes that
|
||||||
@ -400,7 +400,7 @@ public class MainListener {
|
|||||||
final String sender = player.getName();
|
final String sender = player.getName();
|
||||||
final PlotId id = plot.getId();
|
final PlotId id = plot.getId();
|
||||||
final String newMessage = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
|
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);
|
// 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()) {
|
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||||
PlotPlayer user = entry.getValue();
|
PlotPlayer user = entry.getValue();
|
||||||
@ -450,7 +450,7 @@ public class MainListener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (originPlot == null && current.getPlotAbs() == null /*May not work*/) {
|
if (originPlot == null && current.getPlotAbs() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!FlagManager.isPlotFlagTrue(currentPlot, "explosion")) {
|
if (!FlagManager.isPlotFlagTrue(currentPlot, "explosion")) {
|
||||||
@ -492,12 +492,6 @@ public class MainListener {
|
|||||||
public void onBlockBreak(final ChangeBlockEvent.Decay event) {
|
public void onBlockBreak(final ChangeBlockEvent.Decay event) {
|
||||||
onBlockChange(event);
|
onBlockChange(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Listener
|
|
||||||
// public void onBlockBreak(final ChangeBlockEvent.Fluid event) {
|
|
||||||
// onBlockChange(event);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Listener
|
@Listener
|
||||||
public void onBlockBreak(final ChangeBlockEvent.Grow event) {
|
public void onBlockBreak(final ChangeBlockEvent.Grow event) {
|
||||||
onBlockChange(event);
|
onBlockChange(event);
|
||||||
@ -824,7 +818,7 @@ public class MainListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Integer border = plotworld.getBorder(); //worldBorder.get(worldname); **May not work**
|
final Integer border = plotworld.getBorder();
|
||||||
if (border != null) {
|
if (border != null) {
|
||||||
if (x2 > border) {
|
if (x2 > border) {
|
||||||
final Vector3d pos = to.getPosition();
|
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 PlotManager plotManager = PS.get().getPlotManager(PS.get().getPlot(plotworld, plotworld.getMin()));
|
||||||
final PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
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 (id == null) {
|
||||||
if (lastPlot == null) {
|
if (lastPlot == null) {
|
||||||
return;
|
return;
|
||||||
@ -886,7 +880,7 @@ public class MainListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Integer border = plotworld.getBorder(); //worldBorder.get(worldname); **May not work**
|
final Integer border = plotworld.getBorder();
|
||||||
if (border != null) {
|
if (border != null) {
|
||||||
if (z2 > border) {
|
if (z2 > border) {
|
||||||
final Vector3d pos = to.getPosition();
|
final Vector3d pos = to.getPosition();
|
||||||
|
@ -4,6 +4,7 @@ import java.time.Instant;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.spongepowered.api.Sponge;
|
||||||
import org.spongepowered.api.data.key.Keys;
|
import org.spongepowered.api.data.key.Keys;
|
||||||
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
|
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
|
||||||
import org.spongepowered.api.data.value.mutable.Value;
|
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.Player;
|
||||||
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
|
||||||
import org.spongepowered.api.entity.living.player.gamemode.GameModes;
|
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.service.ban.BanService;
|
||||||
import org.spongepowered.api.text.Text;
|
import org.spongepowered.api.text.Text;
|
||||||
import org.spongepowered.api.text.chat.ChatTypes;
|
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.PlotGamemode;
|
||||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.sponge.SpongeMain;
|
|
||||||
import com.plotsquared.sponge.util.SpongeUtil;
|
import com.plotsquared.sponge.util.SpongeUtil;
|
||||||
|
|
||||||
public class SpongePlayer extends PlotPlayer {
|
public class SpongePlayer extends PlotPlayer {
|
||||||
@ -95,8 +94,7 @@ public class SpongePlayer extends PlotPlayer {
|
|||||||
hasPerm.add(perm);
|
hasPerm.add(perm);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final boolean value = player.hasPermission(perm);
|
return player.hasPermission(perm);
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -279,12 +277,12 @@ public class SpongePlayer extends PlotPlayer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void kick(final String message) {
|
public void kick(final String message) {
|
||||||
player.kick(SpongeUtil.text(message));
|
player.kick(Text.of(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBanned() {
|
public boolean isBanned() {
|
||||||
BanService service = SpongeMain.THIS.getGame().getServiceManager().provide(BanService.class).get();
|
BanService service = Sponge.getServiceManager().provide(BanService.class).get();
|
||||||
return service.isBanned((GameProfile) player);
|
return service.isBanned(player.getProfile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
package com.plotsquared.sponge.util;
|
package com.plotsquared.sponge.util;
|
||||||
|
|
||||||
import org.spongepowered.api.text.action.TextActions;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
import com.intellectualcrafters.plot.util.ChatManager;
|
||||||
import com.plotsquared.sponge.object.SpongePlayer;
|
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
|
@Override
|
||||||
public TextBuilder builder() {
|
public Text.Builder builder() {
|
||||||
return Texts.builder();
|
return Text.builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void color(final PlotMessage m, final String color) {
|
public void color(final PlotMessage m, final String color) {
|
||||||
m.$(this).color(Texts.of(color).getColor());
|
m.$(this).color(Text.of(color).getColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tooltip(final PlotMessage m, final PlotMessage... tooltips) {
|
public void tooltip(final PlotMessage m, final PlotMessage... tooltips) {
|
||||||
final TextBuilder builder = Texts.builder();
|
final Text.Builder builder = Text.builder();
|
||||||
boolean lb = false;
|
boolean lb = false;
|
||||||
for (final PlotMessage tooltip : tooltips) {
|
for (final PlotMessage tooltip : tooltips) {
|
||||||
if (lb) {
|
if (lb) {
|
||||||
builder.append(Texts.of("\n"));
|
builder.append(Text.of("\n"));
|
||||||
}
|
}
|
||||||
builder.append(tooltip.$(this).build());
|
builder.append(tooltip.$(this).build());
|
||||||
lb = true;
|
lb = true;
|
||||||
@ -42,13 +42,13 @@ public class SpongeChatManager extends ChatManager<TextBuilder> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void text(final PlotMessage m, final String text) {
|
public void text(final PlotMessage m, final String text) {
|
||||||
m.$(this).append(Texts.of(text));
|
m.$(this).append(Text.of(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(final PlotMessage m, final PlotPlayer player) {
|
public void send(final PlotMessage m, final PlotPlayer player) {
|
||||||
if (ConsolePlayer.isConsole(player)) {
|
if (ConsolePlayer.isConsole(player)) {
|
||||||
player.sendMessage(Texts.legacy().to(m.$(this).build()));
|
player.sendMessage(m.$(this).build().toPlain());
|
||||||
} else {
|
} else {
|
||||||
((SpongePlayer) player).player.sendMessage(m.$(this).build());
|
((SpongePlayer) player).player.sendMessage(m.$(this).build());
|
||||||
}
|
}
|
||||||
|
@ -50,17 +50,17 @@ public class SpongeCommand implements CommandCallable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<? extends Text> getShortDescription(final CommandSource cmd) {
|
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
|
@Override
|
||||||
public Optional<? extends Text> getHelp(final CommandSource cmd) {
|
public Optional<? extends Text> getHelp(final CommandSource cmd) {
|
||||||
return Optional.of(Texts.of("/plot help"));
|
return Optional.of(Text.of("/plot help"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Text getUsage(final CommandSource cmd) {
|
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 java.util.Optional;
|
||||||
|
|
||||||
import org.apache.commons.lang.NotImplementedException;
|
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.cause.Cause;
|
||||||
import org.spongepowered.api.event.service.ChangeServiceProviderEvent;
|
|
||||||
import org.spongepowered.api.service.economy.EconomyService;
|
import org.spongepowered.api.service.economy.EconomyService;
|
||||||
import org.spongepowered.api.service.economy.account.UniqueAccount;
|
import org.spongepowered.api.service.economy.account.UniqueAccount;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
@ -17,22 +17,22 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.plotsquared.sponge.object.SpongePlayer;
|
import com.plotsquared.sponge.object.SpongePlayer;
|
||||||
|
|
||||||
public class SpongeEconHandler extends EconHandler {
|
public class SpongeEconHandler extends EconHandler {
|
||||||
|
|
||||||
private EconomyService econ;
|
private EconomyService econ;
|
||||||
|
|
||||||
@Listener
|
public SpongeEconHandler() {
|
||||||
public void onChangeServiceProvider(ChangeServiceProviderEvent event) {
|
if (Sponge.getServiceManager().isRegistered(EconomyService.class)) {
|
||||||
if (event.getService().equals(EconomyService.class)) {
|
econ = Sponge.getServiceManager().provide(EconomyService.class).get();
|
||||||
this.econ = (EconomyService) event.getNewProviderRegistration().getProvider();
|
} else {
|
||||||
|
PS.log("No economy service was registered.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void withdrawMoney(PlotPlayer player, double amount) {
|
public void withdrawMoney(PlotPlayer player, double amount) {
|
||||||
if (econ != null) {
|
if (econ != null) {
|
||||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||||
if (uOpt.isPresent()) {
|
if (accOpt.isPresent()) {
|
||||||
UniqueAccount acc = uOpt.get();
|
UniqueAccount acc = accOpt.get();
|
||||||
acc.withdraw(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
acc.withdraw(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,9 +41,9 @@ public class SpongeEconHandler extends EconHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void depositMoney(PlotPlayer player, double amount) {
|
public void depositMoney(PlotPlayer player, double amount) {
|
||||||
if (econ != null) {
|
if (econ != null) {
|
||||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||||
if (uOpt.isPresent()) {
|
if (accOpt.isPresent()) {
|
||||||
UniqueAccount acc = uOpt.get();
|
UniqueAccount acc = accOpt.get();
|
||||||
acc.deposit(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
acc.deposit(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,9 +52,9 @@ public class SpongeEconHandler extends EconHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void depositMoney(OfflinePlotPlayer player, double amount) {
|
public void depositMoney(OfflinePlotPlayer player, double amount) {
|
||||||
if (econ != null) {
|
if (econ != null) {
|
||||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||||
if (uOpt.isPresent()) {
|
if (accOpt.isPresent()) {
|
||||||
UniqueAccount acc = uOpt.get();
|
UniqueAccount acc = accOpt.get();
|
||||||
acc.deposit(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
acc.deposit(econ.getDefaultCurrency(), new BigDecimal(amount), Cause.of("PlotSquared"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,9 +79,9 @@ public class SpongeEconHandler extends EconHandler {
|
|||||||
@Override
|
@Override
|
||||||
public double getBalance(PlotPlayer player) {
|
public double getBalance(PlotPlayer player) {
|
||||||
if (econ != null) {
|
if (econ != null) {
|
||||||
Optional<UniqueAccount> uOpt = econ.getAccount(player.getUUID());
|
Optional<UniqueAccount> accOpt = econ.getAccount(player.getUUID());
|
||||||
if (uOpt.isPresent()) {
|
if (accOpt.isPresent()) {
|
||||||
UniqueAccount acc = uOpt.get();
|
UniqueAccount acc = accOpt.get();
|
||||||
BigDecimal balance = acc.getBalance(econ.getDefaultCurrency());
|
BigDecimal balance = acc.getBalance(econ.getDefaultCurrency());
|
||||||
return balance.doubleValue();
|
return balance.doubleValue();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
package com.plotsquared.sponge.util;
|
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.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
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.PlotMergeEvent;
|
||||||
import com.plotsquared.sponge.events.PlotRateEvent;
|
import com.plotsquared.sponge.events.PlotRateEvent;
|
||||||
import com.plotsquared.sponge.events.PlotUnlinkEvent;
|
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 {
|
public class SpongeEventUtil extends EventUtil {
|
||||||
|
|
||||||
@ -54,13 +54,13 @@ public class SpongeEventUtil extends EventUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callClear(final String world, final PlotId id) {
|
public boolean callClear(final Plot plot) {
|
||||||
return callEvent(new PlotClearEvent(world, id));
|
return callEvent(new PlotClearEvent(plot));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callDelete(final String world, final PlotId id) {
|
public void callDelete(Plot plot) {
|
||||||
callEvent(new PlotDeleteEvent(world, id));
|
callEvent(new PlotDeleteEvent(plot));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -74,13 +74,13 @@ public class SpongeEventUtil extends EventUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callMerge(final String world, final Plot plot, final ArrayList<PlotId> plots) {
|
public boolean callMerge(final Plot plot, final ArrayList<PlotId> plots) {
|
||||||
return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(world), plot, plots));
|
return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(plot.getArea().worldname), plot, plots));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean callUnlink(final String world, final ArrayList<PlotId> plots) {
|
public boolean callUnlink(final PlotArea area, final ArrayList<PlotId> plots) {
|
||||||
return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(world), plots));
|
return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(area.worldname), plots));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,8 @@ public class SpongeTitleManager extends AbstractTitle {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, final int in, final int delay, final int out) {
|
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);
|
((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