summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2017-11-17 11:08:26 +1100
committermd_5 <git@md-5.net>2017-11-17 11:08:26 +1100
commitc15d8694401f4982c69c5762852210255ee9703a (patch)
tree491ae70042d1ec5d8efde0c1023673fb0e760ccf
parentb4c298d644ec7d66c955912d8ca7341e53fddcfa (diff)
downloadcraftbukkit-c15d8694401f4982c69c5762852210255ee9703a.tar
craftbukkit-c15d8694401f4982c69c5762852210255ee9703a.tar.gz
craftbukkit-c15d8694401f4982c69c5762852210255ee9703a.tar.lz
craftbukkit-c15d8694401f4982c69c5762852210255ee9703a.tar.xz
craftbukkit-c15d8694401f4982c69c5762852210255ee9703a.zip
Use generics in health scaling methods
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3cfe5ac4..9747a886 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1332,7 +1332,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void updateScaledHealth() {
AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().getAttributeMap();
- Collection set = attributemapserver.c(); // PAIL: Rename
+ Collection<AttributeInstance> set = attributemapserver.c(); // PAIL: Rename
injectScaledMaxHealth(set, true);
@@ -1347,13 +1347,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()));
}
- public void injectScaledMaxHealth(Collection collection, boolean force) {
+ public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
if (!scaledHealth && !force) {
return;
}
- for (Object genericInstance : collection) {
- IAttribute attribute = ((AttributeInstance) genericInstance).getAttribute();
- if (attribute.getName().equals("generic.maxHealth")) {
+ for (AttributeInstance genericInstance : collection) {
+ if (genericInstance.getAttribute().getName().equals("generic.maxHealth")) {
collection.remove(genericInstance);
break;
}