Ignored lots of compiler warnings.
Mostly these are deprecations from the Spigot team which I believe shouldn't be deprecated. For example, players refer to each other by name, not UUID - so there will always be a need for player lookup by name. Also the block IDs are a well-documented standard that everyone understands, even if they're not very human-friendly. Plugins use those IDs and data values to specify block types for example in config files. As for the rest of the ignores, I either decided the warnings are just noise based on the situation, or that I'm comfortable with the risks. Possibly for the first time in 5 years of dev work on this plugin, I just compiled without any warnings. :)
This commit is contained in:
parent
079d3c143a
commit
289b832b9a
|
|
@ -31,6 +31,7 @@ class AutoExtendClaimTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private int getLowestBuiltY()
|
private int getLowestBuiltY()
|
||||||
{
|
{
|
||||||
int y = this.claim.getLesserBoundaryCorner().getBlockY();
|
int y = this.claim.getLesserBoundaryCorner().getBlockY();
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,8 @@ public class BlockEventHandler implements Listener
|
||||||
|
|
||||||
if(!player.hasPermission("griefprevention.eavesdropsigns"))
|
if(!player.hasPermission("griefprevention.eavesdropsigns"))
|
||||||
{
|
{
|
||||||
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
||||||
for(Player otherPlayer : players)
|
for(Player otherPlayer : players)
|
||||||
{
|
{
|
||||||
if(otherPlayer.hasPermission("griefprevention.eavesdropsigns"))
|
if(otherPlayer.hasPermission("griefprevention.eavesdropsigns"))
|
||||||
|
|
@ -174,7 +175,8 @@ public class BlockEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//when a player places a block...
|
//when a player places a block...
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
|
@SuppressWarnings("null")
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
|
||||||
public void onBlockPlace(BlockPlaceEvent placeEvent)
|
public void onBlockPlace(BlockPlaceEvent placeEvent)
|
||||||
{
|
{
|
||||||
Player player = placeEvent.getPlayer();
|
Player player = placeEvent.getPlayer();
|
||||||
|
|
@ -754,7 +756,7 @@ public class BlockEventHandler implements Listener
|
||||||
|
|
||||||
//from where?
|
//from where?
|
||||||
Block fromBlock = dispenseEvent.getBlock();
|
Block fromBlock = dispenseEvent.getBlock();
|
||||||
Dispenser dispenser = new Dispenser(fromBlock.getType(), fromBlock.getData());
|
Dispenser dispenser = (Dispenser)fromBlock.getState();
|
||||||
|
|
||||||
//to where?
|
//to where?
|
||||||
Block toBlock = fromBlock.getRelative(dispenser.getFacing());
|
Block toBlock = fromBlock.getRelative(dispenser.getFacing());
|
||||||
|
|
|
||||||
|
|
@ -825,7 +825,8 @@ public class Claim
|
||||||
return thisCorner.getWorld().getName().compareTo(otherCorner.getWorld().getName()) < 0;
|
return thisCorner.getWorld().getName().compareTo(otherCorner.getWorld().getName()) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long getPlayerInvestmentScore()
|
@SuppressWarnings("deprecation")
|
||||||
|
long getPlayerInvestmentScore()
|
||||||
{
|
{
|
||||||
//decide which blocks will be considered player placed
|
//decide which blocks will be considered player placed
|
||||||
Location lesserBoundaryCorner = this.getLesserBoundaryCorner();
|
Location lesserBoundaryCorner = this.getLesserBoundaryCorner();
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,9 @@ public abstract class DataStore
|
||||||
|
|
||||||
class NoTransferException extends Exception
|
class NoTransferException extends Exception
|
||||||
{
|
{
|
||||||
NoTransferException(String message)
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
NoTransferException(String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
@ -1005,7 +1007,8 @@ public abstract class DataStore
|
||||||
//if the claim should be opened to looting
|
//if the claim should be opened to looting
|
||||||
if(grantAccess)
|
if(grantAccess)
|
||||||
{
|
{
|
||||||
Player winner = GriefPrevention.instance.getServer().getPlayer(winnerName);
|
@SuppressWarnings("deprecation")
|
||||||
|
Player winner = GriefPrevention.instance.getServer().getPlayer(winnerName);
|
||||||
if(winner != null)
|
if(winner != null)
|
||||||
{
|
{
|
||||||
//notify the winner
|
//notify the winner
|
||||||
|
|
@ -1020,8 +1023,10 @@ public abstract class DataStore
|
||||||
//if the siege ended due to death, transfer inventory to winner
|
//if the siege ended due to death, transfer inventory to winner
|
||||||
if(death)
|
if(death)
|
||||||
{
|
{
|
||||||
Player winner = GriefPrevention.instance.getServer().getPlayer(winnerName);
|
@SuppressWarnings("deprecation")
|
||||||
Player loser = GriefPrevention.instance.getServer().getPlayer(loserName);
|
Player winner = GriefPrevention.instance.getServer().getPlayer(winnerName);
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
Player loser = GriefPrevention.instance.getServer().getPlayer(loserName);
|
||||||
if(winner != null && loser != null)
|
if(winner != null && loser != null)
|
||||||
{
|
{
|
||||||
//get loser's inventory, then clear it
|
//get loser's inventory, then clear it
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ class DeliverClaimBlocksTask implements Runnable
|
||||||
//if no player specified, this task will create a player-specific task for each online player, scheduled one tick apart
|
//if no player specified, this task will create a player-specific task for each online player, scheduled one tick apart
|
||||||
if(this.player == null)
|
if(this.player == null)
|
||||||
{
|
{
|
||||||
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
||||||
|
|
||||||
long i = 0;
|
long i = 0;
|
||||||
for(Player onlinePlayer : players)
|
for(Player onlinePlayer : players)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.Rabbit;
|
import org.bukkit.entity.Rabbit;
|
||||||
import org.bukkit.entity.Rabbit.Type;
|
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
|
|
@ -166,6 +165,7 @@ public class EntityEventHandler implements Listener
|
||||||
{
|
{
|
||||||
//when not allowed, drop as item instead of forming a block
|
//when not allowed, drop as item instead of forming a block
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
ItemStack itemStack = new ItemStack(entity.getMaterial(), 1, entity.getBlockData());
|
ItemStack itemStack = new ItemStack(entity.getMaterial(), 1, entity.getBlockData());
|
||||||
Item item = block.getWorld().dropItem(entity.getLocation(), itemStack);
|
Item item = block.getWorld().dropItem(entity.getLocation(), itemStack);
|
||||||
item.setVelocity(new Vector());
|
item.setVelocity(new Vector());
|
||||||
|
|
@ -218,6 +218,7 @@ public class EntityEventHandler implements Listener
|
||||||
this.handleExplosion(explodeEvent.getBlock().getLocation(), null, explodeEvent.blockList());
|
this.handleExplosion(explodeEvent.getBlock().getLocation(), null, explodeEvent.blockList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
void handleExplosion(Location location, Entity entity, List<Block> blocks)
|
void handleExplosion(Location location, Entity entity, List<Block> blocks)
|
||||||
{
|
{
|
||||||
//only applies to claims-enabled worlds
|
//only applies to claims-enabled worlds
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
namesThread.start();
|
namesThread.start();
|
||||||
|
|
||||||
//load ignore lists for any already-online players
|
//load ignore lists for any already-online players
|
||||||
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
||||||
for(Player player : players)
|
for(Player player : players)
|
||||||
{
|
{
|
||||||
new IgnoreLoaderThread(player.getUniqueId(), this.dataStore.getPlayerData(player.getUniqueId()).ignoredPlayers).start();
|
new IgnoreLoaderThread(player.getUniqueId(), this.dataStore.getPlayerData(player.getUniqueId()).ignoredPlayers).start();
|
||||||
|
|
@ -926,7 +927,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
//handles slash commands
|
//handles slash commands
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
|
@SuppressWarnings("deprecation")
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
|
||||||
|
|
||||||
Player player = null;
|
Player player = null;
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
|
|
@ -2878,7 +2880,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OfflinePlayer resolvePlayerByName(String name)
|
@SuppressWarnings("deprecation")
|
||||||
|
public OfflinePlayer resolvePlayerByName(String name)
|
||||||
{
|
{
|
||||||
//try online players first
|
//try online players first
|
||||||
Player targetPlayer = this.getServer().getPlayerExact(name);
|
Player targetPlayer = this.getServer().getPlayerExact(name);
|
||||||
|
|
@ -2951,7 +2954,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
//save data for any online players
|
//save data for any online players
|
||||||
Collection<Player> players = (Collection<Player>)this.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> players = (Collection<Player>)this.getServer().getOnlinePlayers();
|
||||||
for(Player player : players)
|
for(Player player : players)
|
||||||
{
|
{
|
||||||
UUID playerID = player.getUniqueId();
|
UUID playerID = player.getUniqueId();
|
||||||
|
|
@ -3222,7 +3226,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restoreChunk(Chunk chunk, int miny, boolean aggressiveMode, long delayInTicks, Player playerReceivingVisualization)
|
@SuppressWarnings("deprecation")
|
||||||
|
public void restoreChunk(Chunk chunk, int miny, boolean aggressiveMode, long delayInTicks, Player playerReceivingVisualization)
|
||||||
{
|
{
|
||||||
//build a snapshot of this chunk, including 1 block boundary outside of the chunk all the way around
|
//build a snapshot of this chunk, including 1 block boundary outside of the chunk all the way around
|
||||||
int maxHeight = chunk.getWorld().getMaxHeight();
|
int maxHeight = chunk.getWorld().getMaxHeight();
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
@ -34,7 +32,6 @@ import me.ryanhamshire.GriefPrevention.Visualization;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
//holds all of GriefPrevention's player-tied data
|
//holds all of GriefPrevention's player-tied data
|
||||||
public class PlayerData
|
public class PlayerData
|
||||||
|
|
|
||||||
|
|
@ -31,19 +31,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.Achievement;
|
|
||||||
import org.bukkit.BanList;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.ChunkSnapshot;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.TravelAgent;
|
import org.bukkit.TravelAgent;
|
||||||
import org.bukkit.BanList.Type;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
@ -56,7 +51,6 @@ import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Hanging;
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.ItemFrame;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
|
|
@ -497,6 +491,7 @@ class PlayerEventHandler implements Listener
|
||||||
if(category == CommandCategory.Whisper && args.length > 1)
|
if(category == CommandCategory.Whisper && args.length > 1)
|
||||||
{
|
{
|
||||||
//determine target player, might be NULL
|
//determine target player, might be NULL
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
Player targetPlayer = GriefPrevention.instance.getServer().getPlayer(args[1]);
|
Player targetPlayer = GriefPrevention.instance.getServer().getPlayer(args[1]);
|
||||||
|
|
||||||
//softmute feature
|
//softmute feature
|
||||||
|
|
@ -522,7 +517,8 @@ class PlayerEventHandler implements Listener
|
||||||
|
|
||||||
String logMessage = logMessageBuilder.toString();
|
String logMessage = logMessageBuilder.toString();
|
||||||
|
|
||||||
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
||||||
for(Player onlinePlayer : players)
|
for(Player onlinePlayer : players)
|
||||||
{
|
{
|
||||||
if(onlinePlayer.hasPermission("griefprevention.eavesdrop") && !onlinePlayer.equals(targetPlayer) && !onlinePlayer.equals(player))
|
if(onlinePlayer.hasPermission("griefprevention.eavesdrop") && !onlinePlayer.equals(targetPlayer) && !onlinePlayer.equals(player))
|
||||||
|
|
@ -758,7 +754,8 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//when a player successfully joins the server...
|
//when a player successfully joins the server...
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@SuppressWarnings("deprecation")
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
void onPlayerJoin(PlayerJoinEvent event)
|
void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
@ -840,7 +837,8 @@ class PlayerEventHandler implements Listener
|
||||||
GriefPrevention.AddLogEntry("Auto-banned new player " + player.getName() + " because that account is using an IP address very recently used by banned player " + info.bannedAccountName + " (" + info.address.toString() + ").", CustomLogEntryTypes.AdminActivity);
|
GriefPrevention.AddLogEntry("Auto-banned new player " + player.getName() + " because that account is using an IP address very recently used by banned player " + info.bannedAccountName + " (" + info.address.toString() + ").", CustomLogEntryTypes.AdminActivity);
|
||||||
|
|
||||||
//notify any online ops
|
//notify any online ops
|
||||||
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> players = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
||||||
for(Player otherPlayer : players)
|
for(Player otherPlayer : players)
|
||||||
{
|
{
|
||||||
if(otherPlayer.isOp())
|
if(otherPlayer.isOp())
|
||||||
|
|
@ -1563,7 +1561,8 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
|
|
||||||
//when a player interacts with the world
|
//when a player interacts with the world
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@SuppressWarnings("deprecation")
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
void onPlayerInteract(PlayerInteractEvent event)
|
void onPlayerInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
//not interested in left-click-on-air actions
|
//not interested in left-click-on-air actions
|
||||||
|
|
@ -2490,7 +2489,8 @@ class PlayerEventHandler implements Listener
|
||||||
private ConcurrentHashMap<Integer, Boolean> inventoryHolderCache = new ConcurrentHashMap<Integer, Boolean>();
|
private ConcurrentHashMap<Integer, Boolean> inventoryHolderCache = new ConcurrentHashMap<Integer, Boolean>();
|
||||||
private boolean isInventoryHolder(Block clickedBlock)
|
private boolean isInventoryHolder(Block clickedBlock)
|
||||||
{
|
{
|
||||||
Integer cacheKey = clickedBlock.getTypeId();
|
@SuppressWarnings("deprecation")
|
||||||
|
Integer cacheKey = clickedBlock.getTypeId();
|
||||||
Boolean cachedValue = this.inventoryHolderCache.get(cacheKey);
|
Boolean cachedValue = this.inventoryHolderCache.get(cacheKey);
|
||||||
if(cachedValue != null)
|
if(cachedValue != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@
|
||||||
|
|
||||||
package me.ryanhamshire.GriefPrevention;
|
package me.ryanhamshire.GriefPrevention;
|
||||||
|
|
||||||
import org.bukkit.BanList;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.BanList.Type;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
//kicks or bans a player
|
//kicks or bans a player
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,8 @@ class RestoreNatureExecutionTask implements Runnable
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
//apply changes to the world, but ONLY to unclaimed blocks
|
//apply changes to the world, but ONLY to unclaimed blocks
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
private ArrayList<Integer> notAllowedToHang; //natural blocks which don't naturally hang in their air
|
private ArrayList<Integer> notAllowedToHang; //natural blocks which don't naturally hang in their air
|
||||||
private ArrayList<Integer> playerBlocks; //a "complete" list of player-placed blocks. MUST BE MAINTAINED as patches introduce more
|
private ArrayList<Integer> playerBlocks; //a "complete" list of player-placed blocks. MUST BE MAINTAINED as patches introduce more
|
||||||
|
|
||||||
public RestoreNatureProcessingTask(BlockSnapshot[][][] snapshots, int miny, Environment environment, Biome biome, Location lesserBoundaryCorner, Location greaterBoundaryCorner, int seaLevel, boolean aggressiveMode, boolean creativeMode, Player player)
|
@SuppressWarnings("deprecation")
|
||||||
|
public RestoreNatureProcessingTask(BlockSnapshot[][][] snapshots, int miny, Environment environment, Biome biome, Location lesserBoundaryCorner, Location greaterBoundaryCorner, int seaLevel, boolean aggressiveMode, boolean creativeMode, Player player)
|
||||||
{
|
{
|
||||||
this.snapshots = snapshots;
|
this.snapshots = snapshots;
|
||||||
this.miny = miny;
|
this.miny = miny;
|
||||||
|
|
@ -149,7 +150,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task);
|
GriefPrevention.instance.getServer().getScheduler().scheduleSyncDelayedTask(GriefPrevention.instance, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removePlayerLeaves()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void removePlayerLeaves()
|
||||||
{
|
{
|
||||||
if(this.seaLevel < 1) return;
|
if(this.seaLevel < 1) return;
|
||||||
|
|
||||||
|
|
@ -171,7 +173,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
//converts sandstone adjacent to sand to sand, and any other sandstone to air
|
//converts sandstone adjacent to sand to sand, and any other sandstone to air
|
||||||
private void removeSandstone()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void removeSandstone()
|
||||||
{
|
{
|
||||||
for(int x = 1; x < snapshots.length - 1; x++)
|
for(int x = 1; x < snapshots.length - 1; x++)
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +213,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reduceStone()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void reduceStone()
|
||||||
{
|
{
|
||||||
if(this.seaLevel < 1) return;
|
if(this.seaLevel < 1) return;
|
||||||
|
|
||||||
|
|
@ -257,7 +261,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reduceLogs()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void reduceLogs()
|
||||||
{
|
{
|
||||||
if(this.seaLevel < 1) return;
|
if(this.seaLevel < 1) return;
|
||||||
|
|
||||||
|
|
@ -295,7 +300,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removePlayerBlocks()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void removePlayerBlocks()
|
||||||
{
|
{
|
||||||
int miny = this.miny;
|
int miny = this.miny;
|
||||||
if(miny < 1) miny = 1;
|
if(miny < 1) miny = 1;
|
||||||
|
|
@ -317,7 +323,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeHanging()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void removeHanging()
|
||||||
{
|
{
|
||||||
int miny = this.miny;
|
int miny = this.miny;
|
||||||
if(miny < 1) miny = 1;
|
if(miny < 1) miny = 1;
|
||||||
|
|
@ -343,7 +350,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeWallsAndTowers()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void removeWallsAndTowers()
|
||||||
{
|
{
|
||||||
int [] excludedBlocksArray = new int []
|
int [] excludedBlocksArray = new int []
|
||||||
{
|
{
|
||||||
|
|
@ -396,7 +404,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}while(changed);
|
}while(changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void coverSurfaceStone()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void coverSurfaceStone()
|
||||||
{
|
{
|
||||||
for(int x = 1; x < snapshots.length - 1; x++)
|
for(int x = 1; x < snapshots.length - 1; x++)
|
||||||
{
|
{
|
||||||
|
|
@ -420,7 +429,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillHolesAndTrenches()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void fillHolesAndTrenches()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> fillableBlocks = new ArrayList<Integer>();
|
ArrayList<Integer> fillableBlocks = new ArrayList<Integer>();
|
||||||
fillableBlocks.add(Material.AIR.getId());
|
fillableBlocks.add(Material.AIR.getId());
|
||||||
|
|
@ -478,7 +488,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}while(changed);
|
}while(changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fixWater()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void fixWater()
|
||||||
{
|
{
|
||||||
int miny = this.miny;
|
int miny = this.miny;
|
||||||
if(miny < 1) miny = 1;
|
if(miny < 1) miny = 1;
|
||||||
|
|
@ -562,7 +573,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}while(changed);
|
}while(changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeDumpedFluids()
|
@SuppressWarnings("deprecation")
|
||||||
|
private void removeDumpedFluids()
|
||||||
{
|
{
|
||||||
if(this.seaLevel < 1) return;
|
if(this.seaLevel < 1) return;
|
||||||
|
|
||||||
|
|
@ -586,7 +598,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int highestY(int x, int z, boolean ignoreLeaves)
|
@SuppressWarnings("deprecation")
|
||||||
|
private int highestY(int x, int z, boolean ignoreLeaves)
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
for(y = snapshots[0].length - 1; y > 0; y--)
|
for(y = snapshots[0].length - 1; y > 0; y--)
|
||||||
|
|
@ -607,7 +620,8 @@ class RestoreNatureProcessingTask implements Runnable
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ArrayList<Integer> getPlayerBlocks(Environment environment, Biome biome)
|
@SuppressWarnings("deprecation")
|
||||||
|
static ArrayList<Integer> getPlayerBlocks(Environment environment, Biome biome)
|
||||||
{
|
{
|
||||||
//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"
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ class SecureClaimTask implements Runnable
|
||||||
claim.doorsOpen = false;
|
claim.doorsOpen = false;
|
||||||
|
|
||||||
//eject bad guys
|
//eject bad guys
|
||||||
Collection<Player> onlinePlayers = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
@SuppressWarnings("unchecked")
|
||||||
|
Collection<Player> onlinePlayers = (Collection<Player>)GriefPrevention.instance.getServer().getOnlinePlayers();
|
||||||
for(Player player : onlinePlayers)
|
for(Player player : onlinePlayers)
|
||||||
{
|
{
|
||||||
if(claim.contains(player.getLocation(), false, false) && claim.allowAccess(player) != null)
|
if(claim.contains(player.getLocation(), false, false) && claim.allowAccess(player) != null)
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ public class Visualization
|
||||||
}
|
}
|
||||||
|
|
||||||
//reverts a visualization by sending another block change list, this time with the real world block values
|
//reverts a visualization by sending another block change list, this time with the real world block values
|
||||||
public static void Revert(Player player)
|
@SuppressWarnings("deprecation")
|
||||||
|
public static void Revert(Player player)
|
||||||
{
|
{
|
||||||
if(!player.isOnline()) return;
|
if(!player.isOnline()) return;
|
||||||
|
|
||||||
|
|
@ -125,7 +126,8 @@ public class Visualization
|
||||||
//adds a claim's visualization to the current visualization
|
//adds a claim's visualization to the current visualization
|
||||||
//handy for combining several visualizations together, as when visualization a top level claim with several subdivisions inside
|
//handy for combining several visualizations together, as when visualization a top level claim with several subdivisions inside
|
||||||
//locality is a performance consideration. only create visualization blocks for around 100 blocks of the locality
|
//locality is a performance consideration. only create visualization blocks for around 100 blocks of the locality
|
||||||
private void addClaimElements(Claim claim, int height, VisualizationType visualizationType, Location locality)
|
@SuppressWarnings("deprecation")
|
||||||
|
private void addClaimElements(Claim claim, int height, VisualizationType visualizationType, Location locality)
|
||||||
{
|
{
|
||||||
Location smallXsmallZ = claim.getLesserBoundaryCorner();
|
Location smallXsmallZ = claim.getLesserBoundaryCorner();
|
||||||
Location bigXbigZ = claim.getGreaterBoundaryCorner();
|
Location bigXbigZ = claim.getGreaterBoundaryCorner();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ class VisualizationApplicationTask implements Runnable
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
//for each element (=block) of the visualization
|
//for each element (=block) of the visualization
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ package me.ryanhamshire.GriefPrevention.events;
|
||||||
|
|
||||||
import me.ryanhamshire.GriefPrevention.Claim;
|
import me.ryanhamshire.GriefPrevention.Claim;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user