mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-03 21:15:28 +02:00
Fix some bugs with Rupture and fix a small memory leak
This commit is contained in:
@@ -2,16 +2,17 @@ package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TransientMetadataTools {
|
||||
public static final String OLD_NAME_METAKEY = TransientMetadataTools.OLD_NAME_METAKEY;
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public TransientMetadataTools(mcMMO pluginRef) {
|
||||
public TransientMetadataTools(@NotNull mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
}
|
||||
|
||||
public void cleanAllMobMetadata(LivingEntity livingEntity) {
|
||||
public void cleanAllLivingEntityMetadata(@NotNull LivingEntity livingEntity) {
|
||||
//Since its not written anywhere, apparently the GC won't touch objects with metadata still present on them
|
||||
if (livingEntity.hasMetadata(mcMMO.customNameKey)) {
|
||||
livingEntity.setCustomName(livingEntity.getMetadata(mcMMO.customNameKey).get(0).asString());
|
||||
@@ -33,10 +34,13 @@ public class TransientMetadataTools {
|
||||
livingEntity.removeMetadata(mcMMO.travelingBlock, pluginRef);
|
||||
}
|
||||
|
||||
if(livingEntity.hasMetadata(mcMMO.REPLANT_META_KEY)) {
|
||||
livingEntity.removeMetadata(mcMMO.REPLANT_META_KEY, pluginRef);
|
||||
if(livingEntity.hasMetadata(mcMMO.RUPTURE_META_KEY)) {
|
||||
livingEntity.removeMetadata(mcMMO.RUPTURE_META_KEY, pluginRef);
|
||||
}
|
||||
|
||||
if(livingEntity.hasMetadata(mcMMO.EXPLOSION_FROM_RUPTURE)) {
|
||||
livingEntity.removeMetadata(mcMMO.EXPLOSION_FROM_RUPTURE, pluginRef);
|
||||
}
|
||||
|
||||
//Cleanup mob metadata
|
||||
mcMMO.getCompatibilityManager().getPersistentDataLayer().removeMobFlags(livingEntity);
|
||||
|
Reference in New Issue
Block a user