mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	Add server-plot flag, and option to disable on-claim teleportation
This commit is contained in:
		@@ -217,7 +217,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                final Plot plot = area.getOwnedPlot(id);
 | 
					                final Plot plot = area.getOwnedPlot(id);
 | 
				
			||||||
                if (plot != null) {
 | 
					                if (plot != null) {
 | 
				
			||||||
                    if (PlotPlayer.wrap(plot.owner) == null) {
 | 
					                    if (!MainUtil.isServerOwned(plot) || PlotPlayer.wrap(plot.getOwner()) == null) {
 | 
				
			||||||
                        if (world.getKeepSpawnInMemory()) {
 | 
					                        if (world.getKeepSpawnInMemory()) {
 | 
				
			||||||
                            world.setKeepSpawnInMemory(false);
 | 
					                            world.setKeepSpawnInMemory(false);
 | 
				
			||||||
                            return;
 | 
					                            return;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -156,9 +156,9 @@ import java.util.UUID;
 | 
				
			|||||||
                // Add any existing plots to the current cluster
 | 
					                // Add any existing plots to the current cluster
 | 
				
			||||||
                for (Plot plot : plots) {
 | 
					                for (Plot plot : plots) {
 | 
				
			||||||
                    if (plot.hasOwner()) {
 | 
					                    if (plot.hasOwner()) {
 | 
				
			||||||
                        if (!cluster.isAdded(plot.owner)) {
 | 
					                        if (!cluster.isAdded(plot.getOwner())) {
 | 
				
			||||||
                            cluster.invited.add(plot.owner);
 | 
					                            cluster.invited.add(plot.getOwner());
 | 
				
			||||||
                            DBFunc.setInvited(cluster, plot.owner);
 | 
					                            DBFunc.setInvited(cluster, plot.getOwner());
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,7 +91,7 @@ import java.util.UUID;
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            UUID uuid = player.getUUID();
 | 
					            UUID uuid = player.getUUID();
 | 
				
			||||||
            String name = MainUtil.getName(plot.owner);
 | 
					            String name = MainUtil.getName(plot.getOwner());
 | 
				
			||||||
            inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info",
 | 
					            inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info",
 | 
				
			||||||
                "&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name,
 | 
					                "&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name,
 | 
				
			||||||
                "&cAlias: &6" + plot.getAlias(),
 | 
					                "&cAlias: &6" + plot.getAlias(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -246,7 +246,7 @@ public class ListCmd extends SubCommand {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                plots = new ArrayList<>();
 | 
					                plots = new ArrayList<>();
 | 
				
			||||||
                for (Plot plot : PlotSquared.get().getPlots()) {
 | 
					                for (Plot plot : PlotSquared.get().getPlots()) {
 | 
				
			||||||
                    if (plot.owner == null) {
 | 
					                    if (plot.getOwner() == null) {
 | 
				
			||||||
                        plots.add(plot);
 | 
					                        plots.add(plot);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -259,10 +259,10 @@ public class ListCmd extends SubCommand {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                plots = new ArrayList<>();
 | 
					                plots = new ArrayList<>();
 | 
				
			||||||
                for (Plot plot : PlotSquared.get().getPlots()) {
 | 
					                for (Plot plot : PlotSquared.get().getPlots()) {
 | 
				
			||||||
                    if (plot.owner == null) {
 | 
					                    if (plot.getOwner() == null) {
 | 
				
			||||||
                        continue;
 | 
					                        continue;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (UUIDHandler.getName(plot.owner) == null) {
 | 
					                    if (UUIDHandler.getName(plot.getOwner()) == null) {
 | 
				
			||||||
                        plots.add(plot);
 | 
					                        plots.add(plot);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -352,7 +352,7 @@ public class ListCmd extends SubCommand {
 | 
				
			|||||||
            new RunnableVal3<Integer, Plot, PlotMessage>() {
 | 
					            new RunnableVal3<Integer, Plot, PlotMessage>() {
 | 
				
			||||||
                @Override public void run(Integer i, Plot plot, PlotMessage message) {
 | 
					                @Override public void run(Integer i, Plot plot, PlotMessage message) {
 | 
				
			||||||
                    String color;
 | 
					                    String color;
 | 
				
			||||||
                    if (plot.owner == null) {
 | 
					                    if (plot.getOwner() == null) {
 | 
				
			||||||
                        color = "$3";
 | 
					                        color = "$3";
 | 
				
			||||||
                    } else if (plot.isOwner(player.getUUID())) {
 | 
					                    } else if (plot.isOwner(player.getUUID())) {
 | 
				
			||||||
                        color = "$1";
 | 
					                        color = "$1";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -670,6 +670,8 @@ public enum Captions {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"),
 | 
					    NEVER("Never", "Info"), UNKNOWN("Unknown", "Info"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SERVER("Server", "Info"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    EVERYONE("Everyone", "Info"), PLOT_UNOWNED(
 | 
					    EVERYONE("Everyone", "Info"), PLOT_UNOWNED(
 | 
				
			||||||
        "$2The current plot must have an owner to perform this action", "Info"),
 | 
					        "$2The current plot must have an owner to perform this action", "Info"),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -290,6 +290,7 @@ public class Settings extends Config {
 | 
				
			|||||||
    public static final class Teleport {
 | 
					    public static final class Teleport {
 | 
				
			||||||
        @Comment("Teleport to your plot on death") public static boolean ON_DEATH = false;
 | 
					        @Comment("Teleport to your plot on death") public static boolean ON_DEATH = false;
 | 
				
			||||||
        @Comment("Teleport to your plot on login") public static boolean ON_LOGIN = false;
 | 
					        @Comment("Teleport to your plot on login") public static boolean ON_LOGIN = false;
 | 
				
			||||||
 | 
					        @Comment("Teleport to your plot on claim") public static boolean ON_CLAIM = true;
 | 
				
			||||||
        @Comment("Add a teleportation delay to all commands") public static int DELAY = 0;
 | 
					        @Comment("Add a teleportation delay to all commands") public static int DELAY = 0;
 | 
				
			||||||
        @Comment("The visit command is ordered by world instead of globally") public static boolean
 | 
					        @Comment("The visit command is ordered by world instead of globally") public static boolean
 | 
				
			||||||
            PER_WORLD_VISIT = false;
 | 
					            PER_WORLD_VISIT = false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ public class DBFunc {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    // TODO: Use this instead. public static final UUID EVERYONE = UUID.fromString("4aa2aaa4-c06b-485c-bc58-186aa1780d9b");
 | 
					    // TODO: Use this instead. public static final UUID EVERYONE = UUID.fromString("4aa2aaa4-c06b-485c-bc58-186aa1780d9b");
 | 
				
			||||||
    public static final UUID EVERYONE = UUID.fromString("1-1-3-3-7");
 | 
					    public static final UUID EVERYONE = UUID.fromString("1-1-3-3-7");
 | 
				
			||||||
 | 
					    public static final UUID SERVER = UUID.fromString("00000000-0000-0000-0000-000000000000");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Abstract Database Manager
 | 
					     * Abstract Database Manager
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,6 +29,7 @@ public final class Flags {
 | 
				
			|||||||
    public static final BooleanFlag TITLES = new BooleanFlag("titles");
 | 
					    public static final BooleanFlag TITLES = new BooleanFlag("titles");
 | 
				
			||||||
    public static final BooleanFlag NOTIFY_ENTER = new BooleanFlag("notify-enter");
 | 
					    public static final BooleanFlag NOTIFY_ENTER = new BooleanFlag("notify-enter");
 | 
				
			||||||
    public static final BooleanFlag HIDE_INFO = new BooleanFlag("hide-info");
 | 
					    public static final BooleanFlag HIDE_INFO = new BooleanFlag("hide-info");
 | 
				
			||||||
 | 
					    public static final BooleanFlag SERVER_PLOT = new BooleanFlag("server-plot");
 | 
				
			||||||
    public static final LongFlag TIME = new LongFlag("time");
 | 
					    public static final LongFlag TIME = new LongFlag("time");
 | 
				
			||||||
    public static final PlotWeatherFlag WEATHER = new PlotWeatherFlag("weather");
 | 
					    public static final PlotWeatherFlag WEATHER = new PlotWeatherFlag("weather");
 | 
				
			||||||
    public static final DoubleFlag PRICE = new DoubleFlag("price") {
 | 
					    public static final DoubleFlag PRICE = new DoubleFlag("price") {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -169,7 +169,7 @@ public class PlotListener {
 | 
				
			|||||||
                            replacements.put("%world%", plot.getArea().toString());
 | 
					                            replacements.put("%world%", plot.getArea().toString());
 | 
				
			||||||
                            replacements.put("%greeting%", greeting);
 | 
					                            replacements.put("%greeting%", greeting);
 | 
				
			||||||
                            replacements.put("%alias", plot.toString());
 | 
					                            replacements.put("%alias", plot.toString());
 | 
				
			||||||
                            replacements.put("%s", MainUtil.getName(plot.owner));
 | 
					                            replacements.put("%s", MainUtil.getName(plot.getOwner()));
 | 
				
			||||||
                            String main = StringMan
 | 
					                            String main = StringMan
 | 
				
			||||||
                                .replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements);
 | 
					                                .replaceFromMap(Captions.TITLE_ENTERED_PLOT.s(), replacements);
 | 
				
			||||||
                            String sub = StringMan
 | 
					                            String sub = StringMan
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,10 +53,12 @@ public class Plot {
 | 
				
			|||||||
    private static HashSet<RegionWrapper> regions_cache;
 | 
					    private static HashSet<RegionWrapper> regions_cache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final PlotId id;
 | 
					    private final PlotId id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * plot owner
 | 
					     * plot owner
 | 
				
			||||||
     * (Merged plots can have multiple owners)
 | 
					     * (Merged plots can have multiple owners)
 | 
				
			||||||
     * Direct access is Deprecated: use getOwners()
 | 
					     * Direct access is Deprecated: use getOwners()
 | 
				
			||||||
 | 
					     * @deprecated
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Deprecated public UUID owner;
 | 
					    @Deprecated public UUID owner;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -324,20 +326,33 @@ public class Plot {
 | 
				
			|||||||
     * @return if the provided uuid is the owner of the plot
 | 
					     * @return if the provided uuid is the owner of the plot
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public boolean isOwner(@Nonnull UUID uuid) {
 | 
					    public boolean isOwner(@Nonnull UUID uuid) {
 | 
				
			||||||
        if (uuid.equals(this.owner)) {
 | 
					        if (uuid.equals(this.getOwner())) {
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (!isMerged()) {
 | 
					        if (!isMerged()) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Set<Plot> connected = getConnectedPlots();
 | 
					        Set<Plot> connected = getConnectedPlots();
 | 
				
			||||||
        return connected.stream().anyMatch(current -> uuid.equals(current.owner));
 | 
					        return connected.stream().anyMatch(current -> uuid.equals(current.getOwner()));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean isOwnerAbs(UUID uuid) {
 | 
					    public boolean isOwnerAbs(UUID uuid) {
 | 
				
			||||||
        return uuid.equals(this.owner);
 | 
					        return uuid.equals(this.owner);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * plot owner
 | 
				
			||||||
 | 
					     * (Merged plots can have multiple owners)
 | 
				
			||||||
 | 
					     * Direct access is Deprecated: use getOwners()
 | 
				
			||||||
 | 
					     * @deprecated
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Deprecated public UUID getOwner() {
 | 
				
			||||||
 | 
					        if (MainUtil.isServerOwned(this)) {
 | 
				
			||||||
 | 
					            return DBFunc.SERVER;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return this.owner;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Gets a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots).
 | 
					     * Gets a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots).
 | 
				
			||||||
     * <p>
 | 
					     * <p>
 | 
				
			||||||
@@ -347,25 +362,25 @@ public class Plot {
 | 
				
			|||||||
     * @return the plot owners
 | 
					     * @return the plot owners
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public Set<UUID> getOwners() {
 | 
					    public Set<UUID> getOwners() {
 | 
				
			||||||
        if (this.owner == null) {
 | 
					        if (this.getOwner() == null) {
 | 
				
			||||||
            return ImmutableSet.of();
 | 
					            return ImmutableSet.of();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (isMerged()) {
 | 
					        if (isMerged()) {
 | 
				
			||||||
            Set<Plot> plots = getConnectedPlots();
 | 
					            Set<Plot> plots = getConnectedPlots();
 | 
				
			||||||
            Plot[] array = plots.toArray(new Plot[plots.size()]);
 | 
					            Plot[] array = plots.toArray(new Plot[plots.size()]);
 | 
				
			||||||
            ImmutableSet.Builder<UUID> owners = ImmutableSet.builder();
 | 
					            ImmutableSet.Builder<UUID> owners = ImmutableSet.builder();
 | 
				
			||||||
            UUID last = this.owner;
 | 
					            UUID last = this.getOwner();
 | 
				
			||||||
            owners.add(this.owner);
 | 
					            owners.add(this.getOwner());
 | 
				
			||||||
            for (Plot current : array) {
 | 
					            for (Plot current : array) {
 | 
				
			||||||
                if (last == null || current.owner.getMostSignificantBits() != last
 | 
					                if (last == null || current.getOwner().getMostSignificantBits() != last
 | 
				
			||||||
                    .getMostSignificantBits()) {
 | 
					                    .getMostSignificantBits()) {
 | 
				
			||||||
                    owners.add(current.owner);
 | 
					                    owners.add(current.getOwner());
 | 
				
			||||||
                    last = current.owner;
 | 
					                    last = current.getOwner();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return owners.build();
 | 
					            return owners.build();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return ImmutableSet.of(this.owner);
 | 
					        return ImmutableSet.of(this.getOwner());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -1443,7 +1458,7 @@ public class Plot {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        setSign(player.getName());
 | 
					        setSign(player.getName());
 | 
				
			||||||
        MainUtil.sendMessage(player, Captions.CLAIMED);
 | 
					        MainUtil.sendMessage(player, Captions.CLAIMED);
 | 
				
			||||||
        if (teleport) {
 | 
					        if (teleport && Settings.Teleport.ON_CLAIM) {
 | 
				
			||||||
            teleportPlayer(player);
 | 
					            teleportPlayer(player);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        PlotArea plotworld = getArea();
 | 
					        PlotArea plotworld = getArea();
 | 
				
			||||||
@@ -1579,7 +1594,7 @@ public class Plot {
 | 
				
			|||||||
        if (plot == null) {
 | 
					        if (plot == null) {
 | 
				
			||||||
            this.moveData(plot, whenDone);
 | 
					            this.moveData(plot, whenDone);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        } else if (plot.owner == null) {
 | 
					        } else if (plot.getOwner() == null) {
 | 
				
			||||||
            this.moveData(plot, whenDone);
 | 
					            this.moveData(plot, whenDone);
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -2979,7 +2994,7 @@ public class Plot {
 | 
				
			|||||||
        // copy data
 | 
					        // copy data
 | 
				
			||||||
        for (Plot plot : plots) {
 | 
					        for (Plot plot : plots) {
 | 
				
			||||||
            Plot other = plot.getRelative(destination.getArea(), offset.x, offset.y);
 | 
					            Plot other = plot.getRelative(destination.getArea(), offset.x, offset.y);
 | 
				
			||||||
            other.create(plot.owner, false);
 | 
					            other.create(plot.getOwner(), false);
 | 
				
			||||||
            if (!plot.getFlags().isEmpty()) {
 | 
					            if (!plot.getFlags().isEmpty()) {
 | 
				
			||||||
                other.getSettings().flags = plot.getFlags();
 | 
					                other.getSettings().flags = plot.getFlags();
 | 
				
			||||||
                DBFunc.setFlags(other, plot.getFlags());
 | 
					                DBFunc.setFlags(other, plot.getFlags());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ public class InboxOwner extends CommentInbox {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override public boolean addComment(Plot plot, PlotComment comment) {
 | 
					    @Override public boolean addComment(Plot plot, PlotComment comment) {
 | 
				
			||||||
        if (plot.owner == null) {
 | 
					        if (plot.getOwner() == null) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        plot.addComment(comment);
 | 
					        plot.addComment(comment);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ public class InboxReport extends CommentInbox {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override public boolean addComment(Plot plot, PlotComment comment) {
 | 
					    @Override public boolean addComment(Plot plot, PlotComment comment) {
 | 
				
			||||||
        if (plot.owner == null) {
 | 
					        if (plot.getOwner() == null) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        DBFunc.setComment(plot, comment);
 | 
					        DBFunc.setComment(plot, comment);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -335,6 +335,9 @@ public class MainUtil {
 | 
				
			|||||||
        if (owner.equals(DBFunc.EVERYONE)) {
 | 
					        if (owner.equals(DBFunc.EVERYONE)) {
 | 
				
			||||||
            return Captions.EVERYONE.s();
 | 
					            return Captions.EVERYONE.s();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (owner.equals(DBFunc.SERVER)) {
 | 
				
			||||||
 | 
					            return Captions.SERVER.s();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        String name = UUIDHandler.getName(owner);
 | 
					        String name = UUIDHandler.getName(owner);
 | 
				
			||||||
        if (name == null) {
 | 
					        if (name == null) {
 | 
				
			||||||
            return Captions.UNKNOWN.s();
 | 
					            return Captions.UNKNOWN.s();
 | 
				
			||||||
@@ -342,6 +345,10 @@ public class MainUtil {
 | 
				
			|||||||
        return name;
 | 
					        return name;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static boolean isServerOwned(Plot plot) {
 | 
				
			||||||
 | 
					        return plot.getFlag(Flags.SERVER_PLOT).orElse(false);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Get the corner locations for a list of regions.
 | 
					     * Get the corner locations for a list of regions.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
package com.github.intellectualsites.plotsquared.plot.util;
 | 
					package com.github.intellectualsites.plotsquared.plot.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
 | 
					import com.github.intellectualsites.plotsquared.plot.PlotSquared;
 | 
				
			||||||
 | 
					import com.github.intellectualsites.plotsquared.plot.config.Captions;
 | 
				
			||||||
 | 
					import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
 | 
				
			||||||
import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
 | 
					import com.github.intellectualsites.plotsquared.plot.object.OfflinePlotPlayer;
 | 
				
			||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
 | 
					import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
 | 
				
			||||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
 | 
					import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
 | 
				
			||||||
@@ -98,6 +100,9 @@ public class UUIDHandler {
 | 
				
			|||||||
        if (implementation == null) {
 | 
					        if (implementation == null) {
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (uuid.equals(DBFunc.SERVER)) {
 | 
				
			||||||
 | 
					            return Captions.SERVER.s();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return implementation.getName(uuid);
 | 
					        return implementation.getName(uuid);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,9 +160,15 @@ public class ExpireManager {
 | 
				
			|||||||
                applicable.add(et);
 | 
					                applicable.add(et);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (applicable.isEmpty()) {
 | 
					        if (applicable.isEmpty()) {
 | 
				
			||||||
            return new ArrayList<>();
 | 
					            return new ArrayList<>();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (MainUtil.isServerOwned(plot)) {
 | 
				
			||||||
 | 
					            return new ArrayList<>();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        boolean shouldCheckAccountAge = false;
 | 
					        boolean shouldCheckAccountAge = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        long diff = getAge(plot);
 | 
					        long diff = getAge(plot);
 | 
				
			||||||
@@ -366,12 +372,12 @@ public class ExpireManager {
 | 
				
			|||||||
        int changes = changed == null ? 0 : changed.changes_sd;
 | 
					        int changes = changed == null ? 0 : changed.changes_sd;
 | 
				
			||||||
        int modified = changed == null ? 0 : changed.changes;
 | 
					        int modified = changed == null ? 0 : changed.changes;
 | 
				
			||||||
        PlotSquared.debug(
 | 
					        PlotSquared.debug(
 | 
				
			||||||
            "$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.owner
 | 
					            "$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " User:" + plot.getOwner()
 | 
				
			||||||
                + " Delta:" + changes + "/" + modified + " Connected: " + StringMan
 | 
					                + " Delta:" + changes + "/" + modified + " Connected: " + StringMan
 | 
				
			||||||
                .getString(plots));
 | 
					                .getString(plots));
 | 
				
			||||||
        PlotSquared.debug("$4 - Area: " + plot.getArea());
 | 
					        PlotSquared.debug("$4 - Area: " + plot.getArea());
 | 
				
			||||||
        if (plot.hasOwner()) {
 | 
					        if (plot.hasOwner()) {
 | 
				
			||||||
            PlotSquared.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
 | 
					            PlotSquared.debug("$4 - Owner: " + UUIDHandler.getName(plot.getOwner()));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            PlotSquared.debug("$4 - Owner: Unowned");
 | 
					            PlotSquared.debug("$4 - Owner: Unowned");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -406,8 +412,8 @@ public class ExpireManager {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public long getAccountAge(Plot plot) {
 | 
					    public long getAccountAge(Plot plot) {
 | 
				
			||||||
        if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.owner)
 | 
					        if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.getOwner())
 | 
				
			||||||
            || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
 | 
					            || UUIDHandler.getPlayer(plot.getOwner()) != null || plot.getRunning() > 0) {
 | 
				
			||||||
            return Long.MAX_VALUE;
 | 
					            return Long.MAX_VALUE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        long max = 0;
 | 
					        long max = 0;
 | 
				
			||||||
@@ -419,8 +425,8 @@ public class ExpireManager {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public long getAge(Plot plot) {
 | 
					    public long getAge(Plot plot) {
 | 
				
			||||||
        if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.owner)
 | 
					        if (!plot.hasOwner() || Objects.equals(DBFunc.EVERYONE, plot.getOwner())
 | 
				
			||||||
            || UUIDHandler.getPlayer(plot.owner) != null || plot.getRunning() > 0) {
 | 
					            || UUIDHandler.getPlayer(plot.getOwner()) != null || plot.getRunning() > 0) {
 | 
				
			||||||
            return 0;
 | 
					            return 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Optional<?> keep = plot.getFlag(Flags.KEEP);
 | 
					        Optional<?> keep = plot.getFlag(Flags.KEEP);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -90,7 +90,7 @@ public class PlayerEvents extends PlotListener implements Listener {
 | 
				
			|||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (Settings.Redstone.DISABLE_OFFLINE) {
 | 
					            if (Settings.Redstone.DISABLE_OFFLINE) {
 | 
				
			||||||
                if (UUIDHandler.getPlayer(plot.owner) == null) {
 | 
					                if (UUIDHandler.getPlayer(plot.getOwner()) == null) {
 | 
				
			||||||
                    boolean disable = true;
 | 
					                    boolean disable = true;
 | 
				
			||||||
                    for (UUID trusted : plot.getTrusted()) {
 | 
					                    for (UUID trusted : plot.getTrusted()) {
 | 
				
			||||||
                        if (UUIDHandler.getPlayer(trusted) != null) {
 | 
					                        if (UUIDHandler.getPlayer(trusted) != null) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user