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