mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
@ -1336,17 +1336,17 @@ public class PS {
|
||||
}
|
||||
case "f":
|
||||
case "floor": {
|
||||
config.set(base + "plot.floor", Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(",")));
|
||||
config.set(base + "plot.floor", new ArrayList<String>(Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(","))));
|
||||
break;
|
||||
}
|
||||
case "m":
|
||||
case "main": {
|
||||
config.set(base + "plot.filling", Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(",")));
|
||||
config.set(base + "plot.filling", new ArrayList<String>(Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(","))));
|
||||
break;
|
||||
}
|
||||
case "w":
|
||||
case "wall": {
|
||||
config.set(base + "wall.filling", Arrays.asList(StringMan.join(Configuration.BLOCKLIST.parseString(value), ",").split(",")));
|
||||
config.set(base + "wall.filling", Configuration.BLOCK.parseString(value).toString());
|
||||
break;
|
||||
}
|
||||
case "b":
|
||||
|
@ -218,7 +218,7 @@ public class DebugExec extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final String flag = args[1];
|
||||
for (final Plot plot : PS.get().getPlots()) {
|
||||
for (final Plot plot : PS.get().getBasePlots()) {
|
||||
if (FlagManager.getPlotFlagRaw(plot, flag) != null) {
|
||||
FlagManager.removePlotFlag(plot, flag);
|
||||
}
|
||||
@ -409,6 +409,49 @@ public class DebugExec extends SubCommand {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "allcmd": {
|
||||
if (args.length < 3) {
|
||||
C.COMMAND_SYNTAX.send(player, "/plot debugexec allcmd <condition> <command>");
|
||||
return false;
|
||||
}
|
||||
long start = System.currentTimeMillis();
|
||||
Command<PlotPlayer> cmd = MainCommand.getInstance().getCommand(args[3]);
|
||||
String[] params = Arrays.copyOfRange(args, 4, args.length);
|
||||
if (args[1].equals("true")) {
|
||||
Location loc = (Location) player.getMeta("location");
|
||||
Plot plot = (Plot) player.getMeta("lastplot");
|
||||
for (Plot current : PS.get().getBasePlots()) {
|
||||
player.setMeta("location", current.getBottomAbs());
|
||||
player.setMeta("lastplot", current);
|
||||
cmd.onCommand(player, params);
|
||||
}
|
||||
if (loc == null) {
|
||||
player.deleteMeta("location");
|
||||
} else {
|
||||
player.setMeta("location", loc);
|
||||
}
|
||||
if (plot == null) {
|
||||
player.deleteMeta("lastplot");
|
||||
} else {
|
||||
player.setMeta("lastplot", plot);
|
||||
}
|
||||
player.sendMessage("&c> " + (System.currentTimeMillis() - start));
|
||||
return true;
|
||||
}
|
||||
init();
|
||||
scope.put("_2", params);
|
||||
scope.put("_3", cmd);
|
||||
script = "_1=PS.getBasePlots().iterator();while(_1.hasNext()){plot=_1.next();if(" + args[1] + "){PlotPlayer.setMeta(\"location\",plot.getBottomAbs());PlotPlayer.setMeta(\"lastplot\",plot);_3.onCommand(PlotPlayer,_2)}}";
|
||||
break;
|
||||
}
|
||||
case "all": {
|
||||
if (args.length < 3) {
|
||||
C.COMMAND_SYNTAX.send(player, "/plot debugexec all <condition> <code>");
|
||||
return false;
|
||||
}
|
||||
script = "_1=PS.getBasePlots().iterator();while(_1.hasNext()){plot=_1.next();if(" + args[1] + "){" + StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ") + "}}";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
script = StringMan.join(args, " ");
|
||||
}
|
||||
|
@ -210,6 +210,8 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
////////////////////////
|
||||
int help_index = -1;
|
||||
String category = null;
|
||||
Location loc = null;
|
||||
Plot plot = null;
|
||||
boolean tp = false;
|
||||
switch (args.length) {
|
||||
case 0: {
|
||||
@ -268,15 +270,21 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
}
|
||||
default: {
|
||||
if (args.length >= 2) {
|
||||
String world = player.getLocation().getWorld();
|
||||
Plot plot = Plot.fromString(world, args[0]);
|
||||
String world = player.getLocation().getWorld();
|
||||
Plot newPlot = Plot.fromString(world, args[0]);
|
||||
if (newPlot == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ConsolePlayer.isConsole(player) && (!newPlot.world.equals(world) || newPlot.isDenied(player.getUUID())) && !Permissions.hasPermission(player, C.PERMISSION_ADMIN)) {
|
||||
break;
|
||||
}
|
||||
// Save meta
|
||||
loc = (Location) player.getMeta("location");
|
||||
loc = (Location) player.getMeta("location");
|
||||
plot = (Plot) player.getMeta("lastplot");
|
||||
tp = true;
|
||||
// Set loc
|
||||
player.setMeta("location", newPlot.getBottomAbs());
|
||||
player.setMeta("lastplot", newPlot);
|
||||
// Trim command
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
}
|
||||
@ -292,8 +300,18 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
||||
args[0] = args[0].replaceFirst(":", " ");
|
||||
}
|
||||
String fullCmd = StringMan.join(args, " ");
|
||||
getInstance().handle(player, cmd + " " + fullCmd);
|
||||
if (loc != null) {
|
||||
getInstance().handle(player, cmd + " " + fullCmd);
|
||||
// Restore location
|
||||
if (tp) {
|
||||
if (loc == null) {
|
||||
player.deleteMeta("location");
|
||||
} else {
|
||||
player.setMeta("location", loc);
|
||||
}
|
||||
if (plot == null) {
|
||||
player.deleteMeta("lastplot");
|
||||
} else {
|
||||
player.setMeta("lastplot", plot);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -15,7 +15,6 @@ import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
public class ConsolePlayer extends PlotPlayer {
|
||||
|
||||
private static ConsolePlayer instance;
|
||||
private Location loc;
|
||||
private final HashMap<String, Object> meta;
|
||||
|
||||
public static ConsolePlayer getConsole() {
|
||||
@ -38,8 +37,9 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
} else {
|
||||
world = "world";
|
||||
}
|
||||
loc = new Location(world, 0, 0, 0);
|
||||
meta = new HashMap<>();
|
||||
Location loc = new Location(world, 0, 0, 0);
|
||||
setMeta("location", loc);
|
||||
}
|
||||
|
||||
public static boolean isConsole(final PlotPlayer plr) {
|
||||
@ -53,12 +53,12 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return loc;
|
||||
return (Location) getMeta("location");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocationFull() {
|
||||
return loc;
|
||||
return (Location) getMeta("location");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -85,7 +85,7 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
public void teleport(final Location loc) {
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
setMeta("lastplot", plot);
|
||||
this.loc = loc;
|
||||
setMeta("location", loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,14 +7,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.util.CmdConfirm;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.general.commands.CommandCaller;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
/**
|
||||
* The PlotPlayer class<br>
|
||||
@ -321,17 +322,19 @@ public abstract class PlotPlayer implements CommandCaller {
|
||||
public void unregister() {
|
||||
final Plot plot = getCurrentPlot();
|
||||
if (plot != null) {
|
||||
PlotListener.plotExit(this, plot);
|
||||
EventUtil.manager.callLeave(this, plot);
|
||||
}
|
||||
ExpireManager.dates.put(getUUID(), System.currentTimeMillis());
|
||||
EventUtil.unregisterPlayer(this);
|
||||
if (Settings.DELETE_PLOTS_ON_BAN && isBanned()) {
|
||||
for (final Plot owned : PS.get().getPlotsInWorld(getName())) {
|
||||
owned.deletePlot(null);
|
||||
PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), getName()));
|
||||
}
|
||||
}
|
||||
UUIDHandler.getPlayers().remove(getName());
|
||||
String name = getName();
|
||||
ExpireManager.dates.put(getUUID(), System.currentTimeMillis());
|
||||
SetupUtils.setupMap.remove(name);
|
||||
CmdConfirm.removePending(name);
|
||||
UUIDHandler.getPlayers().remove(name);
|
||||
PS.get().IMP.unregister(this);
|
||||
}
|
||||
}
|
||||
|
@ -284,6 +284,11 @@ public abstract class PlotWorld {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return worldname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for the <b>/plot setup</b> command Return null if you do not want to support this feature
|
||||
*
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
@ -22,15 +21,6 @@ public abstract class EventUtil {
|
||||
|
||||
public static EventUtil manager = null;
|
||||
|
||||
public static void unregisterPlayer(final PlotPlayer player) {
|
||||
final String name = player.getName();
|
||||
if (SetupUtils.setupMap.containsKey(name)) {
|
||||
SetupUtils.setupMap.remove(name);
|
||||
}
|
||||
CmdConfirm.removePending(name);
|
||||
PS.get().IMP.unregister(player);
|
||||
}
|
||||
|
||||
public abstract Rating callRating(final PlotPlayer player, final Plot plot, final Rating rating);
|
||||
|
||||
public abstract boolean callClaim(final PlotPlayer player, final Plot plot, final boolean auto);
|
||||
|
@ -108,27 +108,32 @@ public abstract class UUIDHandlerImplementation {
|
||||
* lazy UUID conversion:
|
||||
* - Useful if the person misconfigured the database, or settings before PlotMe conversion
|
||||
*/
|
||||
if (!Settings.OFFLINE_MODE) {
|
||||
UUID offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
|
||||
if (!unknown.contains(offline) && !name.value.equals(name.value.toLowerCase())) {
|
||||
offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
|
||||
if (!unknown.contains(offline)) {
|
||||
offline = null;
|
||||
}
|
||||
}
|
||||
if (offline != null && !offline.equals(uuid)) {
|
||||
unknown.remove(offline);
|
||||
final Set<Plot> plots = PS.get().getPlots(offline);
|
||||
if (plots.size() > 0) {
|
||||
for (final Plot plot : plots) {
|
||||
plot.owner = uuid;
|
||||
if (!Settings.OFFLINE_MODE && unknown.size() > 0) {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
UUID offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
|
||||
if (!unknown.contains(offline) && !name.value.equals(name.value.toLowerCase())) {
|
||||
offline = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.value.toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
if (!unknown.contains(offline)) {
|
||||
offline = null;
|
||||
}
|
||||
}
|
||||
if (offline != null && !offline.equals(uuid)) {
|
||||
unknown.remove(offline);
|
||||
final Set<Plot> plots = PS.get().getPlots(offline);
|
||||
if (plots.size() > 0) {
|
||||
for (final Plot plot : plots) {
|
||||
plot.owner = uuid;
|
||||
}
|
||||
DBFunc.replaceUUID(offline, uuid);
|
||||
PS.debug("&cDetected invalid UUID stored for: " + name.value);
|
||||
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
|
||||
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database.");
|
||||
}
|
||||
}
|
||||
DBFunc.replaceUUID(offline, uuid);
|
||||
PS.debug("&cDetected invalid UUID stored for: " + name.value);
|
||||
PS.debug("&7 - Did you recently switch to online-mode storage without running `uuidconvert`?");
|
||||
PS.debug("&6PlotSquared will update incorrect entries when the user logs in, or you can reconstruct your database.");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
final UUID offline = uuidMap.put(name, uuid);
|
||||
|
Reference in New Issue
Block a user