Memory leak fix

This commit is contained in:
nossr50 2020-11-27 16:26:24 -08:00
parent ab276ffe33
commit bcd260d9c1
3 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,6 @@
Version 2.1.159
Fixed a memory leak involving renamed mobs
Version 2.1.158
Fixed a bug where Lure level 4 and above would break fishing with the new Master Angler
URLs in party/admin chat work again (use https:// in front to make links clickable)

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.158</version>
<version>2.1.159-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.mcMMO;
import org.bukkit.entity.LivingEntity;
public class TransientMetadataTools {
public static final String OLD_NAME_METAKEY = "mcMMO_oldName";
private final mcMMO pluginRef;
public TransientMetadataTools(mcMMO pluginRef) {
@ -17,6 +18,10 @@ public class TransientMetadataTools {
livingEntity.removeMetadata(mcMMO.customNameKey, pluginRef);
}
if(livingEntity.hasMetadata(OLD_NAME_METAKEY)) {
livingEntity.removeMetadata(OLD_NAME_METAKEY, pluginRef);
}
//Involved in changing mob names to hearts
if (livingEntity.hasMetadata(mcMMO.customVisibleKey)) {
livingEntity.setCustomNameVisible(livingEntity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());