mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +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,20 +79,18 @@ 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);
|
plot.setSign(finalName);
|
||||||
plot.setSign(finalName);
|
MainUtil.sendMessage(player, Captions.SET_OWNER);
|
||||||
MainUtil.sendMessage(player, Captions.SET_OWNER);
|
if (other != null) {
|
||||||
if (other != null) {
|
MainUtil.sendMessage(other, Captions.NOW_OWNER,
|
||||||
MainUtil.sendMessage(other, Captions.NOW_OWNER,
|
plot.getArea() + ";" + plot.getId());
|
||||||
plot.getArea() + ";" + plot.getId());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MainUtil.sendMessage(player, Captions.SET_OWNER_CANCELLED);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasConfirmation(player)) {
|
if (hasConfirmation(player)) {
|
||||||
|
@ -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