This commit is contained in:
Jesse Boyd 2016-03-02 06:59:05 +11:00
commit 109715e0d7
22 changed files with 379 additions and 209 deletions

View File

@ -1,6 +1,6 @@
dependencies { dependencies {
compile project(':Core') compile project(':Core')
compile 'org.bukkit:bukkit:1.8.8-R0.1-SNAPSHOT' compile 'org.bukkit:bukkit:1.9-R0.1-SNAPSHOT'
compile 'net.milkbowl.vault:VaultAPI:1.5' compile 'net.milkbowl.vault:VaultAPI:1.5'
} }

View File

@ -223,14 +223,14 @@ public class LikePlotMeConverter {
PS.get().config.set("worlds." + world + ".road.width", pathwidth); PS.get().config.set("worlds." + world + ".road.width", pathwidth);
Integer pathheight = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); // Integer pathheight = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
if ((pathheight == null) || (pathheight == 0)) { if (pathheight == 0) {
pathheight = 64; pathheight = 64;
} }
PS.get().config.set("worlds." + world + ".road.height", pathheight); PS.get().config.set("worlds." + world + ".road.height", pathheight);
PS.get().config.set("worlds." + world + ".wall.height", pathheight); PS.get().config.set("worlds." + world + ".wall.height", pathheight);
PS.get().config.set("worlds." + world + ".plot.height", pathheight); PS.get().config.set("worlds." + world + ".plot.height", pathheight);
Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); // Integer plotsize = PLOTME_DG_YML.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
if ((plotsize == null) || (plotsize == 0)) { if (plotsize == 0) {
plotsize = 32; plotsize = 32;
} }
PS.get().config.set("worlds." + world + ".plot.size", plotsize); PS.get().config.set("worlds." + world + ".plot.size", plotsize);

View File

