mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-01 11:11:21 +01:00
don't wipe all the player's enchants when using the item revision system
This commit is contained in:
parent
ec4ae923d2
commit
6f040883e7
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems</artifactId>
|
||||
<version>6.5</version>
|
||||
<version>6.5.1-SNAPSHOT</version>
|
||||
<name>MMOItems</name>
|
||||
<description>A great item solution for your RPG server.</description>
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class Bunny_Mode extends Ability {
|
||||
|
||||
this.player = player;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(MMOItems.plugin, (@NotNull Runnable) this::close, (long) (duration * 20));
|
||||
Bukkit.getScheduler().runTaskLater(MMOItems.plugin, (Runnable) this::close, (long) (duration * 20));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -11,18 +11,25 @@ import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.stat.Soulbound;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemModInstance {
|
||||
private final NBTItem nbtItem;
|
||||
private final int amount;
|
||||
private final Map<Enchantment,Integer> enchantments;
|
||||
// Not initialized at first for performance reasons
|
||||
private MMOItem mmoItem;
|
||||
|
||||
public ItemModInstance(NBTItem nbt) {
|
||||
this.nbtItem = nbt;
|
||||
this.amount = nbt.getItem().getAmount();
|
||||
this.enchantments = nbt.getItem().getEnchantments();
|
||||
}
|
||||
|
||||
public void applySoulbound(Player p) {
|
||||
@ -62,6 +69,7 @@ public class ItemModInstance {
|
||||
public ItemStack toStack() {
|
||||
ItemStack stack = mmoItem.newBuilder().build();
|
||||
stack.setAmount(amount);
|
||||
stack.addUnsafeEnchantments(this.enchantments);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public abstract class TemporaryListener implements Listener {
|
||||
* used to close the temporary listener after some delay
|
||||
*/
|
||||
public void close(long duration) {
|
||||
Bukkit.getScheduler().runTaskLater(MMOItems.plugin, (@NotNull Runnable) this::close, duration);
|
||||
Bukkit.getScheduler().runTaskLater(MMOItems.plugin, (Runnable) this::close, duration);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
Loading…
Reference in New Issue
Block a user