== is faster than .equals() for enums.

This commit is contained in:
GJ
2013-02-04 11:35:52 -05:00
parent 49de6614c0
commit 4aceadd777
7 changed files with 11 additions and 11 deletions

View File

@ -312,7 +312,7 @@ public final class BlockChecks {
}
public static boolean isLog(Block block) {
if (block.getType().equals(Material.LOG) || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLogBlock(block))) {
if (block.getType() == Material.LOG || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLogBlock(block))) {
return true;
}
@ -320,7 +320,7 @@ public final class BlockChecks {
}
public static boolean isLeaves(Block block) {
if (block.getType().equals(Material.LEAVES) || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLeafBlock(block))) {
if (block.getType() == Material.LEAVES || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLeafBlock(block))) {
return true;
}

View File

@ -35,14 +35,14 @@ public final class ChimaeraWing {
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
if (!(block.getRelative(0, y, 0).getType() == Material.AIR)) {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.teleport(block.getRelative(0, y - 1, 0).getLocation());
return;
}
}
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType().equals(Material.BED_BLOCK)) {
if (player.getBedSpawnLocation() != null && player.getBedSpawnLocation().getBlock().getType() == Material.BED_BLOCK) {
player.teleport(player.getBedSpawnLocation());
}
else {