Delombok + import organisation

This commit is contained in:
Alexander Söderberg 2020-07-17 17:24:45 +02:00
parent c0a0d36e5d
commit 33b6ef66d6
287 changed files with 1355 additions and 505 deletions

View File

@ -107,7 +107,6 @@ import com.plotsquared.core.uuid.UUIDPipeline;
import com.plotsquared.core.uuid.offline.OfflineModeUUIDService;
import com.sk89q.worldedit.WorldEdit;
import io.papermc.lib.PaperLib;
import lombok.Getter;
import net.kyori.adventure.audience.Audience;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
@ -167,15 +166,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
private int[] version;
@Getter private String pluginName;
@Getter private SingleWorldListener singleWorldListener;
private String pluginName;
private SingleWorldListener singleWorldListener;
private Method methodUnloadChunk0;
private boolean methodUnloadSetup = false;
private boolean metricsStarted;
private EconHandler econ;
private PermHandler perm;
@Getter private Injector injector;
private Injector injector;
@Inject private PlotAreaManager plotAreaManager;
@Inject private EventDispatcher eventDispatcher;
@ -1123,4 +1122,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
return BukkitUtil.BUKKIT_AUDIENCES.audience(Bukkit.getConsoleSender());
}
public String getPluginName() {
return this.pluginName;
}
public SingleWorldListener getSingleWorldListener() {
return this.singleWorldListener;
}
public Injector getInjector() {
return this.injector;
}
}

View File

