mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking
This commit is contained in:
		@@ -19,7 +19,7 @@ import java.util.UUID;
 | 
				
			|||||||
@CommandDeclaration(command = "add",
 | 
					@CommandDeclaration(command = "add",
 | 
				
			||||||
    description = "Allow a user to build in a plot while you are online",
 | 
					    description = "Allow a user to build in a plot while you are online",
 | 
				
			||||||
    usage = "/plot add <player>", category = CommandCategory.SETTINGS, permission = "plots.add",
 | 
					    usage = "/plot add <player>", category = CommandCategory.SETTINGS, permission = "plots.add",
 | 
				
			||||||
    requiredType = RequiredType.NONE) public class Add extends Command {
 | 
					    requiredType = RequiredType.PLAYER) public class Add extends Command {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Add() {
 | 
					    public Add() {
 | 
				
			||||||
        super(MainCommand.getInstance(), true);
 | 
					        super(MainCommand.getInstance(), true);
 | 
				
			||||||
@@ -63,21 +63,19 @@ import java.util.UUID;
 | 
				
			|||||||
        checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions
 | 
					        checkTrue(size <= plot.getArea().MAX_PLOT_MEMBERS || Permissions
 | 
				
			||||||
                .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
 | 
					                .hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_TRUST),
 | 
				
			||||||
            Captions.PLOT_MAX_MEMBERS);
 | 
					            Captions.PLOT_MAX_MEMBERS);
 | 
				
			||||||
        confirm.run(this, new Runnable() {
 | 
					        // Success
 | 
				
			||||||
            @Override // Success
 | 
					        confirm.run(this, () -> {
 | 
				
			||||||
            public void run() {
 | 
					            for (UUID uuid : uuids) {
 | 
				
			||||||
                for (UUID uuid : uuids) {
 | 
					                if (uuid != DBFunc.EVERYONE) {
 | 
				
			||||||
                    if (uuid != DBFunc.EVERYONE) {
 | 
					                    if (!plot.removeTrusted(uuid)) {
 | 
				
			||||||
                        if (!plot.removeTrusted(uuid)) {
 | 
					                        if (plot.getDenied().contains(uuid)) {
 | 
				
			||||||
                            if (plot.getDenied().contains(uuid)) {
 | 
					                            plot.removeDenied(uuid);
 | 
				
			||||||
                                plot.removeDenied(uuid);
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    plot.addMember(uuid);
 | 
					 | 
				
			||||||
                    EventUtil.manager.callMember(player, plot, uuid, true);
 | 
					 | 
				
			||||||
                    MainUtil.sendMessage(player, Captions.MEMBER_ADDED);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                plot.addMember(uuid);
 | 
				
			||||||
 | 
					                EventUtil.manager.callMember(player, plot, uuid, true);
 | 
				
			||||||
 | 
					                MainUtil.sendMessage(player, Captions.MEMBER_ADDED);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }, null);
 | 
					        }, null);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,8 +25,12 @@ public class Auto extends SubCommand {
 | 
				
			|||||||
        if (allowedPlots == null) {
 | 
					        if (allowedPlots == null) {
 | 
				
			||||||
            allowedPlots = player.getAllowedPlots();
 | 
					            allowedPlots = player.getAllowedPlots();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        int currentPlots =
 | 
					        int currentPlots;
 | 
				
			||||||
            Settings.Limit.GLOBAL ? player.getPlotCount() : player.getPlotCount(plotarea.worldname);
 | 
					        if (Settings.Limit.GLOBAL) {
 | 
				
			||||||
 | 
					            currentPlots = player.getPlotCount();
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            currentPlots = player.getPlotCount(plotarea.worldname);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        int diff = currentPlots - allowedPlots;
 | 
					        int diff = currentPlots - allowedPlots;
 | 
				
			||||||
        if (diff + sizeX * sizeZ > 0) {
 | 
					        if (diff + sizeX * sizeZ > 0) {
 | 
				
			||||||
            if (diff < 0) {
 | 
					            if (diff < 0) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,11 +27,9 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
 | 
				
			|||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        plot.addRunning();
 | 
					        plot.addRunning();
 | 
				
			||||||
        plot.setBiome(value.toUpperCase(), new Runnable() {
 | 
					        plot.setBiome(value.toUpperCase(), () -> {
 | 
				
			||||||
            @Override public void run() {
 | 
					            plot.removeRunning();
 | 
				
			||||||
                plot.removeRunning();
 | 
					            MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase());
 | 
				
			||||||
                MainUtil.sendMessage(player, Captions.BIOME_SET_TO.s() + value.toLowerCase());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,13 +126,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
 | 
				
			|||||||
                            }
 | 
					                            }
 | 
				
			||||||
                            i++;
 | 
					                            i++;
 | 
				
			||||||
                            final AtomicBoolean result = new AtomicBoolean(false);
 | 
					                            final AtomicBoolean result = new AtomicBoolean(false);
 | 
				
			||||||
                            result.set(origin.move(possible, new Runnable() {
 | 
					                            result.set(origin.move(possible, () -> {
 | 
				
			||||||
                                @Override public void run() {
 | 
					                                if (result.get()) {
 | 
				
			||||||
                                    if (result.get()) {
 | 
					                                    MainUtil.sendMessage(player,
 | 
				
			||||||
                                        MainUtil.sendMessage(player,
 | 
					                                        "Moving: " + origin + " -> " + possible);
 | 
				
			||||||
                                            "Moving: " + origin + " -> " + possible);
 | 
					                                    TaskManager.runTaskLater(task, 1);
 | 
				
			||||||
                                        TaskManager.runTaskLater(task, 1);
 | 
					 | 
				
			||||||
                                    }
 | 
					 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }, false));
 | 
					                            }, false));
 | 
				
			||||||
                            if (result.get()) {
 | 
					                            if (result.get()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,7 +16,7 @@ import java.util.UUID;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@CommandDeclaration(command = "deny", aliases = {"d", "ban"},
 | 
					@CommandDeclaration(command = "deny", aliases = {"d", "ban"},
 | 
				
			||||||
    description = "Deny a user from a plot", usage = "/plot deny <player>",
 | 
					    description = "Deny a user from a plot", usage = "/plot deny <player>",
 | 
				
			||||||
    category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE) public class Deny
 | 
					    category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Deny
 | 
				
			||||||
    extends SubCommand {
 | 
					    extends SubCommand {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Deny() {
 | 
					    public Deny() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,8 +38,12 @@ import java.util.UUID;
 | 
				
			|||||||
                if (args.length > 2) {
 | 
					                if (args.length > 2) {
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                final UUID uuid =
 | 
					                final UUID uuid;
 | 
				
			||||||
                    args.length == 2 ? UUIDHandler.getUUIDFromString(args[1]) : player.getUUID();
 | 
					                if (args.length == 2) {
 | 
				
			||||||
 | 
					                    uuid = UUIDHandler.getUUIDFromString(args[1]);
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    uuid = player.getUUID();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                if (uuid == null) {
 | 
					                if (uuid == null) {
 | 
				
			||||||
                    Captions.INVALID_PLAYER.send(player, args[1]);
 | 
					                    Captions.INVALID_PLAYER.send(player, args[1]);
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
@@ -47,12 +51,20 @@ import java.util.UUID;
 | 
				
			|||||||
                MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal<byte[]>() {
 | 
					                MainUtil.getPersistentMeta(uuid, "grantedPlots", new RunnableVal<byte[]>() {
 | 
				
			||||||
                    @Override public void run(byte[] array) {
 | 
					                    @Override public void run(byte[] array) {
 | 
				
			||||||
                        if (arg0.equals("check")) { // check
 | 
					                        if (arg0.equals("check")) { // check
 | 
				
			||||||
                            int granted =
 | 
					                            int granted;
 | 
				
			||||||
                                array == null ? 0 : ByteArrayUtilities.bytesToInteger(array);
 | 
					                            if (array == null) {
 | 
				
			||||||
 | 
					                                granted = 0;
 | 
				
			||||||
 | 
					                            } else {
 | 
				
			||||||
 | 
					                                granted = ByteArrayUtilities.bytesToInteger(array);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                            Captions.GRANTED_PLOTS.send(player, granted);
 | 
					                            Captions.GRANTED_PLOTS.send(player, granted);
 | 
				
			||||||
                        } else { // add
 | 
					                        } else { // add
 | 
				
			||||||
                            int amount =
 | 
					                            int amount;
 | 
				
			||||||
                                1 + (array == null ? 0 : ByteArrayUtilities.bytesToInteger(array));
 | 
					                            if (array == null) {
 | 
				
			||||||
 | 
					                                amount = 1;
 | 
				
			||||||
 | 
					                            } else {
 | 
				
			||||||
 | 
					                                amount = 1 + ByteArrayUtilities.bytesToInteger(array);
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
                            boolean replace = array != null;
 | 
					                            boolean replace = array != null;
 | 
				
			||||||
                            String key = "grantedPlots";
 | 
					                            String key = "grantedPlots";
 | 
				
			||||||
                            byte[] rawData = ByteArrayUtilities.integerToBytes(amount);
 | 
					                            byte[] rawData = ByteArrayUtilities.integerToBytes(amount);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ import java.util.List;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@CommandDeclaration(command = "inbox", description = "Review the comments for a plot",
 | 
					@CommandDeclaration(command = "inbox", description = "Review the comments for a plot",
 | 
				
			||||||
    usage = "/plot inbox [inbox] [delete <index>|clear|page]", permission = "plots.inbox",
 | 
					    usage = "/plot inbox [inbox] [delete <index>|clear|page]", permission = "plots.inbox",
 | 
				
			||||||
    category = CommandCategory.CHAT, requiredType = RequiredType.NONE) public class Inbox
 | 
					    category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) public class Inbox
 | 
				
			||||||
    extends SubCommand {
 | 
					    extends SubCommand {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
 | 
					    public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
 | 
				
			||||||
@@ -23,7 +23,7 @@ import java.util.List;
 | 
				
			|||||||
            MainUtil.sendMessage(player, Captions.INBOX_EMPTY);
 | 
					            MainUtil.sendMessage(player, Captions.INBOX_EMPTY);
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        PlotComment[] comments = oldComments.toArray(new PlotComment[oldComments.size()]);
 | 
					        PlotComment[] comments = oldComments.toArray(new PlotComment[0]);
 | 
				
			||||||
        if (page < 0) {
 | 
					        if (page < 0) {
 | 
				
			||||||
            page = 0;
 | 
					            page = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,9 +130,15 @@ import java.util.UUID;
 | 
				
			|||||||
        if (arg != null) {
 | 
					        if (arg != null) {
 | 
				
			||||||
            info = getCaption(arg);
 | 
					            info = getCaption(arg);
 | 
				
			||||||
            if (info == null) {
 | 
					            if (info == null) {
 | 
				
			||||||
                MainUtil.sendMessage(player,
 | 
					                if (Settings.Ratings.USE_LIKES) {
 | 
				
			||||||
                    "&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
 | 
					                    MainUtil.sendMessage(player,
 | 
				
			||||||
                        + "&aowner&7, " + (Settings.Ratings.USE_LIKES ? " &alikes" : " &arating"));
 | 
					                        "&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
 | 
				
			||||||
 | 
					                            + "&aowner&7, " + " &alikes");
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    MainUtil.sendMessage(player,
 | 
				
			||||||
 | 
					                        "&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
 | 
				
			||||||
 | 
					                            + "&aowner&7, " + " &arating");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            full = true;
 | 
					            full = true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ import java.util.UUID;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@CommandDeclaration(command = "kick", aliases = {"k"}, description = "Kick a player from your plot",
 | 
					@CommandDeclaration(command = "kick", aliases = {"k"}, description = "Kick a player from your plot",
 | 
				
			||||||
    permission = "plots.kick", usage = "/plot kick <player>", category = CommandCategory.TELEPORT,
 | 
					    permission = "plots.kick", usage = "/plot kick <player>", category = CommandCategory.TELEPORT,
 | 
				
			||||||
    requiredType = RequiredType.NONE) public class Kick extends SubCommand {
 | 
					    requiredType = RequiredType.PLAYER) public class Kick extends SubCommand {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public Kick() {
 | 
					    public Kick() {
 | 
				
			||||||
        super(Argument.PlayerName);
 | 
					        super(Argument.PlayerName);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,8 +96,11 @@ public class Like extends SubCommand {
 | 
				
			|||||||
            final Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating));
 | 
					            final Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating));
 | 
				
			||||||
            if (result != null) {
 | 
					            if (result != null) {
 | 
				
			||||||
                plot.addRating(uuid, result);
 | 
					                plot.addRating(uuid, result);
 | 
				
			||||||
                sendMessage(player, like ? Captions.RATING_LIKED : Captions.RATING_DISLIKED,
 | 
					                if (like) {
 | 
				
			||||||
                    plot.getId().toString());
 | 
					                    sendMessage(player, Captions.RATING_LIKED, plot.getId().toString());
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    sendMessage(player, Captions.RATING_DISLIKED, plot.getId().toString());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        if (plot.getSettings().ratings == null) {
 | 
					        if (plot.getSettings().ratings == null) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
 | 
				
			|||||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
 | 
					import com.github.intellectualsites.plotsquared.plot.util.Permissions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots",
 | 
					@CommandDeclaration(usage = "/plot swap <X;Z>", command = "swap", description = "Swap two plots",
 | 
				
			||||||
    aliases = {"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.NONE)
 | 
					    aliases = {"switch"}, category = CommandCategory.CLAIMING, requiredType = RequiredType.PLAYER)
 | 
				
			||||||
public class Swap extends SubCommand {
 | 
					public class Swap extends SubCommand {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override public boolean onCommand(final PlotPlayer player, String[] args) {
 | 
					    @Override public boolean onCommand(final PlotPlayer player, String[] args) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,8 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
 | 
				
			|||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
 | 
					import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
 | 
				
			||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
 | 
					import com.github.intellectualsites.plotsquared.plot.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@CommandDeclaration(command = "unlink", aliases = {"u", "unmerge"},
 | 
					@CommandDeclaration(command = "unlink", aliases = {"u",
 | 
				
			||||||
    description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", requiredType = RequiredType.PLAYER, category = CommandCategory.SETTINGS, confirmation = true)
 | 
					    "unmerge"}, description = "Unlink a mega-plot", usage = "/plot unlink [createroads]", requiredType = RequiredType.PLAYER, category = CommandCategory.SETTINGS, confirmation = true)
 | 
				
			||||||
public class Unlink extends SubCommand {
 | 
					public class Unlink extends SubCommand {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override public boolean onCommand(final PlotPlayer player, String[] args) {
 | 
					    @Override public boolean onCommand(final PlotPlayer player, String[] args) {
 | 
				
			||||||
@@ -38,14 +38,12 @@ public class Unlink extends SubCommand {
 | 
				
			|||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            createRoad = true;
 | 
					            createRoad = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        Runnable runnable = new Runnable() {
 | 
					        Runnable runnable = () -> {
 | 
				
			||||||
            @Override public void run() {
 | 
					            if (!plot.unlinkPlot(createRoad, createRoad)) {
 | 
				
			||||||
                if (!plot.unlinkPlot(createRoad, createRoad)) {
 | 
					                MainUtil.sendMessage(player, "&cUnlink has been cancelled");
 | 
				
			||||||
                    MainUtil.sendMessage(player, "&cUnlink has been cancelled");
 | 
					                return;
 | 
				
			||||||
                    return;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS);
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            MainUtil.sendMessage(player, Captions.UNLINK_SUCCESS);
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        if (hasConfirmation(player)) {
 | 
					        if (hasConfirmation(player)) {
 | 
				
			||||||
            CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable);
 | 
					            CmdConfirm.addPending(player, "/plot unlink " + plot.getId(), runnable);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user