mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-08 19:28:07 +01:00
Fixed errors.
This commit is contained in:
parent
bdbebfa29d
commit
fbaca34218
@ -62,7 +62,7 @@ public class Clear extends SubCommand {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.clear(world, plot, plot.owner == null, null);
|
||||
MainUtil.clear(world, plot, plot.owner_ == null, null);
|
||||
PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
|
||||
}
|
||||
};
|
||||
@ -110,7 +110,7 @@ public class Clear extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.clear")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
@ -122,7 +122,7 @@ public class Clear extends SubCommand {
|
||||
@Override
|
||||
public void run() {
|
||||
final long start = System.currentTimeMillis();
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, plot.owner == null, new Runnable() {
|
||||
final boolean result = MainUtil.clearAsPlayer(plot, plot.owner_ == null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MainUtil.sendMessage(plr, C.CLEARING_DONE, "" + (System.currentTimeMillis() - start));
|
||||
|
@ -129,9 +129,9 @@ public class Cluster extends SubCommand {
|
||||
// Add any existing plots to the current cluster
|
||||
for (final Plot plot : PlotSquared.getPlots(plr.getLocation().getWorld()).values()) {
|
||||
final PlotCluster current = ClusterManager.getCluster(plot);
|
||||
if (cluster.equals(current) && !cluster.hasRights(plot.owner)) {
|
||||
cluster.invited.add(plot.owner);
|
||||
DBFunc.setInvited(world, cluster, plot.owner);
|
||||
if (cluster.equals(current) && !cluster.hasRights(plot.owner_)) {
|
||||
cluster.invited.add(plot.owner_);
|
||||
DBFunc.setInvited(world, cluster, plot.owner_);
|
||||
}
|
||||
}
|
||||
if (!PlotSquared.isPlotWorld(world)) {
|
||||
|
@ -123,7 +123,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
}
|
||||
if (uuid != null) {
|
||||
MainUtil.sendMessage(null, " - &aFound plot: " + plot.id + " : " + line);
|
||||
plot.owner = uuid;
|
||||
plot.owner_ = uuid;
|
||||
plot.hasChanged = true;
|
||||
plots.add(plot);
|
||||
} else {
|
||||
|
@ -85,7 +85,7 @@ public class DebugClear extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.debugclear")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.debugclear")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
|
@ -97,7 +97,7 @@ public class DebugExec extends SubCommand {
|
||||
for (final Entry<Plot, Long> entry : ExpireManager.expiredPlots.get(args[1]).entrySet()) {
|
||||
final Plot plot = entry.getKey();
|
||||
final Long stamp = entry.getValue();
|
||||
MainUtil.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner) + " : " + stamp);
|
||||
MainUtil.sendMessage(null, " - " + plot.world + ";" + plot.id.x + ";" + plot.id.y + ";" + UUIDHandler.getName(plot.owner_) + " : " + stamp);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class Delete extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.uuidWrapper.getUUID(plr)))) && !Permissions.hasPermission(plr, "plots.admin.command.delete")) {
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.uuidWrapper.getUUID(plr)))) && !Permissions.hasPermission(plr, "plots.admin.command.delete")) {
|
||||
return !sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
@ -62,7 +62,7 @@ public class Delete extends SubCommand {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
||||
if ((PlotSquared.economy != null) && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.isOwner(UUIDHandler.getUUID(plr))) {
|
||||
final double c = pWorld.SELL_PRICE;
|
||||
if (c > 0d) {
|
||||
EconHandler.depositPlayer(plr, c);
|
||||
|
@ -53,7 +53,7 @@ public class Denied extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.denied")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.denied")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class Denied extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.denied.contains(uuid)) {
|
||||
if (plot.owner.equals(uuid)) {
|
||||
if (plot.isOwner(uuid)) {
|
||||
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
|
||||
return false;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class Helpers extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.helpers")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.helpers")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class Helpers extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.helpers.contains(uuid)) {
|
||||
if (plot.owner.equals(uuid)) {
|
||||
if (plot.isOwner(uuid)) {
|
||||
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
|
||||
return false;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class Home extends SubCommand {
|
||||
Plot temp;
|
||||
if ((temp = isAlias(args[0])) != null) {
|
||||
if (temp.hasOwner()) {
|
||||
if (temp.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
||||
if (temp.isOwner(plr.getUUID())) {
|
||||
MainUtil.teleportPlayer(plr, plr.getLocation(), temp);
|
||||
return true;
|
||||
}
|
||||
|
@ -59,10 +59,10 @@ public class Inbox extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
Integer tier;
|
||||
final UUID uuid = UUIDHandler.getUUID(plr);
|
||||
final UUID uuid = plr.getUUID();
|
||||
if (Permissions.hasPermission(plr, "plots.comment.admin")) {
|
||||
tier = 0;
|
||||
} else if ((plot != null) && plot.owner.equals(uuid)) {
|
||||
} else if ((plot != null) && plot.isOwner(uuid)) {
|
||||
tier = 1;
|
||||
} else if ((plot != null) && plot.helpers.contains(uuid)) {
|
||||
tier = 2;
|
||||
|
@ -21,6 +21,9 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -110,11 +113,11 @@ public class Info extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
String owner = "none";
|
||||
if (plot.owner != null) {
|
||||
owner = UUIDHandler.getName(plot.owner);
|
||||
if (plot.owner_ == null) {
|
||||
owner = "unowned";
|
||||
}
|
||||
if (owner == null) {
|
||||
owner = plot.owner.toString();
|
||||
else {
|
||||
owner = getPlayerList(plot.getOwners());
|
||||
}
|
||||
String info = C.PLOT_INFO.s();
|
||||
if (args.length == 1) {
|
||||
@ -170,11 +173,11 @@ public class Info extends SubCommand {
|
||||
final String flags = "&6" + (StringUtils.join(FlagManager.getPlotFlags(plot), "").length() > 0 ? StringUtils.join(FlagManager.getPlotFlags(plot), "&7, &6") : "none");
|
||||
final boolean build = (player == null) || plot.isAdded(player.getUUID());
|
||||
String owner = "none";
|
||||
if (plot.owner != null) {
|
||||
owner = UUIDHandler.getName(plot.owner);
|
||||
if (plot.owner_ == null) {
|
||||
owner = "unowned";
|
||||
}
|
||||
if (owner == null) {
|
||||
owner = plot.owner.toString();
|
||||
else {
|
||||
owner = getPlayerList(plot.getOwners());
|
||||
}
|
||||
info = info.replaceAll("%alias%", alias);
|
||||
info = info.replaceAll("%id%", id.toString());
|
||||
@ -192,7 +195,8 @@ public class Info extends SubCommand {
|
||||
return info;
|
||||
}
|
||||
|
||||
private String getPlayerList(final ArrayList<UUID> l) {
|
||||
private String getPlayerList(final Collection<UUID> uuids) {
|
||||
ArrayList<UUID> l = new ArrayList<>(uuids);
|
||||
if ((l == null) || (l.size() < 1)) {
|
||||
return " none";
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class Kick extends SubCommand {
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class Merge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final boolean admin = Permissions.hasPermission(plr, "plots.admin.command.merge");
|
||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !admin) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !admin) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
@ -138,10 +138,10 @@ public class Merge extends SubCommand {
|
||||
boolean multiMerge = false;
|
||||
final HashSet<UUID> multiUUID = new HashSet<UUID>();
|
||||
HashSet<PlotId> multiPlots = new HashSet<>();
|
||||
final UUID u1 = plot.getOwner();
|
||||
final UUID u1 = plot.owner_;
|
||||
for (final PlotId myid : plots) {
|
||||
final Plot myplot = PlotSquared.getPlots(world).get(myid);
|
||||
UUID u2 = myplot.getOwner();
|
||||
UUID u2 = myplot.owner_;
|
||||
if (myplot == null || u2 == null) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERM_MERGE.s().replaceAll("%plot%", myid.toString()));
|
||||
return false;
|
||||
@ -190,7 +190,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
|
||||
MainUtil.mergePlots(world, plots, true);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner_), plot);
|
||||
MainUtil.update(loc);
|
||||
}
|
||||
MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED);
|
||||
@ -219,7 +219,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
|
||||
MainUtil.mergePlots(world, plots, true);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner_), plot);
|
||||
MainUtil.update(loc);
|
||||
return true;
|
||||
}
|
||||
|
@ -120,8 +120,8 @@ public class Purge extends SubCommand {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
if (plot.owner != null) {
|
||||
final String name = UUIDHandler.getName(plot.owner);
|
||||
if (plot.owner_ != null) {
|
||||
final String name = UUIDHandler.getName(plot.owner_);
|
||||
if (name == null) {
|
||||
ids.add(plot.id);
|
||||
}
|
||||
@ -138,7 +138,7 @@ public class Purge extends SubCommand {
|
||||
final Collection<Plot> plots = PlotSquared.getPlots(worldname).values();
|
||||
final Set<PlotId> ids = new HashSet<>();
|
||||
for (final Plot plot : plots) {
|
||||
if (plot.owner == null) {
|
||||
if (plot.owner_ == null) {
|
||||
ids.add(plot.id);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class Rate extends SubCommand {
|
||||
sendMessage(plr, C.RATING_NOT_OWNED);
|
||||
return true;
|
||||
}
|
||||
if (plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
||||
if (plot.isOwner(plr.getUUID())) {
|
||||
sendMessage(plr, C.RATING_NOT_YOUR_OWN);
|
||||
return true;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class SchematicCmd extends SubCommand {
|
||||
}
|
||||
final Plot plot = SchematicCmd.this.plots[SchematicCmd.this.counter];
|
||||
final CompoundTag sch = SchematicHandler.manager.getCompoundTag(worldname, plot.id);
|
||||
final String o = UUIDHandler.getName(plot.owner);
|
||||
final String o = UUIDHandler.getName(plot.owner_);
|
||||
final String owner = o == null ? "unknown" : o;
|
||||
if (sch == null) {
|
||||
MainUtil.sendMessage(null, "&7 - Skipped plot &c" + plot.id);
|
||||
@ -303,7 +303,7 @@ public class SchematicCmd extends SubCommand {
|
||||
}
|
||||
final Plot plot = SchematicCmd.this.plots[SchematicCmd.this.counter];
|
||||
final CompoundTag sch = SchematicHandler.manager.getCompoundTag(world, plot.id);
|
||||
final String o = UUIDHandler.getName(plot.owner);
|
||||
final String o = UUIDHandler.getName(plot.owner_);
|
||||
final String owner = o == null ? "unknown" : o;
|
||||
if (sch == null) {
|
||||
MainUtil.sendMessage(plr, "&7 - Skipped plot &c" + plot.id);
|
||||
|
@ -52,7 +52,7 @@ public class SetOwner extends SubCommand {
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
final Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if ((plot == null) || (plot.owner == null)) {
|
||||
if ((plot == null) || (plot.owner_ == null)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class SetOwner extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.NEED_USER);
|
||||
return false;
|
||||
}
|
||||
if (!plot.owner.equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
||||
return false;
|
||||
}
|
||||
@ -75,9 +75,9 @@ public class SetOwner extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
||||
return false;
|
||||
}
|
||||
current.owner = uuid;
|
||||
current.owner_ = uuid;
|
||||
PlotSquared.updatePlot(current);
|
||||
DBFunc.setOwner(current, current.owner);
|
||||
DBFunc.setOwner(current, current.owner_);
|
||||
}
|
||||
MainUtil.setSign(args[0], plot);
|
||||
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||
|
@ -52,7 +52,7 @@ public class Swap extends SubCommand {
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class Swap extends SubCommand {
|
||||
try {
|
||||
plotid = new PlotId(Integer.parseInt(id.split(";")[0]), Integer.parseInt(id.split(";")[1]));
|
||||
final Plot plot2 = PlotSquared.getPlots(world).get(plotid);
|
||||
if (((plot2 == null) || !plot2.hasOwner() || (plot2.owner != UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
if (((plot2 == null) || !plot2.hasOwner() || !(plot2.owner_.equals(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PERM_MERGE, plotid.toString());
|
||||
return false;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class Trusted extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.getOwner().equals(UUIDHandler.getUUID(plr)) && !Permissions.hasPermission(plr, "plots.admin.command.trusted")) {
|
||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.trusted")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class Trusted extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!plot.trusted.contains(uuid)) {
|
||||
if (plot.owner.equals(uuid)) {
|
||||
if (plot.isOwner(uuid)) {
|
||||
MainUtil.sendMessage(plr, C.ALREADY_OWNER);
|
||||
return false;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class Unclaim extends SubCommand {
|
||||
if (!MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr)))) && !Permissions.hasPermission(plr, "plots.admin.command.unclaim")) {
|
||||
if ((((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID()))) && !Permissions.hasPermission(plr, "plots.admin.command.unclaim")) {
|
||||
return !sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
assert plot != null;
|
||||
|
@ -56,7 +56,7 @@ public class Unlink extends SubCommand {
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.unlink")) {
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.isOwner(plr.getUUID())) && !Permissions.hasPermission(plr, "plots.admin.command.unlink")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
if (MainUtil.getTopPlot(plot).equals(MainUtil.getBottomPlot(plot))) {
|
||||
@ -124,14 +124,14 @@ public class Unlink extends SubCommand {
|
||||
if (ly) {
|
||||
manager.createRoadSouth(plotworld, p);
|
||||
}
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
|
||||
MainUtil.setSign(UUIDHandler.getName(plot.owner_), plot);
|
||||
}
|
||||
}
|
||||
manager.finishPlotUnlink(plotworld, ids);
|
||||
for (final PlotId id : ids) {
|
||||
final Plot myPlot = MainUtil.getPlot(world, id);
|
||||
if (plot.hasOwner()) {
|
||||
final String name = UUIDHandler.getName(myPlot.owner);
|
||||
final String name = UUIDHandler.getName(myPlot.owner_);
|
||||
if (name != null) {
|
||||
MainUtil.setSign(name, myPlot);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class Visit extends SubCommand {
|
||||
public List<Plot> getPlots(final UUID uuid) {
|
||||
final List<Plot> plots = new ArrayList<>();
|
||||
for (final Plot p : PlotSquared.getPlots()) {
|
||||
if (p.hasOwner() && p.owner.equals(uuid)) {
|
||||
if (p.hasOwner() && p.isOwner(uuid)) {
|
||||
plots.add(p);
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class list extends SubCommand {
|
||||
case "unowned": {
|
||||
plots = new HashSet<>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.owner == null) {
|
||||
if (plot.owner_ == null) {
|
||||
plots.add(plot);
|
||||
}
|
||||
}
|
||||
@ -160,10 +160,10 @@ public class list extends SubCommand {
|
||||
case "unknown": {
|
||||
plots = new HashSet<>();
|
||||
for (Plot plot : PlotSquared.getPlots()) {
|
||||
if (plot.owner == null) {
|
||||
if (plot.owner_ == null) {
|
||||
continue;
|
||||
}
|
||||
if (UUIDHandler.getName(plot.owner) == null) {
|
||||
if (UUIDHandler.getName(plot.owner_) == null) {
|
||||
plots.add(plot);
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ public class list extends SubCommand {
|
||||
// This might work xD
|
||||
for (int x = (page * 12); x < max; x++) {
|
||||
p = (Plot) plots.toArray()[x];
|
||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner))).append("\n");
|
||||
string.append(C.PLOT_LIST_ITEM_ORDERED.s().replaceAll("%in", x + 1 + "").replaceAll("%id", p.id.toString()).replaceAll("%world", p.world).replaceAll("%owner", getName(p.owner_))).append("\n");
|
||||
}
|
||||
string.append(C.PLOT_LIST_FOOTER.s().replaceAll("%word%", "There is").replaceAll("%num%", plots.size() + "").replaceAll("%plot%", plots.size() == 1 ? "plot" : "plots"));
|
||||
MainUtil.sendMessage(player, string.toString());
|
||||
|
@ -138,6 +138,18 @@ public class Plot implements Cloneable {
|
||||
public boolean hasOwner() {
|
||||
return this.owner_ != null;
|
||||
}
|
||||
|
||||
public boolean isOwner(UUID uuid) {
|
||||
return PlotHandler.isOwner(this, uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of owner UUIDs for a plot (supports multi-owner mega-plots)
|
||||
* @return
|
||||
*/
|
||||
public HashSet<UUID> getOwners() {
|
||||
return PlotHandler.getOwners(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player is either the owner or on the helpers list
|
||||
@ -147,21 +159,7 @@ public class Plot implements Cloneable {
|
||||
* @return true if the player is added as a helper or is the owner
|
||||
*/
|
||||
public boolean isAdded(final UUID uuid) {
|
||||
if (this.owner_ == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.denied.contains(uuid)) {
|
||||
return false;
|
||||
}
|
||||
if (this.helpers.contains(uuid) || this.helpers.contains(DBFunc.everyone)) {
|
||||
return true;
|
||||
}
|
||||
if (this.trusted.contains(uuid) || this.trusted.contains(DBFunc.everyone)) {
|
||||
if (PlotHandler.isOnline(this)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return PlotHandler.isOwner(this, uuid);
|
||||
return PlotHandler.isAdded(this, uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -73,4 +74,22 @@ public class PlotHandler {
|
||||
owners.retainAll(getOwners(plot2));
|
||||
return owners.size() > 0;
|
||||
}
|
||||
|
||||
public static boolean isAdded(Plot plot, final UUID uuid) {
|
||||
if (plot.owner_ == null) {
|
||||
return false;
|
||||
}
|
||||
if (plot.denied.contains(uuid)) {
|
||||
return false;
|
||||
}
|
||||
if (plot.helpers.contains(uuid) || plot.helpers.contains(DBFunc.everyone)) {
|
||||
return true;
|
||||
}
|
||||
if (plot.trusted.contains(uuid) || plot.trusted.contains(DBFunc.everyone)) {
|
||||
if (PlotHandler.isOnline(plot)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return PlotHandler.isOwner(plot, uuid);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user