Avoid some magic values and suppress warnings for the rest.

This commit is contained in:
Olof Larsson 2013-09-20 12:50:32 +02:00
parent 5a7024db4c
commit a5f4781f7b
4 changed files with 12 additions and 3 deletions

View File

@ -56,12 +56,13 @@ public class CmdFactionsSeeChunk extends FCommand
msg("<i>Visualized %s", chunk.toString(PSFormatHumanSpace.get()));
}
@SuppressWarnings("deprecation")
public static void showPillar(Player player, World world, int blockX, int blockZ)
{
for (int blockY = 0; blockY < world.getMaxHeight(); blockY++)
{
Location loc = new Location(world, blockX, blockY, blockZ);
if (loc.getBlock().getTypeId() != 0) continue;
if (loc.getBlock().getType() != Material.AIR) continue;
int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId();
VisualizeUtil.addLocation(player, loc, typeId);
}

View File

@ -41,6 +41,7 @@ public class FactionsListenerExploit implements Listener
// OBSIDIAN GENERATORS
// -------------------------------------------- //
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void obsidianGenerators(BlockFromToEvent event)
{
@ -52,7 +53,7 @@ public class FactionsListenerExploit implements Listener
int target = block.getTypeId();
if ((target == 55 || target == 132) && (source == 0 || source == 10 || source == 11))
{
block.setTypeId(0);
block.setType(Material.AIR);
}
}
@ -106,6 +107,7 @@ public class FactionsListenerExploit implements Listener
// this optional change below provides workaround for waterwalling providing perfect protection,
// and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void tntWaterlog(EntityExplodeEvent event)
{

View File

@ -688,7 +688,7 @@ public class FactionsListenerMain implements Listener
public void blockFireSpread(BlockSpreadEvent event)
{
// If fire is spreading ...
if (event.getNewState().getTypeId() != 51) return;
if (event.getNewState().getType() != Material.FIRE) return;
// ... consider blocking it.
blockFireSpread(event.getBlock(), event);

View File

@ -37,12 +37,14 @@ public class VisualizeUtil
// SINGLE
// -------------------------------------------- //
@SuppressWarnings("deprecation")
public static void addLocation(Player player, Location location, int typeId, byte data)
{
getPlayerLocations(player).add(location);
player.sendBlockChange(location, typeId, data);
}
@SuppressWarnings("deprecation")
public static void addLocation(Player player, Location location, int typeId)
{
getPlayerLocations(player).add(location);
@ -53,6 +55,7 @@ public class VisualizeUtil
// MANY
// -------------------------------------------- //
@SuppressWarnings("deprecation")
public static void addLocations(Player player, Map<Location, Integer> locationMaterialIds)
{
Set<Location> ploc = getPlayerLocations(player);
@ -63,6 +66,7 @@ public class VisualizeUtil
}
}
@SuppressWarnings("deprecation")
public static void addLocations(Player player, Collection<Location> locations, int typeId)
{
Set<Location> ploc = getPlayerLocations(player);
@ -73,6 +77,7 @@ public class VisualizeUtil
}
}
@SuppressWarnings("deprecation")
public static void addBlocks(Player player, Collection<Block> blocks, int typeId)
{
Set<Location> ploc = getPlayerLocations(player);
@ -88,6 +93,7 @@ public class VisualizeUtil
// CLEAR
// -------------------------------------------- //
@SuppressWarnings("deprecation")
public static void clear(Player player)
{
Set<Location> locations = getPlayerLocations(player);