@ -157,7 +157,6 @@ public class ChunkListener implements Listener {
final int z = Z << 4; final int z = Z << 4;
final int x2 = x + 15; final int x2 = x + 15;
final int z2 = z + 15; final int z2 = z + 15;
Thread thread = new Thread();
Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs(); Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs();
if (plot != null && plot.hasOwner()) { if (plot != null && plot.hasOwner()) {
return false; return false;

View File

@ -158,9 +158,6 @@ public class BukkitUtil extends WorldUtil {
public int getBiomeFromString(final String biomeStr) { public int getBiomeFromString(final String biomeStr) {
try { try {
final Biome biome = Biome.valueOf(biomeStr.toUpperCase()); final Biome biome = Biome.valueOf(biomeStr.toUpperCase());
if (biome == null) {
return -1;
}
return Arrays.asList(Biome.values()).indexOf(biome); return Arrays.asList(Biome.values()).indexOf(biome);
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
return -1; return -1;

View File

@ -0,0 +1,35 @@
package com.plotsquared.bukkit.util.block;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue;
import com.plotsquared.bukkit.util.BukkitUtil;
import org.bukkit.Chunk;
public class FastChunk_1_9 extends PlotChunk<Chunk> {
public FastChunk_1_9(SetQueue.ChunkWrapper wrap) {
super(wrap);
}
@Override
public Chunk getChunkAbs() {
SetQueue.ChunkWrapper loc = getChunkWrapper();
return BukkitUtil.getWorld(loc.world).getChunkAt(loc.x, loc.z);
}
@Override public void setBlock(int x, int y, int z, int id, byte data) {
}
@Override public void setBiome(int x, int z, int biome) {
}
@Override public PlotChunk clone() {
return null;
}
@Override public PlotChunk shallowClone() {
return null;
}
}

View File

@ -49,11 +49,8 @@ public class FastQueue_1_8_3 extends SlowQueue {
private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition"); private final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection"); private final RefClass classChunkSection = getRefClass("{nms}.ChunkSection");
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>(); public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
private RefMethod methodGetHandlePlayer;
private RefMethod methodGetHandleChunk; private RefMethod methodGetHandleChunk;
private RefConstructor MapChunk; private RefConstructor MapChunk;
private RefField connection;
private RefMethod send;
private RefMethod methodInitLighting; private RefMethod methodInitLighting;
private RefConstructor classBlockPositionConstructor; private RefConstructor classBlockPositionConstructor;
private RefConstructor classChunkSectionConstructor; private RefConstructor classChunkSectionConstructor;
@ -64,12 +61,9 @@ public class FastQueue_1_8_3 extends SlowQueue {
private RefMethod methodGetIdArray; private RefMethod methodGetIdArray;
public FastQueue_1_8_3() throws NoSuchMethodException, RuntimeException { public FastQueue_1_8_3() throws NoSuchMethodException, RuntimeException {
methodGetHandlePlayer = classCraftPlayer.getMethod("getHandle");
methodGetHandleChunk = classCraftChunk.getMethod("getHandle"); methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
methodInitLighting = classChunk.getMethod("initLighting"); methodInitLighting = classChunk.getMethod("initLighting");
MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class); MapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
connection = classEntityPlayer.getField("playerConnection");
send = classConnection.getMethod("sendPacket", classPacket.getRealClass());
classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class); classBlockPositionConstructor = classBlockPosition.getConstructor(int.class, int.class, int.class);
methodX = classWorld.getMethod("x", classBlockPosition.getRealClass()); methodX = classWorld.getMethod("x", classBlockPosition.getRealClass());
fieldSections = classChunk.getField("sections"); fieldSections = classChunk.getField("sections");

View File

@ -0,0 +1,12 @@
package com.plotsquared.bukkit.util.block;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue;
import org.bukkit.Chunk;
public class FastQueue_1_9 extends SlowQueue {
@Override public PlotChunk<Chunk> getChunk(SetQueue.ChunkWrapper wrap) {
return new FastChunk_1_9(wrap);
}
}

View File

@ -1,5 +1,7 @@
dependencies { dependencies {
testCompile 'junit:junit:4.12'
compile 'org.yaml:snakeyaml:1.16' compile 'org.yaml:snakeyaml:1.16'
compile 'com.google.code.gson:gson:2.2.4'
} }
sourceCompatibility = 1.7 sourceCompatibility = 1.7

View File

@ -246,7 +246,7 @@ public class ConfigurationSerialization {
final SerializableAs alias = clazz.getAnnotation(SerializableAs.class); final SerializableAs alias = clazz.getAnnotation(SerializableAs.class);
if ((alias != null) && (alias.value() != null)) { if (alias != null) {
return alias.value(); return alias.value();
} }

View File

@ -8,7 +8,11 @@ import com.intellectualcrafters.plot.commands.WE_Anywhere;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.*; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.database.Database;
import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager;
import com.intellectualcrafters.plot.database.SQLite;
import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.AbstractFlag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.flag.FlagValue; import com.intellectualcrafters.plot.flag.FlagValue;
@ -16,22 +20,67 @@ import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils; import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator; import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotAnalysis;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotFilter;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.ChatManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.CommentManager;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.InventoryUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.ReflectionUtils;
import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SetQueue;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.area.QuadMap; import com.intellectualcrafters.plot.util.area.QuadMap;
import com.plotsquared.listener.WESubscriber; import com.plotsquared.listener.WESubscriber;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import java.io.*; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.file.Files; import java.nio.file.Files;
import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*; import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
@ -44,10 +93,10 @@ import java.util.zip.ZipInputStream;
* @author boy0001 | Empire92 * @author boy0001 | Empire92
*/ */
public class PS { public class PS {
// protected static: // protected static:
private static PS instance; private static PS instance;
private HashSet<Integer> plotareaHashCheck = new HashSet<Integer>(); private HashSet<Integer> plotareaHashCheck = new HashSet<>();
private boolean plotareaHasCollision = false; private boolean plotareaHasCollision = false;
/** /**
* All plot areas (quick global access) * All plot areas (quick global access)
@ -81,9 +130,8 @@ public class PS {
private String PLATFORM = null; private String PLATFORM = null;
private String LAST_VERSION; private String LAST_VERSION;
private Database database; private Database database;
private Connection connection;
private Thread thread; private Thread thread;
/** /**
* Initialize PlotSquared with the desired Implementation class * Initialize PlotSquared with the desired Implementation class
* @param imp_class * @param imp_class
@ -135,7 +183,7 @@ public class PS {
WorldEdit.getInstance().getEventBus().register(new WESubscriber()); WorldEdit.getInstance().getEventBus().register(new WESubscriber());
MainCommand.getInstance().createCommand(new WE_Anywhere()); MainCommand.getInstance().createCommand(new WE_Anywhere());
} }
// Events // Events
IMP.registerCommands(); IMP.registerCommands();
IMP.registerPlayerEvents(); IMP.registerPlayerEvents();
@ -162,7 +210,7 @@ public class PS {
@Override @Override
public void run() { public void run() {
for (final Plot plot : getPlots()) { for (final Plot plot : getPlots()) {
if ((plot.hasOwner()) && (plot.temp != -1)) { if (plot.hasOwner() && (plot.temp != -1)) {
if (UUIDHandler.getName(plot.owner) == null) { if (UUIDHandler.getName(plot.owner) == null) {
UUIDHandler.implementation.unknown.add(plot.owner); UUIDHandler.implementation.unknown.add(plot.owner);
} }
@ -180,7 +228,7 @@ public class PS {
// PlotMe // PlotMe
if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME) { if (Settings.CONVERT_PLOTME || Settings.CACHE_PLOTME) {
TaskManager.runTaskLater(new Runnable() { TaskManager.runTaskLater(new Runnable() {
@Override @Override
public void run() { public void run() {
if (IMP.initPlotMeConverter()) { if (IMP.initPlotMeConverter()) {
@ -217,12 +265,12 @@ public class PS {
AbstractTitle.TITLE_CLASS = IMP.initTitleManager(); AbstractTitle.TITLE_CLASS = IMP.initTitleManager();
// Chat // Chat
ChatManager.manager = IMP.initChatManager(); ChatManager.manager = IMP.initChatManager();
// Check for updates // Check for updates
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
final URL url = getUpdate(); final URL url = Updater.getUpdate();
if (url != null) { if (url != null) {
update = url; update = url;
} else if ((LAST_VERSION != null) && !StringMan.join(VERSION, ".").equals(LAST_VERSION)) { } else if ((LAST_VERSION != null) && !StringMan.join(VERSION, ".").equals(LAST_VERSION)) {
@ -230,7 +278,7 @@ public class PS {
} }
} }
}); });
// World generators: // World generators:
final ConfigurationSection section = config.getConfigurationSection("worlds"); final ConfigurationSection section = config.getConfigurationSection("worlds");
if (section != null) { if (section != null) {
@ -259,7 +307,7 @@ public class PS {
} }
}, 1); }, 1);
} }
// Copy files // Copy files
copyFile("automerge.js", "scripts"); copyFile("automerge.js", "scripts");
copyFile("town.template", "templates"); copyFile("town.template", "templates");
@ -273,7 +321,7 @@ public class PS {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* Get the instance of PlotSquared * Get the instance of PlotSquared
* *
@ -282,7 +330,7 @@ public class PS {
public static PS get() { public static PS get() {
return instance; return instance;
} }
/** /**
* Log a message to the IPlotMain logger * Log a message to the IPlotMain logger
* *
@ -292,7 +340,7 @@ public class PS {
public static void log(final Object message) { public static void log(final Object message) {
get().IMP.log(StringMan.getString(message)); get().IMP.log(StringMan.getString(message));
} }
public static void stacktrace() { public static void stacktrace() {
System.err.println(StringMan.join(new Exception().getStackTrace(), "\n\tat ")); System.err.println(StringMan.join(new Exception().getStackTrace(), "\n\tat "));
} }
@ -335,8 +383,9 @@ public class PS {
} }
/** /**
* Get the platform this is running on (Bukkit, Sponge) * <p>Get the server platform this plugin is running on this is running on.
* @return * This will be either <b>Bukkit</b> or <b>Sponge</b></p>
* @return The server platform
*/ */
public String getPlatform() { public String getPlatform() {
return PLATFORM; return PLATFORM;
@ -346,12 +395,12 @@ public class PS {
* Get the database object * Get the database object
* *
* @return Database object * @return Database object
* @see #getConnection() Get the database connection * @see Database#getConnection() To get the database connection
*/ */
public Database getDatabase() { public Database getDatabase() {
return database; return database;
} }
/** /**
* Update the global reference * Update the global reference
* to a plot object * to a plot object
@ -361,7 +410,7 @@ public class PS {
public boolean updatePlot(final Plot plot) { public boolean updatePlot(final Plot plot) {
return plot.getArea().addPlot(plot); return plot.getArea().addPlot(plot);
} }
/** /**
* Get the relevant plot area for a location.<br> * Get the relevant plot area for a location.<br>
* - If there is only one plot area globally that will be returned<br> * - If there is only one plot area globally that will be returned<br>
@ -426,7 +475,7 @@ public class PS {
} }
} }
} }
public PlotArea getPlotArea(String world, String id) { public PlotArea getPlotArea(String world, String id) {
PlotArea[] areas = plotareamap.get(world); PlotArea[] areas = plotareamap.get(world);
if (areas == null) { if (areas == null) {
@ -445,7 +494,7 @@ public class PS {
return null; return null;
} }
} }
public PlotArea getPlotAreaAbs(String world, String id) { public PlotArea getPlotAreaAbs(String world, String id) {
PlotArea[] areas = plotareamap.get(world); PlotArea[] areas = plotareamap.get(world);
if (areas == null) { if (areas == null) {
@ -485,7 +534,7 @@ public class PS {
return null; return null;
} }
} }
public Set<PlotArea> getPlotAreas(String world, RegionWrapper region) { public Set<PlotArea> getPlotAreas(String world, RegionWrapper region) {
QuadMap<PlotArea> areas = plotareagrid.get(world); QuadMap<PlotArea> areas = plotareagrid.get(world);
return areas != null ? areas.get(region) : new HashSet<PlotArea>(); return areas != null ? areas.get(region) : new HashSet<PlotArea>();
@ -494,7 +543,7 @@ public class PS {
/** /**
* Get the plot area which contains a location.<br> * Get the plot area which contains a location.<br>
* - If the plot area does not contain a location, null will be returned * - If the plot area does not contain a location, null will be returned
* *
* @param loc * @param loc
* @return * @return
*/ */
@ -558,7 +607,7 @@ public class PS {
public PlotManager getPlotManager(Plot plot) { public PlotManager getPlotManager(Plot plot) {
return plot.getArea().manager; return plot.getArea().manager;
} }
public PlotManager getPlotManager(Location loc) { public PlotManager getPlotManager(Location loc) {
PlotArea pa = getPlotAreaAbs(loc); PlotArea pa = getPlotAreaAbs(loc);
return pa != null ? pa.manager : null; return pa != null ? pa.manager : null;
@ -633,7 +682,7 @@ public class PS {
} }
map.add(plotarea); map.add(plotarea);
} }
/** /**
* Remove a plot world reference * Remove a plot world reference
* *
@ -653,7 +702,7 @@ public class PS {
} }
setPlotsTmp(area); setPlotsTmp(area);
} }
public void removePlotAreas(String world) { public void removePlotAreas(String world) {
for (PlotArea area : getPlotAreas(world)) { for (PlotArea area : getPlotAreas(world)) {
removePlotArea(area); removePlotArea(area);
@ -677,7 +726,7 @@ public class PS {
} }
clusters_tmp.put(area.toString(), area.getClusters()); clusters_tmp.put(area.toString(), area.getClusters());
} }
public Set<PlotCluster> getClusters(String world) { public Set<PlotCluster> getClusters(String world) {
HashSet<PlotCluster> set = new HashSet<>(); HashSet<PlotCluster> set = new HashSet<>();
if (Settings.ENABLE_CLUSTERS) { if (Settings.ENABLE_CLUSTERS) {
@ -813,7 +862,7 @@ public class PS {
result.addAll(overflow); result.addAll(overflow);
return result; return result;
} }
/** /**
* Sort plots by hashcode * Sort plots by hashcode
* @param plots * @param plots
@ -867,7 +916,7 @@ public class PS {
} }
return result; return result;
} }
/** /**
* Sort plots by creation timestamp * Sort plots by creation timestamp
* @param input * @param input
@ -1037,7 +1086,7 @@ public class PS {
return result; return result;
} }
} }
/** /**
* @deprecated Unchecked, use {@link #sortPlots(Collection, SortType, PlotArea)} instead which will in turn call this * @deprecated Unchecked, use {@link #sortPlots(Collection, SortType, PlotArea)} instead which will in turn call this
* @param input * @param input
@ -1130,7 +1179,7 @@ public class PS {
} }
return toReturn; return toReturn;
} }
/** /**
* Get all the plots owned by a player name * Get all the plots owned by a player name
* @param world * @param world
@ -1152,7 +1201,7 @@ public class PS {
final UUID uuid = UUIDHandler.getUUID(player, null); final UUID uuid = UUIDHandler.getUUID(player, null);
return getPlots(area, uuid); return getPlots(area, uuid);
} }
/** /**
* Get all plots by a PlotPlayer * Get all plots by a PlotPlayer
* @param world * @param world
@ -1163,7 +1212,7 @@ public class PS {
final UUID uuid = player.getUUID(); final UUID uuid = player.getUUID();
return getPlots(world, uuid); return getPlots(world, uuid);
} }
/** /**
* Get all plots by a PlotPlayer * Get all plots by a PlotPlayer
* @param area * @param area
@ -1174,7 +1223,7 @@ public class PS {
final UUID uuid = player.getUUID(); final UUID uuid = player.getUUID();
return getPlots(area, uuid); return getPlots(area, uuid);
} }
/** /**
* Get all plots by a UUID in a world * Get all plots by a UUID in a world
* @param world * @param world
@ -1192,7 +1241,7 @@ public class PS {
} }
return new HashSet<>(myplots); return new HashSet<>(myplots);
} }
/** /**
* Get all plots by a UUID in an area * Get all plots by a UUID in an area
* @param area * @param area
@ -1210,7 +1259,7 @@ public class PS {
} }
return new HashSet<>(myplots); return new HashSet<>(myplots);
} }
/** /**
* Use {@link #hasPlotArea(String)}<br> * Use {@link #hasPlotArea(String)}<br>
* Note: Worlds may have more than one plot area * Note: Worlds may have more than one plot area
@ -1254,7 +1303,7 @@ public class PS {
return plotareamap.containsKey(world); return plotareamap.containsKey(world);
} }
} }
public Collection<Plot> getPlots(final String world) { public Collection<Plot> getPlots(final String world) {
final HashSet<Plot> set = new HashSet<>(); final HashSet<Plot> set = new HashSet<>();
foreachPlotArea(world, new RunnableVal<PlotArea>() { foreachPlotArea(world, new RunnableVal<PlotArea>() {
@ -1265,15 +1314,15 @@ public class PS {
}); });
return set; return set;
} }
public Collection<Plot> getPlots(final PlotArea area) { public Collection<Plot> getPlots(final PlotArea area) {
return area == null ? new HashSet<Plot>() : area.getPlots(); return area == null ? new HashSet<Plot>() : area.getPlots();
} }
public Plot getPlot(PlotArea area, final PlotId id) { public Plot getPlot(PlotArea area, final PlotId id) {
return area == null ? null : (id == null ? null : area.getPlot(id)); return area == null ? null : (id == null ? null : area.getPlot(id));
} }
/** /**
* Get the plots for a PlotPlayer * Get the plots for a PlotPlayer
* @param player * @param player
@ -1282,7 +1331,7 @@ public class PS {
public Set<Plot> getPlots(final PlotPlayer player) { public Set<Plot> getPlots(final PlotPlayer player) {
return getPlots(player.getUUID()); return getPlots(player.getUUID());
} }
/** /**
* Get the plots for a UUID * Get the plots for a UUID
* @param uuid * @param uuid
@ -1300,7 +1349,7 @@ public class PS {
}); });
return new HashSet<>(myplots); return new HashSet<>(myplots);
} }
/** /**
* Get the plots for a UUID * Get the plots for a UUID
* @param uuid * @param uuid
@ -1318,7 +1367,7 @@ public class PS {
}); });
return new HashSet<>(myplots); return new HashSet<>(myplots);
} }
/** /**
* Unregister a plot from local memory (does not call DB) * Unregister a plot from local memory (does not call DB)
* @param plot * @param plot
@ -1343,7 +1392,7 @@ public class PS {
} }
return false; return false;
} }
/** /**
* This method is called by the PlotGenerator class normally<br> * This method is called by the PlotGenerator class normally<br>
* - Initializes the PlotArea and PlotManager classes<br> * - Initializes the PlotArea and PlotManager classes<br>
@ -1569,7 +1618,7 @@ public class PS {
} }
} }
} }
/** /**
* Setup the configuration for a plot world based on world arguments<br> * Setup the configuration for a plot world based on world arguments<br>
* e.g. /mv create <world> normal -g PlotSquared:<args> * e.g. /mv create <world> normal -g PlotSquared:<args>
@ -1654,86 +1703,42 @@ public class PS {
} }
return true; return true;
} }
public boolean canUpdate(final String current, final String other) { public boolean canUpdate(final String current, final String other) {
final String s1 = normalisedVersion(current); final String s1 = normalisedVersion(current);
final String s2 = normalisedVersion(other); final String s2 = normalisedVersion(other);
final int cmp = s1.compareTo(s2); final int cmp = s1.compareTo(s2);
return cmp < 0; return cmp < 0;
} }
public String normalisedVersion(final String version) { public String normalisedVersion(final String version) {
return normalisedVersion(version, ".", 4); final String[] split = Pattern.compile(".", Pattern.LITERAL).split(version);
}
public String normalisedVersion(final String version, final String sep, final int maxWidth) {
final String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version);
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
for (final String s : split) { for (final String s : split) {
sb.append(String.format("%" + maxWidth + 's', s)); sb.append(String.format("%" + 4 + 's', s));
} }
return sb.toString(); return sb.toString();
} }
/**
* Gets the default update URL, or null if the plugin is up to date
* @return
*/
public URL getUpdate() {
final String pom = "https://raw.githubusercontent.com/IntellectualSites/PlotSquared/master/pom.xml";
try {
final URL page = new URL(pom);
final URLConnection con = page.openConnection();
final String agent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1";
con.addRequestProperty("User-Agent", agent);
String line;
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
while ((line = in.readLine()) != null) {
line = line.trim();
if (line.startsWith("<version>")) {
line = line.replaceAll("[^\\d.]", "");
break;
}
}
}
if (!canUpdate(config.getString("version"), line)) {
PS.debug("&7PlotSquared is already up to date!");
return null;
}
String dl = "https://raw.githubusercontent.com/IntellectualSites/PlotSquared/master/target/PlotSquared-${PLATFORM}.jar";
dl = dl.replaceAll(Pattern.quote("${PLATFORM}"), getPlatform());
log("&6PlotSquared v" + line + " is available:");
log("&8 - &3Use: &7/plot update");
log("&8 - &3Or: &7" + dl);
return new URL(dl);
} catch (IOException e) {
e.printStackTrace();
log("&dCould not check for updates (0)");
log("&7 - Manually check for updates: " + pom);
}
return null;
}
public boolean update(final PlotPlayer sender, final URL url) { public boolean update(final PlotPlayer sender, final URL url) {
if (url == null) {
return false;
}
try { try {
final String name = FILE.getName(); final String name = FILE.getName();
final File newJar = new File("plugins/update/" + name); final File newJar = new File("plugins/update/" + name);
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url); MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
MainUtil.sendMessage(sender, "$2 - User-Agent: " + "Mozilla/4.0");
final URLConnection con = url.openConnection(); final URLConnection con = url.openConnection();
con.addRequestProperty("User-Agent", "Mozilla/4.0"); try (InputStream stream = con.getInputStream()) {
final InputStream stream = con.getInputStream(); final File parent = newJar.getParentFile();
final File parent = newJar.getParentFile(); if (!parent.exists()) {
if (!parent.exists()) { parent.mkdirs();
parent.mkdirs(); }
MainUtil.sendMessage(sender, "$2 - Output: " + newJar);
if (!newJar.delete()) {
MainUtil.sendMessage(sender, "Failed to update PlotSquared");
MainUtil.sendMessage(sender, "Jar file failed to delete.");
MainUtil.sendMessage(sender, " - Please update manually");
}
Files.copy(stream, newJar.toPath());
} }
MainUtil.sendMessage(sender, "$2 - Output: " + newJar);
newJar.delete();
Files.copy(stream, newJar.toPath());
stream.close();
MainUtil.sendMessage(sender, "$1The update will take effect when the server is restarted next"); MainUtil.sendMessage(sender, "$1The update will take effect when the server is restarted next");
return true; return true;
} catch (IOException e) { } catch (IOException e) {
@ -1745,15 +1750,7 @@ public class PS {
} }
return false; return false;
} }
/**
* Get the database connection
* @return The database connection
*/
public Connection getConnection() {
return connection;
}
/** /**
* Copy a file from inside the jar to a location * Copy a file from inside the jar to a location
* @param file Name of the file inside PlotSquared.jar * @param file Name of the file inside PlotSquared.jar
@ -1806,7 +1803,7 @@ public class PS {
log("&cCould not save " + file); log("&cCould not save " + file);
} }
} }
private Map<String, Map<PlotId, Plot>> getPlotsRaw() { private Map<String, Map<PlotId, Plot>> getPlotsRaw() {
HashMap<String, Map<PlotId, Plot>> map = new HashMap<>(); HashMap<String, Map<PlotId, Plot>> map = new HashMap<>();
for (PlotArea area : plotareas) { for (PlotArea area : plotareas) {
@ -1888,7 +1885,7 @@ public class PS {
IMP.disable(); IMP.disable();
} }
} }
/** /**
* Setup the default flags for PlotSquared<br> * Setup the default flags for PlotSquared<br>
* - Create the flags * - Create the flags
@ -2019,7 +2016,7 @@ public class PS {
}); });
FlagManager.addFlag(new AbstractFlag("description", new FlagValue.StringValue()), true); FlagManager.addFlag(new AbstractFlag("description", new FlagValue.StringValue()), true);
} }
/** /**
* Setup the default configuration (settings.yml) * Setup the default configuration (settings.yml)
*/ */
@ -2279,7 +2276,7 @@ public class PS {
Settings.MERGE_REMOVES_ROADS = config.getBoolean("merge.remove-terrain"); Settings.MERGE_REMOVES_ROADS = config.getBoolean("merge.remove-terrain");
Settings.AUTO_PURGE = config.getBoolean("auto-purge", false); Settings.AUTO_PURGE = config.getBoolean("auto-purge", false);
} }
/** /**
* Setup all configuration files<br> * Setup all configuration files<br>
* - Config: settings.yml<br> * - Config: settings.yml<br>
@ -2340,7 +2337,7 @@ public class PS {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* Setup the storage file (load + save missing nodes) * Setup the storage file (load + save missing nodes)
*/ */
@ -2371,11 +2368,11 @@ public class PS {
Settings.DB.SQLITE_DB = storage.getString("sqlite.db"); Settings.DB.SQLITE_DB = storage.getString("sqlite.db");
Settings.DB.PREFIX = storage.getString("prefix"); Settings.DB.PREFIX = storage.getString("prefix");
} }
/** /**
* Show startup debug information * Show startup debug information
*/ */
public void showDebug() { private void showDebug() {
if (Settings.DEBUG) { if (Settings.DEBUG) {
final Map<String, String> settings = new HashMap<>(); final Map<String, String> settings = new HashMap<>();
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS); settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
@ -2392,7 +2389,7 @@ public class PS {
} }
} }
} }
/** /**
* Setup the style.yml file * Setup the style.yml file
*/ */
@ -2409,7 +2406,7 @@ public class PS {
} }
} }
} }
/** /**
* Get the java version * Get the java version
* @return Java version as a double * @return Java version as a double
@ -2417,13 +2414,13 @@ public class PS {
public double getJavaVersion() { public double getJavaVersion() {
return Double.parseDouble(System.getProperty("java.specification.version")); return Double.parseDouble(System.getProperty("java.specification.version"));
} }
public void foreachPlotArea(RunnableVal<PlotArea> runnable) { public void foreachPlotArea(RunnableVal<PlotArea> runnable) {
for (PlotArea area : plotareas) { for (PlotArea area : plotareas) {
runnable.run(area); runnable.run(area);
} }
} }
public void foreachPlot(final RunnableVal<Plot> runnable) { public void foreachPlot(final RunnableVal<Plot> runnable) {
for (PlotArea area : plotareas) { for (PlotArea area : plotareas) {
for (Plot plot : area.getPlots()) { for (Plot plot : area.getPlots()) {
@ -2431,7 +2428,7 @@ public class PS {
} }
} }
} }
public void foreachPlotRaw(final RunnableVal<Plot> runnable) { public void foreachPlotRaw(final RunnableVal<Plot> runnable) {
for (PlotArea area : plotareas) { for (PlotArea area : plotareas) {
for (Plot plot : area.getPlots()) { for (Plot plot : area.getPlots()) {
@ -2488,7 +2485,7 @@ public class PS {
Collections.addAll(set, plotareas); Collections.addAll(set, plotareas);
return set; return set;
} }
/** /**
* @deprecated Since worlds can have multiple plot areas * @deprecated Since worlds can have multiple plot areas
* @return Set of world names * @return Set of world names
@ -2501,7 +2498,7 @@ public class PS {
} }
return set; return set;
} }
public boolean isAugmented(String world) { public boolean isAugmented(String world) {
PlotArea[] areas = plotareamap.get(world); PlotArea[] areas = plotareamap.get(world);
if (areas == null) { if (areas == null) {

View File

@ -0,0 +1,85 @@
package com.intellectualcrafters.plot;
import static com.intellectualcrafters.plot.PS.log;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
public class Updater {
private static String readUrl(String urlString) {
BufferedReader reader = null;
try {
URL url = new URL(urlString);
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder buffer = new StringBuilder();
int read;
char[] chars = new char[1024];
while ((read = reader.read(chars)) != -1) {
buffer.append(chars, 0, read);
}
return buffer.toString();
} catch (IOException e) {
log("&dCould not check for updates (0)");
e.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null;
}
public static URL getUpdate() {
String str = readUrl("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest");
Gson gson = new Gson();
URL url = null;
Release release = gson.fromJson(str, Release.class);
String downloadURL = String.format("PlotSquared-%s%n.jar", PS.get().getPlatform());
List<Release.Asset> assets = release.assets;
for (Release.Asset asset : assets) {
if (asset.name.equals(downloadURL)) {
try {
url = new URL(asset.downloadUrl);
break;
} catch (MalformedURLException e) {
e.printStackTrace();
log("&dCould not check for updates (0)");
log("&7 - Manually check for updates: https://github.com/IntellectualSites/PlotSquared/releases");
}
}
}
if (!PS.get().canUpdate(PS.get().config.getString("version"), release.name)) {
PS.debug("&7PlotSquared is already up to date!");
return null;
}
log("&6PlotSquared " + release.tagName + " is available:");
log("&8 - &3Use: &7/plot update");
log("&8 - &3Or: &7" + downloadURL);
return url;
}
private static class Release {
public String name;
@SerializedName("tag_name") String tagName;
List<Asset> assets;
static class Asset {
public String name;
@SerializedName("browser_download_url") String downloadUrl;
}
}
}

View File

@ -92,7 +92,6 @@ public class Claim extends SubCommand {
return sendMessage(plr, C.NOT_IN_PLOT); return sendMessage(plr, C.NOT_IN_PLOT);
} }
final int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(loc.getWorld()); final int currentPlots = Settings.GLOBAL_LIMIT ? plr.getPlotCount() : plr.getPlotCount(loc.getWorld());
boolean removeGrantedPlot = false;
int grants = 0; int grants = 0;
if (currentPlots >= plr.getAllowedPlots()) { if (currentPlots >= plr.getAllowedPlots()) {
if (plr.hasPersistentMeta("grantedPlots")) { if (plr.hasPersistentMeta("grantedPlots")) {

View File

@ -65,10 +65,6 @@ public class Condense extends SubCommand {
MainUtil.sendMessage(plr, "TASK ALREADY STARTED"); MainUtil.sendMessage(plr, "TASK ALREADY STARTED");
return false; return false;
} }
if (args.length == 2) {
MainUtil.sendMessage(plr, "/plot condense " + area.toString() + " start <radius>");
return false;
}
if (!MathMan.isInteger(args[2])) { if (!MathMan.isInteger(args[2])) {
MainUtil.sendMessage(plr, "INVALID RADIUS"); MainUtil.sendMessage(plr, "INVALID RADIUS");
return false; return false;

View File

@ -12,6 +12,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
@CommandDeclaration( @CommandDeclaration(
command = "debugpaste", command = "debugpaste",
@ -41,7 +42,7 @@ public class DebugPaste extends SubCommand {
b.append("links.settings_yml: '").append(settingsYML).append("'\n"); b.append("links.settings_yml: '").append(settingsYML).append("'\n");
b.append("links.latest_log: '").append(latestLOG).append("'\n"); b.append("links.latest_log: '").append(latestLOG).append("'\n");
b.append("\n# YAAAS! Now let us move on to the server info\n"); b.append("\n# YAAAS! Now let us move on to the server info\n");
b.append("version.server: '").append(PS.get().IMP.getServerVersion()).append("'\n"); b.append("version.server: '").append(Arrays.toString(PS.get().IMP.getServerVersion())).append("'\n");
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper() + ";" + !Settings.OFFLINE_MODE).append("\n"); b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper() + ";" + !Settings.OFFLINE_MODE).append("\n");
b.append("plugins:"); b.append("plugins:");
for (String id : PS.get().IMP.getPluginIds()) { for (String id : PS.get().IMP.getPluginIds()) {

View File

@ -20,15 +20,15 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.net.MalformedURLException;
import java.net.URL;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.net.MalformedURLException;
import java.net.URL;
@CommandDeclaration( @CommandDeclaration(
command = "update", command = "update",
permission = "plots.admin.command.update", permission = "plots.admin.command.update",

View File

@ -464,20 +464,14 @@ public class SQLManager implements AbstractDB {
final Plot plot = plotMap.get(plotId); final Plot plot = plotMap.get(plotId);
if (plot != null) { if (plot != null) {
settings.add(new SettingsPair(id, plot.getSettings())); settings.add(new SettingsPair(id, plot.getSettings()));
if (plot.getDenied() != null) { for (final UUID uuid : plot.getDenied()) {
for (final UUID uuid : plot.getDenied()) { denied.add(new UUIDPair(id, uuid));
denied.add(new UUIDPair(id, uuid));
}
} }
if (plot.getMembers() != null) { for (final UUID uuid : plot.getMembers()) {
for (final UUID uuid : plot.getMembers()) { trusted.add(new UUIDPair(id, uuid));
trusted.add(new UUIDPair(id, uuid));
}
} }
if (plot.getTrusted() != null) { for (final UUID uuid : plot.getTrusted()) {
for (final UUID uuid : plot.getTrusted()) { helpers.add(new UUIDPair(id, uuid));
helpers.add(new UUIDPair(id, uuid));
}
} }
} }
} }

View File

@ -203,9 +203,6 @@ public class Location implements Cloneable, Comparable<Location> {
@Override @Override
public int compareTo(final Location o) { public int compareTo(final Location o) {
if (o == null) {
throw new NullPointerException("Specified object was null");
}
if (x == o.getX() && y == o.getY() || z == o.getZ()) { if (x == o.getX() && y == o.getY() || z == o.getZ()) {
return 0; return 0;
} }

View File

@ -357,7 +357,7 @@ public class Plot {
*/ */
public HashSet<UUID> getOwners() { public HashSet<UUID> getOwners() {
if (owner == null) { if (owner == null) {
return new HashSet<UUID>(); return new HashSet<>();
} }
if (isMerged()) { if (isMerged()) {
HashSet<Plot> plots = getConnectedPlots(); HashSet<Plot> plots = getConnectedPlots();
@ -910,16 +910,15 @@ public class Plot {
}); });
return; return;
} }
final String rename = name == null ? "unknown" : name;
final PlotManager manager = this.area.getPlotManager(); final PlotManager manager = this.area.getPlotManager();
if (this.area.ALLOW_SIGNS) { if (this.area.ALLOW_SIGNS) {
final Location loc = manager.getSignLoc(this.area, this); final Location loc = manager.getSignLoc(this.area, this);
final String id = this.id.x + ";" + this.id.y; final String id = this.id.x + ";" + this.id.y;
final String[] lines = new String[] { final String[] lines = new String[] {
C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename), C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename), C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name),
C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", rename) }; C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name) };
WorldUtil.IMP.setSign(this.area.worldname, loc.getX(), loc.getY(), loc.getZ(), lines); WorldUtil.IMP.setSign(this.area.worldname, loc.getX(), loc.getY(), loc.getZ(), lines);
} }
} }
@ -1245,7 +1244,7 @@ public class Plot {
*/ */
public void setSign() { public void setSign() {
if (this.owner == null) { if (this.owner == null) {
this.setSign(null); this.setSign("unknown");
return; return;
} }
this.setSign(UUIDHandler.getName(this.owner)); this.setSign(UUIDHandler.getName(this.owner));

View File

@ -0,0 +1,64 @@
package com.intellectualcrafters.plot;
import static com.intellectualcrafters.plot.PS.log;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.List;
public class UpdaterTest {
@org.junit.Test
public void getUpdate() throws Exception {
String str = null;
BufferedReader reader = null;
try {
URL url = new URL("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest");
reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder buffer = new StringBuilder();
int read;
char[] chars = new char[1024];
while ((read = reader.read(chars)) != -1) {
buffer.append(chars, 0, read);
}
str = buffer.toString();
} catch (IOException e) {
log("&dCould not check for updates (0)");
e.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
if (str == null) {
return;
}
Gson gson = new Gson();
Release release = gson.fromJson(str, Release.class);
System.out.println(release.name);
for (Release.Assets asset : release.assets) {
System.out.println(asset.name);
System.out.println(asset.downloadUrl);
}
}
private static class Release {
String name;
List<Assets> assets;
private static class Assets {
String name;
@SerializedName("browser_download_url") String downloadUrl;
}
}
}

View File

@ -214,9 +214,7 @@ public class MainListener {
if (cap == 0) { if (cap == 0) {
return false; return false;
} }
if (mobs == null) { mobs = plot.countEntities();
mobs = plot.countEntities();
}
if (mobs[3] >= cap) { if (mobs[3] >= cap) {
return false; return false;
} }
@ -260,9 +258,7 @@ public class MainListener {
if (cap == 0) { if (cap == 0) {
return false; return false;
} }
if (mobs == null) { mobs = plot.countEntities();
mobs = plot.countEntities();
}
if (mobs[4] >= cap) { if (mobs[4] >= cap) {
return false; return false;
} }

View File

@ -9,7 +9,12 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.schematic.PlotItem; import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.ReflectionUtils;
import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.object.SpongePlayer; import com.plotsquared.sponge.object.SpongePlayer;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -29,7 +34,6 @@ import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.serializer.TextSerializers; import org.spongepowered.api.text.serializer.TextSerializers;
import org.spongepowered.api.text.translation.Translatable;
import org.spongepowered.api.text.translation.Translation; import org.spongepowered.api.text.translation.Translation;
import org.spongepowered.api.world.World; import org.spongepowered.api.world.World;
import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.biome.BiomeType;
@ -38,7 +42,11 @@ import org.spongepowered.api.world.extent.Extent;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
public class SpongeUtil extends WorldUtil { public class SpongeUtil extends WorldUtil {
@ -103,28 +111,23 @@ public class SpongeUtil extends WorldUtil {
} }
public static Translation getTranslation(final String m) { public static Translation getTranslation(final String m) {
return new Translatable() { return new Translation() {
@Override @Override
public Translation getTranslation() { public String getId() {
return new Translation() { return m;
@Override
public String getId() {
return m;
}
@Override
public String get(final Locale l, final Object... args) {
return m;
}
@Override
public String get(final Locale l) {
return m;
}
};
} }
}.getTranslation();
@Override
public String get(final Locale l, final Object... args) {
return m;
}
@Override
public String get(final Locale l) {
return m;
}
};
} }
private static HashMap<BlockState, PlotBlock> stateMap; private static HashMap<BlockState, PlotBlock> stateMap;

View File

@ -77,7 +77,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version> <version>1.9-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sk89q</groupId> <groupId>com.sk89q</groupId>