mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-08 07:27:39 +01:00
Fixed #1377 keep-on-death
This commit is contained in:
parent
152518532c
commit
86d1e18baa
@ -11,9 +11,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
|||||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.Type;
|
import net.Indyuce.mmoitems.api.Type;
|
||||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -41,6 +39,11 @@ public class MMOUtils {
|
|||||||
return particle.getDataType() == Particle.DustOptions.class;
|
return particle.getDataType() == Particle.DustOptions.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSoulboundTo(@NotNull NBTItem item, @NotNull Player player) {
|
||||||
|
final @Nullable String foundNbt = item.getString("MMOITEMS_SOULBOUND");
|
||||||
|
return foundNbt != null && foundNbt.contains(player.getUniqueId().toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should cancel interaction if one of the two cases:
|
* Should cancel interaction if one of the two cases:
|
||||||
* - the item type no longer exists
|
* - the item type no longer exists
|
||||||
|
@ -11,6 +11,7 @@ import net.Indyuce.mmoitems.api.interaction.util.InteractItem;
|
|||||||
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
||||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||||
import net.Indyuce.mmoitems.api.util.DeathDowngrading;
|
import net.Indyuce.mmoitems.api.util.DeathDowngrading;
|
||||||
|
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
@ -41,7 +42,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (!PlayerData.has(event.getEntity())) return;
|
if (!PlayerData.has(event.getEntity())) return;
|
||||||
|
|
||||||
// See description of DelayedDeathDowngrade child class for full explanation
|
// See description of DelayedDeathDowngrade child class for full explanation
|
||||||
(new DelayedDeathDowngrade(event)).runTaskLater(MMOItems.plugin, 3L);
|
new DelayedDeathDowngrade(event).runTaskLater(MMOItems.plugin, 3L);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,8 +68,7 @@ public class PlayerListener implements Listener {
|
|||||||
* using a JsonParser followed by map checkups in the SoulboundData
|
* using a JsonParser followed by map checkups in the SoulboundData
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
if ((MMOItems.plugin.getLanguage().keepSoulboundOnDeath && nbt.getBoolean("MMOITEMS_DISABLE_DEATH_DROP"))
|
if (nbt.getBoolean("MMOITEMS_DISABLE_DEATH_DROP") || (MMOItems.plugin.getLanguage().keepSoulboundOnDeath && MMOUtils.isSoulboundTo(nbt, player))) {
|
||||||
|| (nbt.hasTag("MMOITEMS_SOULBOUND") && nbt.getString("MMOITEMS_SOULBOUND").contains(player.getUniqueId().toString()))) {
|
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
soulboundInfo.registerItem(item);
|
soulboundInfo.registerItem(item);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user