Use enhanced for loop where applicable (#1016)
This commit is contained in:
parent
47cd376610
commit
bf214afe2e
|
|
@ -233,10 +233,8 @@ public class BlockEventHandler implements Listener
|
|||
if (block.getType() == Material.FIRE && !doesAllowFireProximityInWorld(block.getWorld()))
|
||||
{
|
||||
List<Player> players = block.getWorld().getPlayers();
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
for (Player otherPlayer : players)
|
||||
{
|
||||
Player otherPlayer = players.get(i);
|
||||
|
||||
// Ignore players in creative or spectator mode to avoid users from checking if someone is spectating near them
|
||||
if (otherPlayer.getGameMode() == GameMode.CREATIVE || otherPlayer.getGameMode() == GameMode.SPECTATOR)
|
||||
{
|
||||
|
|
@ -784,9 +782,8 @@ public class BlockEventHandler implements Listener
|
|||
};
|
||||
|
||||
//pro-actively put out any fires adjacent the burning block, to reduce future processing here
|
||||
for (int i = 0; i < adjacentBlocks.length; i++)
|
||||
for (Block adjacentBlock : adjacentBlocks)
|
||||
{
|
||||
Block adjacentBlock = adjacentBlocks[i];
|
||||
if (adjacentBlock.getType() == Material.FIRE && adjacentBlock.getRelative(BlockFace.DOWN).getType() != Material.NETHERRACK)
|
||||
{
|
||||
adjacentBlock.setType(Material.AIR);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
|
@ -597,15 +596,15 @@ public class Claim
|
|||
if (this.allowEdit(player) == null) return null;
|
||||
|
||||
//anyone who's in the managers (/PermissionTrust) list can do this
|
||||
for (int i = 0; i < this.managers.size(); i++)
|
||||
for (String managerID : this.managers)
|
||||
{
|
||||
String managerID = this.managers.get(i);
|
||||
if (managerID == null) continue;
|
||||
if (player.getUniqueId().toString().equals(managerID)) return null;
|
||||
|
||||
else if (managerID.startsWith("[") && managerID.endsWith("]"))
|
||||
{
|
||||
managerID = managerID.substring(1, managerID.length() - 1);
|
||||
if (managerID == null || managerID.isEmpty()) continue;
|
||||
if (managerID.isEmpty()) continue;
|
||||
if (player.hasPermission(managerID)) return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -675,11 +674,8 @@ public class Claim
|
|||
public void getPermissions(ArrayList<String> builders, ArrayList<String> containers, ArrayList<String> accessors, ArrayList<String> managers)
|
||||
{
|
||||
//loop through all the entries in the hash map
|
||||
Iterator<Map.Entry<String, ClaimPermission>> mappingsIterator = this.playerIDToClaimPermissionMap.entrySet().iterator();
|
||||
while (mappingsIterator.hasNext())
|
||||
for (Map.Entry<String, ClaimPermission> entry : this.playerIDToClaimPermissionMap.entrySet())
|
||||
{
|
||||
Map.Entry<String, ClaimPermission> entry = mappingsIterator.next();
|
||||
|
||||
//build up a list for each permission level
|
||||
if (entry.getValue() == ClaimPermission.Build)
|
||||
{
|
||||
|
|
@ -696,10 +692,7 @@ public class Claim
|
|||
}
|
||||
|
||||
//managers are handled a little differently
|
||||
for (int i = 0; i < this.managers.size(); i++)
|
||||
{
|
||||
managers.add(this.managers.get(i));
|
||||
}
|
||||
managers.addAll(this.managers);
|
||||
}
|
||||
|
||||
//returns a copy of the location representing lower x, y, z limits
|
||||
|
|
@ -761,10 +754,10 @@ public class Claim
|
|||
else if (excludeSubdivisions)
|
||||
{
|
||||
//search all subdivisions to see if the location is in any of them
|
||||
for (int i = 0; i < this.children.size(); i++)
|
||||
for (Claim child : this.children)
|
||||
{
|
||||
//if we find such a subdivision, return false
|
||||
if (this.children.get(i).contains(location, ignoreHeight, true))
|
||||
if (child.contains(location, ignoreHeight, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -814,9 +807,8 @@ public class Claim
|
|||
for (Chunk chunk : chunks)
|
||||
{
|
||||
Entity[] entities = chunk.getEntities();
|
||||
for (int i = 0; i < entities.length; i++)
|
||||
for (Entity entity : entities)
|
||||
{
|
||||
Entity entity = entities[i];
|
||||
if (!(entity instanceof Player) && this.contains(entity.getLocation(), false, false))
|
||||
{
|
||||
totalEntities++;
|
||||
|
|
@ -846,9 +838,8 @@ public class Claim
|
|||
for (Chunk chunk : chunks)
|
||||
{
|
||||
BlockState[] actives = chunk.getTileEntities();
|
||||
for (int i = 0; i < actives.length; i++)
|
||||
for (BlockState active : actives)
|
||||
{
|
||||
BlockState active = actives[i];
|
||||
if (BlockEventHandler.isActiveBlock(active))
|
||||
{
|
||||
if (this.contains(active.getLocation(), false, false))
|
||||
|
|
|
|||
|
|
@ -86,11 +86,7 @@ class CleanupUnusedClaimTask implements Runnable
|
|||
if (expireEventCanceled())
|
||||
return;
|
||||
//make a copy of this player's claim list
|
||||
Vector<Claim> claims = new Vector<>();
|
||||
for (int i = 0; i < ownerData.getClaims().size(); i++)
|
||||
{
|
||||
claims.add(ownerData.getClaims().get(i));
|
||||
}
|
||||
Vector<Claim> claims = new Vector<>(ownerData.getClaims());
|
||||
|
||||
//delete them
|
||||
GriefPrevention.instance.dataStore.deleteClaimsForPlayer(claim.ownerID, true);
|
||||
|
|
@ -98,12 +94,12 @@ class CleanupUnusedClaimTask implements Runnable
|
|||
GriefPrevention.AddLogEntry("earliestPermissibleLastLogin#getTime: " + earliestPermissibleLastLogin.getTime(), CustomLogEntryTypes.Debug, true);
|
||||
GriefPrevention.AddLogEntry("ownerInfo#getLastPlayed: " + ownerInfo.getLastPlayed(), CustomLogEntryTypes.Debug, true);
|
||||
|
||||
for (int i = 0; i < claims.size(); i++)
|
||||
for (Claim claim : claims)
|
||||
{
|
||||
//if configured to do so, restore the land to natural
|
||||
if (GriefPrevention.instance.creativeRulesApply(claims.get(i).getLesserBoundaryCorner()) || GriefPrevention.instance.config_claims_survivalAutoNatureRestoration)
|
||||
if (GriefPrevention.instance.creativeRulesApply(claim.getLesserBoundaryCorner()) || GriefPrevention.instance.config_claims_survivalAutoNatureRestoration)
|
||||
{
|
||||
GriefPrevention.instance.restoreClaim(claims.get(i), 0);
|
||||
GriefPrevention.instance.restoreClaim(claim, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,9 +131,8 @@ class CustomLogger
|
|||
int daysToKeepLogs = GriefPrevention.instance.config_logs_daysToKeep;
|
||||
Calendar expirationBoundary = Calendar.getInstance();
|
||||
expirationBoundary.add(Calendar.DATE, -daysToKeepLogs);
|
||||
for (int i = 0; i < files.length; i++)
|
||||
for (File file : files)
|
||||
{
|
||||
File file = files[i];
|
||||
if (file.isDirectory()) continue; //skip any folders
|
||||
|
||||
String filename = file.getName().replace(".log", "");
|
||||
|
|
|
|||
|
|
@ -348,16 +348,17 @@ public abstract class DataStore
|
|||
//this will return 0 when he's offline, and the correct number when online.
|
||||
synchronized public int getGroupBonusBlocks(UUID playerID)
|
||||
{
|
||||
Player player = GriefPrevention.instance.getServer().getPlayer(playerID);
|
||||
|
||||
if (player == null) return 0;
|
||||
|
||||
int bonusBlocks = 0;
|
||||
Set<String> keys = permissionToBonusBlocksMap.keySet();
|
||||
Iterator<String> iterator = keys.iterator();
|
||||
while (iterator.hasNext())
|
||||
|
||||
for (Map.Entry<String, Integer> groupEntry : this.permissionToBonusBlocksMap.entrySet())
|
||||
{
|
||||
String groupName = iterator.next();
|
||||
Player player = GriefPrevention.instance.getServer().getPlayer(playerID);
|
||||
if (player != null && player.hasPermission(groupName))
|
||||
if (player.hasPermission(groupEntry.getKey()))
|
||||
{
|
||||
bonusBlocks += this.permissionToBonusBlocksMap.get(groupName);
|
||||
bonusBlocks += groupEntry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -923,10 +924,8 @@ public abstract class DataStore
|
|||
claimsToCheck = this.claims;
|
||||
}
|
||||
|
||||
for (int i = 0; i < claimsToCheck.size(); i++)
|
||||
for (Claim otherClaim : claimsToCheck)
|
||||
{
|
||||
Claim otherClaim = claimsToCheck.get(i);
|
||||
|
||||
//if we find an existing claim which will be overlapped
|
||||
if (otherClaim.id != newClaim.id && otherClaim.inDataStore && otherClaim.overlaps(newClaim))
|
||||
{
|
||||
|
|
@ -1187,10 +1186,9 @@ public abstract class DataStore
|
|||
//drop any remainder on the ground at his feet
|
||||
Object[] keys = wontFitItems.keySet().toArray();
|
||||
Location winnerLocation = winner.getLocation();
|
||||
for (int i = 0; i < keys.length; i++)
|
||||
for (Map.Entry<Integer, ItemStack> wontFitItem : wontFitItems.entrySet())
|
||||
{
|
||||
Integer key = (Integer) keys[i];
|
||||
winnerLocation.getWorld().dropItemNaturally(winnerLocation, wontFitItems.get(key));
|
||||
winner.getWorld().dropItemNaturally(winnerLocation, wontFitItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1276,17 +1274,15 @@ public abstract class DataStore
|
|||
{
|
||||
//make a list of the player's claims
|
||||
ArrayList<Claim> claimsToDelete = new ArrayList<>();
|
||||
for (int i = 0; i < this.claims.size(); i++)
|
||||
for (Claim claim : this.claims)
|
||||
{
|
||||
Claim claim = this.claims.get(i);
|
||||
if ((playerID == claim.ownerID || (playerID != null && playerID.equals(claim.ownerID))))
|
||||
claimsToDelete.add(claim);
|
||||
}
|
||||
|
||||
//delete them one by one
|
||||
for (int i = 0; i < claimsToDelete.size(); i++)
|
||||
for (Claim claim : claimsToDelete)
|
||||
{
|
||||
Claim claim = claimsToDelete.get(i);
|
||||
claim.removeSurfaceFluids(null);
|
||||
|
||||
this.deleteClaim(claim, releasePets);
|
||||
|
|
@ -1737,10 +1733,9 @@ public abstract class DataStore
|
|||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(messagesFilePath));
|
||||
|
||||
//for each message ID
|
||||
for (int i = 0; i < messageIDs.length; i++)
|
||||
for (Messages messageID : messageIDs)
|
||||
{
|
||||
//get default for this message
|
||||
Messages messageID = messageIDs[i];
|
||||
CustomizableMessage messageData = defaults.get(messageID.name());
|
||||
|
||||
//if default is missing, log an error and use some fake data for now so that the plugin can run
|
||||
|
|
|
|||
|
|
@ -54,10 +54,8 @@ class EntityCleanupTask implements Runnable
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < worlds.size(); i++)
|
||||
for (World world : worlds)
|
||||
{
|
||||
World world = worlds.get(i);
|
||||
|
||||
List<Entity> entities = world.getEntities();
|
||||
|
||||
//starting and stopping point. each execution of the task scans 10% of the server's (loaded) entities
|
||||
|
|
|
|||
|
|
@ -344,10 +344,8 @@ public class EntityEventHandler implements Listener
|
|||
//make a list of blocks which were allowed to explode
|
||||
List<Block> explodedBlocks = new ArrayList<>();
|
||||
Claim cachedClaim = null;
|
||||
for (int i = 0; i < blocks.size(); i++)
|
||||
for (Block block : blocks)
|
||||
{
|
||||
Block block = blocks.get(i);
|
||||
|
||||
//always ignore air blocks
|
||||
if (block.getType() == Material.AIR) continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import java.util.Arrays;
|
|||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Matcher;
|
||||
|
|
@ -85,9 +86,8 @@ public class FlatFileDataStore extends DataStore
|
|||
|
||||
//load group data into memory
|
||||
File[] files = playerDataFolder.listFiles();
|
||||
for (int i = 0; i < files.length; i++)
|
||||
for (File file : files)
|
||||
{
|
||||
File file = files[i];
|
||||
if (!file.isFile()) continue; //avoids folders
|
||||
|
||||
//all group data files start with a dollar sign. ignoring the rest, which are player data files.
|
||||
|
|
@ -801,9 +801,8 @@ public class FlatFileDataStore extends DataStore
|
|||
synchronized void migrateData(DatabaseDataStore databaseStore)
|
||||
{
|
||||
//migrate claims
|
||||
for (int i = 0; i < this.claims.size(); i++)
|
||||
for (Claim claim : this.claims)
|
||||
{
|
||||
Claim claim = this.claims.get(i);
|
||||
databaseStore.addClaim(claim, true);
|
||||
for (Claim child : claim.children)
|
||||
{
|
||||
|
|
@ -812,19 +811,16 @@ public class FlatFileDataStore extends DataStore
|
|||
}
|
||||
|
||||
//migrate groups
|
||||
Iterator<String> groupNamesEnumerator = this.permissionToBonusBlocksMap.keySet().iterator();
|
||||
while (groupNamesEnumerator.hasNext())
|
||||
for (Map.Entry<String, Integer> groupEntry : this.permissionToBonusBlocksMap.entrySet())
|
||||
{
|
||||
String groupName = groupNamesEnumerator.next();
|
||||
databaseStore.saveGroupBonusBlocks(groupName, this.permissionToBonusBlocksMap.get(groupName));
|
||||
databaseStore.saveGroupBonusBlocks(groupEntry.getKey(), groupEntry.getValue());
|
||||
}
|
||||
|
||||
//migrate players
|
||||
File playerDataFolder = new File(playerDataFolderPath);
|
||||
File[] files = playerDataFolder.listFiles();
|
||||
for (int i = 0; i < files.length; i++)
|
||||
for (File file : files)
|
||||
{
|
||||
File file = files[i];
|
||||
if (!file.isFile()) continue; //avoids folders
|
||||
if (file.isHidden()) continue; //avoid hidden files, which are likely not created by GriefPrevention
|
||||
|
||||
|
|
|
|||
|
|
@ -541,11 +541,11 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
//sea level
|
||||
this.config_seaLevelOverride = new HashMap<>();
|
||||
for (int i = 0; i < worlds.size(); i++)
|
||||
for (World world : worlds)
|
||||
{
|
||||
int seaLevelOverride = config.getInt("GriefPrevention.SeaLevelOverrides." + worlds.get(i).getName(), -1);
|
||||
outConfig.set("GriefPrevention.SeaLevelOverrides." + worlds.get(i).getName(), seaLevelOverride);
|
||||
this.config_seaLevelOverride.put(worlds.get(i).getName(), seaLevelOverride);
|
||||
int seaLevelOverride = config.getInt("GriefPrevention.SeaLevelOverrides." + world.getName(), -1);
|
||||
outConfig.set("GriefPrevention.SeaLevelOverrides." + world.getName(), seaLevelOverride);
|
||||
this.config_seaLevelOverride.put(world.getName(), seaLevelOverride);
|
||||
}
|
||||
|
||||
this.config_claims_preventGlobalMonsterEggs = config.getBoolean("GriefPrevention.Claims.PreventGlobalMonsterEggs", true);
|
||||
|
|
@ -690,9 +690,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
//validate that list
|
||||
this.config_siege_enabledWorlds = new ArrayList<>();
|
||||
for (int i = 0; i < siegeEnabledWorldNames.size(); i++)
|
||||
for (String worldName : siegeEnabledWorldNames)
|
||||
{
|
||||
String worldName = siegeEnabledWorldNames.get(i);
|
||||
World world = this.getServer().getWorld(worldName);
|
||||
if (world == null)
|
||||
{
|
||||
|
|
@ -742,9 +741,9 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
//build a default config entry
|
||||
ArrayList<String> defaultBreakableBlocksList = new ArrayList<>();
|
||||
for (int i = 0; i < this.config_siege_blocks.size(); i++)
|
||||
for (Material siegeBlock : this.config_siege_blocks)
|
||||
{
|
||||
defaultBreakableBlocksList.add(this.config_siege_blocks.get(i).name());
|
||||
defaultBreakableBlocksList.add(siegeBlock.name());
|
||||
}
|
||||
|
||||
//try to load the list from the config file
|
||||
|
|
@ -758,9 +757,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
//parse the list of siege-breakable blocks
|
||||
this.config_siege_blocks = new ArrayList<>();
|
||||
for (int i = 0; i < breakableBlocksList.size(); i++)
|
||||
for (String blockName : breakableBlocksList)
|
||||
{
|
||||
String blockName = breakableBlocksList.get(i);
|
||||
Material material = Material.getMaterial(blockName);
|
||||
if (material == null)
|
||||
{
|
||||
|
|
@ -950,36 +948,36 @@ public class GriefPrevention extends JavaPlugin
|
|||
//try to parse the list of commands requiring access trust in land claims
|
||||
this.config_claims_commandsRequiringAccessTrust = new ArrayList<>();
|
||||
String[] commands = accessTrustSlashCommands.split(";");
|
||||
for (int i = 0; i < commands.length; i++)
|
||||
for (String command : commands)
|
||||
{
|
||||
if (!commands[i].isEmpty())
|
||||
if (!command.isEmpty())
|
||||
{
|
||||
this.config_claims_commandsRequiringAccessTrust.add(commands[i].trim().toLowerCase());
|
||||
this.config_claims_commandsRequiringAccessTrust.add(command.trim().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
//try to parse the list of commands which should be monitored for spam
|
||||
this.config_spam_monitorSlashCommands = new ArrayList<>();
|
||||
commands = slashCommandsToMonitor.split(";");
|
||||
for (int i = 0; i < commands.length; i++)
|
||||
for (String command : commands)
|
||||
{
|
||||
this.config_spam_monitorSlashCommands.add(commands[i].trim().toLowerCase());
|
||||
this.config_spam_monitorSlashCommands.add(command.trim().toLowerCase());
|
||||
}
|
||||
|
||||
//try to parse the list of commands which should be included in eavesdropping
|
||||
this.config_eavesdrop_whisperCommands = new ArrayList<>();
|
||||
commands = whisperCommandsToMonitor.split(";");
|
||||
for (int i = 0; i < commands.length; i++)
|
||||
for (String command : commands)
|
||||
{
|
||||
this.config_eavesdrop_whisperCommands.add(commands[i].trim().toLowerCase());
|
||||
this.config_eavesdrop_whisperCommands.add(command.trim().toLowerCase());
|
||||
}
|
||||
|
||||
//try to parse the list of commands which should be banned during pvp combat
|
||||
this.config_pvp_blockedCommands = new ArrayList<>();
|
||||
commands = bannedPvPCommandsList.split(";");
|
||||
for (int i = 0; i < commands.length; i++)
|
||||
for (String command : commands)
|
||||
{
|
||||
this.config_pvp_blockedCommands.add(commands[i].trim().toLowerCase());
|
||||
this.config_pvp_blockedCommands.add(command.trim().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1501,8 +1499,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
if (managers.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < managers.size(); i++)
|
||||
permissions.append(this.trustEntryToPlayerName(managers.get(i)) + " ");
|
||||
for (String manager : managers)
|
||||
permissions.append(this.trustEntryToPlayerName(manager) + " ");
|
||||
}
|
||||
|
||||
player.sendMessage(permissions.toString());
|
||||
|
|
@ -1511,8 +1509,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
if (builders.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < builders.size(); i++)
|
||||
permissions.append(this.trustEntryToPlayerName(builders.get(i)) + " ");
|
||||
for (String builder : builders)
|
||||
permissions.append(this.trustEntryToPlayerName(builder) + " ");
|
||||
}
|
||||
|
||||
player.sendMessage(permissions.toString());
|
||||
|
|
@ -1521,8 +1519,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
if (containers.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < containers.size(); i++)
|
||||
permissions.append(this.trustEntryToPlayerName(containers.get(i)) + " ");
|
||||
for (String container : containers)
|
||||
permissions.append(this.trustEntryToPlayerName(container) + " ");
|
||||
}
|
||||
|
||||
player.sendMessage(permissions.toString());
|
||||
|
|
@ -1531,8 +1529,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
|
||||
if (accessors.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < accessors.size(); i++)
|
||||
permissions.append(this.trustEntryToPlayerName(accessors.get(i)) + " ");
|
||||
for (String accessor : accessors)
|
||||
permissions.append(this.trustEntryToPlayerName(accessor) + " ");
|
||||
}
|
||||
|
||||
player.sendMessage(permissions.toString());
|
||||
|
|
@ -2252,9 +2250,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
if (claims.size() > 0)
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.ClaimsListHeader);
|
||||
for (int i = 0; i < claims.size(); i++)
|
||||
for (Claim claim : claims)
|
||||
{
|
||||
Claim claim = claims.get(i);
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, getfriendlyLocationString(claim.getLesserBoundaryCorner()));
|
||||
}
|
||||
}
|
||||
|
|
@ -3008,10 +3005,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
if (claim == null)
|
||||
{
|
||||
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||
for (int i = 0; i < playerData.getClaims().size(); i++)
|
||||
{
|
||||
targetClaims.add(playerData.getClaims().get(i));
|
||||
}
|
||||
targetClaims.addAll(playerData.getClaims());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3088,10 +3082,8 @@ public class GriefPrevention extends JavaPlugin
|
|||
}
|
||||
|
||||
//apply changes
|
||||
for (int i = 0; i < targetClaims.size(); i++)
|
||||
for (Claim currentClaim : targetClaims)
|
||||
{
|
||||
Claim currentClaim = targetClaims.get(i);
|
||||
|
||||
if (permissionLevel == null)
|
||||
{
|
||||
if (!currentClaim.managers.contains(identifierToAdd))
|
||||
|
|
@ -3310,16 +3302,16 @@ public class GriefPrevention extends JavaPlugin
|
|||
ItemStack[] armorStacks = inventory.getArmorContents();
|
||||
|
||||
//check armor slots, stop if any items are found
|
||||
for (int i = 0; i < armorStacks.length; i++)
|
||||
for (ItemStack armorStack : armorStacks)
|
||||
{
|
||||
if (!(armorStacks[i] == null || armorStacks[i].getType() == Material.AIR)) return false;
|
||||
if (!(armorStack == null || armorStack.getType() == Material.AIR)) return false;
|
||||
}
|
||||
|
||||
//check other slots, stop if any items are found
|
||||
ItemStack[] generalStacks = inventory.getContents();
|
||||
for (int i = 0; i < generalStacks.length; i++)
|
||||
for (ItemStack generalStack : generalStacks)
|
||||
{
|
||||
if (!(generalStacks[i] == null || generalStacks[i].getType() == Material.AIR)) return false;
|
||||
if (!(generalStack == null || generalStack.getType() == Material.AIR)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1498,9 +1498,8 @@ class PlayerEventHandler implements Listener
|
|||
if (bucketEvent.getBucket() == Material.LAVA_BUCKET)
|
||||
{
|
||||
List<Player> players = block.getWorld().getPlayers();
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
for (Player otherPlayer : players)
|
||||
{
|
||||
Player otherPlayer = players.get(i);
|
||||
Location location = otherPlayer.getLocation();
|
||||
if (!otherPlayer.equals(player) && otherPlayer.getGameMode() == GameMode.SURVIVAL && player.canSee(otherPlayer) && block.getY() >= location.getBlockY() - 1 && location.distanceSquared(block.getLocation()) < minLavaDistance * minLavaDistance)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,9 +97,8 @@ class RestoreNatureExecutionTask implements Runnable
|
|||
//clean up any entities in the chunk, ensure no players are suffocated
|
||||
Chunk chunk = this.lesserCorner.getChunk();
|
||||
Entity[] entities = chunk.getEntities();
|
||||
for (int i = 0; i < entities.length; i++)
|
||||
for (Entity entity : entities)
|
||||
{
|
||||
Entity entity = entities[i];
|
||||
if (!(entity instanceof Player || entity instanceof Animals))
|
||||
{
|
||||
//hanging entities (paintings, item frames) are protected when they're in land claims
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import org.bukkit.block.data.type.Leaves;
|
|||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
//non-main-thread task which processes world data to repair the unnatural
|
||||
//after processing is complete, creates a main thread task to make the necessary changes to the world
|
||||
|
|
@ -390,8 +391,7 @@ class RestoreNatureProcessingTask implements Runnable
|
|||
Material.LILY_PAD
|
||||
};
|
||||
|
||||
ArrayList<Material> excludedBlocks = new ArrayList<>();
|
||||
for (int i = 0; i < excludedBlocksArray.length; i++) excludedBlocks.add(excludedBlocksArray[i]);
|
||||
ArrayList<Material> excludedBlocks = new ArrayList<>(Arrays.asList(excludedBlocksArray));
|
||||
|
||||
excludedBlocks.addAll(Tag.SAPLINGS.getValues());
|
||||
excludedBlocks.addAll(Tag.LEAVES.getValues());
|
||||
|
|
|
|||
|
|
@ -167,10 +167,9 @@ class UUIDFetcher
|
|||
{
|
||||
GriefPrevention.AddLogEntry("Generating offline mode UUIDs for remaining unresolved players...");
|
||||
|
||||
for (int i = 0; i < names.size(); i++)
|
||||
for (String name : names)
|
||||
{
|
||||
String name = names.get(i);
|
||||
UUID uuid = java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));
|
||||
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8));
|
||||
GriefPrevention.AddLogEntry(name + " --> " + uuid.toString());
|
||||
lookupCache.put(name, uuid);
|
||||
lookupCache.put(name.toLowerCase(), uuid);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user