mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 11:13:45 +01:00 
			
		
		
		
	Version number fixes, fixed documentation, new caption added, and tweaks to API functionality.
This commit is contained in:
		@@ -132,8 +132,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
 | 
			
		||||
        // Check for updates
 | 
			
		||||
        if (PlotSquared.get().getUpdateUtility() != null) {
 | 
			
		||||
            final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
 | 
			
		||||
            updateUtility
 | 
			
		||||
                .checkForUpdate(this.getPluginVersionString(), ((updateDescription, throwable) -> {
 | 
			
		||||
            updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(),
 | 
			
		||||
                ((updateDescription, throwable) -> {
 | 
			
		||||
                    Bukkit.getScheduler().runTask(BukkitMain.this, () -> {
 | 
			
		||||
                        getLogger().info("-------- PlotSquared Update Check --------");
 | 
			
		||||
                        if (throwable != null) {
 | 
			
		||||
@@ -803,4 +803,5 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
 | 
			
		||||
    @Override public LegacyMappings getLegacyMappings() {
 | 
			
		||||
        return this.legacyMappings;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -642,7 +642,7 @@ import java.util.regex.Pattern;
 | 
			
		||||
            && PlotSquared.get().getUpdateUtility() != null) {
 | 
			
		||||
            final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
 | 
			
		||||
            final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class);
 | 
			
		||||
            updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(),
 | 
			
		||||
            updateUtility.checkForUpdate(PlotSquared.get().getVersion().versionString(),
 | 
			
		||||
                ((updateDescription, throwable) -> {
 | 
			
		||||
                    if (throwable != null) {
 | 
			
		||||
                        bukkitMain.getLogger().severe(String
 | 
			
		||||
 
 | 
			
		||||
@@ -63,12 +63,12 @@ public interface IPlotMain extends ILogger {
 | 
			
		||||
     */
 | 
			
		||||
    String getPluginVersionString();
 | 
			
		||||
 | 
			
		||||
    String getPluginName();
 | 
			
		||||
    default String getPluginName() {
 | 
			
		||||
        return "PlotSquared";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the version of Minecraft that is running.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    int[] getServerVersion();
 | 
			
		||||
 | 
			
		||||
@@ -101,7 +101,7 @@ public interface IPlotMain extends ILogger {
 | 
			
		||||
    /**
 | 
			
		||||
     * The task manager will run and manage Minecraft tasks.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     * @return the PlotSquared task manager
 | 
			
		||||
     */
 | 
			
		||||
    TaskManager getTaskManager();
 | 
			
		||||
 | 
			
		||||
@@ -138,49 +138,39 @@ public interface IPlotMain extends ILogger {
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the economy provider.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     * @return the PlotSquared economy manager
 | 
			
		||||
     */
 | 
			
		||||
    EconHandler getEconomyHandler();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the {@link QueueProvider} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    QueueProvider initBlockQueue();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the {@link WorldUtil} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    WorldUtil initWorldUtil();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the EventUtil class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    EventUtil initEventUtil();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the chunk manager.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     * @return the PlotSquared chunk manager
 | 
			
		||||
     */
 | 
			
		||||
    ChunkManager initChunkManager();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the {@link SetupUtils} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    SetupUtils initSetupUtils();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets {@link HybridUtils} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    HybridUtils initHybridUtils();
 | 
			
		||||
 | 
			
		||||
@@ -199,32 +189,28 @@ public interface IPlotMain extends ILogger {
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the {@link UUIDHandlerImplementation} which will cache and
 | 
			
		||||
     * provide UUIDs.
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    UUIDHandlerImplementation initUUIDHandler();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the {@link InventoryUtil} class (used for implementation specific
 | 
			
		||||
     * inventory guis).
 | 
			
		||||
     *
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    InventoryUtil initInventoryUtil();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Unregisters a {@link PlotPlayer} from cache e.g. if they have logged off.
 | 
			
		||||
     *
 | 
			
		||||
     * @param player
 | 
			
		||||
     * @param player the player to remove
 | 
			
		||||
     */
 | 
			
		||||
    void unregister(PlotPlayer player);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the generator wrapper for a world (world) and generator (name).
 | 
			
		||||
     *
 | 
			
		||||
     * @param world
 | 
			
		||||
     * @param name
 | 
			
		||||
     * @return
 | 
			
		||||
     * @param world the world to get the generator from
 | 
			
		||||
     * @param name the name of the generator
 | 
			
		||||
     * @return the generator being used for the provided world
 | 
			
		||||
     */
 | 
			
		||||
    GeneratorWrapper<?> getGenerator(String world, String name);
 | 
			
		||||
 | 
			
		||||
@@ -232,7 +218,7 @@ public interface IPlotMain extends ILogger {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register the chunk processor which will clean out chunks that have too
 | 
			
		||||
     * many blockstates or entities.
 | 
			
		||||
     * many block states or entities.
 | 
			
		||||
     */
 | 
			
		||||
    void registerChunkProcessor();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,8 +33,8 @@ import com.sk89q.worldedit.WorldEdit;
 | 
			
		||||
import lombok.Getter;
 | 
			
		||||
import lombok.NonNull;
 | 
			
		||||
import lombok.Setter;
 | 
			
		||||
 | 
			
		||||
import org.jetbrains.annotations.Nullable;
 | 
			
		||||
 | 
			
		||||
import java.io.*;
 | 
			
		||||
import java.net.MalformedURLException;
 | 
			
		||||
import java.net.URISyntaxException;
 | 
			
		||||
@@ -1623,7 +1623,7 @@ import java.util.zip.ZipInputStream;
 | 
			
		||||
                final Properties properties = new Properties();
 | 
			
		||||
                properties.load(bufferedReader);
 | 
			
		||||
                final boolean enabled =
 | 
			
		||||
                    Boolean.valueOf(properties.getOrDefault("enabled", true).toString());
 | 
			
		||||
                    Boolean.parseBoolean(properties.getOrDefault("enabled", true).toString());
 | 
			
		||||
                if (enabled) {
 | 
			
		||||
                    this.updateUtility = new UpdateUtility(properties.getProperty("path"),
 | 
			
		||||
                        properties.getProperty("job"), properties.getProperty("artifact"));
 | 
			
		||||
 
 | 
			
		||||
@@ -30,6 +30,13 @@ public class PlotVersion {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String versionString() {
 | 
			
		||||
        if (hash == 0 && build == 0) {
 | 
			
		||||
            return "NoVer-SNAPSHOT";
 | 
			
		||||
        } else {
 | 
			
		||||
            return "4." + build;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    @Override public String toString() {
 | 
			
		||||
        if (hash == 0 && build == 0) {
 | 
			
		||||
            return "PlotSquared-NoVer-SNAPSHOT";
 | 
			
		||||
 
 | 
			
		||||
@@ -14,9 +14,8 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@CommandDeclaration(command = "inbox", description = "Review the comments for a plot",
 | 
			
		||||
    usage = "/plot inbox [inbox] [delete <index>|clear|page]", permission = "plots.inbox",
 | 
			
		||||
    category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER) public class Inbox
 | 
			
		||||
    extends SubCommand {
 | 
			
		||||
    usage = "/plot inbox [inbox] [delete <index>|clear|page]", permission = "plots.inbox", category = CommandCategory.CHAT, requiredType = RequiredType.PLAYER)
 | 
			
		||||
public class Inbox extends SubCommand {
 | 
			
		||||
 | 
			
		||||
    public void displayComments(PlotPlayer player, List<PlotComment> oldComments, int page) {
 | 
			
		||||
        if (oldComments == null || oldComments.isEmpty()) {
 | 
			
		||||
@@ -150,12 +149,13 @@ import java.util.List;
 | 
			
		||||
                            PlotComment comment = value.get(index - 1);
 | 
			
		||||
                            inbox.removeComment(plot, comment);
 | 
			
		||||
                            boolean success = plot.removeComment(comment);
 | 
			
		||||
                            //noinspection StatementWithEmptyBody
 | 
			
		||||
                            if (success) {
 | 
			
		||||
                                MainUtil
 | 
			
		||||
                                    .sendMessage(player, Captions.COMMENT_REMOVED, comment.comment);
 | 
			
		||||
                                MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS,
 | 
			
		||||
                                    comment.comment);
 | 
			
		||||
                            } else {
 | 
			
		||||
                                //TODO Comment removal failure message
 | 
			
		||||
                                MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_FAILURE,
 | 
			
		||||
                                    comment.comment);
 | 
			
		||||
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    })) {
 | 
			
		||||
@@ -172,7 +172,7 @@ import java.util.List;
 | 
			
		||||
                    if (!comments.isEmpty()) {
 | 
			
		||||
                        plot.removeComments(comments);
 | 
			
		||||
                    }
 | 
			
		||||
                    MainUtil.sendMessage(player, Captions.COMMENT_REMOVED, "*");
 | 
			
		||||
                    MainUtil.sendMessage(player, Captions.COMMENT_REMOVED_SUCCESS, "*");
 | 
			
		||||
                    return true;
 | 
			
		||||
                default:
 | 
			
		||||
                    try {
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
 | 
			
		||||
                    "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92 $2& $1MattBDev $2& $1dordsor21");
 | 
			
		||||
                MainUtil.sendMessage(player,
 | 
			
		||||
                    "$2>> $1&lWiki$2: $1https://github.com/IntellectualSites/PlotSquared/wiki");
 | 
			
		||||
                MainUtil.sendMessage(player,
 | 
			
		||||
                    "$2>> $1&lNewest Version$2: $1" + getNewestVersionString());
 | 
			
		||||
                //                MainUtil.sendMessage(player,
 | 
			
		||||
                //                    "$2>> $1&lNewest Version$2: $1" + getNewestVersionString());
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        return true;
 | 
			
		||||
 
 | 
			
		||||
@@ -280,13 +280,12 @@ public enum Captions {
 | 
			
		||||
        "Comment"),
 | 
			
		||||
 | 
			
		||||
    INVALID_INBOX("$2That is not a valid inbox.&-$1Accepted values: %s", "Comment"), NO_PERM_INBOX(
 | 
			
		||||
        "$2You do not have permission for that inbox", "Comment"),
 | 
			
		||||
 | 
			
		||||
    NO_PERM_INBOX_MODIFY("$2You do not have permission to modify that inbox",
 | 
			
		||||
        "Comment"), NO_PLOT_INBOX("$2You must stand in or supply a plot argument", "Comment"),
 | 
			
		||||
 | 
			
		||||
    COMMENT_REMOVED("$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), COMMENT_ADDED(
 | 
			
		||||
        "$4A comment has been left", "Comment"),
 | 
			
		||||
        "$2You do not have permission for that inbox", "Comment"), NO_PERM_INBOX_MODIFY(
 | 
			
		||||
        "$2You do not have permission to modify that inbox", "Comment"), NO_PLOT_INBOX(
 | 
			
		||||
        "$2You must stand in or supply a plot argument", "Comment"), COMMENT_REMOVED_SUCCESS(
 | 
			
		||||
        "$4Successfully deleted comment/s:n$2 - '$3%s$2'", "Comment"), COMMENT_REMOVED_FAILURE(
 | 
			
		||||
        "$4Failed to delete comment!", "Comment"), COMMENT_ADDED("$4A comment has been left",
 | 
			
		||||
        "Comment"),
 | 
			
		||||
 | 
			
		||||
    COMMENT_HEADER("$2&m---------&r $1Comments $2&m---------&r", "Comment"), INBOX_EMPTY(
 | 
			
		||||
        "$2No comments", "Comment"),
 | 
			
		||||
 
 | 
			
		||||
@@ -399,35 +399,48 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Finishing off plot merging by adding in the walls surrounding the plot (OPTIONAL)(UNFINISHED).
 | 
			
		||||
     *
 | 
			
		||||
     * @return false if part of the merge failed, otherwise true if successful.
 | 
			
		||||
     */
 | 
			
		||||
    @Override public boolean finishPlotMerge(List<PlotId> plotIds) {
 | 
			
		||||
        //TODO This method shouldn't always return true
 | 
			
		||||
        final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK;
 | 
			
		||||
        plotIds.forEach(id -> setWall(id, block));
 | 
			
		||||
        boolean success = true;
 | 
			
		||||
        for (PlotId plotId : plotIds) {
 | 
			
		||||
            success &= setWall(plotId, block);
 | 
			
		||||
        }
 | 
			
		||||
        if (Settings.General.MERGE_REPLACE_WALL) {
 | 
			
		||||
            final BlockBucket wallBlock = classicPlotWorld.WALL_FILLING;
 | 
			
		||||
            plotIds.forEach(id -> setWallFilling(id, wallBlock));
 | 
			
		||||
            for (PlotId id : plotIds) {
 | 
			
		||||
                success &= setWallFilling(id, wallBlock);
 | 
			
		||||
            }
 | 
			
		||||
        return true;
 | 
			
		||||
        }
 | 
			
		||||
        return success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override public boolean finishPlotUnlink(List<PlotId> plotIds) {
 | 
			
		||||
        //TODO This method shouldn't always return true
 | 
			
		||||
        final BlockBucket block = classicPlotWorld.CLAIMED_WALL_BLOCK;
 | 
			
		||||
        plotIds.forEach(id -> setWall(id, block));
 | 
			
		||||
        return true;
 | 
			
		||||
        boolean success = true;
 | 
			
		||||
        for (PlotId id : plotIds) {
 | 
			
		||||
            success &= setWall(id, block);
 | 
			
		||||
        }
 | 
			
		||||
        return success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets all the blocks along all the plot walls to their correct state (claimed or unclaimed).
 | 
			
		||||
     *
 | 
			
		||||
     * @return true if the wall blocks were successfully set
 | 
			
		||||
     */
 | 
			
		||||
    @Override public boolean regenerateAllPlotWalls() {
 | 
			
		||||
        //TODO This method shouldn't always return true
 | 
			
		||||
        boolean success = true;
 | 
			
		||||
        for (Plot plot : classicPlotWorld.getPlots()) {
 | 
			
		||||
            if (plot.hasOwner()) {
 | 
			
		||||
                setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK);
 | 
			
		||||
                success &= setWall(plot.getId(), classicPlotWorld.CLAIMED_WALL_BLOCK);
 | 
			
		||||
            } else {
 | 
			
		||||
                setWall(plot.getId(), classicPlotWorld.WALL_BLOCK);
 | 
			
		||||
                success &= setWall(plot.getId(), classicPlotWorld.WALL_BLOCK);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
        return success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override public boolean startPlotMerge(List<PlotId> plotIds) {
 | 
			
		||||
@@ -448,7 +461,9 @@ public class ClassicPlotManager extends SquarePlotManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Remove sign for a plot.
 | 
			
		||||
     * Retrieves the location of where a sign should be for a plot.
 | 
			
		||||
     * @param plot The plot
 | 
			
		||||
     * @return The location where a sign should be
 | 
			
		||||
     */
 | 
			
		||||
    @Override public Location getSignLoc(Plot plot) {
 | 
			
		||||
        plot = plot.getBasePlot(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -147,8 +147,7 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
        if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
 | 
			
		||||
            createSchemAbs(queue, pos1, pos2);
 | 
			
		||||
        }
 | 
			
		||||
        queue.enqueue();
 | 
			
		||||
        return true;
 | 
			
		||||
        return queue.enqueue();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -222,7 +221,9 @@ public class HybridPlotManager extends ClassicPlotManager {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Remove sign for a plot.
 | 
			
		||||
     * Retrieves the location of where a sign should be for a plot.
 | 
			
		||||
     * @param plot The plot
 | 
			
		||||
     * @return The location where a sign should be
 | 
			
		||||
     */
 | 
			
		||||
    @Override public Location getSignLoc(Plot plot) {
 | 
			
		||||
        return hybridPlotWorld.getSignLocation(plot);
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,12 @@ public abstract class PlotManager {
 | 
			
		||||
 | 
			
		||||
    public abstract boolean unClaimPlot(Plot plot, Runnable whenDone);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Retrieves the location of where a sign should be for a plot.
 | 
			
		||||
     *
 | 
			
		||||
     * @param plot The plot
 | 
			
		||||
     * @return The location where a sign should be
 | 
			
		||||
     */
 | 
			
		||||
    public abstract Location getSignLoc(Plot plot);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
@@ -47,8 +53,7 @@ public abstract class PlotManager {
 | 
			
		||||
     */
 | 
			
		||||
    public abstract String[] getPlotComponents(PlotId plotId);
 | 
			
		||||
 | 
			
		||||
    public abstract boolean setComponent(PlotId plotId, String component,
 | 
			
		||||
                                         BlockBucket blocks);
 | 
			
		||||
    public abstract boolean setComponent(PlotId plotId, String component, BlockBucket blocks);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * PLOT MERGING (return false if your generator does not support plot
 | 
			
		||||
 
 | 
			
		||||
@@ -102,8 +102,7 @@ public abstract class BasicLocalBlockQueue extends LocalBlockQueue {
 | 
			
		||||
                lastWrappedChunk.setBlock(x & 15, y, z & 15, id);
 | 
			
		||||
                LocalChunk previous = this.blockChunks.put(pair, lastWrappedChunk);
 | 
			
		||||
                if (previous == null) {
 | 
			
		||||
                    chunks.add(lastWrappedChunk);
 | 
			
		||||
                    return true;
 | 
			
		||||
                    return chunks.add(lastWrappedChunk);
 | 
			
		||||
                }
 | 
			
		||||
                this.blockChunks.put(pair, previous);
 | 
			
		||||
                lastWrappedChunk = previous;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user