Fix dupe bug

This commit is contained in:
nossr50 2021-01-01 22:15:44 -08:00
parent 1408065768
commit bec54d93ac
3 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,10 @@
Version 2.1.167 Version 2.1.167
Add McMMOPlayerPreXpGainEvent event for plugins to modify given exp Fixed a serious dupe bug
Add SkillActivationPerkEvent Add McMMOPlayerPreXpGainEvent event for plugins to modify given exp (thanks electronicboy)
Add SkillActivationPerkEvent (thanks electronicboy)
NOTE:
This bug was introduced in 2.1.165, update immediately if you are on 2.1.165 or 2.1.166
Version 2.1.166 Version 2.1.166

View File

@ -645,7 +645,10 @@ public class EntityListener implements Listener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
LivingEntity entity = event.getEntity(); LivingEntity entity = event.getEntity();
mcMMO.getTransientEntityTracker().removeSummon(entity, null, false);
if(mcMMO.getTransientEntityTracker().isTransientSummon(entity)) {
mcMMO.getTransientEntityTracker().removeSummon(entity, null, false);
}
/* WORLD BLACKLIST CHECK */ /* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) { if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {

View File

@ -124,6 +124,16 @@ public class TransientEntityTracker {
addToChunkLookupCache(trackedTamingEntity); addToChunkLookupCache(trackedTamingEntity);
} }
/**
* Checks if a living entity is a summon
*
* @param livingEntity target livinig entity
* @return true if target living entity is a summon
*/
public synchronized boolean isTransientSummon(@NotNull LivingEntity livingEntity) {
return getChunkLookupCache().contains(livingEntity);
}
/** /**
* Get the tracked taming entities for a player * Get the tracked taming entities for a player
* If the player isn't registered this will return null * If the player isn't registered this will return null