mirror of
https://github.com/NLthijs48/AreaShop.git
synced 2024-11-16 07:15:23 +01:00
Cleanups because of Intellij IDEA inspections
This commit is contained in:
parent
6154454f96
commit
012920a51c
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,7 +1,6 @@
|
||||
# Maven stuff
|
||||
/target
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
@ -15,18 +14,9 @@ local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
# IntelliJ IDEA
|
||||
*.iml
|
||||
.idea
|
||||
|
@ -155,7 +155,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
|
||||
int fixes = 0;
|
||||
Integer build = null;
|
||||
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if(plugin == null || !(plugin instanceof WorldGuardPlugin) || !plugin.isEnabled()) {
|
||||
if(!(plugin instanceof WorldGuardPlugin) || !plugin.isEnabled()) {
|
||||
error("WorldGuard plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
@ -232,7 +232,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
|
||||
// Check if WorldEdit is present
|
||||
String weVersion = null;
|
||||
plugin = getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
if(plugin == null || !(plugin instanceof WorldEditPlugin) || !plugin.isEnabled()) {
|
||||
if(!(plugin instanceof WorldEditPlugin) || !plugin.isEnabled()) {
|
||||
error("WorldEdit plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
|
@ -17,9 +17,9 @@ import java.util.Map;
|
||||
*/
|
||||
public abstract class CommandAreaShop {
|
||||
|
||||
AreaShop plugin = AreaShop.getInstance();
|
||||
final AreaShop plugin = AreaShop.getInstance();
|
||||
|
||||
private Map<String, Pair<String, Long>> lastUsed;
|
||||
private final Map<String, Pair<String, Long>> lastUsed;
|
||||
|
||||
public CommandAreaShop() {
|
||||
lastUsed = new HashMap<>();
|
||||
|
@ -30,8 +30,8 @@ import java.util.UUID;
|
||||
|
||||
public class ImportJob {
|
||||
|
||||
private AreaShop plugin;
|
||||
private CommandSender sender;
|
||||
private final AreaShop plugin;
|
||||
private final CommandSender sender;
|
||||
|
||||
/**
|
||||
* Create and execute the import.
|
||||
@ -362,7 +362,6 @@ public class ImportJob {
|
||||
|
||||
// Set rented until
|
||||
if(from.isLong("info.last-withdrawal")
|
||||
&& region != null
|
||||
&& region instanceof RentRegion) {
|
||||
RentRegion rentRegion = (RentRegion)region;
|
||||
long lastWithdrawal = from.getLong("info.last-withdrawal");
|
||||
@ -404,7 +403,7 @@ public class ImportJob {
|
||||
|
||||
}
|
||||
|
||||
private static List<Pair<Integer, String>> timeUnitLookup = new ArrayList<Pair<Integer, String>>() {
|
||||
private static final List<Pair<Integer, String>> timeUnitLookup = new ArrayList<Pair<Integer, String>>() {
|
||||
{
|
||||
add(new Pair<>(60 * 24 * 30 * 12, "year"));
|
||||
add(new Pair<>(60 * 24 * 30, "month"));
|
||||
|
@ -141,7 +141,7 @@ public class StackCommand extends CommandAreaShop {
|
||||
plugin.message(player, "stack-addStart", amount, regionsPerTick * 20);
|
||||
new BukkitRunnable() {
|
||||
private int current = -1;
|
||||
private RegionManager manager = AreaShop.getInstance().getWorldGuard().getRegionManager(selection.getWorld());
|
||||
private final RegionManager manager = AreaShop.getInstance().getWorldGuard().getRegionManager(selection.getWorld());
|
||||
private int counter = 1;
|
||||
private int tooLow = 0;
|
||||
private int tooHigh = 0;
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.OfflinePlayer;
|
||||
*/
|
||||
public class BuyingRegionEvent extends CancellableRegionEvent<BuyRegion> {
|
||||
|
||||
private OfflinePlayer player;
|
||||
private final OfflinePlayer player;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.OfflinePlayer;
|
||||
*/
|
||||
public class RentingRegionEvent extends CancellableRegionEvent<RentRegion> {
|
||||
|
||||
private OfflinePlayer player;
|
||||
private boolean extending;
|
||||
private final OfflinePlayer player;
|
||||
private final boolean extending;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.OfflinePlayer;
|
||||
*/
|
||||
public class ResellingRegionEvent extends CancellableRegionEvent<BuyRegion> {
|
||||
|
||||
private OfflinePlayer player;
|
||||
private final OfflinePlayer player;
|
||||
|
||||
/**
|
||||
* Contructor.
|
||||
|
@ -10,8 +10,8 @@ import org.bukkit.command.CommandSender;
|
||||
*/
|
||||
public class AddedFriendEvent extends CancellableRegionEvent<GeneralRegion> {
|
||||
|
||||
private OfflinePlayer friend;
|
||||
private CommandSender by;
|
||||
private final OfflinePlayer friend;
|
||||
private final CommandSender by;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -10,8 +10,8 @@ import org.bukkit.command.CommandSender;
|
||||
*/
|
||||
public class DeletedFriendEvent extends CancellableRegionEvent<GeneralRegion> {
|
||||
|
||||
private OfflinePlayer friend;
|
||||
private CommandSender by;
|
||||
private final OfflinePlayer friend;
|
||||
private final CommandSender by;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -8,7 +8,7 @@ import me.wiefferink.areashop.regions.RentRegion;
|
||||
*/
|
||||
public class RentedRegionEvent extends NotifyRegionEvent<RentRegion> {
|
||||
|
||||
private boolean extended;
|
||||
private final boolean extended;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -10,7 +10,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public class ResoldRegionEvent extends NotifyRegionEvent<BuyRegion> {
|
||||
|
||||
private UUID from;
|
||||
private final UUID from;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -10,8 +10,8 @@ import java.util.UUID;
|
||||
*/
|
||||
public class SoldRegionEvent extends NotifyRegionEvent<BuyRegion> {
|
||||
|
||||
private UUID oldBuyer;
|
||||
private double refundedMoney;
|
||||
private final UUID oldBuyer;
|
||||
private final double refundedMoney;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -10,8 +10,8 @@ import java.util.UUID;
|
||||
*/
|
||||
public class UnrentedRegionEvent extends NotifyRegionEvent<RentRegion> {
|
||||
|
||||
private UUID oldRenter;
|
||||
private double refundedMoney;
|
||||
private final UUID oldRenter;
|
||||
private final double refundedMoney;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -21,9 +21,9 @@ import java.util.Set;
|
||||
|
||||
public class TeleportFeature extends RegionFeature {
|
||||
|
||||
private static ArrayList<Material> canSpawnIn = new ArrayList<>(Arrays.asList(Material.WOOD_DOOR, Material.WOODEN_DOOR, Material.SIGN_POST, Material.WALL_SIGN, Material.STONE_PLATE, Material.IRON_DOOR_BLOCK, Material.WOOD_PLATE, Material.TRAP_DOOR, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.DRAGON_EGG, Material.GOLD_PLATE, Material.IRON_PLATE));
|
||||
private static ArrayList<Material> cannotSpawnOn = new ArrayList<>(Arrays.asList(Material.PISTON_EXTENSION, Material.PISTON_MOVING_PIECE, Material.SIGN_POST, Material.WALL_SIGN, Material.STONE_PLATE, Material.IRON_DOOR_BLOCK, Material.WOOD_PLATE, Material.TRAP_DOOR, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.CACTUS, Material.IRON_FENCE, Material.FENCE_GATE, Material.THIN_GLASS, Material.NETHER_FENCE, Material.DRAGON_EGG, Material.GOLD_PLATE, Material.IRON_PLATE, Material.STAINED_GLASS_PANE));
|
||||
private static ArrayList<Material> cannotSpawnBeside = new ArrayList<>(Arrays.asList(Material.LAVA, Material.STATIONARY_LAVA, Material.CACTUS));
|
||||
private static final ArrayList<Material> canSpawnIn = new ArrayList<>(Arrays.asList(Material.WOOD_DOOR, Material.WOODEN_DOOR, Material.SIGN_POST, Material.WALL_SIGN, Material.STONE_PLATE, Material.IRON_DOOR_BLOCK, Material.WOOD_PLATE, Material.TRAP_DOOR, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.DRAGON_EGG, Material.GOLD_PLATE, Material.IRON_PLATE));
|
||||
private static final ArrayList<Material> cannotSpawnOn = new ArrayList<>(Arrays.asList(Material.PISTON_EXTENSION, Material.PISTON_MOVING_PIECE, Material.SIGN_POST, Material.WALL_SIGN, Material.STONE_PLATE, Material.IRON_DOOR_BLOCK, Material.WOOD_PLATE, Material.TRAP_DOOR, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.CACTUS, Material.IRON_FENCE, Material.FENCE_GATE, Material.THIN_GLASS, Material.NETHER_FENCE, Material.DRAGON_EGG, Material.GOLD_PLATE, Material.IRON_PLATE, Material.STAINED_GLASS_PANE));
|
||||
private static final ArrayList<Material> cannotSpawnBeside = new ArrayList<>(Arrays.asList(Material.LAVA, Material.STATIONARY_LAVA, Material.CACTUS));
|
||||
|
||||
public TeleportFeature() {
|
||||
}
|
||||
|
@ -181,8 +181,9 @@ public class WorldGuardRegionFlagsFeature extends RegionFeature {
|
||||
}
|
||||
}
|
||||
// Indicate that the regions needs to be saved
|
||||
// TODO do we still need this? maybe only for old WorldGuard?
|
||||
plugin.getFileManager().saveIsRequiredForRegionWorld(region.getWorldName());
|
||||
if(worldGuard.getDescription().getVersion().startsWith("5.")) {
|
||||
plugin.getFileManager().saveIsRequiredForRegionWorld(region.getWorldName());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ import java.util.List;
|
||||
*/
|
||||
public class RegionSign {
|
||||
|
||||
private SignsFeature signsFeature;
|
||||
private String key;
|
||||
private final SignsFeature signsFeature;
|
||||
private final String key;
|
||||
|
||||
public RegionSign(SignsFeature signsFeature, String key) {
|
||||
this.signsFeature = signsFeature;
|
||||
|
@ -37,8 +37,8 @@ import java.util.Set;
|
||||
|
||||
public class SignsFeature extends RegionFeature {
|
||||
|
||||
private static Map<String, RegionSign> allSigns = Collections.synchronizedMap(new HashMap<>());
|
||||
private static Map<String, List<RegionSign>> signsByChunk = Collections.synchronizedMap(new HashMap<>());
|
||||
private static final Map<String, RegionSign> allSigns = Collections.synchronizedMap(new HashMap<>());
|
||||
private static final Map<String, List<RegionSign>> signsByChunk = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
private Map<String, RegionSign> signs;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
* Notify region expiry and track activity time.
|
||||
*/
|
||||
public final class PlayerLoginLogoutListener implements Listener {
|
||||
private AreaShop plugin;
|
||||
private final AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -45,7 +45,7 @@ import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class CommandManager extends Manager implements CommandExecutor, TabCompleter {
|
||||
private ArrayList<CommandAreaShop> commands;
|
||||
private final ArrayList<CommandAreaShop> commands;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -28,8 +28,8 @@ public class FeatureManager extends Manager {
|
||||
TeleportFeature.class
|
||||
));
|
||||
// One instance of each feature, registered for event handling
|
||||
private Set<RegionFeature> globalFeatures;
|
||||
private Map<Class<? extends RegionFeature>, Constructor<? extends RegionFeature>> regionFeatureConstructors;
|
||||
private final Set<RegionFeature> globalFeatures;
|
||||
private final Map<Class<? extends RegionFeature>, Constructor<? extends RegionFeature>> regionFeatureConstructors;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -56,7 +56,7 @@ public class FileManager extends Manager {
|
||||
private YamlConfiguration defaultConfig = null;
|
||||
private YamlConfiguration defaultConfigFallback = null;
|
||||
private boolean saveGroupsRequired = false;
|
||||
private Set<String> worldRegionsRequireSaving;
|
||||
private final Set<String> worldRegionsRequireSaving;
|
||||
|
||||
private HashMap<String, Integer> versions = null;
|
||||
private String versionPath = null;
|
||||
@ -184,7 +184,7 @@ public class FileManager extends Manager {
|
||||
*/
|
||||
public RentRegion getRent(String name) {
|
||||
GeneralRegion region = regions.get(name.toLowerCase());
|
||||
if(region != null && region instanceof RentRegion) {
|
||||
if(region instanceof RentRegion) {
|
||||
return (RentRegion)region;
|
||||
}
|
||||
return null;
|
||||
@ -197,7 +197,7 @@ public class FileManager extends Manager {
|
||||
*/
|
||||
public BuyRegion getBuy(String name) {
|
||||
GeneralRegion region = regions.get(name.toLowerCase());
|
||||
if(region != null && region instanceof BuyRegion) {
|
||||
if(region instanceof BuyRegion) {
|
||||
return (BuyRegion)region;
|
||||
}
|
||||
return null;
|
||||
|
@ -4,7 +4,7 @@ import me.wiefferink.areashop.AreaShop;
|
||||
|
||||
public abstract class Manager {
|
||||
|
||||
AreaShop plugin = AreaShop.getInstance();
|
||||
final AreaShop plugin = AreaShop.getInstance();
|
||||
|
||||
/**
|
||||
* Called at shutdown of the plugin.
|
||||
|
@ -28,7 +28,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SignLinkerManager extends Manager implements Listener {
|
||||
private Map<UUID, SignLinker> signLinkers;
|
||||
private final Map<UUID, SignLinker> signLinkers;
|
||||
private boolean eventsRegistered;
|
||||
|
||||
public SignLinkerManager() {
|
||||
@ -152,8 +152,8 @@ public class SignLinkerManager extends Manager implements Listener {
|
||||
private boolean hasSign = false;
|
||||
private boolean hasRegion = false;
|
||||
|
||||
public Player linker;
|
||||
public String profile;
|
||||
public final Player linker;
|
||||
public final String profile;
|
||||
|
||||
public GeneralRegion region = null;
|
||||
|
||||
|
@ -45,7 +45,7 @@ import java.util.UUID;
|
||||
public abstract class GeneralRegion implements GeneralRegionInterface, Comparable<GeneralRegion>, ReplacementProvider {
|
||||
static final AreaShop plugin = AreaShop.getInstance();
|
||||
|
||||
YamlConfiguration config;
|
||||
final YamlConfiguration config;
|
||||
private boolean saveRequired = false;
|
||||
private boolean deleted = false;
|
||||
private long volume = -1;
|
||||
@ -1258,11 +1258,11 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
|
||||
* Class to store the result of a limits check.
|
||||
*/
|
||||
public class LimitResult {
|
||||
private boolean actionAllowed;
|
||||
private LimitType limitingFactor;
|
||||
private int maximum;
|
||||
private int current;
|
||||
private String limitingGroup;
|
||||
private final boolean actionAllowed;
|
||||
private final LimitType limitingFactor;
|
||||
private final int maximum;
|
||||
private final int current;
|
||||
private final String limitingGroup;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -11,12 +11,12 @@ import java.util.Set;
|
||||
// TODO consider switching to saving lowercase regions
|
||||
public class RegionGroup {
|
||||
|
||||
private AreaShop plugin;
|
||||
private String name;
|
||||
private Set<String> regions;
|
||||
private final AreaShop plugin;
|
||||
private final String name;
|
||||
private final Set<String> regions;
|
||||
private Set<String> autoRegions;
|
||||
private boolean autoDirty;
|
||||
private Set<String> worlds;
|
||||
private final Set<String> worlds;
|
||||
|
||||
/**
|
||||
* Constructor, used when creating new groups or restoring them from groups.yml at server boot.
|
||||
|
@ -638,7 +638,7 @@ public class RentRegion extends GeneralRegion {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean unRent(boolean giveMoneyBack, CommandSender executor) {
|
||||
boolean own = executor != null && executor instanceof Player && this.isRenter((Player)executor);
|
||||
boolean own = executor instanceof Player && this.isRenter((Player) executor);
|
||||
if(executor != null) {
|
||||
if(!executor.hasPermission("areashop.unrent") && !own) {
|
||||
message(executor, "unrent-noPermissionOther");
|
||||
|
@ -18,15 +18,15 @@ import java.util.logging.Logger;
|
||||
|
||||
public class GithubUpdateCheck {
|
||||
|
||||
public static String API_HOST = "https://api.github.com/repos";
|
||||
public static String API_LATEST_RELEASE = "releases/latest";
|
||||
public static String USER_AGENT = "GithubUpdateCheck by NLThijs48";
|
||||
public static boolean DEBUG = false;
|
||||
public static final String API_HOST = "https://api.github.com/repos";
|
||||
public static final String API_LATEST_RELEASE = "releases/latest";
|
||||
public static final String USER_AGENT = "GithubUpdateCheck by NLThijs48";
|
||||
public static final boolean DEBUG = false;
|
||||
|
||||
private String author;
|
||||
private String repository;
|
||||
private Plugin plugin;
|
||||
private Logger logger;
|
||||
private final String author;
|
||||
private final String repository;
|
||||
private final Plugin plugin;
|
||||
private final Logger logger;
|
||||
private URL url;
|
||||
private VersionComparator versionComparator;
|
||||
|
||||
@ -35,7 +35,7 @@ public class GithubUpdateCheck {
|
||||
private boolean error;
|
||||
private boolean hasUpdate;
|
||||
private String latestVersion;
|
||||
private String currentVersion;
|
||||
private final String currentVersion;
|
||||
|
||||
/**
|
||||
* Create a new GithubUpdateCheck with the required information.
|
||||
@ -225,19 +225,6 @@ public class GithubUpdateCheck {
|
||||
void run(GithubUpdateCheck result);
|
||||
}
|
||||
|
||||
public class UpdateCheckResult {
|
||||
public boolean error;
|
||||
public boolean hasUpdate;
|
||||
|
||||
/**
|
||||
* Constructor, create empty result.
|
||||
*/
|
||||
public UpdateCheckResult() {
|
||||
error = false;
|
||||
hasUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a debug message if DEBUG is enabled.
|
||||
* @param message Message to print
|
||||
|
@ -10,9 +10,9 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class RegionAccessSet {
|
||||
private Set<String> playerNames;
|
||||
private Set<UUID> playerUniqueIds;
|
||||
private Set<String> groupNames;
|
||||
private final Set<String> playerNames;
|
||||
private final Set<UUID> playerUniqueIds;
|
||||
private final Set<String> groupNames;
|
||||
|
||||
/**
|
||||
* Constructor, creates an empty set.
|
||||
|
@ -3,7 +3,7 @@ package me.wiefferink.areashop.interfaces;
|
||||
import java.io.File;
|
||||
|
||||
public abstract class WorldEditInterface {
|
||||
protected AreaShopInterface pluginInterface;
|
||||
protected final AreaShopInterface pluginInterface;
|
||||
|
||||
public WorldEditInterface(AreaShopInterface pluginInterface) {
|
||||
this.pluginInterface = pluginInterface;
|
||||
|
@ -11,7 +11,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class WorldGuardInterface {
|
||||
protected AreaShopInterface pluginInterface;
|
||||
protected final AreaShopInterface pluginInterface;
|
||||
|
||||
public WorldGuardInterface(AreaShopInterface pluginInterface) {
|
||||
this.pluginInterface = pluginInterface;
|
||||
|
Loading…
Reference in New Issue
Block a user