Remove explicit type declaration (#1015)

This commit is contained in:
Adam 2020-09-17 11:25:38 -04:00 committed by GitHub
parent 88dd68505a
commit 47cd376610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 94 additions and 94 deletions

View File

@ -86,7 +86,7 @@ public class BlockEventHandler implements Listener
this.dataStore = dataStore; this.dataStore = dataStore;
//create the list of blocks which will not trigger a warning when they're placed outside of land claims //create the list of blocks which will not trigger a warning when they're placed outside of land claims
this.trashBlocks = new ArrayList<Material>(); this.trashBlocks = new ArrayList<>();
this.trashBlocks.add(Material.COBBLESTONE); this.trashBlocks.add(Material.COBBLESTONE);
this.trashBlocks.add(Material.TORCH); this.trashBlocks.add(Material.TORCH);
this.trashBlocks.add(Material.DIRT); this.trashBlocks.add(Material.DIRT);

View File

@ -59,10 +59,10 @@ public class Claim
public UUID ownerID; public UUID ownerID;
//list of players who (beyond the claim owner) have permission to grant permissions in this claim //list of players who (beyond the claim owner) have permission to grant permissions in this claim
public ArrayList<String> managers = new ArrayList<String>(); public ArrayList<String> managers = new ArrayList<>();
//permissions for this claim, see ClaimPermission class //permissions for this claim, see ClaimPermission class
private HashMap<String, ClaimPermission> playerIDToClaimPermissionMap = new HashMap<String, ClaimPermission>(); private HashMap<String, ClaimPermission> playerIDToClaimPermissionMap = new HashMap<>();
//whether or not this claim is in the data store //whether or not this claim is in the data store
//if a claim instance isn't in the data store, it isn't "active" - players can't interract with it //if a claim instance isn't in the data store, it isn't "active" - players can't interract with it
@ -81,7 +81,7 @@ public class Claim
//children (subdivisions) //children (subdivisions)
//note subdivisions themselves never have children //note subdivisions themselves never have children
public ArrayList<Claim> children = new ArrayList<Claim>(); public ArrayList<Claim> children = new ArrayList<>();
//information about a siege involving this claim. null means no siege is impacting this claim //information about a siege involving this claim. null means no siege is impacting this claim
public SiegeData siegeData = null; public SiegeData siegeData = null;
@ -303,7 +303,7 @@ public class Claim
Claim claim = new Claim Claim claim = new Claim
(new Location(this.lesserBoundaryCorner.getWorld(), this.lesserBoundaryCorner.getBlockX() - howNear, this.lesserBoundaryCorner.getBlockY(), this.lesserBoundaryCorner.getBlockZ() - howNear), (new Location(this.lesserBoundaryCorner.getWorld(), this.lesserBoundaryCorner.getBlockX() - howNear, this.lesserBoundaryCorner.getBlockY(), this.lesserBoundaryCorner.getBlockZ() - howNear),
new Location(this.greaterBoundaryCorner.getWorld(), this.greaterBoundaryCorner.getBlockX() + howNear, this.greaterBoundaryCorner.getBlockY(), this.greaterBoundaryCorner.getBlockZ() + howNear), new Location(this.greaterBoundaryCorner.getWorld(), this.greaterBoundaryCorner.getBlockX() + howNear, this.greaterBoundaryCorner.getBlockY(), this.greaterBoundaryCorner.getBlockZ() + howNear),
null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), null); null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null);
return claim.contains(location, false, true); return claim.contains(location, false, true);
} }
@ -942,7 +942,7 @@ public class Claim
public ArrayList<Chunk> getChunks() public ArrayList<Chunk> getChunks()
{ {
ArrayList<Chunk> chunks = new ArrayList<Chunk>(); ArrayList<Chunk> chunks = new ArrayList<>();
World world = this.getLesserBoundaryCorner().getWorld(); World world = this.getLesserBoundaryCorner().getWorld();
Chunk lesserChunk = this.getLesserBoundaryCorner().getChunk(); Chunk lesserChunk = this.getLesserBoundaryCorner().getChunk();

View File

@ -86,7 +86,7 @@ class CleanupUnusedClaimTask implements Runnable
if (expireEventCanceled()) if (expireEventCanceled())
return; return;
//make a copy of this player's claim list //make a copy of this player's claim list
Vector<Claim> claims = new Vector<Claim>(); Vector<Claim> claims = new Vector<>();
for (int i = 0; i < ownerData.getClaims().size(); i++) for (int i = 0; i < ownerData.getClaims().size(); i++)
{ {
claims.add(ownerData.getClaims().get(i)); claims.add(ownerData.getClaims().get(i));

View File

@ -65,14 +65,14 @@ public abstract class DataStore
{ {
//in-memory cache for player data //in-memory cache for player data
protected ConcurrentHashMap<UUID, PlayerData> playerNameToPlayerDataMap = new ConcurrentHashMap<UUID, PlayerData>(); protected ConcurrentHashMap<UUID, PlayerData> playerNameToPlayerDataMap = new ConcurrentHashMap<>();
//in-memory cache for group (permission-based) data //in-memory cache for group (permission-based) data
protected ConcurrentHashMap<String, Integer> permissionToBonusBlocksMap = new ConcurrentHashMap<String, Integer>(); protected ConcurrentHashMap<String, Integer> permissionToBonusBlocksMap = new ConcurrentHashMap<>();
//in-memory cache for claim data //in-memory cache for claim data
ArrayList<Claim> claims = new ArrayList<Claim>(); ArrayList<Claim> claims = new ArrayList<>();
ConcurrentHashMap<Long, ArrayList<Claim>> chunksToClaimsMap = new ConcurrentHashMap<Long, ArrayList<Claim>>(); ConcurrentHashMap<Long, ArrayList<Claim>> chunksToClaimsMap = new ConcurrentHashMap<>();
//in-memory cache for messages //in-memory cache for messages
private String[] messages; private String[] messages;
@ -108,7 +108,7 @@ public abstract class DataStore
static final String SUBDIVISION_VIDEO_URL = "" + ChatColor.DARK_AQUA + ChatColor.UNDERLINE + "bit.ly/mcgpsub" + ChatColor.RESET; static final String SUBDIVISION_VIDEO_URL = "" + ChatColor.DARK_AQUA + ChatColor.UNDERLINE + "bit.ly/mcgpsub" + ChatColor.RESET;
//list of UUIDs which are soft-muted //list of UUIDs which are soft-muted
ConcurrentHashMap<UUID, Boolean> softMuteMap = new ConcurrentHashMap<UUID, Boolean>(); ConcurrentHashMap<UUID, Boolean> softMuteMap = new ConcurrentHashMap<>();
//world guard reference, if available //world guard reference, if available
private WorldGuardWrapper worldGuard = null; private WorldGuardWrapper worldGuard = null;
@ -274,7 +274,7 @@ public abstract class DataStore
{ {
GriefPrevention.AddLogEntry("Failed to read from the banned words data file: " + e.toString()); GriefPrevention.AddLogEntry("Failed to read from the banned words data file: " + e.toString());
e.printStackTrace(); e.printStackTrace();
return new ArrayList<String>(); return new ArrayList<>();
} }
} }
@ -781,7 +781,7 @@ public abstract class DataStore
} }
else else
{ {
return Collections.unmodifiableCollection(new ArrayList<Claim>()); return Collections.unmodifiableCollection(new ArrayList<>());
} }
} }
@ -904,10 +904,10 @@ public abstract class DataStore
new Location(world, smallx, smally, smallz), new Location(world, smallx, smally, smallz),
new Location(world, bigx, bigy, bigz), new Location(world, bigx, bigy, bigz),
ownerID, ownerID,
new ArrayList<String>(), new ArrayList<>(),
new ArrayList<String>(), new ArrayList<>(),
new ArrayList<String>(), new ArrayList<>(),
new ArrayList<String>(), new ArrayList<>(),
id); id);
newClaim.parent = parent; newClaim.parent = parent;
@ -1200,7 +1200,7 @@ public abstract class DataStore
} }
//timestamp for each siege cooldown to end //timestamp for each siege cooldown to end
private HashMap<String, Long> siegeCooldownRemaining = new HashMap<String, Long>(); private HashMap<String, Long> siegeCooldownRemaining = new HashMap<>();
//whether or not a sieger can siege a particular victim or claim, considering only cooldowns //whether or not a sieger can siege a particular victim or claim, considering only cooldowns
synchronized public boolean onCooldown(Player attacker, Player defender, Claim defenderClaim) synchronized public boolean onCooldown(Player attacker, Player defender, Claim defenderClaim)
@ -1275,7 +1275,7 @@ public abstract class DataStore
synchronized public void deleteClaimsForPlayer(UUID playerID, boolean releasePets) synchronized public void deleteClaimsForPlayer(UUID playerID, boolean releasePets)
{ {
//make a list of the player's claims //make a list of the player's claims
ArrayList<Claim> claimsToDelete = new ArrayList<Claim>(); ArrayList<Claim> claimsToDelete = new ArrayList<>();
for (int i = 0; i < this.claims.size(); i++) for (int i = 0; i < this.claims.size(); i++)
{ {
Claim claim = this.claims.get(i); Claim claim = this.claims.get(i);
@ -1492,7 +1492,7 @@ public abstract class DataStore
Messages[] messageIDs = Messages.values(); Messages[] messageIDs = Messages.values();
this.messages = new String[Messages.values().length]; this.messages = new String[Messages.values().length];
HashMap<String, CustomizableMessage> defaults = new HashMap<String, CustomizableMessage>(); HashMap<String, CustomizableMessage> defaults = new HashMap<>();
//initialize defaults //initialize defaults
this.addDefault(defaults, Messages.RespectingClaims, "Now respecting claims.", null); this.addDefault(defaults, Messages.RespectingClaims, "Now respecting claims.", null);
@ -1810,7 +1810,7 @@ public abstract class DataStore
if (this.getSchemaVersion() >= 1) return names; if (this.getSchemaVersion() >= 1) return names;
//list to build results //list to build results
List<String> resultNames = new ArrayList<String>(); List<String> resultNames = new ArrayList<>();
for (String name : names) for (String name : names)
{ {
@ -1864,7 +1864,7 @@ public abstract class DataStore
//gets all the claims "near" a location //gets all the claims "near" a location
Set<Claim> getNearbyClaims(Location location) Set<Claim> getNearbyClaims(Location location)
{ {
Set<Claim> claims = new HashSet<Claim>(); Set<Claim> claims = new HashSet<>();
Chunk lesserChunk = location.getWorld().getChunkAt(location.subtract(150, 0, 150)); Chunk lesserChunk = location.getWorld().getChunkAt(location.subtract(150, 0, 150));
Chunk greaterChunk = location.getWorld().getChunkAt(location.add(300, 0, 300)); Chunk greaterChunk = location.getWorld().getChunkAt(location.add(300, 0, 300));

View File

@ -188,9 +188,9 @@ public class DatabaseDataStore extends DataStore
results = statement.executeQuery("SELECT * FROM griefprevention_playerdata;"); results = statement.executeQuery("SELECT * FROM griefprevention_playerdata;");
//make a list of changes to be made //make a list of changes to be made
HashMap<String, UUID> changes = new HashMap<String, UUID>(); HashMap<String, UUID> changes = new HashMap<>();
ArrayList<String> namesToConvert = new ArrayList<String>(); ArrayList<String> namesToConvert = new ArrayList<>();
while (results.next()) while (results.next())
{ {
//get the id //get the id
@ -272,8 +272,8 @@ public class DatabaseDataStore extends DataStore
results = statement.executeQuery("SELECT * FROM griefprevention_claimdata;"); results = statement.executeQuery("SELECT * FROM griefprevention_claimdata;");
ArrayList<Claim> claimsToRemove = new ArrayList<Claim>(); ArrayList<Claim> claimsToRemove = new ArrayList<>();
ArrayList<Claim> subdivisionsToLoad = new ArrayList<Claim>(); ArrayList<Claim> subdivisionsToLoad = new ArrayList<>();
List<World> validWorlds = Bukkit.getServer().getWorlds(); List<World> validWorlds = Bukkit.getServer().getWorlds();
Long claimID = null; Long claimID = null;
@ -442,10 +442,10 @@ public class DatabaseDataStore extends DataStore
String owner = ""; String owner = "";
if (claim.ownerID != null) owner = claim.ownerID.toString(); if (claim.ownerID != null) owner = claim.ownerID.toString();
ArrayList<String> builders = new ArrayList<String>(); ArrayList<String> builders = new ArrayList<>();
ArrayList<String> containers = new ArrayList<String>(); ArrayList<String> containers = new ArrayList<>();
ArrayList<String> accessors = new ArrayList<String>(); ArrayList<String> accessors = new ArrayList<>();
ArrayList<String> managers = new ArrayList<String>(); ArrayList<String> managers = new ArrayList<>();
claim.getPermissions(builders, containers, accessors, managers); claim.getPermissions(builders, containers, accessors, managers);

View File

@ -45,7 +45,7 @@ class EntityCleanupTask implements Runnable
@Override @Override
public void run() public void run()
{ {
ArrayList<World> worlds = new ArrayList<World>(); ArrayList<World> worlds = new ArrayList<>();
for (World world : GriefPrevention.instance.getServer().getWorlds()) for (World world : GriefPrevention.instance.getServer().getWorlds())
{ {
if (GriefPrevention.instance.config_claims_worldModes.get(world) == ClaimsMode.Creative) if (GriefPrevention.instance.config_claims_worldModes.get(world) == ClaimsMode.Creative)

View File

@ -342,7 +342,7 @@ public class EntityEventHandler implements Listener
} }
//make a list of blocks which were allowed to explode //make a list of blocks which were allowed to explode
List<Block> explodedBlocks = new ArrayList<Block>(); List<Block> explodedBlocks = new ArrayList<>();
Claim cachedClaim = null; Claim cachedClaim = null;
for (int i = 0; i < blocks.size(); i++) for (int i = 0; i < blocks.size(); i++)
{ {
@ -1055,7 +1055,7 @@ public class EntityEventHandler implements Listener
message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement); message += " " + GriefPrevention.instance.dataStore.getMessage(Messages.IgnoreClaimsAdvertisement);
if (sendErrorMessagesToPlayers) if (sendErrorMessagesToPlayers)
GriefPrevention.sendMessage(attacker, TextMode.Err, message); GriefPrevention.sendMessage(attacker, TextMode.Err, message);
PreventPvPEvent pvpEvent = new PreventPvPEvent(new Claim(subEvent.getEntity().getLocation(), subEvent.getEntity().getLocation(), null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), null)); PreventPvPEvent pvpEvent = new PreventPvPEvent(new Claim(subEvent.getEntity().getLocation(), subEvent.getEntity().getLocation(), null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null));
Bukkit.getPluginManager().callEvent(pvpEvent); Bukkit.getPluginManager().callEvent(pvpEvent);
if (!pvpEvent.isCancelled()) if (!pvpEvent.isCancelled())
{ {
@ -1451,7 +1451,7 @@ public class EntityEventHandler implements Listener
} }
} }
public static final HashSet<PotionEffectType> positiveEffects = new HashSet<PotionEffectType>(Arrays.asList public static final HashSet<PotionEffectType> positiveEffects = new HashSet<>(Arrays.asList
( (
PotionEffectType.ABSORPTION, PotionEffectType.ABSORPTION,
PotionEffectType.DAMAGE_RESISTANCE, PotionEffectType.DAMAGE_RESISTANCE,

View File

@ -149,7 +149,7 @@ public class FlatFileDataStore extends DataStore
if (this.getSchemaVersion() == 0) if (this.getSchemaVersion() == 0)
{ {
files = playerDataFolder.listFiles(); files = playerDataFolder.listFiles();
ArrayList<String> namesToConvert = new ArrayList<String>(); ArrayList<String> namesToConvert = new ArrayList<>();
for (File playerFile : files) for (File playerFile : files)
{ {
namesToConvert.add(playerFile.getName()); namesToConvert.add(playerFile.getName());
@ -394,7 +394,7 @@ public class FlatFileDataStore extends DataStore
void loadClaimData(File[] files) throws Exception void loadClaimData(File[] files) throws Exception
{ {
ConcurrentHashMap<Claim, Long> orphans = new ConcurrentHashMap<Claim, Long>(); ConcurrentHashMap<Claim, Long> orphans = new ConcurrentHashMap<>();
for (int i = 0; i < files.length; i++) for (int i = 0; i < files.length; i++)
{ {
if (files[i].isFile()) //avoids folders if (files[i].isFile()) //avoids folders
@ -430,7 +430,7 @@ public class FlatFileDataStore extends DataStore
try try
{ {
ArrayList<Long> out_parentID = new ArrayList<Long>(); //hacky output parameter ArrayList<Long> out_parentID = new ArrayList<>(); //hacky output parameter
Claim claim = this.loadClaim(files[i], out_parentID, claimID); Claim claim = this.loadClaim(files[i], out_parentID, claimID);
if (out_parentID.size() == 0 || out_parentID.get(0) == -1) if (out_parentID.size() == 0 || out_parentID.get(0) == -1)
{ {
@ -542,10 +542,10 @@ public class FlatFileDataStore extends DataStore
if (claim.ownerID != null) ownerID = claim.ownerID.toString(); if (claim.ownerID != null) ownerID = claim.ownerID.toString();
yaml.set("Owner", ownerID); yaml.set("Owner", ownerID);
ArrayList<String> builders = new ArrayList<String>(); ArrayList<String> builders = new ArrayList<>();
ArrayList<String> containers = new ArrayList<String>(); ArrayList<String> containers = new ArrayList<>();
ArrayList<String> accessors = new ArrayList<String>(); ArrayList<String> accessors = new ArrayList<>();
ArrayList<String> managers = new ArrayList<String>(); ArrayList<String> managers = new ArrayList<>();
claim.getPermissions(builders, containers, accessors, managers); claim.getPermissions(builders, containers, accessors, managers);
yaml.set("Builders", builders); yaml.set("Builders", builders);

View File

@ -80,7 +80,7 @@ public class GriefPrevention extends JavaPlugin
public DataStore dataStore; public DataStore dataStore;
//this tracks item stacks expected to drop which will need protection //this tracks item stacks expected to drop which will need protection
ArrayList<PendingItemProtection> pendingItemWatchList = new ArrayList<PendingItemProtection>(); ArrayList<PendingItemProtection> pendingItemWatchList = new ArrayList<>();
//log entry manager for GP's custom log files //log entry manager for GP's custom log files
CustomLogger customLogger; CustomLogger customLogger;
@ -461,7 +461,7 @@ public class GriefPrevention extends JavaPlugin
config_pvp_allowLavaNearPlayers = config.getBoolean("GriefPrevention.PvP.AllowLavaDumpingNearOtherPlayers", false); config_pvp_allowLavaNearPlayers = config.getBoolean("GriefPrevention.PvP.AllowLavaDumpingNearOtherPlayers", false);
//decide claim mode for each world //decide claim mode for each world
this.config_claims_worldModes = new ConcurrentHashMap<World, ClaimsMode>(); this.config_claims_worldModes = new ConcurrentHashMap<>();
this.config_creativeWorldsExist = false; this.config_creativeWorldsExist = false;
for (World world : worlds) for (World world : worlds)
{ {
@ -532,7 +532,7 @@ public class GriefPrevention extends JavaPlugin
} }
//pvp worlds list //pvp worlds list
this.config_pvp_specifiedWorlds = new HashMap<World, Boolean>(); this.config_pvp_specifiedWorlds = new HashMap<>();
for (World world : worlds) for (World world : worlds)
{ {
boolean pvpWorld = config.getBoolean("GriefPrevention.PvP.RulesEnabledInWorld." + world.getName(), world.getPVP()); boolean pvpWorld = config.getBoolean("GriefPrevention.PvP.RulesEnabledInWorld." + world.getName(), world.getPVP());
@ -540,7 +540,7 @@ public class GriefPrevention extends JavaPlugin
} }
//sea level //sea level
this.config_seaLevelOverride = new HashMap<String, Integer>(); this.config_seaLevelOverride = new HashMap<>();
for (int i = 0; i < worlds.size(); i++) for (int i = 0; i < worlds.size(); i++)
{ {
int seaLevelOverride = config.getInt("GriefPrevention.SeaLevelOverrides." + worlds.get(i).getName(), -1); int seaLevelOverride = config.getInt("GriefPrevention.SeaLevelOverrides." + worlds.get(i).getName(), -1);
@ -679,7 +679,7 @@ public class GriefPrevention extends JavaPlugin
} }
//default for siege worlds list //default for siege worlds list
ArrayList<String> defaultSiegeWorldNames = new ArrayList<String>(); ArrayList<String> defaultSiegeWorldNames = new ArrayList<>();
//get siege world names from the config file //get siege world names from the config file
List<String> siegeEnabledWorldNames = config.getStringList("GriefPrevention.Siege.Worlds"); List<String> siegeEnabledWorldNames = config.getStringList("GriefPrevention.Siege.Worlds");
@ -689,7 +689,7 @@ public class GriefPrevention extends JavaPlugin
} }
//validate that list //validate that list
this.config_siege_enabledWorlds = new ArrayList<World>(); this.config_siege_enabledWorlds = new ArrayList<>();
for (int i = 0; i < siegeEnabledWorldNames.size(); i++) for (int i = 0; i < siegeEnabledWorldNames.size(); i++)
{ {
String worldName = siegeEnabledWorldNames.get(i); String worldName = siegeEnabledWorldNames.get(i);
@ -705,7 +705,7 @@ public class GriefPrevention extends JavaPlugin
} }
//default siege blocks //default siege blocks
this.config_siege_blocks = new ArrayList<Material>(); this.config_siege_blocks = new ArrayList<>();
this.config_siege_blocks.add(Material.DIRT); this.config_siege_blocks.add(Material.DIRT);
this.config_siege_blocks.add(Material.GRASS_BLOCK); this.config_siege_blocks.add(Material.GRASS_BLOCK);
this.config_siege_blocks.add(Material.GRASS); this.config_siege_blocks.add(Material.GRASS);
@ -741,7 +741,7 @@ public class GriefPrevention extends JavaPlugin
this.config_siege_blocks.add(Material.SNOW); this.config_siege_blocks.add(Material.SNOW);
//build a default config entry //build a default config entry
ArrayList<String> defaultBreakableBlocksList = new ArrayList<String>(); ArrayList<String> defaultBreakableBlocksList = new ArrayList<>();
for (int i = 0; i < this.config_siege_blocks.size(); i++) for (int i = 0; i < this.config_siege_blocks.size(); i++)
{ {
defaultBreakableBlocksList.add(this.config_siege_blocks.get(i).name()); defaultBreakableBlocksList.add(this.config_siege_blocks.get(i).name());
@ -757,7 +757,7 @@ public class GriefPrevention extends JavaPlugin
} }
//parse the list of siege-breakable blocks //parse the list of siege-breakable blocks
this.config_siege_blocks = new ArrayList<Material>(); this.config_siege_blocks = new ArrayList<>();
for (int i = 0; i < breakableBlocksList.size(); i++) for (int i = 0; i < breakableBlocksList.size(); i++)
{ {
String blockName = breakableBlocksList.get(i); String blockName = breakableBlocksList.get(i);
@ -948,7 +948,7 @@ public class GriefPrevention extends JavaPlugin
} }
//try to parse the list of commands requiring access trust in land claims //try to parse the list of commands requiring access trust in land claims
this.config_claims_commandsRequiringAccessTrust = new ArrayList<String>(); this.config_claims_commandsRequiringAccessTrust = new ArrayList<>();
String[] commands = accessTrustSlashCommands.split(";"); String[] commands = accessTrustSlashCommands.split(";");
for (int i = 0; i < commands.length; i++) for (int i = 0; i < commands.length; i++)
{ {
@ -959,7 +959,7 @@ public class GriefPrevention extends JavaPlugin
} }
//try to parse the list of commands which should be monitored for spam //try to parse the list of commands which should be monitored for spam
this.config_spam_monitorSlashCommands = new ArrayList<String>(); this.config_spam_monitorSlashCommands = new ArrayList<>();
commands = slashCommandsToMonitor.split(";"); commands = slashCommandsToMonitor.split(";");
for (int i = 0; i < commands.length; i++) for (int i = 0; i < commands.length; i++)
{ {
@ -967,7 +967,7 @@ public class GriefPrevention extends JavaPlugin
} }
//try to parse the list of commands which should be included in eavesdropping //try to parse the list of commands which should be included in eavesdropping
this.config_eavesdrop_whisperCommands = new ArrayList<String>(); this.config_eavesdrop_whisperCommands = new ArrayList<>();
commands = whisperCommandsToMonitor.split(";"); commands = whisperCommandsToMonitor.split(";");
for (int i = 0; i < commands.length; i++) for (int i = 0; i < commands.length; i++)
{ {
@ -975,7 +975,7 @@ public class GriefPrevention extends JavaPlugin
} }
//try to parse the list of commands which should be banned during pvp combat //try to parse the list of commands which should be banned during pvp combat
this.config_pvp_blockedCommands = new ArrayList<String>(); this.config_pvp_blockedCommands = new ArrayList<>();
commands = bannedPvPCommandsList.split(";"); commands = bannedPvPCommandsList.split(";");
for (int i = 0; i < commands.length; i++) for (int i = 0; i < commands.length; i++)
{ {
@ -1488,10 +1488,10 @@ public class GriefPrevention extends JavaPlugin
//otherwise build a list of explicit permissions by permission level //otherwise build a list of explicit permissions by permission level
//and send that to the player //and send that to the player
ArrayList<String> builders = new ArrayList<String>(); ArrayList<String> builders = new ArrayList<>();
ArrayList<String> containers = new ArrayList<String>(); ArrayList<String> containers = new ArrayList<>();
ArrayList<String> accessors = new ArrayList<String>(); ArrayList<String> accessors = new ArrayList<>();
ArrayList<String> managers = new ArrayList<String>(); ArrayList<String> managers = new ArrayList<>();
claim.getPermissions(builders, containers, accessors, managers); claim.getPermissions(builders, containers, accessors, managers);
GriefPrevention.sendMessage(player, TextMode.Info, Messages.TrustListHeader); GriefPrevention.sendMessage(player, TextMode.Info, Messages.TrustListHeader);
@ -2241,7 +2241,7 @@ public class GriefPrevention extends JavaPlugin
else if (cmd.getName().equalsIgnoreCase("adminclaimslist")) else if (cmd.getName().equalsIgnoreCase("adminclaimslist"))
{ {
//find admin claims //find admin claims
Vector<Claim> claims = new Vector<Claim>(); Vector<Claim> claims = new Vector<>();
for (Claim claim : this.dataStore.claims) for (Claim claim : this.dataStore.claims)
{ {
if (claim.ownerID == null) //admin claim if (claim.ownerID == null) //admin claim
@ -3004,7 +3004,7 @@ public class GriefPrevention extends JavaPlugin
} }
//determine which claims should be modified //determine which claims should be modified
ArrayList<Claim> targetClaims = new ArrayList<Claim>(); ArrayList<Claim> targetClaims = new ArrayList<>();
if (claim == null) if (claim == null)
{ {
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId()); PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
@ -3140,7 +3140,7 @@ public class GriefPrevention extends JavaPlugin
} }
//helper method to resolve a player by name //helper method to resolve a player by name
ConcurrentHashMap<String, UUID> playerNameToIDMap = new ConcurrentHashMap<String, UUID>(); ConcurrentHashMap<String, UUID> playerNameToIDMap = new ConcurrentHashMap<>();
//thread to build the above cache //thread to build the above cache
private class CacheOfflinePlayerNamesThread extends Thread private class CacheOfflinePlayerNamesThread extends Thread
@ -3664,7 +3664,7 @@ public class GriefPrevention extends JavaPlugin
Location lesserCorner = newClaim.getLesserBoundaryCorner(); Location lesserCorner = newClaim.getLesserBoundaryCorner();
Location greaterCorner = newClaim.getGreaterBoundaryCorner(); Location greaterCorner = newClaim.getGreaterBoundaryCorner();
World world = lesserCorner.getWorld(); World world = lesserCorner.getWorld();
ArrayList<ChunkSnapshot> snapshots = new ArrayList<ChunkSnapshot>(); ArrayList<ChunkSnapshot> snapshots = new ArrayList<>();
for (int chunkx = lesserCorner.getBlockX() / 16; chunkx <= greaterCorner.getBlockX() / 16; chunkx++) for (int chunkx = lesserCorner.getBlockX() / 16; chunkx <= greaterCorner.getBlockX() / 16; chunkx++)
{ {
for (int chunkz = lesserCorner.getBlockZ() / 16; chunkz <= greaterCorner.getBlockZ() / 16; chunkz++) for (int chunkz = lesserCorner.getBlockZ() / 16; chunkz <= greaterCorner.getBlockZ() / 16; chunkz++)
@ -3794,7 +3794,7 @@ public class GriefPrevention extends JavaPlugin
*/ */
//Track scheduled "rescues" so we can cancel them if the player happens to teleport elsewhere so we can cancel it. //Track scheduled "rescues" so we can cancel them if the player happens to teleport elsewhere so we can cancel it.
ConcurrentHashMap<UUID, BukkitTask> portalReturnTaskMap = new ConcurrentHashMap<UUID, BukkitTask>(); ConcurrentHashMap<UUID, BukkitTask> portalReturnTaskMap = new ConcurrentHashMap<>();
public void startRescueTask(Player player, Location location) public void startRescueTask(Player player, Location location)
{ {

View File

@ -24,7 +24,7 @@ import java.util.Set;
//ordered list of material info objects, for fast searching //ordered list of material info objects, for fast searching
public class MaterialCollection public class MaterialCollection
{ {
Set<MaterialInfo> materials = new HashSet<MaterialInfo>(); Set<MaterialInfo> materials = new HashSet<>();
void Add(MaterialInfo material) void Add(MaterialInfo material)
{ {

View File

@ -125,7 +125,7 @@ public class PlayerData
//ignore list //ignore list
//true means invisible (admin-forced ignore), false means player-created ignore //true means invisible (admin-forced ignore), false means player-created ignore
public ConcurrentHashMap<UUID, Boolean> ignoredPlayers = new ConcurrentHashMap<UUID, Boolean>(); public ConcurrentHashMap<UUID, Boolean> ignoredPlayers = new ConcurrentHashMap<>();
public boolean ignoreListChanged = false; public boolean ignoreListChanged = false;
//profanity warning, once per play session //profanity warning, once per play session
@ -247,7 +247,7 @@ public class PlayerData
{ {
if (this.claims == null) if (this.claims == null)
{ {
this.claims = new Vector<Claim>(); this.claims = new Vector<>();
//find all the claims belonging to this player and note them for future reference //find all the claims belonging to this player and note them for future reference
DataStore dataStore = GriefPrevention.instance.dataStore; DataStore dataStore = GriefPrevention.instance.dataStore;

View File

@ -111,13 +111,13 @@ class PlayerEventHandler implements Listener
private GriefPrevention instance; private GriefPrevention instance;
//list of temporarily banned ip's //list of temporarily banned ip's
private ArrayList<IpBanInfo> tempBannedIps = new ArrayList<IpBanInfo>(); private ArrayList<IpBanInfo> tempBannedIps = new ArrayList<>();
//number of milliseconds in a day //number of milliseconds in a day
private final long MILLISECONDS_IN_DAY = 1000 * 60 * 60 * 24; private final long MILLISECONDS_IN_DAY = 1000 * 60 * 60 * 24;
//timestamps of login and logout notifications in the last minute //timestamps of login and logout notifications in the last minute
private ArrayList<Long> recentLoginLogoutNotifications = new ArrayList<Long>(); private ArrayList<Long> recentLoginLogoutNotifications = new ArrayList<>();
//regex pattern for the "how do i claim land?" scanner //regex pattern for the "how do i claim land?" scanner
private Pattern howToClaimPattern = null; private Pattern howToClaimPattern = null;
@ -163,7 +163,7 @@ class PlayerEventHandler implements Listener
else if (this.dataStore.isSoftMuted(player.getUniqueId())) else if (this.dataStore.isSoftMuted(player.getUniqueId()))
{ {
String notificationMessage = "(Muted " + player.getName() + "): " + message; String notificationMessage = "(Muted " + player.getName() + "): " + message;
Set<Player> recipientsToKeep = new HashSet<Player>(); Set<Player> recipientsToKeep = new HashSet<>();
for (Player recipient : recipients) for (Player recipient : recipients)
{ {
if (this.dataStore.isSoftMuted(recipient.getUniqueId())) if (this.dataStore.isSoftMuted(recipient.getUniqueId()))
@ -229,7 +229,7 @@ class PlayerEventHandler implements Listener
//based on ignore lists, remove some of the audience //based on ignore lists, remove some of the audience
if (!player.hasPermission("griefprevention.notignorable")) if (!player.hasPermission("griefprevention.notignorable"))
{ {
Set<Player> recipientsToRemove = new HashSet<Player>(); Set<Player> recipientsToRemove = new HashSet<>();
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId()); PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
for (Player recipient : recipients) for (Player recipient : recipients)
{ {
@ -537,7 +537,7 @@ class PlayerEventHandler implements Listener
} }
} }
private ConcurrentHashMap<String, CommandCategory> commandCategoryMap = new ConcurrentHashMap<String, CommandCategory>(); private ConcurrentHashMap<String, CommandCategory> commandCategoryMap = new ConcurrentHashMap<>();
private CommandCategory getCommandCategory(String commandName) private CommandCategory getCommandCategory(String commandName)
{ {
@ -548,7 +548,7 @@ class PlayerEventHandler implements Listener
if (category != null) return category; if (category != null) return category;
//otherwise build a list of all the aliases of this command across all installed plugins //otherwise build a list of all the aliases of this command across all installed plugins
HashSet<String> aliases = new HashSet<String>(); HashSet<String> aliases = new HashSet<>();
aliases.add(commandName); aliases.add(commandName);
aliases.add("minecraft:" + commandName); aliases.add("minecraft:" + commandName);
for (Plugin plugin : Bukkit.getServer().getPluginManager().getPlugins()) for (Plugin plugin : Bukkit.getServer().getPluginManager().getPlugins())
@ -618,7 +618,7 @@ class PlayerEventHandler implements Listener
GriefPrevention.AddLogEntry(entryBuilder.toString(), CustomLogEntryTypes.SocialActivity, true); GriefPrevention.AddLogEntry(entryBuilder.toString(), CustomLogEntryTypes.SocialActivity, true);
} }
private ConcurrentHashMap<UUID, Date> lastLoginThisServerSessionMap = new ConcurrentHashMap<UUID, Date>(); private ConcurrentHashMap<UUID, Date> lastLoginThisServerSessionMap = new ConcurrentHashMap<>();
//when a player attempts to join the server... //when a player attempts to join the server...
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
@ -875,7 +875,7 @@ class PlayerEventHandler implements Listener
} }
//when a player dies... //when a player dies...
private HashMap<UUID, Long> deathTimestamps = new HashMap<UUID, Long>(); private HashMap<UUID, Long> deathTimestamps = new HashMap<>();
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
void onPlayerDeath(PlayerDeathEvent event) void onPlayerDeath(PlayerDeathEvent event)
@ -908,7 +908,7 @@ class PlayerEventHandler implements Listener
} }
//when a player quits... //when a player quits...
private HashMap<UUID, Integer> heldLogoutMessages = new HashMap<UUID, Integer>(); private HashMap<UUID, Integer> heldLogoutMessages = new HashMap<>();
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
void onPlayerQuit(PlayerQuitEvent event) void onPlayerQuit(PlayerQuitEvent event)
@ -1449,8 +1449,8 @@ class PlayerEventHandler implements Listener
} }
//block use of buckets within other players' claims //block use of buckets within other players' claims
private HashSet<Material> commonAdjacentBlocks_water = new HashSet<Material>(Arrays.asList(Material.WATER, Material.FARMLAND, Material.DIRT, Material.STONE)); private HashSet<Material> commonAdjacentBlocks_water = new HashSet<>(Arrays.asList(Material.WATER, Material.FARMLAND, Material.DIRT, Material.STONE));
private HashSet<Material> commonAdjacentBlocks_lava = new HashSet<Material>(Arrays.asList(Material.LAVA, Material.DIRT, Material.STONE)); private HashSet<Material> commonAdjacentBlocks_lava = new HashSet<>(Arrays.asList(Material.LAVA, Material.DIRT, Material.STONE));
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent bucketEvent) public void onPlayerBucketEmpty(PlayerBucketEmptyEvent bucketEvent)
@ -2145,7 +2145,7 @@ class PlayerEventHandler implements Listener
//if in restore nature fill mode //if in restore nature fill mode
if (playerData.shovelMode == ShovelMode.RestoreNatureFill) if (playerData.shovelMode == ShovelMode.RestoreNatureFill)
{ {
ArrayList<Material> allowedFillBlocks = new ArrayList<Material>(); ArrayList<Material> allowedFillBlocks = new ArrayList<>();
Environment environment = clickedBlock.getWorld().getEnvironment(); Environment environment = clickedBlock.getWorld().getEnvironment();
if (environment == Environment.NETHER) if (environment == Environment.NETHER)
{ {
@ -2474,7 +2474,7 @@ class PlayerEventHandler implements Listener
instance.sendMessage(player, TextMode.Instr, Messages.ClaimStart); instance.sendMessage(player, TextMode.Instr, Messages.ClaimStart);
//show him where he's working //show him where he's working
Claim newClaim = new Claim(clickedBlock.getLocation(), clickedBlock.getLocation(), null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), null); Claim newClaim = new Claim(clickedBlock.getLocation(), clickedBlock.getLocation(), null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null);
Visualization visualization = Visualization.FromClaim(newClaim, clickedBlock.getY(), VisualizationType.RestoreNature, player.getLocation()); Visualization visualization = Visualization.FromClaim(newClaim, clickedBlock.getY(), VisualizationType.RestoreNature, player.getLocation());
// alert plugins of a visualization // alert plugins of a visualization
@ -2624,7 +2624,7 @@ class PlayerEventHandler implements Listener
} }
//determines whether a block type is an inventory holder. uses a caching strategy to save cpu time //determines whether a block type is an inventory holder. uses a caching strategy to save cpu time
private ConcurrentHashMap<Material, Boolean> inventoryHolderCache = new ConcurrentHashMap<Material, Boolean>(); private ConcurrentHashMap<Material, Boolean> inventoryHolderCache = new ConcurrentHashMap<>();
private boolean isInventoryHolder(Block clickedBlock) private boolean isInventoryHolder(Block clickedBlock)
{ {

View File

@ -122,7 +122,7 @@ class RestoreNatureExecutionTask implements Runnable
//show visualization to player who started the restoration //show visualization to player who started the restoration
if (player != null) if (player != null)
{ {
Claim claim = new Claim(lesserCorner, greaterCorner, null, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), null); Claim claim = new Claim(lesserCorner, greaterCorner, null, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null);
Visualization visualization = Visualization.FromClaim(claim, player.getLocation().getBlockY(), VisualizationType.RestoreNature, player.getLocation()); Visualization visualization = Visualization.FromClaim(claim, player.getLocation().getBlockY(), VisualizationType.RestoreNature, player.getLocation());
Visualization.Apply(player, visualization); Visualization.Apply(player, visualization);
} }

View File

@ -68,7 +68,7 @@ class RestoreNatureProcessingTask implements Runnable
this.player = player; this.player = player;
this.creativeMode = creativeMode; this.creativeMode = creativeMode;
this.notAllowedToHang = new ArrayList<Material>(); this.notAllowedToHang = new ArrayList<>();
this.notAllowedToHang.add(Material.DIRT); this.notAllowedToHang.add(Material.DIRT);
this.notAllowedToHang.add(Material.GRASS); this.notAllowedToHang.add(Material.GRASS);
this.notAllowedToHang.add(Material.SNOW); this.notAllowedToHang.add(Material.SNOW);
@ -85,7 +85,7 @@ class RestoreNatureProcessingTask implements Runnable
this.notAllowedToHang.add(Material.STONE); this.notAllowedToHang.add(Material.STONE);
} }
this.playerBlocks = new ArrayList<Material>(); this.playerBlocks = new ArrayList<>();
this.playerBlocks.addAll(RestoreNatureProcessingTask.getPlayerBlocks(this.environment, this.biome)); this.playerBlocks.addAll(RestoreNatureProcessingTask.getPlayerBlocks(this.environment, this.biome));
//in aggressive or creative world mode, also treat these blocks as user placed, to be removed //in aggressive or creative world mode, also treat these blocks as user placed, to be removed
@ -390,7 +390,7 @@ class RestoreNatureProcessingTask implements Runnable
Material.LILY_PAD Material.LILY_PAD
}; };
ArrayList<Material> excludedBlocks = new ArrayList<Material>(); ArrayList<Material> excludedBlocks = new ArrayList<>();
for (int i = 0; i < excludedBlocksArray.length; i++) excludedBlocks.add(excludedBlocksArray[i]); for (int i = 0; i < excludedBlocksArray.length; i++) excludedBlocks.add(excludedBlocksArray[i]);
excludedBlocks.addAll(Tag.SAPLINGS.getValues()); excludedBlocks.addAll(Tag.SAPLINGS.getValues());
@ -455,13 +455,13 @@ class RestoreNatureProcessingTask implements Runnable
private void fillHolesAndTrenches() private void fillHolesAndTrenches()
{ {
ArrayList<Material> fillableBlocks = new ArrayList<Material>(); ArrayList<Material> fillableBlocks = new ArrayList<>();
fillableBlocks.add(Material.AIR); fillableBlocks.add(Material.AIR);
fillableBlocks.add(Material.WATER); fillableBlocks.add(Material.WATER);
fillableBlocks.add(Material.LAVA); fillableBlocks.add(Material.LAVA);
fillableBlocks.add(Material.GRASS); fillableBlocks.add(Material.GRASS);
ArrayList<Material> notSuitableForFillBlocks = new ArrayList<Material>(); ArrayList<Material> notSuitableForFillBlocks = new ArrayList<>();
notSuitableForFillBlocks.add(Material.GRASS); notSuitableForFillBlocks.add(Material.GRASS);
notSuitableForFillBlocks.add(Material.CACTUS); notSuitableForFillBlocks.add(Material.CACTUS);
notSuitableForFillBlocks.add(Material.WATER); notSuitableForFillBlocks.add(Material.WATER);
@ -647,7 +647,7 @@ class RestoreNatureProcessingTask implements Runnable
//NOTE on this list. why not make a list of natural blocks? //NOTE on this list. why not make a list of natural blocks?
//answer: better to leave a few player blocks than to remove too many natural blocks. remember we're "restoring nature" //answer: better to leave a few player blocks than to remove too many natural blocks. remember we're "restoring nature"
//a few extra player blocks can be manually removed, but it will be impossible to guess exactly which natural materials to use in manual repair of an overzealous block removal //a few extra player blocks can be manually removed, but it will be impossible to guess exactly which natural materials to use in manual repair of an overzealous block removal
ArrayList<Material> playerBlocks = new ArrayList<Material>(); ArrayList<Material> playerBlocks = new ArrayList<>();
playerBlocks.add(Material.FIRE); playerBlocks.add(Material.FIRE);
playerBlocks.add(Material.WHITE_BED); playerBlocks.add(Material.WHITE_BED);
playerBlocks.add(Material.ORANGE_BED); playerBlocks.add(Material.ORANGE_BED);

View File

@ -34,7 +34,7 @@ public class SiegeData
{ {
this.defender = defender; this.defender = defender;
this.attacker = attacker; this.attacker = attacker;
this.claims = new ArrayList<Claim>(); this.claims = new ArrayList<>();
this.claims.add(claim); this.claims.add(claim);
} }
} }

View File

@ -14,7 +14,7 @@ class SpamDetector
private int duplicateMessageCount = 0; private int duplicateMessageCount = 0;
//data for individual chatters //data for individual chatters
ConcurrentHashMap<UUID, ChatterData> dataStore = new ConcurrentHashMap<UUID, ChatterData>(); ConcurrentHashMap<UUID, ChatterData> dataStore = new ConcurrentHashMap<>();
private ChatterData getChatterData(UUID chatterID) private ChatterData getChatterData(UUID chatterID)
{ {
@ -230,7 +230,7 @@ class ChatterData
public boolean spamWarned = false; //whether the player has received a warning recently public boolean spamWarned = false; //whether the player has received a warning recently
//all recent message lengths and their total //all recent message lengths and their total
private ConcurrentLinkedQueue<LengthTimestampPair> recentMessageLengths = new ConcurrentLinkedQueue<LengthTimestampPair>(); private ConcurrentLinkedQueue<LengthTimestampPair> recentMessageLengths = new ConcurrentLinkedQueue<>();
private int recentTotalLength = 0; private int recentTotalLength = 0;
public void AddMessage(String message, long timestamp) public void AddMessage(String message, long timestamp)

View File

@ -47,12 +47,12 @@ class UUIDFetcher
{ {
if (lookupCache == null) if (lookupCache == null)
{ {
lookupCache = new HashMap<String, UUID>(); lookupCache = new HashMap<>();
} }
if (correctedNames == null) if (correctedNames == null)
{ {
correctedNames = new HashMap<String, String>(); correctedNames = new HashMap<>();
} }
GriefPrevention.AddLogEntry("UUID conversion process started. Please be patient - this may take a while."); GriefPrevention.AddLogEntry("UUID conversion process started. Please be patient - this may take a while.");

View File

@ -37,7 +37,7 @@ import java.util.ArrayList;
//the result is that those players see new blocks, but the world hasn't been changed. other players can't see the new blocks, either. //the result is that those players see new blocks, but the world hasn't been changed. other players can't see the new blocks, either.
public class Visualization public class Visualization
{ {
public ArrayList<VisualizationElement> elements = new ArrayList<VisualizationElement>(); public ArrayList<VisualizationElement> elements = new ArrayList<>();
//sends a visualization to a player //sends a visualization to a player
public static void Apply(Player player, Visualization visualization) public static void Apply(Player player, Visualization visualization)