geforkt von Mirrors/Paper
Use generics in health scaling methods
Dieser Commit ist enthalten in:
Ursprung
b4c298d644
Commit
c15d869440
@ -1332,7 +1332,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
|
|
||||||
public void updateScaledHealth() {
|
public void updateScaledHealth() {
|
||||||
AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().getAttributeMap();
|
AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().getAttributeMap();
|
||||||
Collection set = attributemapserver.c(); // PAIL: Rename
|
Collection<AttributeInstance> set = attributemapserver.c(); // PAIL: Rename
|
||||||
|
|
||||||
injectScaledMaxHealth(set, true);
|
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()));
|
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) {
|
if (!scaledHealth && !force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Object genericInstance : collection) {
|
for (AttributeInstance genericInstance : collection) {
|
||||||
IAttribute attribute = ((AttributeInstance) genericInstance).getAttribute();
|
if (genericInstance.getAttribute().getName().equals("generic.maxHealth")) {
|
||||||
if (attribute.getName().equals("generic.maxHealth")) {
|
|
||||||
collection.remove(genericInstance);
|
collection.remove(genericInstance);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren