Fixes #701
Fixes set components for other plots
Add setowner uuid.
Probably some other stuff
This commit is contained in:
Jesse Boyd
2015-11-20 17:28:33 +11:00
parent 7ed693dfc8
commit 7db30590c6
5 changed files with 19 additions and 7 deletions

View File

@ -46,18 +46,29 @@ public class Owner extends SetCommand {
public boolean set(PlotPlayer plr, Plot plot, String value) {
HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
final PlotPlayer other = UUIDHandler.getPlayer(value);
UUID uuid;
uuid = other == null ? (Permissions.hasPermission(plr, "plots.admin.command.setowner") ? UUIDHandler.getUUID(value, null) : null) : other.getUUID();
UUID uuid = null;
if (other == null) {
if (Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
if ((uuid = UUIDHandler.getUUID(value, null)) == null) {
try {
uuid = UUID.fromString(value);
} catch (Exception e) {}
}
}
}
else {
other.getUUID();
}
if (uuid == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, value);
return false;
}
String name = other == null ? UUIDHandler.getName(uuid) : other.getName();
String name = other == null ? MainUtil.getName(uuid) : other.getName();
if (plot.isOwner(uuid)) {
C.ALREADY_OWNER.send(plr);
return false;
}
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
if (other != null && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
final int size = plots.size();
final int currentPlots = (Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(other) : MainUtil.getPlayerPlotCount(plot.world, other)) + size;
if (currentPlots > MainUtil.getAllowedPlots(other)) {

View File

@ -177,7 +177,7 @@ public class Set extends SubCommand {
// components
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
if (components.contains(args[0].toLowerCase())) {
return component.onCommand(plr, Arrays.copyOfRange(args, 1, args.length));
return component.onCommand(plr, Arrays.copyOfRange(args, 0, args.length));
}
// flag
{