Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing like 10 memory leaks Fixes #4670
- Loading branch information
Showing
15 changed files
with
140 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/gmail/nossr50/runnables/MobDodgeMetaCleanup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.gmail.nossr50.runnables; | ||
|
||
import com.gmail.nossr50.mcMMO; | ||
import com.gmail.nossr50.util.MetadataConstants; | ||
import org.bukkit.entity.Mob; | ||
import org.bukkit.scheduler.BukkitRunnable; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class MobDodgeMetaCleanup extends BukkitRunnable { | ||
private final @NotNull Mob mob; | ||
private final @NotNull mcMMO pluginRef; | ||
|
||
public MobDodgeMetaCleanup(@NotNull Mob mob, @NotNull mcMMO pluginRef) { | ||
this.mob = mob; | ||
this.pluginRef = pluginRef; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
if(!mob.isValid() || mob.getTarget() == null) { | ||
mob.removeMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, pluginRef); | ||
this.cancel(); | ||
} else if (!mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER)) { | ||
this.cancel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/gmail/nossr50/runnables/TravelingBlockMetaCleanup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.gmail.nossr50.runnables; | ||
|
||
import com.gmail.nossr50.mcMMO; | ||
import com.gmail.nossr50.util.MetadataConstants; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.scheduler.BukkitRunnable; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class TravelingBlockMetaCleanup extends BukkitRunnable { | ||
private final @NotNull Entity entity; | ||
private final @NotNull mcMMO pluginRef; | ||
|
||
public TravelingBlockMetaCleanup(@NotNull Entity entity, @NotNull mcMMO pluginRef) { | ||
this.entity = entity; | ||
this.pluginRef = pluginRef; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
if(!entity.isValid()) { | ||
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef); | ||
this.cancel(); | ||
} else if (!entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) { | ||
this.cancel(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters