Procházet zdrojové kódy

Removed some unnecessary casting.

gmcferrin před 12 roky
rodič
revize
d69cf09d4e

+ 4 - 4
src/main/java/com/gmail/nossr50/listeners/EntityListener.java

@@ -183,8 +183,8 @@ public class EntityListener implements Listener {
         entity.setFireTicks(0);
         BleedTimer.remove(entity);
         Archery.arrowRetrievalCheck(entity);
-        mcMMO.placeStore.removeSpawnedMob(((Entity) entity));
-        mcMMO.placeStore.removeSpawnedPet(((Entity) entity));
+        mcMMO.placeStore.removeSpawnedMob(entity);
+        mcMMO.placeStore.removeSpawnedPet(entity);
     }
 
     /**
@@ -197,7 +197,7 @@ public class EntityListener implements Listener {
         SpawnReason reason = event.getSpawnReason();
 
         if ((reason.equals(SpawnReason.SPAWNER) || reason.equals(SpawnReason.SPAWNER_EGG)) && !Config.getInstance().getExperienceGainsMobspawnersEnabled()) {
-            mcMMO.placeStore.addSpawnedMob(((Entity) event.getEntity()));
+            mcMMO.placeStore.addSpawnedMob(event.getEntity());
         }
     }
 
@@ -398,7 +398,7 @@ public class EntityListener implements Listener {
 
         if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
 
-        if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet((Entity) event.getEntity())) {
+        if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet(event.getEntity())) {
             PlayerProfile profile = Users.getProfile(player);
             EntityType type = event.getEntityType();
             int xp = 0;

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/combat/Axes.java

@@ -132,7 +132,7 @@ public class Axes {
 
             /* Every 50 Skill Levels you gain 1 durability damage (default values) */
             int impactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel();
-            float impactMaxDamage = (float) advancedConfig.getArmorImpactMaxDurabilityDamage() / 100F;
+            float impactMaxDamage = advancedConfig.getArmorImpactMaxDurabilityDamage() / 100F;
             short maxDurability;
             durabilityDamage += (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) impactIncreaseLevel);
 
@@ -153,7 +153,7 @@ public class Axes {
                     	}
                     	int newDurabilityDamage = durabilityDamage - lowerdamage;
                         maxDurability = (short) (armor.getType().getMaxDurability() * impactMaxDamage);
-                    	if (newDurabilityDamage > maxDurability) newDurabilityDamage = (short) maxDurability;
+                    	if (newDurabilityDamage > maxDurability) newDurabilityDamage = maxDurability;
                         armor.setDurability((short) (armor.getDurability() + newDurabilityDamage)); //Damage armor piece
                     }
                 }

+ 2 - 2
src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java

@@ -84,7 +84,7 @@ public class WoodCutting {
                 if (health >= 2) {
                     Combat.dealDamage(player, random.nextInt(health - 1));
                 }
-                inHand.setDurability((short) (inHand.getType().getMaxDurability()));
+                inHand.setDurability(inHand.getType().getMaxDurability());
                 return;
             }
         }
@@ -96,7 +96,7 @@ public class WoodCutting {
             if (health >= 2) {
                 Combat.dealDamage(player, random.nextInt(health - 1));
             }
-            inHand.setDurability((short) (inHand.getType().getMaxDurability()));
+            inHand.setDurability(inHand.getType().getMaxDurability());
             return;
         }
 

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/repair/Repair.java

@@ -244,7 +244,7 @@ public class Repair {
         else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F);
 
         if (Permissions.repairMastery(player)) {
-            bonus = (((float) repairAmount) * bonus);
+            bonus = repairAmount * bonus;
             repairAmount += (int) bonus;
         }
 

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java

@@ -67,7 +67,7 @@ public class CallOfTheWildEventHandler {
             return;
 
         LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
-        mcMMO.placeStore.addSpawnedPet((Entity) entity);
+        mcMMO.placeStore.addSpawnedPet(entity);
 
         ((Tameable) entity).setOwner(player);
 

+ 2 - 2
src/main/java/com/gmail/nossr50/util/Combat.java

@@ -398,8 +398,8 @@ public class Combat {
                 baseXP = 20 * configInstance.getPlayerVersusPlayerXP();
             }
         }
-        else if (!mcMMO.placeStore.isSpawnedMob(((Entity) target))) {
-            if (target instanceof Animals && !mcMMO.placeStore.isSpawnedPet((Entity) target)) {
+        else if (!mcMMO.placeStore.isSpawnedMob(target)) {
+            if (target instanceof Animals && !mcMMO.placeStore.isSpawnedPet(target)) {
                 baseXP = configInstance.getAnimalsXP();
             }
             else {

+ 2 - 2
src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java

@@ -175,10 +175,10 @@ public class HashChunkManager implements ChunkManager {
 
             for(LivingEntity entity : world.getLivingEntities()) {
                 if(mobs.contains(entity.getUniqueId()))
-                    addSpawnedMob((Entity) entity);
+                    addSpawnedMob(entity);
 
                 if(pets.contains(entity.getUniqueId()))
-                    addSpawnedPet((Entity) entity);
+                    addSpawnedPet(entity);
             }
 
             in.clearSpawnedMobs();