Fixed purge command

This commit is contained in:
boy0001 2014-12-20 11:24:29 +11:00
parent 9775ad3dd2
commit e1dea5a450
3 changed files with 10 additions and 7 deletions

View File

@ -43,8 +43,6 @@ import org.bukkit.entity.Player;
final String world = split[0];
final PlotId id = new PlotId(Integer.parseInt(split[1]), Integer.parseInt(split[2]));
System.out.print("VALID ID");
if (plr != null) {
PlayerFunctions.sendMessage(plr, (C.NOT_CONSOLE));
return false;
@ -54,11 +52,16 @@ import org.bukkit.entity.Player;
PlayerFunctions.sendMessage(null, C.NOT_VALID_PLOT_WORLD);
return false;
}
PlotMain.getPlots(world).remove(id);
DBFunc.purge(world, id);
PlayerFunctions.sendMessage(null, "&aPurge of '" + args[0] + "' was successful!");
return true;
} catch (final Exception e) {
if (args.length == 1) {
PlayerFunctions.sendMessage(plr, "This is a dangerous command, if you are sure, use /plot purge {world} -o");
return false;
}
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
}
}

View File

@ -783,14 +783,14 @@ public class SQLManager implements AbstractDB {
if (ids.size() > 0) {
try {
String prefix = "";
String p = "";
final StringBuilder idstr = new StringBuilder("");
for (final Integer id : ids) {
idstr.append(prefix + id);
prefix = " OR `plot_plot_id` = ";
idstr.append(p + id);
p = " OR `plot_plot_id` = ";
}
PreparedStatement stmt = SQLManager.this.connection.prepareStatement("DELETE FROM `" + prefix + "plot_helpers` WHERE `plot_plot_id` = " + idstr + "");
stmt.executeUpdate();
stmt.close();

View File

@ -185,7 +185,7 @@ import java.util.UUID;
if (plot.settings.getFlag("weather") != null) {
player.setPlayerWeather(getWeatherType(plot.settings.getFlag("weather").getValue()));
}
if (booleanFlag(plot, "titles") && Settings.TITLES && (C.TITLE_ENTERED_PLOT.s().length() > 2)) {
if ((booleanFlag(plot, "titles") || Settings.TITLES) && (C.TITLE_ENTERED_PLOT.s().length() > 2)) {
final String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
final String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));
final ChatColor sTitleMainColor = ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s());