mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
purge
This commit is contained in:
parent
e8a698816a
commit
42aeb1479d
@ -34,6 +34,7 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -93,12 +94,11 @@ public class Purge extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PURGE_SYNTAX);
|
||||
return false;
|
||||
}
|
||||
final World world = Bukkit.getWorld(args[1]);
|
||||
if ((world == null) || !PlotSquared.isPlotWorld(world)) {
|
||||
MainUtil.sendMessage(null, C.NOT_VALID_PLOT_WORLD);
|
||||
final String worldname = args[0];
|
||||
if (!BlockManager.manager.isWorld(worldname) || !PlotSquared.isPlotWorld(worldname)) {
|
||||
MainUtil.sendMessage(plr, "INVALID WORLD");
|
||||
return false;
|
||||
}
|
||||
final String worldname = world.getName();
|
||||
final String arg = args[0].toLowerCase();
|
||||
final PlotId id = getId(arg);
|
||||
if (id != null) {
|
||||
@ -112,7 +112,7 @@ public class Purge extends SubCommand {
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[0]);
|
||||
if (uuid != null) {
|
||||
final Set<Plot> plots = PlotSquared.getPlots(world, uuid);
|
||||
final Set<Plot> plots = PlotSquared.getPlots(worldname, uuid);
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
ids.add(plot.id);
|
||||
@ -121,7 +121,7 @@ public class Purge extends SubCommand {
|
||||
return finishPurge(ids.size());
|
||||
}
|
||||
if (arg.equals("all")) {
|
||||
final Set<PlotId> ids = PlotSquared.getPlots(world).keySet();
|
||||
final Set<PlotId> ids = PlotSquared.getPlots(worldname).keySet();
|
||||
if (ids.size() == 0) {
|
||||
return MainUtil.sendMessage(null, "&cNo plots found");
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class Purge extends SubCommand {
|
||||
return finishPurge(ids.size());
|
||||
}
|
||||
if (arg.equals("unknown")) {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(world).values();
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
if (plot.owner != null) {
|
||||
@ -146,7 +146,7 @@ public class Purge extends SubCommand {
|
||||
return finishPurge(ids.size());
|
||||
}
|
||||
if (arg.equals("unowned")) {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(world).values();
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
if (plot.owner == null) {
|
||||
|
@ -26,9 +26,6 @@ import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -41,8 +38,8 @@ public class plugin extends SubCommand {
|
||||
super("plugin", "plots.use", "Show plugin information", "plugin", "version", CommandCategory.INFO, false);
|
||||
}
|
||||
|
||||
public static void setup(final JavaPlugin plugin) {
|
||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
public static void setup() {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@ -51,8 +48,8 @@ public class plugin extends SubCommand {
|
||||
downloads = "unknown";
|
||||
}
|
||||
}
|
||||
}, 1l);
|
||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
});
|
||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@ -62,7 +59,7 @@ public class plugin extends SubCommand {
|
||||
version = "unknown";
|
||||
}
|
||||
}
|
||||
}, 200l);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
private static String convertToNumericString(final String str, final boolean dividers) {
|
||||
|
Loading…
Reference in New Issue
Block a user