mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Move confirmation to commands.yml
This commit is contained in:
parent
ed62ed2487
commit
7ab8d22325
@ -1951,11 +1951,6 @@ public class PS {
|
|||||||
this.config.set("platform", this.platform);
|
this.config.set("platform", this.platform);
|
||||||
|
|
||||||
Map<String, Object> options = new HashMap<>();
|
Map<String, Object> options = new HashMap<>();
|
||||||
// Command confirmation
|
|
||||||
options.put("confirmation.setowner", Settings.CONFIRM_SETOWNER);
|
|
||||||
options.put("confirmation.clear", Settings.CONFIRM_CLEAR);
|
|
||||||
options.put("confirmation.delete", Settings.CONFIRM_DELETE);
|
|
||||||
options.put("confirmation.unlink", Settings.CONFIRM_UNLINK);
|
|
||||||
|
|
||||||
// Protection
|
// Protection
|
||||||
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
|
options.put("protection.redstone.disable-offline", Settings.REDSTONE_DISABLER);
|
||||||
@ -2081,12 +2076,6 @@ public class PS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command confirmation
|
|
||||||
Settings.CONFIRM_SETOWNER = this.config.getBoolean("confirmation.setowner");
|
|
||||||
Settings.CONFIRM_CLEAR = this.config.getBoolean("confirmation.clear");
|
|
||||||
Settings.CONFIRM_DELETE = this.config.getBoolean("confirmation.delete");
|
|
||||||
Settings.CONFIRM_UNLINK = this.config.getBoolean("confirmation.unlink");
|
|
||||||
|
|
||||||
// Protection
|
// Protection
|
||||||
Settings.REDSTONE_DISABLER = this.config.getBoolean("protection.redstone.disable-offline");
|
Settings.REDSTONE_DISABLER = this.config.getBoolean("protection.redstone.disable-offline");
|
||||||
Settings.REDSTONE_DISABLER_UNOCCUPIED = this.config.getBoolean("protection.redstone.disable-unoccupied");
|
Settings.REDSTONE_DISABLER_UNOCCUPIED = this.config.getBoolean("protection.redstone.disable-unoccupied");
|
||||||
|
@ -38,7 +38,8 @@ import java.util.Set;
|
|||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
description = "Create a new PlotArea",
|
description = "Create a new PlotArea",
|
||||||
aliases = "world",
|
aliases = "world",
|
||||||
usage = "/plot area <create|info|list|tp|regen>")
|
usage = "/plot area <create|info|list|tp|regen>",
|
||||||
|
confirmation=true)
|
||||||
public class Area extends SubCommand {
|
public class Area extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -113,7 +114,7 @@ public class Area extends SubCommand {
|
|||||||
object.setupGenerator = "PlotSquared";
|
object.setupGenerator = "PlotSquared";
|
||||||
object.step = area.getSettingNodes();
|
object.step = area.getSettingNodes();
|
||||||
final String path = "worlds." + area.worldname + ".areas." + area.id + "-" + object.min + "-" + object.max;
|
final String path = "worlds." + area.worldname + ".areas." + area.id + "-" + object.min + "-" + object.max;
|
||||||
CmdConfirm.addPending(plr, "/plot area create pos2 (Creates world)", new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (offsetx != 0) {
|
if (offsetx != 0) {
|
||||||
@ -139,7 +140,12 @@ public class Area extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, "An error occured while creating the world: " + area.worldname);
|
MainUtil.sendMessage(plr, "An error occured while creating the world: " + area.worldname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
if (hasConfirmation(plr)) {
|
||||||
|
CmdConfirm.addPending(plr, "/plot area create pos2 (Creates world)", run);
|
||||||
|
} else {
|
||||||
|
run.run();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -234,7 +240,7 @@ public class Area extends SubCommand {
|
|||||||
C.SETUP_WORLD_TAKEN.send(plr, pa.worldname);
|
C.SETUP_WORLD_TAKEN.send(plr, pa.worldname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CmdConfirm.addPending(plr, "/plot area " + StringMan.join(args, " "), new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String path = "worlds." + pa.worldname;
|
String path = "worlds." + pa.worldname;
|
||||||
@ -259,7 +265,12 @@ public class Area extends SubCommand {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
if (hasConfirmation(plr)) {
|
||||||
|
CmdConfirm.addPending(plr, "/plot area " + StringMan.join(args, " "), run);
|
||||||
|
} else {
|
||||||
|
run.run();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pa.id == null) {
|
if (pa.id == null) {
|
||||||
|
@ -40,7 +40,8 @@ import java.util.Set;
|
|||||||
permission = "plots.clear",
|
permission = "plots.clear",
|
||||||
category = CommandCategory.APPEARANCE,
|
category = CommandCategory.APPEARANCE,
|
||||||
usage = "/plot clear [id]",
|
usage = "/plot clear [id]",
|
||||||
aliases = "reset")
|
aliases = "reset",
|
||||||
|
confirmation=true)
|
||||||
public class Clear extends SubCommand {
|
public class Clear extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -118,7 +119,7 @@ public class Clear extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (Settings.CONFIRM_CLEAR && !Permissions.hasPermission(plr, "plots.confirm.bypass")) {
|
if (hasConfirmation(plr)) {
|
||||||
CmdConfirm.addPending(plr, "/plot clear " + plot.getId(), runnable);
|
CmdConfirm.addPending(plr, "/plot clear " + plot.getId(), runnable);
|
||||||
} else {
|
} else {
|
||||||
TaskManager.runTask(runnable);
|
TaskManager.runTask(runnable);
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
@ -32,7 +31,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
|||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -42,7 +40,8 @@ import java.util.HashSet;
|
|||||||
usage = "/plot delete",
|
usage = "/plot delete",
|
||||||
aliases = {"dispose", "del"},
|
aliases = {"dispose", "del"},
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE,
|
||||||
|
confirmation=true)
|
||||||
public class Delete extends SubCommand {
|
public class Delete extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,7 +89,7 @@ public class Delete extends SubCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (Settings.CONFIRM_DELETE && !Permissions.hasPermission(plr, "plots.confirm.bypass")) {
|
if (hasConfirmation(plr)) {
|
||||||
CmdConfirm.addPending(plr, "/plot delete " + plot.getId(), run);
|
CmdConfirm.addPending(plr, "/plot delete " + plot.getId(), run);
|
||||||
} else {
|
} else {
|
||||||
TaskManager.runTask(run);
|
TaskManager.runTask(run);
|
||||||
|
@ -42,7 +42,8 @@ import java.util.UUID;
|
|||||||
description = "Merge the plot you are standing on, with another plot",
|
description = "Merge the plot you are standing on, with another plot",
|
||||||
permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
permission = "plots.merge", usage = "/plot merge <all|n|e|s|w> [removeroads]",
|
||||||
category = CommandCategory.SETTINGS,
|
category = CommandCategory.SETTINGS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE,
|
||||||
|
confirmation=true)
|
||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
|
|
||||||
public final static String[] values = new String[]{"north", "east", "south", "west", "auto"};
|
public final static String[] values = new String[]{"north", "east", "south", "west", "auto"};
|
||||||
@ -180,7 +181,7 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
isOnline = true;
|
isOnline = true;
|
||||||
final int dir = direction;
|
final int dir = direction;
|
||||||
CmdConfirm.addPending(accepter, C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", plr.getName()), new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
||||||
@ -200,7 +201,12 @@ public class Merge extends SubCommand {
|
|||||||
}
|
}
|
||||||
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
|
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
if (hasConfirmation(plr)) {
|
||||||
|
CmdConfirm.addPending(accepter, C.MERGE_REQUEST_CONFIRM.s().replaceAll("%s", plr.getName()), run);
|
||||||
|
} else {
|
||||||
|
run.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isOnline) {
|
if (!isOnline) {
|
||||||
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
|
MainUtil.sendMessage(plr, C.NO_AVAILABLE_AUTOMERGE);
|
||||||
|
@ -41,7 +41,8 @@ import java.util.UUID;
|
|||||||
usage = "/plot setowner <player>",
|
usage = "/plot setowner <player>",
|
||||||
aliases = {"owner", "so", "seto"},
|
aliases = {"owner", "so", "seto"},
|
||||||
category = CommandCategory.CLAIMING,
|
category = CommandCategory.CLAIMING,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE,
|
||||||
|
confirmation=true)
|
||||||
public class Owner extends SetCommand {
|
public class Owner extends SetCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -104,7 +105,7 @@ public class Owner extends SetCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (Settings.CONFIRM_SETOWNER && !Permissions.hasPermission(plr, "plots.confirm.bypass")) {
|
if (hasConfirmation(plr)) {
|
||||||
CmdConfirm.addPending(plr, "/plot set owner " + value, run);
|
CmdConfirm.addPending(plr, "/plot set owner " + value, run);
|
||||||
} else {
|
} else {
|
||||||
TaskManager.runTask(run);
|
TaskManager.runTask(run);
|
||||||
|
@ -43,7 +43,8 @@ import java.util.UUID;
|
|||||||
permission = "plots.admin",
|
permission = "plots.admin",
|
||||||
description = "Purge all plots for a world",
|
description = "Purge all plots for a world",
|
||||||
category = CommandCategory.ADMINISTRATION,
|
category = CommandCategory.ADMINISTRATION,
|
||||||
requiredType = RequiredType.CONSOLE)
|
requiredType = RequiredType.CONSOLE,
|
||||||
|
confirmation=true)
|
||||||
public class Purge extends SubCommand {
|
public class Purge extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -167,7 +168,7 @@ public class Purge extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String cmd = "/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
String cmd = "/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
||||||
CmdConfirm.addPending(plr, cmd, new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
HashSet<Integer> ids = new HashSet<Integer>();
|
HashSet<Integer> ids = new HashSet<Integer>();
|
||||||
@ -181,7 +182,12 @@ public class Purge extends SubCommand {
|
|||||||
DBFunc.purgeIds(ids);
|
DBFunc.purgeIds(ids);
|
||||||
C.PURGE_SUCCESS.send(plr, ids.size() + "/" + toDelete.size());
|
C.PURGE_SUCCESS.send(plr, ids.size() + "/" + toDelete.size());
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
if (hasConfirmation(plr)) {
|
||||||
|
CmdConfirm.addPending(plr, cmd, run);
|
||||||
|
} else {
|
||||||
|
run.run();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
@ -37,7 +36,8 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
|||||||
description = "Unlink a mega-plot",
|
description = "Unlink a mega-plot",
|
||||||
usage = "/plot unlink",
|
usage = "/plot unlink",
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
category = CommandCategory.SETTINGS)
|
category = CommandCategory.SETTINGS,
|
||||||
|
confirmation=true)
|
||||||
public class Unlink extends SubCommand {
|
public class Unlink extends SubCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -77,7 +77,7 @@ public class Unlink extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.UNLINK_SUCCESS);
|
MainUtil.sendMessage(plr, C.UNLINK_SUCCESS);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (Settings.CONFIRM_UNLINK && !Permissions.hasPermission(plr, "plots.confirm.bypass")) {
|
if (hasConfirmation(plr)) {
|
||||||
CmdConfirm.addPending(plr, "/plot unlink " + plot.getId(), runnable);
|
CmdConfirm.addPending(plr, "/plot unlink " + plot.getId(), runnable);
|
||||||
} else {
|
} else {
|
||||||
TaskManager.runTask(runnable);
|
TaskManager.runTask(runnable);
|
||||||
|
@ -172,13 +172,6 @@ public class Settings {
|
|||||||
public static boolean TWIN_MODE_UUID = false;
|
public static boolean TWIN_MODE_UUID = false;
|
||||||
public static boolean OFFLINE_MODE = false;
|
public static boolean OFFLINE_MODE = false;
|
||||||
public static boolean UUID_LOWERCASE = false;
|
public static boolean UUID_LOWERCASE = false;
|
||||||
/**
|
|
||||||
* Command confirmation
|
|
||||||
*/
|
|
||||||
public static boolean CONFIRM_SETOWNER = true;
|
|
||||||
public static boolean CONFIRM_CLEAR = true;
|
|
||||||
public static boolean CONFIRM_DELETE = true;
|
|
||||||
public static boolean CONFIRM_UNLINK = true;
|
|
||||||
/**
|
/**
|
||||||
* Use global plot limit?
|
* Use global plot limit?
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user