@ -25,15 +25,13 @@
*/
package com.plotsquared.bukkit.entity;
import lombok.Getter;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import javax.annotation.Nonnull;
@Getter
public abstract class EntityWrapper {
protected final float yaw;
@ -64,4 +62,31 @@ public abstract class EntityWrapper {
public abstract void saveEntity();
public float getYaw() {
return this.yaw;
}
public float getPitch() {
return this.pitch;
}
public Entity getEntity() {
return this.entity;
}
public EntityType getType() {
return this.type;
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
}

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Random;
final class BlockStatePopulator extends BlockPopulator {

View File

@ -29,8 +29,8 @@ import com.plotsquared.core.generator.AugmentedUtils;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Random;
public class BukkitAugmentedGenerator extends BlockPopulator {

View File

@ -38,13 +38,12 @@ import com.plotsquared.core.queue.ScopedLocalBlockQueue;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.MainUtil;
import com.sk89q.worldedit.math.BlockVector2;
import lombok.Getter;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@ -62,7 +61,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
private List<BlockPopulator> populators;
private boolean loaded = false;
@Getter private final String levelName;
private final String levelName;
public BukkitPlotGenerator(@Nonnull final String name,
@Nonnull final IndependentPlotGenerator generator,
@ -258,4 +257,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
return toString().equals(obj.toString()) || toString().equals(obj.getClass().getName());
}
public String getLevelName() {
return this.levelName;
}
}

View File

@ -38,8 +38,8 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Random;
final class DelegatePlotGenerator extends IndependentPlotGenerator {

View File

@ -62,16 +62,20 @@ import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.WorldUtil;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extension.platform.Actor;
import lombok.RequiredArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import javax.annotation.Nonnull;
@RequiredArgsConstructor public class BukkitModule extends AbstractModule {
public class BukkitModule extends AbstractModule {
private final BukkitPlatform bukkitPlatform;
public BukkitModule(@Nonnull final BukkitPlatform bukkitPlatform) {
this.bukkitPlatform = bukkitPlatform;
}
@Override protected void configure() {
bind(PlayerManager.class).to(BukkitPlayerManager.class);
bind(JavaPlugin.class).toInstance(bukkitPlatform);

View File

@ -26,7 +26,6 @@
package com.plotsquared.bukkit.listener;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.plot.Plot;
@ -53,10 +52,10 @@ import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import java.lang.reflect.Method;
import java.util.HashSet;

View File

@ -53,8 +53,8 @@ import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.List;
public class EntitySpawnListener implements Listener {

View File

@ -59,8 +59,8 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.projectiles.ProjectileSource;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

View File

@ -215,8 +215,8 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;

View File

@ -37,6 +37,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.generator.ChunkGenerator;
import javax.annotation.Nonnull;
@SuppressWarnings("unused")

View File

@ -32,9 +32,9 @@ import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -27,14 +27,15 @@ package com.plotsquared.bukkit.managers;
import com.google.inject.Singleton;
import org.bukkit.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import se.hyperver.hyperverse.Hyperverse;
import se.hyperver.hyperverse.world.WorldConfiguration;
import se.hyperver.hyperverse.world.WorldConfigurationBuilder;
import se.hyperver.hyperverse.world.WorldFeatures;
import se.hyperver.hyperverse.world.WorldType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Hyperverse specific manager that creates worlds
* using Hyperverse's API

View File

@ -28,6 +28,7 @@ package com.plotsquared.bukkit.managers;
import com.google.inject.Singleton;
import org.bukkit.Bukkit;
import org.bukkit.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View File

@ -27,8 +27,8 @@ package com.plotsquared.bukkit.player;
import com.plotsquared.core.player.OfflinePlotPlayer;
import org.bukkit.OfflinePlayer;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.UUID;
public class BukkitOfflinePlayer implements OfflinePlotPlayer {

View File

@ -53,9 +53,9 @@ import org.bukkit.event.EventException;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.RegisteredListener;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Set;
import java.util.UUID;

View File

@ -33,9 +33,9 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.PlayerManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.UUID;
/**

View File

@ -48,8 +48,8 @@ import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.Container;
import org.bukkit.block.data.BlockData;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;

View File

@ -39,15 +39,13 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Arrays;
public class GenChunk extends ScopedLocalBlockQueue {
@ -59,7 +57,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
public String world;
public int chunkX;
public int chunkZ;
@Getter @Setter private ChunkData chunkData = null;
private ChunkData chunkData = null;
public GenChunk() {
super(null, Location.at("", 0, 0, 0), Location.at("", 15, 255, 15));
@ -217,4 +215,12 @@ public class GenChunk extends ScopedLocalBlockQueue {
toReturn.chunkData = this.chunkData;
return toReturn;
}
public ChunkData getChunkData() {
return this.chunkData;
}
public void setChunkData(ChunkData chunkData) {
this.chunkData = chunkData;
}
}

View File

@ -31,6 +31,7 @@ import com.plotsquared.core.queue.LocalBlockQueue;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.WorldUtil;
import com.sk89q.jnbt.CompoundTag;
import javax.annotation.Nonnull;
/**

View File

@ -36,6 +36,7 @@ import com.plotsquared.core.util.PermHandler;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import javax.annotation.Nullable;
@Singleton public class BukkitEconHandler extends EconHandler {

View File

@ -29,12 +29,12 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.generator.GeneratorWrapper;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.SetupObject;
@ -48,8 +48,8 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;

View File

@ -32,7 +32,6 @@ import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.bukkit.player.BukkitPlayerManager;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Caption;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
@ -59,7 +58,6 @@ import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
@ -101,11 +99,11 @@ import org.bukkit.entity.Snowman;
import org.bukkit.entity.Tameable;
import org.bukkit.entity.Vehicle;
import org.bukkit.entity.WaterMob;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

View File

@ -27,14 +27,13 @@ package com.plotsquared.bukkit.util;
import com.google.common.collect.Maps;
import com.plotsquared.core.location.World;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.bukkit.Bukkit;
import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Objects;
@EqualsAndHashCode @ToString public class BukkitWorld implements World<org.bukkit.World> {
public class BukkitWorld implements World<org.bukkit.World> {
private static final Map<String, BukkitWorld> worldMap = Maps.newHashMap();
@ -82,4 +81,36 @@ import java.util.Map;
return this.world.getName();
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof BukkitWorld)) {
return false;
}
final BukkitWorld other = (BukkitWorld) o;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(this.world, other.world)) {
return false;
}
return true;
}
protected boolean canEqual(final Object other) {
return other instanceof BukkitWorld;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $world = this.world;
result = result * PRIME + ($world == null ? 43 : $world.hashCode());
return result;
}
public String toString() {
return "BukkitWorld(world=" + this.world + ")";
}
}

View File

@ -27,16 +27,15 @@ package com.plotsquared.bukkit.uuid;
import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import net.luckperms.api.model.user.UserManager;
import net.alpenblock.bungeeperms.BungeePerms;
import net.alpenblock.bungeeperms.io.UUIDPlayerDB;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import net.alpenblock.bungeeperms.BungeePerms;
import net.alpenblock.bungeeperms.io.UUIDPlayerDB;
/**
* UUID service that uses the BungeePerms API

View File

@ -29,8 +29,8 @@ import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

View File

@ -31,8 +31,8 @@ import net.luckperms.api.LuckPerms;
import net.luckperms.api.model.user.UserManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.RegisteredServiceProvider;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

View File

@ -31,8 +31,8 @@ import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

View File

@ -29,8 +29,8 @@ import com.destroystokyo.paper.profile.PlayerProfile;
import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import org.bukkit.Bukkit;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

View File

@ -30,8 +30,8 @@ import com.plotsquared.core.database.SQLite;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

View File

@ -32,10 +32,10 @@ import com.plotsquared.core.uuid.UUIDService;
import com.sk89q.squirrelid.Profile;
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
import com.sk89q.squirrelid.resolver.ProfileService;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -11,11 +11,6 @@ dependencies {
because("Minecraft uses GSON 2.8.0")
force = true
}
implementation("org.projectlombok:lombok:1.18.12")
compileOnly("org.projectlombok:lombok:1.18.12")
testCompileOnly("org.projectlombok:lombok:1.18.8")
annotationProcessor("org.projectlombok:lombok:1.18.8")
testAnnotationProcessor("org.projectlombok:lombok:1.18.8")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
// Adventure related stuff

View File

@ -36,12 +36,6 @@
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>

View File

@ -37,7 +37,6 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.query.PlotQuery;
import lombok.NoArgsConstructor;
import java.util.Collections;
import java.util.Set;
@ -57,7 +56,10 @@ import java.util.UUID;
*
* @version 5
*/
@SuppressWarnings({"unused", "WeakerAccess"}) @NoArgsConstructor public class PlotAPI {
@SuppressWarnings({"unused", "WeakerAccess"}) public class PlotAPI {
public PlotAPI() {
}
/**
* Gets all plots.

View File

@ -25,11 +25,6 @@
*/
package com.plotsquared.core;
import com.plotsquared.core.command.WE_Anywhere;
import com.plotsquared.core.components.ComponentPresetManager;
import com.plotsquared.core.configuration.Caption;
import com.plotsquared.core.configuration.caption.CaptionMap;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil;
@ -37,6 +32,7 @@ import com.plotsquared.core.configuration.MemorySection;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.Storage;
import com.plotsquared.core.configuration.caption.CaptionLoader;
import com.plotsquared.core.configuration.caption.CaptionMap;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.configuration.serialization.ConfigurationSerialization;
import com.plotsquared.core.database.DBFunc;
@ -64,20 +60,17 @@ import com.plotsquared.core.plot.expiration.ExpiryTask;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.plot.world.SinglePlotArea;
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.LegacyConverter;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.ReflectionUtils;
import com.plotsquared.core.util.logger.ILogger;
import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDPipeline;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.math.BlockVector2;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -133,32 +126,32 @@ public class PlotSquared {
// Current thread
private final Thread thread;
// UUID pipelines
@Getter private final UUIDPipeline impromptuUUIDPipeline =
private final UUIDPipeline impromptuUUIDPipeline =
new UUIDPipeline(Executors.newCachedThreadPool());
@Getter private final UUIDPipeline backgroundUUIDPipeline =
private final UUIDPipeline backgroundUUIDPipeline =
new UUIDPipeline(Executors.newSingleThreadExecutor());
// WorldEdit instance
@Getter private WorldEdit worldedit;
@Getter private File configFile;
@Getter private File worldsFile;
private WorldEdit worldedit;
private File configFile;
private File worldsFile;
public File translationFile; // TODO: REMOVE
public YamlConfiguration style; // TODO: REMOVE
@Getter private YamlConfiguration worldConfiguration;
private YamlConfiguration worldConfiguration;
// Temporary hold the plots/clusters before the worlds load
private HashMap<String, Set<PlotCluster>> clustersTmp;
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
private YamlConfiguration config;
// Localization
@Getter private CaptionMap captionMap;
private CaptionMap captionMap;
// Implementation logger
@Setter @Getter private ILogger logger;
private ILogger logger;
// Platform / Version / Update URL
private PlotVersion version;
// Files and configuration
@Getter private File jarFile = null; // This file
private File jarFile = null; // This file
private File storageFile;
@Getter private EventDispatcher eventDispatcher;
@Getter private PlotListener plotListener;
private EventDispatcher eventDispatcher;
private PlotListener plotListener;
/**
* Initialize PlotSquared with the desired Implementation class.
@ -1454,6 +1447,54 @@ public class PlotSquared {
return config;
}
public UUIDPipeline getImpromptuUUIDPipeline() {
return this.impromptuUUIDPipeline;
}
public UUIDPipeline getBackgroundUUIDPipeline() {
return this.backgroundUUIDPipeline;
}
public WorldEdit getWorldedit() {
return this.worldedit;
}
public File getConfigFile() {
return this.configFile;
}
public File getWorldsFile() {
return this.worldsFile;
}
public YamlConfiguration getWorldConfiguration() {
return this.worldConfiguration;
}
public CaptionMap getCaptionMap() {
return this.captionMap;
}
public ILogger getLogger() {
return this.logger;
}
public File getJarFile() {
return this.jarFile;
}
public EventDispatcher getEventDispatcher() {
return this.eventDispatcher;
}
public PlotListener getPlotListener() {
return this.plotListener;
}
public void setLogger(ILogger logger) {
this.logger = logger;
}
public enum SortType {
CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN
}

View File

@ -25,11 +25,7 @@
*/
package com.plotsquared.core.backup;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import javax.annotation.Nullable;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@ -38,12 +34,18 @@ import java.nio.file.Path;
* Object representing a plot backup. This does not actually contain the
* backup itself, it is just a pointer to an available backup
*/
@RequiredArgsConstructor(access = AccessLevel.PACKAGE) @Getter public class Backup {
public class Backup {
private final BackupProfile owner;
private final long creationTime;
@Nullable private final Path file;
Backup(final BackupProfile owner, final long creationTime, final Path file) {
this.owner = owner;
this.creationTime = creationTime;
this.file = file;
}
/**
* Delete the backup
*/
@ -57,4 +59,15 @@ import java.nio.file.Path;
}
}
public BackupProfile getOwner() {
return this.owner;
}
public long getCreationTime() {
return this.creationTime;
}
@Nullable public Path getFile() {
return this.file;
}
}

View File

@ -28,9 +28,9 @@ package com.plotsquared.core.backup;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.nio.file.Path;
import java.util.Objects;

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.backup;
import javax.annotation.Nonnull;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.CompletableFuture;

View File

@ -29,9 +29,9 @@ import com.google.inject.Singleton;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.nio.file.Path;
import java.util.Objects;

View File

@ -26,7 +26,6 @@
package com.plotsquared.core.backup;
import javax.annotation.Nonnull;
import java.io.File;
import java.nio.file.Path;
import java.util.Collections;

View File

@ -33,8 +33,8 @@ import com.plotsquared.core.plot.schematic.Schematic;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

View File

@ -36,12 +36,9 @@ import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.task.TaskManager;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;
@ -51,11 +48,11 @@ import java.util.concurrent.TimeUnit;
/**
* {@inheritDoc}
*/
@RequiredArgsConstructor @Singleton public class SimpleBackupManager implements BackupManager {
@Singleton public class SimpleBackupManager implements BackupManager {
@Getter private final Path backupPath;
private final Path backupPath;
private final boolean automaticBackup;
@Getter private final int backupLimit;
private final int backupLimit;
private final Cache<PlotCacheKey, BackupProfile> backupProfileCache = CacheBuilder.newBuilder()
.expireAfterAccess(3, TimeUnit.MINUTES).build();
private final PlayerBackupProfileFactory playerBackupProfileFactory;
@ -70,6 +67,14 @@ import java.util.concurrent.TimeUnit;
this.backupLimit = Settings.Backup.BACKUP_LIMIT;
}
public SimpleBackupManager(final Path backupPath, final boolean automaticBackup,
final int backupLimit, final PlayerBackupProfileFactory playerBackupProfileFactory) {
this.backupPath = backupPath;
this.automaticBackup = automaticBackup;
this.backupLimit = backupLimit;
this.playerBackupProfileFactory = playerBackupProfileFactory;
}
@Override @Nonnull public BackupProfile getProfile(@Nonnull final Plot plot) {
if (plot.hasOwner() && !plot.isMerged()) {
try {
@ -111,10 +116,22 @@ import java.util.concurrent.TimeUnit;
return this.automaticBackup;
}
@RequiredArgsConstructor(access = AccessLevel.PRIVATE) private static final class PlotCacheKey {
public Path getBackupPath() {
return this.backupPath;
}
public int getBackupLimit() {
return this.backupLimit;
}
private static final class PlotCacheKey {
private final Plot plot;
private PlotCacheKey(Plot plot) {
this.plot = plot;
}
@Override public boolean equals(final Object o) {
if (this == o) {
return true;

View File

@ -37,9 +37,9 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

View File

@ -27,16 +27,16 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.ConfigurationUtil;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.generator.AugmentedUtils;
import com.plotsquared.core.generator.HybridPlotWorld;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.inject.factory.HybridPlotWorldFactory;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.ConsolePlayer;
@ -73,8 +73,8 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -52,9 +52,9 @@ import com.plotsquared.core.util.task.AutoClaimFinishTask;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Set;

View File

@ -36,8 +36,8 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.nio.file.Files;
import java.time.Instant;
import java.time.ZoneId;

View File

@ -39,9 +39,9 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Set;
import java.util.concurrent.CompletableFuture;

View File

@ -27,7 +27,6 @@ package com.plotsquared.core.command;
import com.google.common.primitives.Ints;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
@ -46,11 +45,12 @@ import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@CommandDeclaration(command = "claim",
aliases = "c",
description = "Claim the current plot you're standing on",

View File

@ -42,8 +42,8 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
import static com.plotsquared.core.command.SubCommand.sendMessage;

View File

@ -25,12 +25,10 @@
*/
package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Caption;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
@ -39,9 +37,7 @@ import com.plotsquared.core.util.StringComparison;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import lombok.SneakyThrows;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nonnull;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -594,10 +590,6 @@ public abstract class Command {
return object;
}
@SneakyThrows protected static void sneakyThrow(@Nonnull final Throwable throwable) {
throw throwable;
}
public enum CommandResult {
FAILURE, SUCCESS
}

View File

@ -26,12 +26,10 @@
package com.plotsquared.core.command;
import com.plotsquared.core.configuration.Captions;
import lombok.RequiredArgsConstructor;
/**
* CommandCategory.
*/
@RequiredArgsConstructor
public enum CommandCategory {
/**
* Claiming CommandConfig.
@ -78,6 +76,10 @@ public enum CommandCategory {
*/
private final Captions caption;
CommandCategory(final Captions caption) {
this.caption = caption;
}
@Override public String toString() {
return this.caption.getTranslated();
}

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

View File

@ -37,6 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "continue",

View File

@ -33,6 +33,7 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.MainUtil;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "createroadschematic",

View File

@ -27,13 +27,13 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.database.Database;
import com.plotsquared.core.database.MySQL;
import com.plotsquared.core.database.SQLManager;
import com.plotsquared.core.database.SQLite;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.listener.PlotListener;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
@ -45,8 +45,8 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;

View File

@ -39,10 +39,10 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDMapping;
import com.sk89q.worldedit.world.entity.EntityType;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Comparator;
import java.util.Map;

View File

@ -63,11 +63,11 @@ import com.plotsquared.core.util.task.RunnableVal3;
import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.world.block.BlockState;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;

View File

@ -37,8 +37,8 @@ import com.plotsquared.core.plot.world.SinglePlotAreaManager;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.File;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;

View File

@ -29,10 +29,10 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.inject.annotations.ConfigFile;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.inject.annotations.ConfigFile;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.PremiumVerification;
@ -40,7 +40,6 @@ import com.plotsquared.core.util.net.IncendoPaster;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.util.MainUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Arrays;
@CommandDeclaration(command = "debugroadregen",

View File

@ -39,6 +39,7 @@ import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

View File

@ -39,8 +39,8 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil;
import com.sk89q.worldedit.world.gamemode.GameModes;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;

View File

@ -35,6 +35,7 @@ import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "setdescription",

View File

@ -27,6 +27,7 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.player.PlotPlayer;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "dislike",

View File

@ -43,6 +43,7 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "done",

View File

@ -39,8 +39,8 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal;
import com.sk89q.jnbt.CompoundTag;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.net.URL;
@CommandDeclaration(usage = "/plot download [schematic|world]",

View File

@ -49,10 +49,9 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.helpmenu.HelpMenu;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

View File

@ -41,8 +41,8 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.query.SortingStrategy;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

View File

@ -37,8 +37,8 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;

View File

@ -33,8 +33,8 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;

View File

@ -40,8 +40,8 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

View File

@ -27,7 +27,6 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Templates;
@ -50,9 +49,9 @@ import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.query.SortingStrategy;
import com.plotsquared.core.uuid.UUIDMapping;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

View File

@ -39,8 +39,8 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

View File

@ -42,9 +42,9 @@ import com.plotsquared.core.util.Expression;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.UUID;
@CommandDeclaration(command = "merge",

View File

@ -36,8 +36,8 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
@CommandDeclaration(usage = "/plot move <X;Z>",

View File

@ -39,8 +39,8 @@ import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.plotsquared.core.util.InventoryUtil;
import com.sk89q.worldedit.world.item.ItemTypes;
import javax.annotation.Nullable;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;

View File

@ -38,8 +38,8 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeoutException;

View File

@ -40,8 +40,8 @@ import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

View File

@ -44,8 +44,8 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;

View File

@ -34,6 +34,7 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.MainUtil;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "regenallroads",

View File

@ -27,18 +27,18 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationSection;
import com.plotsquared.core.configuration.MemorySection;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotAreaType;
import com.plotsquared.core.plot.world.PlotAreaManager;
import com.plotsquared.core.util.MainUtil;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import java.util.Objects;

View File

@ -35,8 +35,8 @@ import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;

View File

@ -38,8 +38,8 @@ import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import com.sk89q.jnbt.CompoundTag;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.net.URL;
import java.util.List;
import java.util.UUID;

View File

@ -42,8 +42,8 @@ import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;

View File

@ -45,8 +45,8 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

View File

@ -34,8 +34,8 @@ import com.plotsquared.core.setup.SetupProcess;
import com.plotsquared.core.setup.SetupStep;
import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

View File

@ -27,8 +27,6 @@ package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ConfigurationNode;
import com.plotsquared.core.configuration.ConfigurationSection;
@ -36,6 +34,8 @@ import com.plotsquared.core.configuration.InvalidConfigurationException;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.events.TeleportCause;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.inject.annotations.WorldFile;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.PlotManager;
@ -48,8 +48,8 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

View File

@ -47,8 +47,8 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

View File

@ -36,8 +36,8 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

View File

@ -37,6 +37,7 @@ import com.plotsquared.core.util.MainUtil;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.TaskManager;
import javax.annotation.Nonnull;
@CommandDeclaration(command = "unlink",

View File

@ -42,8 +42,8 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.query.SortingStrategy;
import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

View File

@ -30,8 +30,8 @@ import com.plotsquared.core.configuration.serialization.SerializableAs;
import com.plotsquared.core.generator.ClassicPlotManagerComponent;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import javax.annotation.Nonnull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -44,11 +44,11 @@ import com.plotsquared.core.util.PatternUtil;
import com.plotsquared.core.util.Permissions;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.item.ItemTypes;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -26,9 +26,6 @@
package com.plotsquared.core.configuration;
import com.plotsquared.core.player.PlotPlayer;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.Collection;
@ -42,14 +39,40 @@ public interface ChatFormatter {
void format(ChatContext context);
@AllArgsConstructor
final class ChatContext {
@Getter private final PlotPlayer recipient;
@Getter @Setter private String message;
@Getter private final Object[] args;
@Getter private final boolean rawOutput;
private final PlotPlayer<?> recipient;
private String message;
private final Object[] args;
private final boolean rawOutput;
public ChatContext(final PlotPlayer<?> recipient, final String message, final Object[] args,
final boolean rawOutput) {
this.recipient = recipient;
this.message = message;
this.args = args;
this.rawOutput = rawOutput;
}
public PlotPlayer<?> getRecipient() {
return this.recipient;
}
public String getMessage() {
return this.message;
}
public Object[] getArgs() {
return this.args;
}
public boolean isRawOutput() {
return this.rawOutput;
}
public void setMessage(String message) {
this.message = message;
}
}
}

View File

@ -28,7 +28,6 @@ package com.plotsquared.core.configuration;
import com.plotsquared.core.plot.BlockBucket;
import com.plotsquared.core.util.StringMan;
import com.sk89q.worldedit.world.block.BlockState;
import lombok.Getter;
import java.util.ArrayList;
import java.util.Arrays;
@ -40,11 +39,11 @@ import java.util.List;
*/
public class ConfigurationNode {
@Getter private final String constant;
private final String constant;
private final Object defaultValue;
@Getter private final String description;
private final String description;
private final ConfigurationUtil.SettingValue type;
@Getter private final Collection<String> suggestions;
private final Collection<String> suggestions;
private Object value;
public ConfigurationNode(String constant, Object defaultValue, String description,
@ -112,4 +111,16 @@ public class ConfigurationNode {
}
return this.defaultValue;
}
public String getConstant() {
return this.constant;
}
public String getDescription() {
return this.description;
}
public Collection<String> getSuggestions() {
return this.suggestions;
}
}

View File

@ -30,11 +30,9 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.block.BlockState;
import lombok.Getter;
import javax.annotation.Nonnull;
/**
* Main Configuration Utility
*/
@ -104,13 +102,16 @@ public class ConfigurationUtil {
public static final class UnknownBlockException extends IllegalArgumentException {
@Getter private final String unknownValue;
private final String unknownValue;
UnknownBlockException(@Nonnull final String unknownValue) {
super(String.format("\"%s\" is not a valid block", unknownValue));
this.unknownValue = unknownValue;
}
public String getUnknownValue() {
return this.unknownValue;
}
}
@ -137,13 +138,16 @@ public class ConfigurationUtil {
public static final class UnsafeBlockException extends IllegalArgumentException {
@Getter private final BlockState unsafeBlock;
private final BlockState unsafeBlock;
UnsafeBlockException(@Nonnull final BlockState unsafeBlock) {
super(String.format("%s is not a valid block", unsafeBlock));
this.unsafeBlock = unsafeBlock;
}
public BlockState getUnsafeBlock() {
return this.unsafeBlock;
}
}
}

View File

@ -27,21 +27,18 @@ package com.plotsquared.core.configuration;
import com.google.common.base.Preconditions;
import com.plotsquared.core.configuration.caption.LocaleHolder;
import lombok.RequiredArgsConstructor;
import javax.annotation.Nonnull;
@RequiredArgsConstructor
public final class StaticCaption implements Caption {
private final String value;
private final boolean usePrefix;
/**
* @deprecated Use {@link #of(String)}
*/
@Deprecated public StaticCaption(final String value) {
this(value, true);
this.value = value;
}
/**

View File

@ -26,7 +26,8 @@
package com.plotsquared.core.configuration.caption;
import com.plotsquared.core.configuration.Caption;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
/**
* A {@link com.plotsquared.core.configuration.Caption} that can be identified by a key
@ -38,6 +39,6 @@ public interface KeyedCaption extends Caption {
*
* @return Caption key
*/
@NonNull String getKey();
@Nonnull String getKey();
}

View File

@ -28,7 +28,6 @@ package com.plotsquared.core.configuration.caption;
import com.plotsquared.core.configuration.Caption;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.util.MainUtil;
import lombok.experimental.UtilityClass;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
@ -38,10 +37,14 @@ import java.util.UUID;
/**
* Utility class that generates {@link net.kyori.adventure.text.minimessage.Template templates}
*/
@UtilityClass
public class Templates {
public final class Templates {
private final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private Templates() {
throw new UnsupportedOperationException(
"This is a utility class and cannot be instantiated");
}
/**
* Create a {@link net.kyori.adventure.text.minimessage.Template} from a PlotSquared {@link Caption}
@ -52,9 +55,8 @@ public class Templates {
* @param replacements Replacements
* @return Generated template
*/
@Nonnull public Template of(@Nonnull final LocaleHolder localeHolder,
@Nonnull final String key,
@Nonnull final Caption caption,
@Nonnull public static Template of(@Nonnull final LocaleHolder localeHolder,
@Nonnull final String key, @Nonnull final Caption caption,
@Nonnull final Template... replacements) {
return Template.of(key, MINI_MESSAGE.parse(caption.getComponent(localeHolder), replacements));
}
@ -66,8 +68,7 @@ public class Templates {
* @param uuid Player UUID
* @return Generated template
*/
@Nonnull public Template of(@Nonnull final String key,
@Nonnull final UUID uuid) {
@Nonnull public static Template of(@Nonnull final String key, @Nonnull final UUID uuid) {
final String username = MainUtil.getName(uuid);
return Template.of(key, username);
}
@ -79,8 +80,7 @@ public class Templates {
* @param value Template value
* @return Generated template
*/
@Nonnull public Template of(@Nonnull final String key,
@Nonnull final String value) {
@Nonnull public static Template of(@Nonnull final String key, @Nonnull final String value) {
return Template.of(key, value);
}
@ -91,8 +91,7 @@ public class Templates {
* @param area Plot area
* @return Generated template
*/
@Nonnull public Template of(@Nonnull final String key,
@Nonnull final PlotArea area) {
@Nonnull public static Template of(@Nonnull final String key, @Nonnull final PlotArea area) {
return Template.of(key, area.toString());
}
@ -103,8 +102,7 @@ public class Templates {
* @param number Number
* @return Generated template
*/
@Nonnull public Template of(@Nonnull final String key,
@Nonnull final Number number) {
@Nonnull public static Template of(@Nonnull final String key, @Nonnull final Number number) {
return Template.of(key, number.toString());
}

Some files were not shown because too many files have changed in this diff Show More