Fixes #748
Fixes #759
This commit is contained in:
Jesse Boyd
2015-11-28 22:46:10 +11:00
parent 7db30590c6
commit 94b0fbb266
23 changed files with 445 additions and 140 deletions

View File

@ -67,7 +67,7 @@ public class Copy extends SubCommand {
C.COMMAND_SYNTAX.send(plr, getUsage());
return false;
}
if (!plot1.getWorld().equals(plot2.getWorld())) {
if (!plot1.getWorld().isCompatible(plot2.getWorld())) {
C.PLOTWORLD_INCOMPATIBLE.send(plr);
return false;
}

View File

@ -34,7 +34,6 @@ import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(

View File

@ -67,7 +67,7 @@ public class Move extends SubCommand {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
return false;
}
if (!plot1.getWorld().equals(plot2.getWorld())) {
if (!plot1.getWorld().isCompatible(plot2.getWorld())) {
C.PLOTWORLD_INCOMPATIBLE.send(plr);
return false;
}

View File

@ -45,30 +45,32 @@ public class Owner extends SetCommand {
@Override
public boolean set(PlotPlayer plr, Plot plot, String value) {
HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
final PlotPlayer other = UUIDHandler.getPlayer(value);
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();
String name = null;
if (value.length() == 36) {
try {
uuid = UUID.fromString(value);
name = MainUtil.getName(uuid);
} catch (Exception e) {}
} else {
uuid = UUIDHandler.getUUID(value, null);
name = UUIDHandler.getName(uuid);
name = name == null ? value : name;
}
if (uuid == null) {
MainUtil.sendMessage(plr, C.INVALID_PLAYER, value);
C.INVALID_PLAYER.send(plr, value);
return false;
}
String name = other == null ? MainUtil.getName(uuid) : other.getName();
if (plot.isOwner(uuid)) {
C.ALREADY_OWNER.send(plr);
return false;
}
if (other != null && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
PlotPlayer other = UUIDHandler.getPlayer(uuid);
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
if (other == null) {
C.INVALID_PLAYER_OFFLINE.send(plr, value);
return false;
}
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)) {
@ -76,6 +78,7 @@ public class Owner extends SetCommand {
return false;
}
}
plot.setOwner(uuid);
MainUtil.setSign(name, plot);
MainUtil.sendMessage(plr, C.SET_OWNER);

View File

@ -55,7 +55,7 @@ public class Swap extends SubCommand {
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot copy <X;Z>");
return false;
}
if (!plot1.getWorld().equals(plot2.getWorld())) {
if (!plot1.getWorld().isCompatible(plot2.getWorld())) {
C.PLOTWORLD_INCOMPATIBLE.send(plr);
return false;
}

View File

@ -331,7 +331,7 @@ public class list extends SubCommand {
}
}
if (sort) {
plots = PS.get().sortPlots(plots, SortType.DISTANCE_FROM_ORIGIN, world);
plots = PS.get().sortPlots(plots, SortType.CREATION_DATE_TIMESTAMP, world);
}
if (page < 0) {
page = 0;