Fixed purge in offline mode servers + typo

This commit is contained in:
boy0001 2015-03-12 20:20:17 +11:00
parent 1f8702f072
commit a1d476321f
2 changed files with 12 additions and 12 deletions

View File

@ -107,17 +107,6 @@ public class Purge extends SubCommand {
DBFunc.purgeIds(worldname, ids); DBFunc.purgeIds(worldname, ids);
return finishPurge(DBid == Integer.MAX_VALUE ? 1 : 0); return finishPurge(DBid == Integer.MAX_VALUE ? 1 : 0);
} }
final UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) {
final Set<Plot> plots = PlotSquared.getPlots(worldname, uuid);
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
ids.add(plot.id);
}
int length = ids.size();
DBFunc.purge(worldname, ids);
return finishPurge(length);
}
if (arg.equals("all")) { if (arg.equals("all")) {
final Set<PlotId> ids = PlotSquared.getPlots(worldname).keySet(); final Set<PlotId> ids = PlotSquared.getPlots(worldname).keySet();
int length = ids.size(); int length = ids.size();
@ -160,6 +149,17 @@ public class Purge extends SubCommand {
DBFunc.purge(worldname, ids); DBFunc.purge(worldname, ids);
return finishPurge(length); return finishPurge(length);
} }
final UUID uuid = UUIDHandler.getUUID(args[0]);
if (uuid != null) {
final Set<Plot> plots = PlotSquared.getPlots(worldname, uuid);
final Set<PlotId> ids = new HashSet<>();
for (final Plot plot : plots) {
ids.add(plot.id);
}
int length = ids.size();
DBFunc.purge(worldname, ids);
return finishPurge(length);
}
MainUtil.sendMessage(plr, C.PURGE_SYNTAX); MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
return false; return false;
} }

View File

@ -236,7 +236,7 @@ public enum C {
* purge * purge
*/ */
PURGE_SYNTAX("Use /plot purge <x;z|player|unowned|unknown|all> <world>"), PURGE_SYNTAX("Use /plot purge <x;z|player|unowned|unknown|all> <world>"),
PURGE_SUCCESS("$4Successfully purge %s plots"), PURGE_SUCCESS("$4Successfully purged %s plots"),
/* /*
* trim * trim
*/ */