mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
various fixes
This commit is contained in:
parent
766dc0f703
commit
a30e8eec9a
@ -1179,10 +1179,13 @@ public class PlotMain extends JavaPlugin {
|
||||
worlds = new HashSet<String>();
|
||||
}
|
||||
if ((generator != null) && (generator instanceof PlotGenerator)) {
|
||||
sendConsoleSenderMessage(C.PREFIX.s() + "&aDetected world load for '" + world + "'.");
|
||||
sendConsoleSenderMessage(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
|
||||
final PlotGenerator plotgen = (PlotGenerator) generator;
|
||||
sendConsoleSenderMessage(C.PREFIX.s() + "&3 - generator: &7" + generator.getClass().getName());
|
||||
final PlotWorld plotworld = plotgen.getNewPlotWorld(world);
|
||||
sendConsoleSenderMessage(C.PREFIX.s() + "&3 - plotworld: &7" + plotworld.getClass().getName());
|
||||
final PlotManager manager = plotgen.getPlotManager();
|
||||
sendConsoleSenderMessage(C.PREFIX.s() + "&3 - manager: &7" + manager.getClass().getName());
|
||||
|
||||
if (!config.contains("worlds." + world)) {
|
||||
config.createSection("worlds." + world);
|
||||
|
@ -179,6 +179,18 @@ public class PlotSettings {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public void removeComment(PlotComment comment) {
|
||||
if (this.comments.contains(comment)) {
|
||||
this.comments.remove(comment);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeComments(ArrayList<PlotComment> comments) {
|
||||
for (PlotComment comment : comments) {
|
||||
removeComment(comment);
|
||||
}
|
||||
}
|
||||
|
||||
public void addComment(final PlotComment comment) {
|
||||
if (this.comments == null) {
|
||||
this.comments = new ArrayList<PlotComment>();
|
||||
|
@ -138,6 +138,7 @@ public class Inbox extends SubCommand {
|
||||
final int index = Integer.parseInt(split[1]);
|
||||
final PlotComment comment = comments.get(index - 1);
|
||||
DBFunc.removeComment(world, plot, comment);
|
||||
plot.settings.removeComment(comment);
|
||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "1 comment");
|
||||
return;
|
||||
}
|
||||
@ -149,6 +150,7 @@ public class Inbox extends SubCommand {
|
||||
for (final PlotComment comment : comments) {
|
||||
DBFunc.removeComment(world, plot, comment);
|
||||
}
|
||||
plot.settings.removeComments(comments);
|
||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
|
||||
return;
|
||||
}
|
||||
|
@ -59,15 +59,10 @@ public class Purge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (args[1].equals("-o")) {
|
||||
final PlotWorld plotworld = PlotMain.getWorldSettings(args[0]);
|
||||
if (plotworld == null) {
|
||||
if (PlotMain.getPlots(args[0])==null) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
|
||||
return false;
|
||||
}
|
||||
if (plr != null) {
|
||||
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
|
||||
return false;
|
||||
}
|
||||
PlotMain.removePlotWorld(args[0]);
|
||||
DBFunc.purge(args[0]);
|
||||
PlayerFunctions.sendMessage(plr, (C.PURGE_SUCCESS));
|
||||
|
@ -28,14 +28,13 @@ public class Visit extends SubCommand {
|
||||
public List<Plot> getPlots(final UUID uuid) {
|
||||
final List<Plot> plots = new ArrayList<>();
|
||||
for (final Plot p : PlotMain.getPlots()) {
|
||||
if (p.owner.equals(uuid)) {
|
||||
if (p.hasOwner() && p.owner.equals(uuid)) {
|
||||
plots.add(p);
|
||||
}
|
||||
}
|
||||
return plots;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
if (args.length < 1) {
|
||||
|
@ -297,6 +297,9 @@ public class SQLManager extends AbstractDB {
|
||||
stmt.setInt(1, id);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
stmt = connection.prepareStatement("DELETE FROM `" + PREFIX + "plot_comments` WHERE `plot_plot_id` = ?");
|
||||
stmt.setInt(1, id);
|
||||
stmt.executeUpdate();
|
||||
stmt = connection.prepareStatement("DELETE FROM `" + PREFIX + "plot` WHERE `id` = ?");
|
||||
stmt.setInt(1, id);
|
||||
stmt.executeUpdate();
|
||||
@ -596,8 +599,13 @@ public class SQLManager extends AbstractDB {
|
||||
}
|
||||
newplots.get(world).put(plot.id, plot);
|
||||
}
|
||||
boolean invalidPlot = false;
|
||||
for (final String worldname : noExist.keySet()) {
|
||||
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'!!!\n&c - Please create this world, or remove the plots from the DB using the purge command!");
|
||||
invalidPlot = true;
|
||||
PlotMain.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
|
||||
}
|
||||
if (invalidPlot) {
|
||||
PlotMain.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
|
||||
}
|
||||
}
|
||||
catch (final SQLException e) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: PlotSquared
|
||||
main: com.intellectualcrafters.plot.PlotMain
|
||||
version: 2.2.0
|
||||
version: 2.2.1
|
||||
load: STARTUP
|
||||
description: >
|
||||
Easy, yet powerful Plot World generation and management.
|
||||
|
Loading…
Reference in New Issue
Block a user