mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Beginning rewrite of Flags and various cleanups
This commit is contained in:
parent
3fb64d9811
commit
65ddb12701
@ -163,9 +163,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getPluginVersion() {
|
||||
final String[] split = getDescription().getVersion().split("\\.");
|
||||
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) };
|
||||
public String getPluginVersion() {
|
||||
return getDescription().getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,10 +32,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
@Override
|
||||
public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) {
|
||||
this.plugin = plugin.toLowerCase();
|
||||
prefix = plotConfig.getString("mySQLprefix");
|
||||
if (prefix == null) {
|
||||
prefix = plugin.toLowerCase();
|
||||
}
|
||||
prefix = plotConfig.getString("mySQLprefix", plugin.toLowerCase());
|
||||
try {
|
||||
if (plotConfig.getBoolean("usemySQL")) {
|
||||
final String user = plotConfig.getString("mySQLuname");
|
||||
|
@ -1,8 +1,5 @@
|
||||
package com.intellectualcrafters.plot;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
||||
@ -20,6 +17,9 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public interface IPlotMain {
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ public interface IPlotMain {
|
||||
* Get the version of the PlotSquared being used
|
||||
* @return
|
||||
*/
|
||||
int[] getPluginVersion();
|
||||
String getPluginVersion();
|
||||
|
||||
/**
|
||||
* Get the version of Minecraft that is running
|
||||
|
@ -126,7 +126,7 @@ public class PS {
|
||||
// private:
|
||||
private File storageFile;
|
||||
private File FILE = null; // This file
|
||||
private int[] VERSION = null;
|
||||
private String VERSION = null;
|
||||
private String PLATFORM = null;
|
||||
private String LAST_VERSION;
|
||||
private Database database;
|
||||
@ -278,8 +278,8 @@ public class PS {
|
||||
final URL url = Updater.getUpdate();
|
||||
if (url != null) {
|
||||
update = url;
|
||||
} else if ((LAST_VERSION != null) && !StringMan.join(VERSION, ".").equals(LAST_VERSION)) {
|
||||
log("&aThanks for updating from: " + LAST_VERSION + " to " + StringMan.join(VERSION, "."));
|
||||
} else if ((LAST_VERSION != null) && !VERSION.equals(LAST_VERSION)) {
|
||||
log("&aThanks for updating from: " + LAST_VERSION + " to " + VERSION);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -383,7 +383,7 @@ public class PS {
|
||||
* Get the current PlotSquared version
|
||||
* @return current version in config or null
|
||||
*/
|
||||
public int[] getVersion() {
|
||||
public String getVersion() {
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
@ -2037,7 +2037,7 @@ public class PS {
|
||||
*/
|
||||
public void setupConfig() {
|
||||
LAST_VERSION = config.getString("version");
|
||||
config.set("version", StringMan.join(VERSION, "."));
|
||||
config.set("version", VERSION);
|
||||
config.set("platform", PLATFORM);
|
||||
|
||||
final Map<String, Object> options = new HashMap<>();
|
||||
@ -2362,7 +2362,7 @@ public class PS {
|
||||
* Setup the storage file (load + save missing nodes)
|
||||
*/
|
||||
private void setupStorage() {
|
||||
storage.set("version", StringMan.join(VERSION, "."));
|
||||
storage.set("version", VERSION);
|
||||
final Map<String, Object> options = new HashMap<>(9);
|
||||
options.put("mysql.use", false);
|
||||
options.put("sqlite.use", true);
|
||||
@ -2414,7 +2414,7 @@ public class PS {
|
||||
* Setup the style.yml file
|
||||
*/
|
||||
private void setupStyle() {
|
||||
style.set("version", StringMan.join(VERSION, "."));
|
||||
style.set("version", VERSION);
|
||||
final Map<String, Object> o = new HashMap<>();
|
||||
o.put("color.1", "6");
|
||||
o.put("color.2", "7");
|
||||
|
@ -23,18 +23,18 @@ package com.intellectualcrafters.plot.commands;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(command = "plugin", permission = "plots.use", description = "Show plugin information", aliases = { "version" }, category = CommandCategory.INFO)
|
||||
@CommandDeclaration(command = "plugin", permission = "plots.use", description = "Show plugin information", aliases = "version",
|
||||
category = CommandCategory.INFO)
|
||||
public class plugin extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
||||
MainUtil.sendMessage(plr, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().IMP.getPluginVersion(), ".")));
|
||||
MainUtil.sendMessage(plr, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", PS.get().IMP.getPluginVersion()));
|
||||
MainUtil.sendMessage(plr, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92");
|
||||
MainUtil.sendMessage(plr, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki");
|
||||
MainUtil.sendMessage(plr, "$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update));
|
||||
MainUtil.sendMessage(plr, "$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? PS.get().IMP.getPluginVersion() : PS.get().update));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -180,11 +180,11 @@ public class SQLManager implements AbstractDB {
|
||||
public synchronized Queue<Runnable> getGlobalTasks() {
|
||||
return globalTasks;
|
||||
}
|
||||
|
||||
|
||||
public synchronized Queue<Runnable> getNotifyTasks() {
|
||||
return notifyTasks;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void addPlotTask(Plot plot, UniqueStatement task) {
|
||||
if (plot == null) {
|
||||
plot = new Plot(null, new PlotId(Integer.MAX_VALUE, Integer.MAX_VALUE));
|
||||
@ -274,17 +274,17 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
tasks.add(task);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void addGlobalTask(final Runnable task) {
|
||||
getGlobalTasks().add(task);
|
||||
}
|
||||
|
||||
|
||||
public synchronized void addNotifyTask(final Runnable task) {
|
||||
if (task != null) {
|
||||
getNotifyTasks().add(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean sendBatch() {
|
||||
try {
|
||||
if (!getGlobalTasks().isEmpty()) {
|
||||
@ -426,11 +426,11 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public Connection getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set Plot owner
|
||||
*
|
||||
@ -454,7 +454,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void createPlotsAndData(final ArrayList<Plot> myList, final Runnable whenDone) {
|
||||
addGlobalTask(new Runnable() {
|
||||
@ -549,7 +549,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a plot
|
||||
*
|
||||
@ -592,7 +592,7 @@ public class SQLManager implements AbstractDB {
|
||||
};
|
||||
setBulk(myList, mod, whenDone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a plot
|
||||
*
|
||||
@ -655,7 +655,7 @@ public class SQLManager implements AbstractDB {
|
||||
};
|
||||
setBulk(myList, mod, whenDone);
|
||||
}
|
||||
|
||||
|
||||
public <T> void setBulk(final ArrayList<T> objList, final StmtMod<T> mod, final Runnable whenDone) {
|
||||
final int size = objList.size();
|
||||
if (size == 0) {
|
||||
@ -774,7 +774,7 @@ public class SQLManager implements AbstractDB {
|
||||
whenDone.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void createSettings(final ArrayList<SettingsPair> myList, final Runnable whenDone) {
|
||||
final StmtMod<SettingsPair> mod = new StmtMod<SettingsPair>() {
|
||||
@Override
|
||||
@ -885,7 +885,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void createEmptySettings(final ArrayList<Integer> myList, final Runnable whenDone) {
|
||||
final StmtMod<Integer> mod = new StmtMod<Integer>() {
|
||||
@Override
|
||||
@ -939,7 +939,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a plot
|
||||
*
|
||||
@ -963,7 +963,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void commit() {
|
||||
try {
|
||||
if (CLOSED) {
|
||||
@ -977,7 +977,7 @@ public class SQLManager implements AbstractDB {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void createPlotAndSettings(final Plot plot, final Runnable whenDone) {
|
||||
addPlotTask(plot, new UniqueStatement("createPlotAndSettings_" + plot.hashCode()) {
|
||||
@ -1022,7 +1022,7 @@ public class SQLManager implements AbstractDB {
|
||||
});
|
||||
addNotifyTask(whenDone);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create tables
|
||||
*
|
||||
@ -1243,7 +1243,7 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.clearBatch();
|
||||
stmt.close();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteSettings(final Plot plot) {
|
||||
addPlotTask(plot, new UniqueStatement("delete_plot_settings") {
|
||||
@ -1258,7 +1258,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteHelpers(final Plot plot) {
|
||||
if (plot.getTrusted().isEmpty()) {
|
||||
@ -1276,7 +1276,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteTrusted(final Plot plot) {
|
||||
if (plot.getMembers().isEmpty()) {
|
||||
@ -1294,7 +1294,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteDenied(final Plot plot) {
|
||||
if (plot.getDenied().isEmpty()) {
|
||||
@ -1312,7 +1312,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteComments(final Plot plot) {
|
||||
addPlotTask(plot, new UniqueStatement("delete_plot_comments") {
|
||||
@ -1328,7 +1328,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteRatings(final Plot plot) {
|
||||
if (Settings.CACHE_RATINGS && plot.getSettings().getRatings().isEmpty()) {
|
||||
@ -1393,7 +1393,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getClusterId(final PlotCluster cluster) {
|
||||
if (cluster.temp > 0) {
|
||||
@ -1553,7 +1553,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void deleteRows(final ArrayList<Integer> rowIds, final String table, final String column) {
|
||||
setBulk(rowIds, new StmtMod<Integer>() {
|
||||
|
||||
@ -1891,7 +1891,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void swapPlots(final Plot p1, final Plot p2) {
|
||||
final int id1 = getId(p1);
|
||||
@ -1925,7 +1925,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void movePlot(final Plot original, final Plot newPlot) {
|
||||
addPlotTask(original, new UniqueStatement("movePlot") {
|
||||
@ -1944,7 +1944,7 @@ public class SQLManager implements AbstractDB {
|
||||
});
|
||||
addPlotTask(newPlot, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setFlags(final Plot plot, final Collection<Flag> flags) {
|
||||
final String flag_string = FlagManager.toString(flags);
|
||||
@ -1961,7 +1961,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setAlias(final Plot plot, final String alias) {
|
||||
addPlotTask(plot, new UniqueStatement("setAlias") {
|
||||
@ -1977,7 +1977,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Purge all plots with the following database IDs
|
||||
*/
|
||||
@ -2025,7 +2025,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void purge(final PlotArea area, final Set<PlotId> plots) {
|
||||
addGlobalTask(new Runnable() {
|
||||
@ -2058,7 +2058,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPosition(final Plot plot, final String position) {
|
||||
addPlotTask(plot, new UniqueStatement("setPosition") {
|
||||
@ -2074,7 +2074,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeComment(final Plot plot, final PlotComment comment) {
|
||||
addPlotTask(plot, new UniqueStatement("removeComment") {
|
||||
@ -2102,7 +2102,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clearInbox(final Plot plot, final String inbox) {
|
||||
addPlotTask(plot, new UniqueStatement("clearInbox") {
|
||||
@ -2126,7 +2126,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getComments(final Plot plot, final String inbox, final RunnableVal<List<PlotComment>> whenDone) {
|
||||
addPlotTask(plot, new UniqueStatement("getComments_" + plot) {
|
||||
@ -2177,7 +2177,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setComment(final Plot plot, final PlotComment comment) {
|
||||
addPlotTask(plot, new UniqueStatement("setComment") {
|
||||
@ -2197,7 +2197,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeTrusted(final Plot plot, final UUID uuid) {
|
||||
addPlotTask(plot, new UniqueStatement("removeTrusted") {
|
||||
@ -2213,7 +2213,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeMember(final Plot plot, final UUID uuid) {
|
||||
addPlotTask(plot, new UniqueStatement("removeMember") {
|
||||
@ -2229,7 +2229,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setTrusted(final Plot plot, final UUID uuid) {
|
||||
addPlotTask(plot, new UniqueStatement("setTrusted") {
|
||||
@ -2245,7 +2245,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setMember(final Plot plot, final UUID uuid) {
|
||||
addPlotTask(plot, new UniqueStatement("setMember") {
|
||||
@ -2261,7 +2261,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeDenied(final Plot plot, final UUID uuid) {
|
||||
addPlotTask(plot, new UniqueStatement("removeDenied") {
|
||||
@ -2277,7 +2277,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDenied(final Plot plot, final UUID uuid) {
|
||||
addPlotTask(plot, new UniqueStatement("setDenied") {
|
||||
@ -2293,7 +2293,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<UUID, Integer> getRatings(final Plot plot) {
|
||||
final HashMap<UUID, Integer> map = new HashMap<>();
|
||||
@ -2313,7 +2313,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRating(final Plot plot, final UUID rater, final int value) {
|
||||
addPlotTask(plot, new UniqueStatement("setRating") {
|
||||
@ -2330,7 +2330,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(final PlotCluster cluster) {
|
||||
final int id = getClusterId(cluster);
|
||||
@ -2666,7 +2666,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setClusterName(final PlotCluster cluster, final String name) {
|
||||
addClusterTask(cluster, new UniqueStatement("setClusterName") {
|
||||
@ -2683,7 +2683,7 @@ public class SQLManager implements AbstractDB {
|
||||
});
|
||||
cluster.settings.setAlias(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeHelper(final PlotCluster cluster, final UUID uuid) {
|
||||
addClusterTask(cluster, new UniqueStatement("removeHelper") {
|
||||
@ -2699,7 +2699,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHelper(final PlotCluster cluster, final UUID uuid) {
|
||||
addClusterTask(cluster, new UniqueStatement("setHelper") {
|
||||
@ -2715,7 +2715,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void createCluster(final PlotCluster cluster) {
|
||||
addClusterTask(cluster, new UniqueStatement("createCluster_" + cluster.hashCode()) {
|
||||
@ -2761,7 +2761,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void resizeCluster(final PlotCluster current, PlotId min, PlotId max) {
|
||||
final PlotId pos1 = new PlotId(current.getP1().x, current.getP1().y);
|
||||
@ -2785,7 +2785,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPosition(final PlotCluster cluster, final String position) {
|
||||
addClusterTask(cluster, new UniqueStatement("setPosition") {
|
||||
@ -2801,7 +2801,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeInvited(final PlotCluster cluster, final UUID uuid) {
|
||||
addClusterTask(cluster, new UniqueStatement("removeInvited") {
|
||||
@ -2817,7 +2817,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setInvited(final PlotCluster cluster, final UUID uuid) {
|
||||
addClusterTask(cluster, new UniqueStatement("setInvited") {
|
||||
@ -2833,14 +2833,14 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean deleteTables() {
|
||||
try {
|
||||
try (Statement stmt = connection.createStatement();
|
||||
PreparedStatement statement = connection.prepareStatement("DROP TABLE `" + prefix + "plot`")) {
|
||||
close();
|
||||
CLOSED = false;
|
||||
SQLManager.this.connection = database.forceConnection();
|
||||
final Statement stmt = connection.createStatement();
|
||||
stmt.addBatch("DROP TABLE `" + prefix + "cluster_invited`");
|
||||
stmt.addBatch("DROP TABLE `" + prefix + "cluster_helpers`");
|
||||
stmt.addBatch("DROP TABLE `" + prefix + "cluster`");
|
||||
@ -2852,9 +2852,6 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.addBatch("DROP TABLE `" + prefix + "plot_denied`");
|
||||
stmt.executeBatch();
|
||||
stmt.clearBatch();
|
||||
stmt.close();
|
||||
|
||||
final PreparedStatement statement = connection.prepareStatement("DROP TABLE `" + prefix + "plot`");
|
||||
statement.executeUpdate();
|
||||
statement.close();
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
@ -2862,7 +2859,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validateAllPlots(final Set<Plot> toValidate) {
|
||||
try {
|
||||
@ -2990,7 +2987,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
commit();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void replaceWorld(final String oldWorld, final String newWorld, final PlotId min, final PlotId max) {
|
||||
addGlobalTask(new Runnable() {
|
||||
@ -3001,7 +2998,6 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.setString(1, newWorld);
|
||||
stmt.setString(2, oldWorld);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -3009,14 +3005,12 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.setString(1, newWorld);
|
||||
stmt.setString(2, oldWorld);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try (PreparedStatement stmt = connection.prepareStatement("UPDATE `"
|
||||
+ prefix
|
||||
+ "plot` SET `world` = ? WHERE `world` = ? AND `plot_id_x` BETWEEN ? AND ? AND `plot_id_z` BETWEEN ? AND ?")) {
|
||||
+ prefix + "plot` SET `world` = ? WHERE `world` = ? AND `plot_id_x` BETWEEN ? AND ? AND `plot_id_z` BETWEEN ? AND ?")) {
|
||||
stmt.setString(1, newWorld);
|
||||
stmt.setString(2, oldWorld);
|
||||
stmt.setInt(3, min.x);
|
||||
@ -3024,7 +3018,6 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.setInt(5, min.y);
|
||||
stmt.setInt(6, max.y);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -3038,7 +3031,6 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.setInt(5, min.x);
|
||||
stmt.setInt(6, min.y);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -3071,14 +3063,13 @@ public class SQLManager implements AbstractDB {
|
||||
stmt.executeUpdate(
|
||||
"UPDATE `" + prefix + "plot_trusted` SET `user_uuid` = '" + now.toString() + "' WHERE `user_uuid` = '" + old.toString()
|
||||
+ "'");
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
|
@ -97,9 +97,6 @@ public class AbstractFlag {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other == this) {
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.intellectualcrafters.plot.flag;
|
||||
|
||||
public class BooleanFlag extends Flag<Boolean> {
|
||||
|
||||
public BooleanFlag(String name) {
|
||||
super(name);
|
||||
}
|
||||
}
|
@ -25,10 +25,11 @@ import com.intellectualcrafters.plot.util.StringMan;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class Flag implements Cloneable {
|
||||
public class Flag<T> implements Cloneable {
|
||||
private AbstractFlag key;
|
||||
private Object value;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Flag object used to store basic information for a Plot. Flags are a key/value pair. For a flag to be usable by a
|
||||
* player, you need to register it with PlotSquared.
|
||||
@ -59,6 +60,10 @@ public class Flag implements Cloneable {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Flag(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the AbstractFlag used in creating the flag
|
||||
@ -145,4 +150,8 @@ public class Flag implements Cloneable {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -2308,9 +2308,6 @@ public class Plot {
|
||||
connected_cache.add(current);
|
||||
queuecache.remove(current);
|
||||
merged = current.getMerged();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
|
||||
}
|
||||
if (merged[0]) {
|
||||
tmp = current.area.getPlotAbs(current.id.getRelative(0));
|
||||
if ((tmp != null) && !queuecache.contains(tmp) && !connected_cache.contains(tmp)) {
|
||||
|
@ -20,11 +20,12 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
/**
|
||||
/**
|
||||
|
||||
*/
|
||||
public class PlotBlock {
|
||||
|
||||
public static PlotBlock EVERYTHING = new PlotBlock((short) 0, (byte) 0);
|
||||
|
||||
public final static PlotBlock EVERYTHING = new PlotBlock((short) 0, (byte) 0);
|
||||
|
||||
public final short id;
|
||||
public final byte data;
|
||||
|
@ -21,6 +21,7 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ExpireManager {
|
||||
|
||||
@ -233,8 +234,7 @@ public class ExpireManager {
|
||||
}
|
||||
if ((last = opp.getLastPlayed()) != 0) {
|
||||
dates_cache.put(uuid, last);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ public class ExpireManager {
|
||||
return false;
|
||||
}
|
||||
final long compared = System.currentTimeMillis() - last;
|
||||
if (compared >= (86400000l * Settings.AUTO_CLEAR_DAYS)) {
|
||||
if (compared >= (TimeUnit.DAYS.toMillis(Settings.AUTO_CLEAR_DAYS))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -13,14 +13,40 @@ import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.ChatManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotQueue;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
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.UUIDHandlerImplementation;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.sponge.generator.SpongePlotGenerator;
|
||||
import com.plotsquared.sponge.listener.ChunkProcessor;
|
||||
import com.plotsquared.sponge.listener.MainListener;
|
||||
import com.plotsquared.sponge.listener.WorldEvents;
|
||||
import com.plotsquared.sponge.util.*;
|
||||
import com.plotsquared.sponge.util.KillRoadMobs;
|
||||
import com.plotsquared.sponge.util.SpongeChatManager;
|
||||
import com.plotsquared.sponge.util.SpongeChunkManager;
|
||||
import com.plotsquared.sponge.util.SpongeCommand;
|
||||
import com.plotsquared.sponge.util.SpongeEconHandler;
|
||||
import com.plotsquared.sponge.util.SpongeEventUtil;
|
||||
import com.plotsquared.sponge.util.SpongeHybridUtils;
|
||||
import com.plotsquared.sponge.util.SpongeInventoryUtil;
|
||||
import com.plotsquared.sponge.util.SpongeMetrics;
|
||||
import com.plotsquared.sponge.util.SpongeSchematicHandler;
|
||||
import com.plotsquared.sponge.util.SpongeSetupUtils;
|
||||
import com.plotsquared.sponge.util.SpongeTaskManager;
|
||||
import com.plotsquared.sponge.util.SpongeTitleManager;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
import com.plotsquared.sponge.util.block.FastQueue;
|
||||
import com.plotsquared.sponge.util.block.SlowQueue;
|
||||
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
|
||||
@ -138,12 +164,11 @@ public class SpongeMain implements IPlotMain {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getPluginVersion() {
|
||||
public String getPluginVersion() {
|
||||
PluginContainer plugin = game.getPluginManager().fromInstance(this).get();
|
||||
String version = plugin.getVersion().get();
|
||||
log("Checking plugin version: PlotSquared: ");
|
||||
final String[] split = version.split("\\.");
|
||||
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), (split.length == 3) ? Integer.parseInt(split[2]) : 0 };
|
||||
return version;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -203,7 +228,7 @@ public class SpongeMain implements IPlotMain {
|
||||
|
||||
@Override
|
||||
public void registerCommands() {
|
||||
getGame().getCommandManager().register(THIS, new SpongeCommand(), new String[] { "plots", "p", "plot", "ps", "plotsquared", "p2", "2" });
|
||||
getGame().getCommandManager().register(THIS, new SpongeCommand(), "plots", "p", "plot", "ps", "plotsquared", "p2", "2");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user