mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-10-13 17:48:20 +02:00
fix bug where armor stand could be renamed to heart symbols
This commit is contained in:
@@ -9,6 +9,7 @@ Version 2.2.043
|
||||
Added Copper_Golem to experience.yml for Combat XP
|
||||
Fixed ExploitFix.PreventArmorStandInteraction in experience.yml not being respected
|
||||
Added ExploitFix.PreventMannequinInteraction to experience.yml to prevent mannequins from granting XP or other effects
|
||||
Fixed bug where Armor Stands would get renamed to heart symbols upon breaking them
|
||||
|
||||
NOTES:
|
||||
You don't need to update your experience.yml, that one updates automatically when you run mcMMO after an update.
|
||||
|
@@ -1203,11 +1203,11 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isMannequinEntity(Entity attacker) {
|
||||
public static boolean isMannequinEntity(Entity attacker) {
|
||||
return MANNEQUIN.contains(attacker.getType().toString());
|
||||
}
|
||||
|
||||
private static boolean isArmorStandEntity(Entity attacker) {
|
||||
public static boolean isArmorStandEntity(Entity attacker) {
|
||||
return ARMOR_STAND.contains(attacker.getType().toString());
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import static com.gmail.nossr50.listeners.EntityListener.isArmorStandEntity;
|
||||
import static com.gmail.nossr50.listeners.EntityListener.isMannequinEntity;
|
||||
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.meta.OldName;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -40,8 +43,12 @@ public final class MobHealthbarUtils {
|
||||
* @param damage damage done by the attack triggering this
|
||||
*/
|
||||
public static void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
|
||||
if (mcMMO.isHealthBarPluginEnabled() || !mcMMO.p.getGeneralConfig()
|
||||
.getMobHealthbarEnabled()) {
|
||||
if (isArmorStandEntity(target) || isMannequinEntity(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.isHealthBarPluginEnabled()
|
||||
|| !mcMMO.p.getGeneralConfig().getMobHealthbarEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,13 +61,13 @@ public final class MobHealthbarUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
String originalName = target.getName();
|
||||
final String originalName = target.getName();
|
||||
String oldName = target.getCustomName();
|
||||
|
||||
/*
|
||||
* Store the name in metadata
|
||||
*/
|
||||
if (target.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY).size() <= 0) {
|
||||
if (target.getMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY).isEmpty()) {
|
||||
target.setMetadata(MetadataConstants.METADATA_KEY_OLD_NAME_KEY,
|
||||
new OldName(originalName, plugin));
|
||||
}
|
||||
|
Reference in New Issue
Block a user