Fixed purge command

This commit is contained in:
boy0001 2014-12-29 00:56:01 +11:00
parent bcd113146b
commit a3c8ba84ab
3 changed files with 10 additions and 4 deletions

View File

@ -1254,6 +1254,10 @@ import java.util.concurrent.TimeUnit;
worlds.remove(world);
}
public static void removePlots(final String world) {
plots.put(world, new HashMap<PlotId, Plot>());
}
/**
* Get all plots
*

View File

@ -59,7 +59,8 @@ import org.bukkit.entity.Player;
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");
PlayerFunctions.sendMessage(plr, "Use /plots purge <world>;<x>;<z>");
PlayerFunctions.sendMessage(plr, "To purge all plots use /plots purge <world> -o");
return false;
}
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
@ -73,12 +74,13 @@ import org.bukkit.entity.Player;
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}
PlotMain.removePlotWorld(args[0]);
PlotMain.removePlots(args[0]);
DBFunc.purge(args[0]);
PlayerFunctions.sendMessage(plr, (C.PURGE_SUCCESS));
return true;
} else {
PlayerFunctions.sendMessage(plr, "This is a dangerous command, if you are sure, use /plot purge {world} -o");
PlayerFunctions.sendMessage(plr, "Use /plots purge <world>;<x>;<z>");
PlayerFunctions.sendMessage(plr, "To purge all plots use /plots purge <world> -o");
return false;
}
}

View File

@ -866,7 +866,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
stmt = SQLManager.this.connection.prepareStatement("DELETE FROM `" + prefix + "plot` WHERE `plot_plot_id` = " + idstr + "");
stmt = SQLManager.this.connection.prepareStatement("DELETE FROM `" + prefix + "plot` WHERE `id` = " + idstr + "");
stmt.setString(1, world);
stmt.executeUpdate();
stmt.close();