mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
== is faster than .equals() for enums.
This commit is contained in:
parent
49de6614c0
commit
4aceadd777
@ -286,7 +286,7 @@ public class BlockListener implements Listener {
|
||||
else if (profile.getToolPreparationMode(ToolType.SHOVEL) && ItemChecks.isShovel(heldItem) && BlockChecks.canBeGigaDrillBroken(block) && Permissions.gigaDrillBreaker(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.EXCAVATION);
|
||||
}
|
||||
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType().equals(Material.SNOW)) && Permissions.berserk(player)) {
|
||||
else if (profile.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW) && Permissions.berserk(player)) {
|
||||
SkillTools.abilityCheck(player, SkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
@ -344,7 +344,7 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
else if (profile.getAbilityMode(AbilityType.BERSERK) && SkillTools.triggerCheck(player, block, AbilityType.BERSERK)) {
|
||||
if (heldItem.getType().equals(Material.AIR)) {
|
||||
if (heldItem.getType() == Material.AIR) {
|
||||
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
|
||||
plugin.getServer().getPluginManager().callEvent(armswing);
|
||||
|
||||
@ -375,7 +375,7 @@ public class BlockListener implements Listener {
|
||||
Woodcutting.beginLeafBlower(player, block);
|
||||
}
|
||||
}
|
||||
else if (!heldItem.getType().equals(Material.SHEARS)) {
|
||||
else if (!(heldItem.getType() == Material.SHEARS)) {
|
||||
event.setInstaBreak(true);
|
||||
Woodcutting.beginLeafBlower(player, block);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
SpawnReason reason = event.getSpawnReason();
|
||||
|
||||
if (reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) {
|
||||
if (reason == SpawnReason.SPAWNER || reason == SpawnReason.SPAWNER_EGG) {
|
||||
mcMMO.placeStore.addSpawnedMob(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class Herbalism {
|
||||
|
||||
for (int y = 0; y <= 2; y++) {
|
||||
Block relativeBlock = block.getRelative(BlockFace.UP, y);
|
||||
if (relativeBlock.getType().equals(blockType) && !mcMMO.placeStore.isTrue(relativeBlock)) {
|
||||
if (relativeBlock.getType() == blockType && !mcMMO.placeStore.isTrue(relativeBlock)) {
|
||||
dropAmount++;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class SuperBreakerEventHandler {
|
||||
private void calculateDurabilityLoss() {
|
||||
this.durabilityLoss = Misc.toolDurabilityLoss;
|
||||
|
||||
if (blockType.equals(Material.OBSIDIAN)) {
|
||||
if (blockType == Material.OBSIDIAN) {
|
||||
durabilityLoss = durabilityLoss * 5;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public enum ToolType {
|
||||
return ItemChecks.isAxe(is);
|
||||
|
||||
case FISTS:
|
||||
return is.getType().equals(Material.AIR);
|
||||
return is.getType() == Material.AIR;
|
||||
|
||||
case HOE:
|
||||
return ItemChecks.isHoe(is);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user