mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
Make /plot setowner
require an argument. Fixes #2501.
This commit is contained in:
parent
834d786037
commit
37280779b0
@ -20,6 +20,10 @@ import java.util.UUID;
|
|||||||
requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand {
|
requiredType = RequiredType.NONE, confirmation = true) public class Owner extends SetCommand {
|
||||||
|
|
||||||
@Override public boolean set(final PlotPlayer player, final Plot plot, String value) {
|
@Override public boolean set(final PlotPlayer player, final Plot plot, String value) {
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
|
Captions.SET_OWNER_MISSING_PLAYER.send(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Set<Plot> plots = plot.getConnectedPlots();
|
Set<Plot> plots = plot.getConnectedPlots();
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
String name = null;
|
String name = null;
|
||||||
@ -75,8 +79,7 @@ import java.util.UUID;
|
|||||||
final String finalName = name;
|
final String finalName = name;
|
||||||
final UUID finalUUID = uuid;
|
final UUID finalUUID = uuid;
|
||||||
final boolean removeDenied = plot.isDenied(finalUUID);
|
final boolean removeDenied = plot.isDenied(finalUUID);
|
||||||
Runnable run = new Runnable() {
|
Runnable run = () -> {
|
||||||
@Override public void run() {
|
|
||||||
if (plot.setOwner(finalUUID, player)) {
|
if (plot.setOwner(finalUUID, player)) {
|
||||||
if (removeDenied)
|
if (removeDenied)
|
||||||
plot.removeDenied(finalUUID);
|
plot.removeDenied(finalUUID);
|
||||||
@ -89,7 +92,6 @@ import java.util.UUID;
|
|||||||
} else {
|
} else {
|
||||||
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED);
|
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
CmdConfirm.addPending(player, "/plot set owner " + value, run);
|
CmdConfirm.addPending(player, "/plot set owner " + value, run);
|
||||||
|
@ -578,6 +578,7 @@ public enum Captions {
|
|||||||
//<editor-fold desc="Set Owner">
|
//<editor-fold desc="Set Owner">
|
||||||
SET_OWNER("$4You successfully set the plot owner", "Owner"),
|
SET_OWNER("$4You successfully set the plot owner", "Owner"),
|
||||||
SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"),
|
SET_OWNER_CANCELLED("$2The set owner action was cancelled", "Owner"),
|
||||||
|
SET_OWNER_MISSING_PLAYER("$1You need to specify a new owner. Correct usage is: $2/plot setowner <owner>", "Owner"),
|
||||||
NOW_OWNER("$4You are now owner of plot %s", "Owner"),
|
NOW_OWNER("$4You are now owner of plot %s", "Owner"),
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
//<editor-fold desc="Signs">
|
//<editor-fold desc="Signs">
|
||||||
|
Loading…
Reference in New Issue
Block a user