diff --git a/src/me/libraryaddict/disguise/commands/DisguiseCommand.java b/src/me/libraryaddict/disguise/commands/DisguiseCommand.java index 0c13dda6..be583cfb 100644 --- a/src/me/libraryaddict/disguise/commands/DisguiseCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguiseCommand.java @@ -22,7 +22,7 @@ public class DisguiseCommand extends BaseDisguiseCommand { sender.sendMessage(ChatColor.RED + "You may not use this command from the console!"); return true; } - Disguise disguise = null; + Disguise disguise; try { disguise = parseDisguise(sender, args); } catch (Exception ex) { diff --git a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java b/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java index fff6ea23..998a5b5a 100644 --- a/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java +++ b/src/me/libraryaddict/disguise/commands/DisguisePlayerCommand.java @@ -57,7 +57,7 @@ public class DisguisePlayerCommand extends BaseDisguiseCommand { } if (DisguiseConfig.isNameOfPlayerShownAboveDisguise()) { if (disguise.getWatcher() instanceof LivingWatcher) { - ((LivingWatcher) disguise.getWatcher()).setCustomName(((Player) player).getDisplayName()); + ((LivingWatcher) disguise.getWatcher()).setCustomName(player.getDisplayName()); if (DisguiseConfig.isNameAboveHeadAlwaysVisible()) { ((LivingWatcher) disguise.getWatcher()).setCustomNameVisible(true); } diff --git a/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java index 9311e467..faa7d390 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java @@ -62,11 +62,8 @@ public class MobDisguise extends TargetedDisguise { } public boolean doesDisguiseAge() { - if (getWatcher() != null) { - return getWatcher() instanceof AgeableWatcher || getWatcher() instanceof ZombieWatcher; - } - return false; - + return getWatcher() != null && + (getWatcher() instanceof AgeableWatcher || getWatcher() instanceof ZombieWatcher); } public boolean isAdult() { diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 70250d94..9a8d62e9 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -443,11 +443,8 @@ public class DisguiseUtilities { } public static boolean isDisguiseInUse(Disguise disguise) { - if (disguise.getEntity() != null && getDisguises().containsKey(disguise.getEntity().getUniqueId()) - && getDisguises().get(disguise.getEntity().getUniqueId()).contains(disguise)) { - return true; - } - return false; + return disguise.getEntity() != null && getDisguises().containsKey(disguise.getEntity().getUniqueId()) + && getDisguises().get(disguise.getEntity().getUniqueId()).contains(disguise); } /** diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index ff95181c..99982efe 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -179,7 +179,7 @@ public class PacketsManager { stringMods.write(i, ((PlayerDisguise) disguise).getName()); } } else { - Object gameProfile = null; + Object gameProfile; String name = ((PlayerDisguise) disguise).getName(); boolean removeName = false; if (!DisguiseUtilities.hasGameProfile(name)) { @@ -529,8 +529,9 @@ public class PacketsManager { if (disguise.isSoundsReplaced()) { String sound = null; DisguiseSound dSound = DisguiseSound.getType(disguise.getType().name()); - if (dSound != null && soundType != null) + if (dSound != null) sound = dSound.getSound(soundType); + if (sound == null) { event.setCancelled(true); } else { @@ -563,7 +564,7 @@ public class PacketsManager { if (soundType == SoundType.HURT || soundType == SoundType.DEATH || soundType == SoundType.IDLE) { // If the volume is the default - if (((Float) mods.read(4)).equals(entitySound.getDamageAndIdleSoundVolume())) { + if (mods.read(4).equals(entitySound.getDamageAndIdleSoundVolume())) { mods.write(4, dSound.getDamageAndIdleSoundVolume()); } // Here I assume its the default pitch as I can't calculate if its real. diff --git a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java index 2709db8b..a0a7a5ce 100644 --- a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java +++ b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java @@ -151,8 +151,7 @@ public class ReflectionManager { public static Entity getBukkitEntity(Object nmsEntity) { try { - Entity bukkitEntity = (Entity) ReflectionManager.getNmsClass("Entity").getMethod("getBukkitEntity").invoke(nmsEntity); - return bukkitEntity; + return (Entity) ReflectionManager.getNmsClass("Entity").getMethod("getBukkitEntity").invoke(nmsEntity); } catch (Exception ex) { ex.printStackTrace(); }