Make variables final if they can be. (#1843)

* Make variables final if they can be.

* Do not use final so that test can pass.

For testing, we use a trick to set this variable, but it won't work if
it is final. Right now, I'd like to keep the test.
This commit is contained in:
tastybento 2021-08-29 18:17:21 -07:00 committed by GitHub
parent a9a7673ce8
commit 9dc4ebc2d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 201 additions and 179 deletions

View File

@ -40,7 +40,7 @@ public abstract class Addon {
private FileConfiguration config; private FileConfiguration config;
private File dataFolder; private File dataFolder;
private File file; private File file;
private Map<String, AddonRequestHandler> requestHandlers = new HashMap<>(); private final Map<String, AddonRequestHandler> requestHandlers = new HashMap<>();
protected Addon() { protected Addon() {
state = State.DISABLED; state = State.DISABLED;

View File

@ -30,8 +30,8 @@ import world.bentobox.bentobox.managers.AddonsManager;
public class AddonClassLoader extends URLClassLoader { public class AddonClassLoader extends URLClassLoader {
private final Map<String, Class<?>> classes = new HashMap<>(); private final Map<String, Class<?>> classes = new HashMap<>();
private Addon addon; private final Addon addon;
private AddonsManager loader; private final AddonsManager loader;
public AddonClassLoader(AddonsManager addonsManager, YamlConfiguration data, File jarFile, ClassLoader parent) public AddonClassLoader(AddonsManager addonsManager, YamlConfiguration data, File jarFile, ClassLoader parent)
throws InvalidAddonInheritException, throws InvalidAddonInheritException,

View File

@ -163,9 +163,12 @@ public final class AddonDescription {
} }
public static class Builder { public static class Builder {
private @NonNull String main; private @NonNull
private @NonNull String name; final String main;
private @NonNull String version; private @NonNull
final String name;
private @NonNull
final String version;
private @NonNull String description = ""; private @NonNull String description = "";
private @NonNull List<String> authors = new ArrayList<>(); private @NonNull List<String> authors = new ArrayList<>();
private @NonNull List<String> dependencies = new ArrayList<>(); private @NonNull List<String> dependencies = new ArrayList<>();

View File

@ -20,7 +20,7 @@ public class AddonRequestBuilder
{ {
private String addonName; private String addonName;
private String requestLabel; private String requestLabel;
private Map<String, Object> metaData = new HashMap<>(); private final Map<String, Object> metaData = new HashMap<>();
/** /**
* Define the addon you wish to request. * Define the addon you wish to request.

View File

@ -78,12 +78,12 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/** /**
* Map of sub commands * Map of sub commands
*/ */
private Map<String, CompositeCommand> subCommands; private final Map<String, CompositeCommand> subCommands;
/** /**
* Map of aliases for subcommands * Map of aliases for subcommands
*/ */
private Map<String, CompositeCommand> subCommandAliases; private final Map<String, CompositeCommand> subCommandAliases;
/** /**
* The command chain from the very top, e.g., island team promote * The command chain from the very top, e.g., island team promote
*/ */
@ -93,7 +93,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
* The prefix to be used in this command * The prefix to be used in this command
*/ */
@Nullable @Nullable
private String permissionPrefix; private final String permissionPrefix;
/** /**
* The world that this command operates in. This is an overworld and will cover any associated nether or end * The world that this command operates in. This is an overworld and will cover any associated nether or end
@ -104,17 +104,17 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
/** /**
* The addon creating this command, if any * The addon creating this command, if any
*/ */
private Addon addon; private final Addon addon;
/** /**
* The top level label * The top level label
*/ */
private String topLabel; private final String topLabel;
/** /**
* Cool down tracker * Cool down tracker
*/ */
private Map<String, Map<String, Long>> cooldowns = new HashMap<>(); private final Map<String, Map<String, Long>> cooldowns = new HashMap<>();
/** /**
* Top level command * Top level command

View File

@ -20,7 +20,7 @@ public abstract class ConfirmableCommand extends CompositeCommand {
/** /**
* Confirmation tracker * Confirmation tracker
*/ */
private static Map<User, Confirmer> toBeConfirmed = new HashMap<>(); private static final Map<User, Confirmer> toBeConfirmed = new HashMap<>();
/** /**
* Top level command * Top level command

View File

@ -26,7 +26,7 @@ public abstract class DelayedTeleportCommand extends CompositeCommand implements
/** /**
* User monitor map * User monitor map
*/ */
private static Map<UUID, DelayedCommand> toBeMonitored = new HashMap<>(); private static final Map<UUID, DelayedCommand> toBeMonitored = new HashMap<>();
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent e) { public void onPlayerMove(PlayerMoveEvent e) {

View File

@ -20,7 +20,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class AdminResetFlagsCommand extends ConfirmableCommand { public class AdminResetFlagsCommand extends ConfirmableCommand {
private List<String> options; private final List<String> options;
public AdminResetFlagsCommand(CompositeCommand parent) { public AdminResetFlagsCommand(CompositeCommand parent) {
super(parent, "resetflags"); super(parent, "resetflags");

View File

@ -38,7 +38,7 @@ public class AdminSettingsCommand extends CompositeCommand {
private final List<String> PROTECTION_FLAG_NAMES; private final List<String> PROTECTION_FLAG_NAMES;
private Island island; private Island island;
private final List<String> SETTING_FLAG_NAMES; private final List<String> SETTING_FLAG_NAMES;
private List<String> WORLD_SETTING_FLAG_NAMES; private final List<String> WORLD_SETTING_FLAG_NAMES;
private @NonNull Optional<Flag> flag = Optional.empty(); private @NonNull Optional<Flag> flag = Optional.empty();
private boolean activeState; private boolean activeState;
private int rank; private int rank;

View File

@ -24,7 +24,7 @@ public class AdminRangeDisplayCommand extends CompositeCommand {
private static final String HIDE = "hide"; private static final String HIDE = "hide";
// Map of users to which ranges must be displayed // Map of users to which ranges must be displayed
private Map<User, Integer> displayRanges = new HashMap<>(); private final Map<User, Integer> displayRanges = new HashMap<>();
public AdminRangeDisplayCommand(CompositeCommand parent) { public AdminRangeDisplayCommand(CompositeCommand parent) {
super(parent, DISPLAY, SHOW, HIDE); super(parent, DISPLAY, SHOW, HIDE);

View File

@ -29,7 +29,7 @@ public class IslandTeamCommand extends CompositeCommand {
* Invited list. Key is the invited party, value is the invite. * Invited list. Key is the invited party, value is the invite.
* @since 1.8.0 * @since 1.8.0
*/ */
private Map<UUID, Invite> inviteMap; private final Map<UUID, Invite> inviteMap;
public IslandTeamCommand(CompositeCommand parent) { public IslandTeamCommand(CompositeCommand parent) {
super(parent, "team"); super(parent, "team");

View File

@ -22,7 +22,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class IslandTeamCoopCommand extends CompositeCommand { public class IslandTeamCoopCommand extends CompositeCommand {
private IslandTeamCommand itc; private final IslandTeamCommand itc;
private @Nullable UUID targetUUID; private @Nullable UUID targetUUID;
public IslandTeamCoopCommand(IslandTeamCommand parentCommand) { public IslandTeamCoopCommand(IslandTeamCommand parentCommand) {

View File

@ -20,7 +20,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class IslandTeamInviteAcceptCommand extends ConfirmableCommand { public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
private IslandTeamCommand itc; private final IslandTeamCommand itc;
private UUID playerUUID; private UUID playerUUID;
private UUID prospectiveOwnerUUID; private UUID prospectiveOwnerUUID;

View File

@ -20,7 +20,7 @@ import world.bentobox.bentobox.util.Util;
public class IslandTeamInviteCommand extends CompositeCommand { public class IslandTeamInviteCommand extends CompositeCommand {
private IslandTeamCommand itc; private final IslandTeamCommand itc;
private @Nullable User invitedPlayer; private @Nullable User invitedPlayer;
public IslandTeamInviteCommand(IslandTeamCommand parent) { public IslandTeamInviteCommand(IslandTeamCommand parent) {

View File

@ -11,7 +11,7 @@ import world.bentobox.bentobox.api.user.User;
public class IslandTeamInviteRejectCommand extends CompositeCommand { public class IslandTeamInviteRejectCommand extends CompositeCommand {
private IslandTeamCommand itc; private final IslandTeamCommand itc;
public IslandTeamInviteRejectCommand(IslandTeamCommand islandTeamCommand) { public IslandTeamInviteRejectCommand(IslandTeamCommand islandTeamCommand) {
super(islandTeamCommand, "reject"); super(islandTeamCommand, "reject");

View File

@ -22,8 +22,8 @@ import world.bentobox.bentobox.database.yaml.YamlDatabase;
*/ */
public class Config<T> { public class Config<T> {
private AbstractDatabaseHandler<T> handler; private final AbstractDatabaseHandler<T> handler;
private Logger logger; private final Logger logger;
private Addon addon; private Addon addon;
public Config(BentoBox plugin, Class<T> type) { public Config(BentoBox plugin, Class<T> type) {

View File

@ -53,7 +53,8 @@ public class Flag implements Comparable<Flag> {
*/ */
WORLD_SETTING(Material.GRASS_BLOCK); WORLD_SETTING(Material.GRASS_BLOCK);
private @NonNull Material icon; private @NonNull
final Material icon;
Type(@NonNull Material icon) { Type(@NonNull Material icon) {
this.icon = icon; this.icon = icon;
@ -482,8 +483,8 @@ public class Flag implements Comparable<Flag> {
*/ */
public static class Builder { public static class Builder {
// Mandatory fields // Mandatory fields
private String id; private final String id;
private Material icon; private final Material icon;
// Listener // Listener
private Listener listener; private Listener listener;
@ -512,7 +513,7 @@ public class Flag implements Comparable<Flag> {
private Mode mode = Mode.EXPERT; private Mode mode = Mode.EXPERT;
// Subflags // Subflags
private Set<Flag> subflags; private final Set<Flag> subflags;
/** /**
* Builder for making flags * Builder for making flags

View File

@ -23,8 +23,8 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class IslandToggleClick implements ClickHandler { public class IslandToggleClick implements ClickHandler {
private BentoBox plugin = BentoBox.getInstance(); private final BentoBox plugin = BentoBox.getInstance();
private String id; private final String id;
/** /**
* @param id - the flag ID that this click listener is associated with * @param id - the flag ID that this click listener is associated with

View File

@ -20,16 +20,16 @@ public class BentoBoxLocale {
private static final String UNKNOWN = "unknown"; private static final String UNKNOWN = "unknown";
private Locale locale; private final Locale locale;
private YamlConfiguration config; private final YamlConfiguration config;
private ItemStack banner; private final ItemStack banner;
private List<String> authors; private final List<String> authors;
/** /**
* List of available prefixes in this locale. * List of available prefixes in this locale.
* @since 1.12.0 * @since 1.12.0
*/ */
private Set<String> prefixes; private final Set<String> prefixes;
public BentoBoxLocale(Locale locale, YamlConfiguration config) { public BentoBoxLocale(Locale locale, YamlConfiguration config) {
this.locale = locale; this.locale = locale;

View File

@ -47,7 +47,7 @@ public class LogEntry {
public static class Builder { public static class Builder {
private long timestamp; private long timestamp;
private String type; private final String type;
private Map<String, String> data; private Map<String, String> data;
public Builder(@NonNull String type) { public Builder(@NonNull String type) {

View File

@ -29,7 +29,7 @@ public class PanelItem {
private String name; private String name;
private boolean glow; private boolean glow;
private ItemMeta meta; private ItemMeta meta;
private String playerHeadName; private final String playerHeadName;
private boolean invisible; private boolean invisible;
public PanelItem(PanelItemBuilder builtItem) { public PanelItem(PanelItemBuilder builtItem) {

View File

@ -31,7 +31,8 @@ public class TabbedPanel extends Panel implements PanelListener {
private static final String PROTECTION_PANEL = "protection.panel."; private static final String PROTECTION_PANEL = "protection.panel.";
private static final long ITEMS_PER_PAGE = 36; private static final long ITEMS_PER_PAGE = 36;
private final TabbedPanelBuilder tpb; private final TabbedPanelBuilder tpb;
private @NonNull BentoBox plugin = BentoBox.getInstance(); private @NonNull
final BentoBox plugin = BentoBox.getInstance();
private int activeTab; private int activeTab;
private int activePage; private int activePage;
private boolean closed; private boolean closed;

View File

@ -3,7 +3,7 @@ package world.bentobox.bentobox.api.placeholders.placeholderapi;
import world.bentobox.bentobox.api.addons.Addon; import world.bentobox.bentobox.api.addons.Addon;
public class AddonPlaceholderExpansion extends BasicPlaceholderExpansion { public class AddonPlaceholderExpansion extends BasicPlaceholderExpansion {
private Addon addon; private final Addon addon;
public AddonPlaceholderExpansion(Addon addon) { public AddonPlaceholderExpansion(Addon addon) {
this.addon = addon; this.addon = addon;

View File

@ -16,7 +16,7 @@ import world.bentobox.bentobox.api.user.User;
*/ */
abstract class BasicPlaceholderExpansion extends PlaceholderExpansion { abstract class BasicPlaceholderExpansion extends PlaceholderExpansion {
@NonNull @NonNull
private Map<@NonNull String, @NonNull PlaceholderReplacer> placeholders; private final Map<@NonNull String, @NonNull PlaceholderReplacer> placeholders;
BasicPlaceholderExpansion() { BasicPlaceholderExpansion() {
super(); super();

View File

@ -3,7 +3,7 @@ package world.bentobox.bentobox.api.placeholders.placeholderapi;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
public class BentoBoxPlaceholderExpansion extends BasicPlaceholderExpansion { public class BentoBoxPlaceholderExpansion extends BasicPlaceholderExpansion {
private BentoBox plugin; private final BentoBox plugin;
public BentoBoxPlaceholderExpansion(BentoBox plugin) { public BentoBoxPlaceholderExpansion(BentoBox plugin) {
super(); super();

View File

@ -47,7 +47,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class User implements MetaDataAble { public class User implements MetaDataAble {
private static Map<UUID, User> users = new HashMap<>(); private static final Map<UUID, User> users = new HashMap<>();
/** /**
* Clears all users from the user list * Clears all users from the user list
@ -136,7 +136,7 @@ public class User implements MetaDataAble {
private static BentoBox plugin = BentoBox.getInstance(); private static BentoBox plugin = BentoBox.getInstance();
@Nullable @Nullable
private Player player; private final Player player;
private OfflinePlayer offlinePlayer; private OfflinePlayer offlinePlayer;
private final UUID playerUUID; private final UUID playerUUID;
@Nullable @Nullable

View File

@ -63,10 +63,10 @@ public class BlueprintClipboard {
private boolean copying; private boolean copying;
private int index; private int index;
private int lastPercentage; private int lastPercentage;
private Map<Vector, List<BlueprintEntity>> bpEntities = new LinkedHashMap<>(); private final Map<Vector, List<BlueprintEntity>> bpEntities = new LinkedHashMap<>();
private Map<Vector, BlueprintBlock> bpAttachable = new LinkedHashMap<>(); private final Map<Vector, BlueprintBlock> bpAttachable = new LinkedHashMap<>();
private Map<Vector, BlueprintBlock> bpBlocks = new LinkedHashMap<>(); private final Map<Vector, BlueprintBlock> bpBlocks = new LinkedHashMap<>();
private BentoBox plugin = BentoBox.getInstance(); private final BentoBox plugin = BentoBox.getInstance();
/** /**
* Create a clipboard for blueprint * Create a clipboard for blueprint

View File

@ -72,7 +72,7 @@ public class BlueprintPaster {
private static final Map<String, String> BLOCK_CONVERSION = ImmutableMap.of("sign", "oak_sign", "wall_sign", "oak_wall_sign"); private static final Map<String, String> BLOCK_CONVERSION = ImmutableMap.of("sign", "oak_sign", "wall_sign", "oak_wall_sign");
private BentoBox plugin; private final BentoBox plugin;
// The minimum block position (x,y,z) // The minimum block position (x,y,z)
private Location pos1; private Location pos1;
// The maximum block position (x,y,z) // The maximum block position (x,y,z)
@ -85,19 +85,19 @@ public class BlueprintPaster {
* The Blueprint to paste. * The Blueprint to paste.
*/ */
@NonNull @NonNull
private Blueprint blueprint; private final Blueprint blueprint;
/** /**
* The Location to paste to. * The Location to paste to.
*/ */
@NonNull @NonNull
private Location location; private final Location location;
/** /**
* Island related to this paste, may be null. * Island related to this paste, may be null.
*/ */
@Nullable @Nullable
private Island island; private final Island island;
/** /**
* Paste a clipboard to a location and run task * Paste a clipboard to a location and run task

View File

@ -23,8 +23,8 @@ import world.bentobox.bentobox.util.Util;
public class DescriptionPrompt extends StringPrompt { public class DescriptionPrompt extends StringPrompt {
private static final String DESCRIPTION = "description"; private static final String DESCRIPTION = "description";
private GameModeAddon addon; private final GameModeAddon addon;
private BlueprintBundle bb; private final BlueprintBundle bb;
public DescriptionPrompt(GameModeAddon addon, BlueprintBundle bb) { public DescriptionPrompt(GameModeAddon addon, BlueprintBundle bb) {
this.addon = addon; this.addon = addon;

View File

@ -15,8 +15,8 @@ import world.bentobox.bentobox.panels.BlueprintManagementPanel;
public class DescriptionSuccessPrompt extends MessagePrompt { public class DescriptionSuccessPrompt extends MessagePrompt {
private GameModeAddon addon; private final GameModeAddon addon;
private BlueprintBundle bb; private final BlueprintBundle bb;
/** /**
* @param addon game mode addon * @param addon game mode addon

View File

@ -20,9 +20,9 @@ import world.bentobox.bentobox.util.Util;
public class NamePrompt extends StringPrompt { public class NamePrompt extends StringPrompt {
private GameModeAddon addon; private final GameModeAddon addon;
@Nullable @Nullable
private BlueprintBundle bb; private final BlueprintBundle bb;
@Nullable @Nullable
private Blueprint bp; private Blueprint bp;

View File

@ -17,9 +17,9 @@ import world.bentobox.bentobox.panels.BlueprintManagementPanel;
public class NameSuccessPrompt extends MessagePrompt { public class NameSuccessPrompt extends MessagePrompt {
private GameModeAddon addon; private final GameModeAddon addon;
private BlueprintBundle bb; private BlueprintBundle bb;
private Blueprint bp; private final Blueprint bp;
/** /**
* Handles the name processing * Handles the name processing

View File

@ -11,7 +11,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
*/ */
public class BlueprintClipboardReader implements ClipboardReader { public class BlueprintClipboardReader implements ClipboardReader {
private InputStream inputStream; private final InputStream inputStream;
public BlueprintClipboardReader(InputStream inputStream) { public BlueprintClipboardReader(InputStream inputStream) {
this.inputStream = inputStream; this.inputStream = inputStream;

View File

@ -11,7 +11,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
*/ */
public class BlueprintClipboardWriter implements ClipboardWriter { public class BlueprintClipboardWriter implements ClipboardWriter {
private OutputStream outputStream; private final OutputStream outputStream;
public BlueprintClipboardWriter(OutputStream outputStream) { public BlueprintClipboardWriter(OutputStream outputStream) {
this.outputStream = outputStream; this.outputStream = outputStream;

View File

@ -21,8 +21,8 @@ import world.bentobox.bentobox.api.addons.Addon;
*/ */
public class Database<T> { public class Database<T> {
private AbstractDatabaseHandler<T> handler; private final AbstractDatabaseHandler<T> handler;
private Logger logger; private final Logger logger;
private static DatabaseSetup databaseSetup = DatabaseSetup.getDatabase(); private static DatabaseSetup databaseSetup = DatabaseSetup.getDatabase();
/** /**

View File

@ -17,7 +17,7 @@ import world.bentobox.bentobox.database.DatabaseConnector;
*/ */
public abstract class AbstractJSONDatabaseHandler<T> extends AbstractDatabaseHandler<T> { public abstract class AbstractJSONDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
private Gson gson; private final Gson gson;
/** /**
* Constructor * Constructor

View File

@ -6,7 +6,7 @@ import world.bentobox.bentobox.database.DatabaseSetup;
public class JSONDatabase implements DatabaseSetup { public class JSONDatabase implements DatabaseSetup {
private JSONDatabaseConnector connector = new JSONDatabaseConnector(BentoBox.getInstance()); private final JSONDatabaseConnector connector = new JSONDatabaseConnector(BentoBox.getInstance());
/* (non-Javadoc) /* (non-Javadoc)
* @see world.bentobox.bentobox.database.DatabaseSetup#getHandler(java.lang.Class) * @see world.bentobox.bentobox.database.DatabaseSetup#getHandler(java.lang.Class)

View File

@ -15,7 +15,7 @@ import world.bentobox.bentobox.api.flags.Flag;
public class FlagTypeAdapter extends TypeAdapter<Flag> { public class FlagTypeAdapter extends TypeAdapter<Flag> {
private BentoBox plugin; private final BentoBox plugin;
public FlagTypeAdapter(BentoBox plugin) { public FlagTypeAdapter(BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -40,7 +40,7 @@ public class MongoDBDatabaseHandler<T> extends AbstractJSONDatabaseHandler<T> {
private static final String MONGO_ID = "_id"; private static final String MONGO_ID = "_id";
private MongoCollection<Document> collection; private MongoCollection<Document> collection;
private DatabaseConnector dbConnecter; private final DatabaseConnector dbConnecter;
/** /**
* Handles the connection to the database and creation of the initial database schema (tables) for * Handles the connection to the database and creation of the initial database schema (tables) for

View File

@ -18,7 +18,7 @@ public class SQLConfiguration {
private String loadObjectsSQL; private String loadObjectsSQL;
private String renameTableSQL; private String renameTableSQL;
private final String tableName; private final String tableName;
private boolean renameRequired; private final boolean renameRequired;
private final String oldTableName; private final String oldTableName;
public <T> SQLConfiguration(BentoBox plugin, Class<T> type) { public <T> SQLConfiguration(BentoBox plugin, Class<T> type) {

View File

@ -15,7 +15,7 @@ import world.bentobox.bentobox.database.DatabaseConnector;
public abstract class SQLDatabaseConnector implements DatabaseConnector { public abstract class SQLDatabaseConnector implements DatabaseConnector {
protected String connectionUrl; protected String connectionUrl;
private DatabaseConnectionSettingsImpl dbSettings; private final DatabaseConnectionSettingsImpl dbSettings;
protected static Connection connection = null; protected static Connection connection = null;
protected static Set<Class<?>> types = new HashSet<>(); protected static Set<Class<?>> types = new HashSet<>();

View File

@ -10,7 +10,7 @@ import world.bentobox.bentobox.database.DatabaseSetup;
*/ */
public class SQLiteDatabase implements DatabaseSetup { public class SQLiteDatabase implements DatabaseSetup {
private SQLiteDatabaseConnector connector = new SQLiteDatabaseConnector(BentoBox.getInstance()); private final SQLiteDatabaseConnector connector = new SQLiteDatabaseConnector(BentoBox.getInstance());
@Override @Override
public <T> AbstractDatabaseHandler<T> getHandler(Class<T> dataObjectClass) { public <T> AbstractDatabaseHandler<T> getHandler(Class<T> dataObjectClass) {

View File

@ -19,8 +19,8 @@ import world.bentobox.bentobox.database.AbstractDatabaseHandler;
*/ */
public class TransitionDatabaseHandler<T> extends AbstractDatabaseHandler<T> { public class TransitionDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
private AbstractDatabaseHandler<T> fromHandler; private final AbstractDatabaseHandler<T> fromHandler;
private AbstractDatabaseHandler<T> toHandler; private final AbstractDatabaseHandler<T> toHandler;
/** /**
* Constructor * Constructor

View File

@ -6,7 +6,7 @@ import world.bentobox.bentobox.database.DatabaseSetup;
public class YamlDatabase implements DatabaseSetup { public class YamlDatabase implements DatabaseSetup {
private YamlDatabaseConnector connector = new YamlDatabaseConnector(BentoBox.getInstance()); private final YamlDatabaseConnector connector = new YamlDatabaseConnector(BentoBox.getInstance());
/** /**
* Get the config * Get the config

View File

@ -24,7 +24,7 @@ public class DynmapHook extends Hook {
private MarkerAPI markerAPI; private MarkerAPI markerAPI;
@NonNull @NonNull
private Map<@NonNull GameModeAddon, @NonNull MarkerSet> markerSets; private final Map<@NonNull GameModeAddon, @NonNull MarkerSet> markerSets;
public DynmapHook() { public DynmapHook() {
super("dynmap", Material.FILLED_MAP); super("dynmap", Material.FILLED_MAP);

View File

@ -26,7 +26,7 @@ import world.bentobox.bentobox.api.placeholders.placeholderapi.BentoBoxPlacehold
public class PlaceholderAPIHook extends PlaceholderHook { public class PlaceholderAPIHook extends PlaceholderHook {
private BentoBoxPlaceholderExpansion bentoboxExpansion; private BentoBoxPlaceholderExpansion bentoboxExpansion;
private Map<Addon, AddonPlaceholderExpansion> addonsExpansions; private final Map<Addon, AddonPlaceholderExpansion> addonsExpansions;
private final Set<String> bentoBoxPlaceholders; private final Set<String> bentoBoxPlaceholders;
private final Map<Addon, Set<String>> addonPlaceholders; private final Map<Addon, Set<String>> addonPlaceholders;

View File

@ -19,7 +19,7 @@ import world.bentobox.bentobox.lists.Flags;
*/ */
public class BannedCommands implements Listener { public class BannedCommands implements Listener {
private BentoBox plugin; private final BentoBox plugin;
/** /**
* @param plugin - plugin * @param plugin - plugin

View File

@ -18,7 +18,7 @@ import world.bentobox.bentobox.lists.Flags;
public class BlockEndDragon implements Listener { public class BlockEndDragon implements Listener {
private BentoBox plugin; private final BentoBox plugin;
public BlockEndDragon(@NonNull BentoBox plugin) { public BlockEndDragon(@NonNull BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -15,7 +15,7 @@ import world.bentobox.bentobox.BentoBox;
*/ */
public class DeathListener implements Listener { public class DeathListener implements Listener {
private BentoBox plugin; private final BentoBox plugin;
public DeathListener(@NonNull BentoBox plugin) { public DeathListener(@NonNull BentoBox plugin) {
super(); super();

View File

@ -32,8 +32,8 @@ import world.bentobox.bentobox.util.Util;
public class JoinLeaveListener implements Listener { public class JoinLeaveListener implements Listener {
private BentoBox plugin; private final BentoBox plugin;
private PlayersManager players; private final PlayersManager players;
/** /**
* @param plugin - plugin object * @param plugin - plugin object

View File

@ -24,7 +24,7 @@ import world.bentobox.bentobox.api.user.User;
public class PanelListenerManager implements Listener { public class PanelListenerManager implements Listener {
private static HashMap<UUID, Panel> openPanels = new HashMap<>(); private static final HashMap<UUID, Panel> openPanels = new HashMap<>();
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClick(InventoryClickEvent event) { public void onInventoryClick(InventoryClickEvent event) {

View File

@ -43,8 +43,8 @@ import world.bentobox.bentobox.util.teleport.SafeSpotTeleport;
public class PortalTeleportationListener implements Listener { public class PortalTeleportationListener implements Listener {
private final BentoBox plugin; private final BentoBox plugin;
private Set<UUID> inPortal; private final Set<UUID> inPortal;
private Set<UUID> inTeleport; private final Set<UUID> inTeleport;
public PortalTeleportationListener(@NonNull BentoBox plugin) { public PortalTeleportationListener(@NonNull BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -17,9 +17,9 @@ import world.bentobox.bentobox.managers.RanksManager;
*/ */
public class CommandCycleClick implements ClickHandler { public class CommandCycleClick implements ClickHandler {
private BentoBox plugin = BentoBox.getInstance(); private final BentoBox plugin = BentoBox.getInstance();
private String command; private final String command;
private CommandRankClickListener commandRankClickListener; private final CommandRankClickListener commandRankClickListener;
public CommandCycleClick(CommandRankClickListener commandRankClickListener, String c) { public CommandCycleClick(CommandRankClickListener commandRankClickListener, String c) {
this.commandRankClickListener = commandRankClickListener; this.commandRankClickListener = commandRankClickListener;

View File

@ -29,7 +29,7 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class CommandRankClickListener implements ClickHandler { public class CommandRankClickListener implements ClickHandler {
private BentoBox plugin = BentoBox.getInstance(); private final BentoBox plugin = BentoBox.getInstance();
/* (non-Javadoc) /* (non-Javadoc)
* @see world.bentobox.bentobox.api.panels.PanelItem.ClickHandler#onClick(world.bentobox.bentobox.api.panels.Panel, world.bentobox.bentobox.api.user.User, org.bukkit.event.inventory.ClickType, int) * @see world.bentobox.bentobox.api.panels.PanelItem.ClickHandler#onClick(world.bentobox.bentobox.api.panels.Panel, world.bentobox.bentobox.api.user.User, org.bukkit.event.inventory.ClickType, int)

View File

@ -41,8 +41,8 @@ import world.bentobox.bentobox.versions.ServerCompatibility;
*/ */
public class HurtingListener extends FlagListener { public class HurtingListener extends FlagListener {
private Map<Integer, Player> thrownPotions = new HashMap<>(); private final Map<Integer, Player> thrownPotions = new HashMap<>();
private Map<Entity, Entity> firedFireworks = new WeakHashMap<>(); private final Map<Entity, Entity> firedFireworks = new WeakHashMap<>();
/** /**
* Handles mob and monster protection * Handles mob and monster protection

View File

@ -40,8 +40,8 @@ import world.bentobox.bentobox.managers.RanksManager;
*/ */
public class PVPListener extends FlagListener { public class PVPListener extends FlagListener {
private Map<Integer, UUID> thrownPotions = new HashMap<>(); private final Map<Integer, UUID> thrownPotions = new HashMap<>();
private Map<Entity, Player> firedFireworks = new WeakHashMap<>(); private final Map<Entity, Player> firedFireworks = new WeakHashMap<>();
/** /**
* This method protects players from PVP if it is not allowed and from * This method protects players from PVP if it is not allowed and from

View File

@ -31,14 +31,14 @@ import world.bentobox.bentobox.util.Pair;
*/ */
public class CleanSuperFlatListener extends FlagListener { public class CleanSuperFlatListener extends FlagListener {
private BentoBox plugin = BentoBox.getInstance(); private final BentoBox plugin = BentoBox.getInstance();
/** /**
* Stores pairs of X,Z coordinates of chunks that need to be regenerated. * Stores pairs of X,Z coordinates of chunks that need to be regenerated.
* @since 1.1 * @since 1.1
*/ */
@NonNull @NonNull
private Queue<@NonNull Pair<@NonNull Integer, @NonNull Integer>> chunkQueue = new LinkedList<>(); private final Queue<@NonNull Pair<@NonNull Integer, @NonNull Integer>> chunkQueue = new LinkedList<>();
/** /**
* Task that runs each tick to regenerate chunks that are in the {@link #chunkQueue}. * Task that runs each tick to regenerate chunks that are in the {@link #chunkQueue}.

View File

@ -24,7 +24,7 @@ import world.bentobox.bentobox.database.objects.Island;
*/ */
public class GeoLimitMobsListener extends FlagListener { public class GeoLimitMobsListener extends FlagListener {
private Map<Entity, Island> mobSpawnTracker = new WeakHashMap<>(); private final Map<Entity, Island> mobSpawnTracker = new WeakHashMap<>();
/** /**
* Start the tracker when the plugin is loaded * Start the tracker when the plugin is loaded

View File

@ -422,7 +422,7 @@ public final class Flags {
.listener(new PistonPushListener()) .listener(new PistonPushListener())
.build(); .build();
private static InvincibleVisitorsListener ilv = new InvincibleVisitorsListener(); private static final InvincibleVisitorsListener ilv = new InvincibleVisitorsListener();
public static final Flag INVINCIBLE_VISITORS = new Flag.Builder("INVINCIBLE_VISITORS", Material.DIAMOND_CHESTPLATE).type(Type.WORLD_SETTING) public static final Flag INVINCIBLE_VISITORS = new Flag.Builder("INVINCIBLE_VISITORS", Material.DIAMOND_CHESTPLATE).type(Type.WORLD_SETTING)
.listener(ilv).clickHandler(ilv).usePanel(true).build(); .listener(ilv).clickHandler(ilv).usePanel(true).build();

View File

@ -319,11 +319,11 @@ public enum GameModePlaceholder {
*/ */
OWNS_ISLAND("owns_island", (addon, user, island) -> String.valueOf(island != null && user != null && user.getUniqueId().equals(island.getOwner()))); OWNS_ISLAND("owns_island", (addon, user, island) -> String.valueOf(island != null && user != null && user.getUniqueId().equals(island.getOwner())));
private String placeholder; private final String placeholder;
/** /**
* @since 1.5.0 * @since 1.5.0
*/ */
private GameModePlaceholderReplacer replacer; private final GameModePlaceholderReplacer replacer;
GameModePlaceholder(String placeholder, GameModePlaceholderReplacer replacer) { GameModePlaceholder(String placeholder, GameModePlaceholderReplacer replacer) {
this.placeholder = placeholder; this.placeholder = placeholder;

View File

@ -62,14 +62,16 @@ public class AddonsManager {
private static final String GAMEMODE = "[gamemode]."; private static final String GAMEMODE = "[gamemode].";
@NonNull @NonNull
private List<Addon> addons; private final List<Addon> addons;
@NonNull @NonNull
private Map<@NonNull Addon, @Nullable AddonClassLoader> loaders; private final Map<@NonNull Addon, @Nullable AddonClassLoader> loaders;
@NonNull @NonNull
private final Map<String, Class<?>> classes; private final Map<String, Class<?>> classes;
private BentoBox plugin; private final BentoBox plugin;
private @NonNull Map<@NonNull String, @Nullable GameModeAddon> worldNames; private @NonNull
private @NonNull Map<@NonNull Addon, @NonNull List<Listener>> listeners; final Map<@NonNull String, @Nullable GameModeAddon> worldNames;
private @NonNull
final Map<@NonNull Addon, @NonNull List<Listener>> listeners;
private final PluginLoader pluginLoader; private final PluginLoader pluginLoader;

View File

@ -35,13 +35,13 @@ public class BlueprintClipboardManager {
private static final String LOAD_ERROR = "Could not load blueprint file - does not exist : "; private static final String LOAD_ERROR = "Could not load blueprint file - does not exist : ";
private File blueprintFolder; private final File blueprintFolder;
private BlueprintClipboard clipboard; private BlueprintClipboard clipboard;
private Gson gson; private Gson gson;
private BentoBox plugin; private final BentoBox plugin;
public BlueprintClipboardManager(BentoBox plugin, File blueprintFolder) { public BlueprintClipboardManager(BentoBox plugin, File blueprintFolder) {
this(plugin, blueprintFolder, null); this(plugin, blueprintFolder, null);

View File

@ -67,13 +67,15 @@ public class BlueprintsManager {
* Inner map's key is the uniqueId of the blueprint bundle so it's * Inner map's key is the uniqueId of the blueprint bundle so it's
* easy to get from a UI * easy to get from a UI
*/ */
private @NonNull Map<GameModeAddon, List<BlueprintBundle>> blueprintBundles; private @NonNull
final Map<GameModeAddon, List<BlueprintBundle>> blueprintBundles;
/** /**
* Map of blueprints. There can be many blueprints per game mode addon * Map of blueprints. There can be many blueprints per game mode addon
* Inner map's key is the blueprint's name so it's easy to get from a UI * Inner map's key is the blueprint's name so it's easy to get from a UI
*/ */
private @NonNull Map<GameModeAddon, List<Blueprint>> blueprints; private @NonNull
final Map<GameModeAddon, List<Blueprint>> blueprints;
/** /**
* Gson used for serializing/deserializing the bundle class * Gson used for serializing/deserializing the bundle class
@ -82,7 +84,8 @@ public class BlueprintsManager {
private final @NonNull BentoBox plugin; private final @NonNull BentoBox plugin;
private @NonNull Set<GameModeAddon> blueprintsLoaded; private @NonNull
final Set<GameModeAddon> blueprintsLoaded;
public BlueprintsManager(@NonNull BentoBox plugin) { public BlueprintsManager(@NonNull BentoBox plugin) {

View File

@ -18,7 +18,7 @@ import world.bentobox.bentobox.api.commands.CompositeCommand;
public class CommandsManager { public class CommandsManager {
@NonNull @NonNull
private Map<@NonNull String, @NonNull CompositeCommand> commands = new HashMap<>(); private final Map<@NonNull String, @NonNull CompositeCommand> commands = new HashMap<>();
private SimpleCommandMap commandMap; private SimpleCommandMap commandMap;
public void registerCommand(@NonNull CompositeCommand command) { public void registerCommand(@NonNull CompositeCommand command) {

View File

@ -23,8 +23,9 @@ import world.bentobox.bentobox.lists.Flags;
*/ */
public class FlagsManager { public class FlagsManager {
private @NonNull BentoBox plugin; private @NonNull
private Map<@NonNull Flag, @Nullable Addon> flags = new HashMap<>(); final BentoBox plugin;
private final Map<@NonNull Flag, @Nullable Addon> flags = new HashMap<>();
/** /**
* Stores the flag listeners that have already been registered into Bukkit's API to avoid duplicates. * Stores the flag listeners that have already been registered into Bukkit's API to avoid duplicates.
@ -32,7 +33,7 @@ public class FlagsManager {
* This helps to make sure each flag listener is loaded correctly. * This helps to make sure each flag listener is loaded correctly.
* @see #registerListeners() * @see #registerListeners()
*/ */
private Map<@NonNull Listener, @NonNull Boolean> registeredListeners = new HashMap<>(); private final Map<@NonNull Listener, @NonNull Boolean> registeredListeners = new HashMap<>();
public FlagsManager(@NonNull BentoBox plugin) { public FlagsManager(@NonNull BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -19,7 +19,7 @@ import world.bentobox.bentobox.lists.GameModePlaceholder;
@Deprecated @Deprecated
public class GameModePlaceholderManager { public class GameModePlaceholderManager {
private BentoBox plugin; private final BentoBox plugin;
public GameModePlaceholderManager(BentoBox plugin) { public GameModePlaceholderManager(BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -14,11 +14,11 @@ import world.bentobox.bentobox.api.hooks.Hook;
*/ */
public class HooksManager { public class HooksManager {
private BentoBox plugin; private final BentoBox plugin;
/** /**
* List of successfully registered hooks. * List of successfully registered hooks.
*/ */
private List<Hook> hooks; private final List<Hook> hooks;
public HooksManager(BentoBox plugin) { public HooksManager(BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -26,12 +26,12 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class IslandDeletionManager implements Listener { public class IslandDeletionManager implements Listener {
private BentoBox plugin; private final BentoBox plugin;
/** /**
* Queue of islands to delete * Queue of islands to delete
*/ */
private Database<IslandDeletion> handler; private final Database<IslandDeletion> handler;
private Set<Location> inDeletion; private final Set<Location> inDeletion;
public IslandDeletionManager(BentoBox plugin) { public IslandDeletionManager(BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -34,11 +34,11 @@ import world.bentobox.bentobox.lists.Flags;
*/ */
public class IslandWorldManager { public class IslandWorldManager {
private BentoBox plugin; private final BentoBox plugin;
/** /**
* Map associating Worlds (Overworld, Nether and End) with the GameModeAddon that creates them. * Map associating Worlds (Overworld, Nether and End) with the GameModeAddon that creates them.
*/ */
private Map<@NonNull World, @NonNull GameModeAddon> gameModes; private final Map<@NonNull World, @NonNull GameModeAddon> gameModes;
/** /**
* Manages worlds registered with BentoBox * Manages worlds registered with BentoBox

View File

@ -66,7 +66,7 @@ import world.bentobox.bentobox.util.teleport.SafeSpotTeleport;
*/ */
public class IslandsManager { public class IslandsManager {
private BentoBox plugin; private final BentoBox plugin;
// Tree species to boat material map // Tree species to boat material map
private static final Map<TreeSpecies, Material> TREE_TO_BOAT = ImmutableMap.<TreeSpecies, Material>builder(). private static final Map<TreeSpecies, Material> TREE_TO_BOAT = ImmutableMap.<TreeSpecies, Material>builder().
@ -81,7 +81,7 @@ public class IslandsManager {
* One island can be spawn, this is the one - otherwise, this value is null * One island can be spawn, this is the one - otherwise, this value is null
*/ */
@NonNull @NonNull
private Map<@NonNull World, @Nullable Island> spawn; private final Map<@NonNull World, @Nullable Island> spawn;
@NonNull @NonNull
private Database<Island> handler; private Database<Island> handler;
@ -90,17 +90,17 @@ public class IslandsManager {
* The last locations where an island were put. * The last locations where an island were put.
* This is not stored persistently and resets when the server starts * This is not stored persistently and resets when the server starts
*/ */
private Map<World, Location> last; private final Map<World, Location> last;
// Island Cache // Island Cache
@NonNull @NonNull
private IslandCache islandCache; private IslandCache islandCache;
// Quarantined islands // Quarantined islands
@NonNull @NonNull
private Map<UUID, List<Island>> quarantineCache; private final Map<UUID, List<Island>> quarantineCache;
// Deleted islands // Deleted islands
@NonNull @NonNull
private List<String> deletedIslands; private final List<String> deletedIslands;
private boolean isSaveTaskRunning; private boolean isSaveTaskRunning;

View File

@ -35,8 +35,8 @@ import world.bentobox.bentobox.util.Util;
*/ */
public class LocalesManager { public class LocalesManager {
private BentoBox plugin; private final BentoBox plugin;
private Map<Locale, BentoBoxLocale> languages = new HashMap<>(); private final Map<Locale, BentoBoxLocale> languages = new HashMap<>();
private static final String LOCALE_FOLDER = "locales"; private static final String LOCALE_FOLDER = "locales";
private static final String BENTOBOX = "BentoBox"; private static final String BENTOBOX = "BentoBox";
private static final String SPACER = "*************************************************"; private static final String SPACER = "*************************************************";

View File

@ -21,7 +21,7 @@ import world.bentobox.bentobox.lists.GameModePlaceholder;
*/ */
public class PlaceholdersManager { public class PlaceholdersManager {
private BentoBox plugin; private final BentoBox plugin;
public PlaceholdersManager(BentoBox plugin) { public PlaceholdersManager(BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -28,12 +28,12 @@ import world.bentobox.bentobox.util.Util;
public class PlayersManager { public class PlayersManager {
private BentoBox plugin; private final BentoBox plugin;
private Database<Players> handler; private Database<Players> handler;
private Database<Names> names; private final Database<Names> names;
private Map<UUID, Players> playerCache; private final Map<UUID, Players> playerCache;
private Set<UUID> inTeleport; private final Set<UUID> inTeleport;
private boolean isSaveTaskRunning; private boolean isSaveTaskRunning;

View File

@ -34,11 +34,15 @@ import world.bentobox.bentobox.web.credits.Contributor;
*/ */
public class WebManager { public class WebManager {
private @NonNull BentoBox plugin; private @NonNull
final BentoBox plugin;
private @Nullable GitHubWebAPI gitHub; private @Nullable GitHubWebAPI gitHub;
private @NonNull List<CatalogEntry> addonsCatalog; private @NonNull
private @NonNull List<CatalogEntry> gamemodesCatalog; final List<CatalogEntry> addonsCatalog;
private @NonNull Map<String, List<Contributor>> contributors; private @NonNull
final List<CatalogEntry> gamemodesCatalog;
private @NonNull
final Map<String, List<Contributor>> contributors;
public WebManager(@NonNull BentoBox plugin) { public WebManager(@NonNull BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -12,8 +12,8 @@ import world.bentobox.bentobox.database.objects.Island;
* *
*/ */
class IslandGrid { class IslandGrid {
private TreeMap<Integer, TreeMap<Integer, Island>> grid = new TreeMap<>(); private final TreeMap<Integer, TreeMap<Integer, Island>> grid = new TreeMap<>();
private BentoBox plugin = BentoBox.getInstance(); private final BentoBox plugin = BentoBox.getInstance();
/** /**
* Adds island to grid * Adds island to grid

View File

@ -26,14 +26,14 @@ import world.bentobox.bentobox.managers.BlueprintsManager;
* *
*/ */
public class NewIsland { public class NewIsland {
private BentoBox plugin; private final BentoBox plugin;
private Island island; private Island island;
private final User user; private final User user;
private final Reason reason; private final Reason reason;
private final World world; private final World world;
private String name; private String name;
private final boolean noPaste; private final boolean noPaste;
private GameModeAddon addon; private final GameModeAddon addon;
private NewIslandLocationStrategy locationStrategy; private NewIslandLocationStrategy locationStrategy;

View File

@ -52,7 +52,7 @@ public class BlueprintManagementPanel {
public static final int MAX_BP_SLOT = 35; public static final int MAX_BP_SLOT = 35;
private static final String INSTRUCTION = "instruction"; private static final String INSTRUCTION = "instruction";
private Entry<Integer, Blueprint> selected; private Entry<Integer, Blueprint> selected;
private Map<Integer, Blueprint> blueprints = new HashMap<>(); private final Map<Integer, Blueprint> blueprints = new HashMap<>();
private final User user; private final User user;
private final GameModeAddon addon; private final GameModeAddon addon;

View File

@ -21,10 +21,10 @@ import world.bentobox.bentobox.blueprints.dataobjects.BlueprintBundle;
*/ */
public class IconChanger implements PanelListener { public class IconChanger implements PanelListener {
private GameModeAddon addon; private final GameModeAddon addon;
private BlueprintBundle bb; private final BlueprintBundle bb;
private BlueprintManagementPanel blueprintManagementPanel; private final BlueprintManagementPanel blueprintManagementPanel;
private BentoBox plugin; private final BentoBox plugin;
/** /**
* Change the icon of a blueprint bundle or blueprint * Change the icon of a blueprint bundle or blueprint

View File

@ -33,9 +33,9 @@ public class DeleteIslandChunks {
private int chunkX; private int chunkX;
private int chunkZ; private int chunkZ;
private BukkitTask task; private BukkitTask task;
private IslandDeletion di; private final IslandDeletion di;
private boolean inDelete; private boolean inDelete;
private BentoBox plugin; private final BentoBox plugin;
private NMSAbstraction nms; private NMSAbstraction nms;
public DeleteIslandChunks(BentoBox plugin, IslandDeletion di) { public DeleteIslandChunks(BentoBox plugin, IslandDeletion di) {

View File

@ -20,7 +20,7 @@ import org.bukkit.plugin.java.JavaPlugin;
* @author Poslovitch * @author Poslovitch
*/ */
public class FileLister{ public class FileLister{
private Plugin plugin; private final Plugin plugin;
public FileLister(Plugin level){ public FileLister(Plugin level){
plugin = level; plugin = level;

View File

@ -300,7 +300,7 @@ public class SafeSpotTeleport {
private String failureMessage = ""; private String failureMessage = "";
private Location location; private Location location;
private Runnable runnable; private Runnable runnable;
private CompletableFuture<Boolean> result = new CompletableFuture<>(); private final CompletableFuture<Boolean> result = new CompletableFuture<>();
public Builder(BentoBox plugin) { public Builder(BentoBox plugin) {
this.plugin = plugin; this.plugin = plugin;

View File

@ -17,7 +17,7 @@ public class ServerCompatibility {
// ---- SINGLETON ---- // ---- SINGLETON ----
private static ServerCompatibility instance = new ServerCompatibility(); private static final ServerCompatibility instance = new ServerCompatibility();
public static ServerCompatibility getInstance() { public static ServerCompatibility getInstance() {
return instance; return instance;
@ -54,7 +54,7 @@ public class ServerCompatibility {
*/ */
INCOMPATIBLE(false); INCOMPATIBLE(false);
private boolean canLaunch; private final boolean canLaunch;
Compatibility(boolean canLaunch) { Compatibility(boolean canLaunch) {
this.canLaunch = canLaunch; this.canLaunch = canLaunch;
@ -85,7 +85,7 @@ public class ServerCompatibility {
*/ */
UNKNOWN(Compatibility.INCOMPATIBLE); UNKNOWN(Compatibility.INCOMPATIBLE);
private Compatibility compatibility; private final Compatibility compatibility;
/** /**
* @since 1.14.0 * @since 1.14.0
*/ */
@ -190,7 +190,7 @@ public class ServerCompatibility {
V1_17_1(Compatibility.COMPATIBLE) V1_17_1(Compatibility.COMPATIBLE)
; ;
private Compatibility compatibility; private final Compatibility compatibility;
ServerVersion(Compatibility compatibility) { ServerVersion(Compatibility compatibility) {
this.compatibility = compatibility; this.compatibility = compatibility;

View File

@ -13,16 +13,22 @@ import com.google.gson.JsonObject;
*/ */
public class CatalogEntry { public class CatalogEntry {
private int slot; private final int slot;
/** /**
* Defaults to {@link Material#PAPER}. * Defaults to {@link Material#PAPER}.
*/ */
private @NonNull Material icon; private @NonNull
private @NonNull String name; final Material icon;
private @NonNull String description; private @NonNull
private @Nullable String topic; final String name;
private @Nullable String tag; private @NonNull
private @NonNull String repository; final String description;
private @Nullable
final String topic;
private @Nullable
final String tag;
private @NonNull
final String repository;
public CatalogEntry(@NonNull JsonObject object) { public CatalogEntry(@NonNull JsonObject object) {
this.slot = object.get("slot").getAsInt(); this.slot = object.get("slot").getAsInt();

View File

@ -9,8 +9,9 @@ import org.eclipse.jdt.annotation.NonNull;
*/ */
public class Contributor { public class Contributor {
private @NonNull String name; private @NonNull
private int commits; final String name;
private final int commits;
public Contributor(@NonNull String name, int commits) { public Contributor(@NonNull String name, int commits) {
this.name = name; this.name = name;

View File

@ -301,7 +301,7 @@ public class AddonTest {
* Utility methods * Utility methods
*/ */
private void createJarArchive(File archiveFile, List<File> tobeJaredList) { private void createJarArchive(File archiveFile, List<File> tobeJaredList) {
byte buffer[] = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
// Open archive file // Open archive file
try (FileOutputStream stream = new FileOutputStream(archiveFile)) { try (FileOutputStream stream = new FileOutputStream(archiveFile)) {
try (JarOutputStream out = new JarOutputStream(stream, new Manifest())) { try (JarOutputStream out = new JarOutputStream(stream, new Manifest())) {

View File

@ -58,7 +58,7 @@ public class AdminResetFlagsCommandTest {
@Mock @Mock
private CompositeCommand ac; private CompositeCommand ac;
private UUID uuid = UUID.randomUUID(); private final UUID uuid = UUID.randomUUID();
@Mock @Mock
private IslandsManager im; private IslandsManager im;
@Mock @Mock

View File

@ -23,7 +23,7 @@ public class LogEntryListAdapterTest {
private LogEntryListAdapter a; private LogEntryListAdapter a;
private YamlConfiguration config; private YamlConfiguration config;
private List<LogEntry> history = new LinkedList<>(); private final List<LogEntry> history = new LinkedList<>();
private UUID target; private UUID target;
private UUID issuer; private UUID issuer;
private List<LogEntry> toLog; private List<LogEntry> toLog;

View File

@ -66,7 +66,7 @@ public class MySQLDatabaseHandlerTest {
"}"; "}";
private MySQLDatabaseHandler<Island> handler; private MySQLDatabaseHandler<Island> handler;
private Island instance; private Island instance;
private String UNIQUE_ID = "xyz"; private final String UNIQUE_ID = "xyz";
@Mock @Mock
private MySQLDatabaseConnector dbConn; private MySQLDatabaseConnector dbConn;
@Mock @Mock

View File

@ -320,7 +320,7 @@ public class BannedCommandsTest {
*/ */
class MyWorldSettings implements WorldSettings { class MyWorldSettings implements WorldSettings {
private Map<String, Boolean> worldFlags = new HashMap<>(); private final Map<String, Boolean> worldFlags = new HashMap<>();
@Override @Override
public @NonNull List<String> getOnLeaveCommands() { public @NonNull List<String> getOnLeaveCommands() {

View File

@ -277,7 +277,7 @@ public class BlockEndDragonTest {
*/ */
class MyWorldSettings implements WorldSettings { class MyWorldSettings implements WorldSettings {
private Map<String, Boolean> worldFlags = new HashMap<>(); private final Map<String, Boolean> worldFlags = new HashMap<>();
@Override @Override
public @NonNull List<String> getOnLeaveCommands() { public @NonNull List<String> getOnLeaveCommands() {

View File

@ -128,8 +128,8 @@ public class PanelListenerManagerTest {
class MyView extends InventoryView { class MyView extends InventoryView {
private Inventory top; private final Inventory top;
private String name; private final String name;
/** /**
* @param name * @param name

View File

@ -56,9 +56,9 @@ public class BlockInteractionListenerTest extends AbstractCommonSetup {
@Mock @Mock
private Block clickedBlock; private Block clickedBlock;
private Map<Material, Flag> inHandItems = new EnumMap<>(Material.class); private final Map<Material, Flag> inHandItems = new EnumMap<>(Material.class);
private Map<Material, Flag> clickedBlocks = new EnumMap<>(Material.class); private final Map<Material, Flag> clickedBlocks = new EnumMap<>(Material.class);
private void setFlags() { private void setFlags() {
inHandItems.put(Material.ENDER_PEARL, Flags.ENDER_PEARL); inHandItems.put(Material.ENDER_PEARL, Flags.ENDER_PEARL);

View File

@ -61,7 +61,7 @@ public class FireListenerTest {
@Mock @Mock
private World world; private World world;
private Map<String, Boolean> worldFlags = new HashMap<>(); private final Map<String, Boolean> worldFlags = new HashMap<>();
@Before @Before
public void setUp() { public void setUp() {

View File

@ -58,7 +58,7 @@ public class GameModePlaceholderTest {
private IslandWorldManager iwm; private IslandWorldManager iwm;
@Mock @Mock
private IslandsManager im; private IslandsManager im;
private RanksManager rm = new RanksManager(); private final RanksManager rm = new RanksManager();
@Mock @Mock
private @Nullable Location location; private @Nullable Location location;

View File

@ -56,7 +56,7 @@ public class BlueprintClipboardManagerTest {
private File blueprintFolder; private File blueprintFolder;
private String json = "{\n" + private final String json = "{\n" +
" \"name\": \"blueprint\",\n" + " \"name\": \"blueprint\",\n" +
" \"attached\": {},\n" + " \"attached\": {},\n" +
" \"entities\": {},\n" + " \"entities\": {},\n" +
@ -78,7 +78,7 @@ public class BlueprintClipboardManagerTest {
" \"bedrock\": [-2.0, -16.0, -1.0]\n" + " \"bedrock\": [-2.0, -16.0, -1.0]\n" +
"}"; "}";
private String jsonNoBedrock = "{\n" + private final String jsonNoBedrock = "{\n" +
" \"name\": \"blueprint\",\n" + " \"name\": \"blueprint\",\n" +
" \"attached\": {},\n" + " \"attached\": {},\n" +
" \"entities\": {},\n" + " \"entities\": {},\n" +

View File

@ -667,7 +667,7 @@ public class BlueprintsManagerTest {
* Utility methods * Utility methods
*/ */
private void createJarArchive(File archiveFile, File folder, List<File> tobeJaredList) { private void createJarArchive(File archiveFile, File folder, List<File> tobeJaredList) {
byte buffer[] = new byte[BUFFER_SIZE]; byte[] buffer = new byte[BUFFER_SIZE];
// Open archive file // Open archive file
try (FileOutputStream stream = new FileOutputStream(archiveFile)) { try (FileOutputStream stream = new FileOutputStream(archiveFile)) {
try (JarOutputStream out = new JarOutputStream(stream, new Manifest())) { try (JarOutputStream out = new JarOutputStream(stream, new Manifest())) {

View File

@ -49,7 +49,7 @@ public class IslandCacheTest {
@Mock @Mock
private Island island; private Island island;
// UUID // UUID
private UUID owner = UUID.randomUUID(); private final UUID owner = UUID.randomUUID();
@Mock @Mock
private Location location; private Location location;
// Test class // Test class

View File

@ -93,7 +93,7 @@ public class NewIslandTest {
@Mock @Mock
private BlueprintBundle bpb; private BlueprintBundle bpb;
private UUID uuid = UUID.randomUUID(); private final UUID uuid = UUID.randomUUID();
@Mock @Mock
private BlueprintsManager bpm; private BlueprintsManager bpm;