mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-23 15:15:12 +01:00
Fixed grindstone giving experience when no enchantments were removed
This commit is contained in:
parent
132bd2650e
commit
e62c12b99d
@ -3,6 +3,8 @@ package com.willfp.ecoenchants.enchantments.support.merging.grindstone;
|
|||||||
import com.willfp.eco.core.EcoPlugin;
|
import com.willfp.eco.core.EcoPlugin;
|
||||||
import com.willfp.eco.core.PluginDependent;
|
import com.willfp.eco.core.PluginDependent;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -70,10 +72,15 @@ public class GrindstoneListeners extends PluginDependent implements Listener {
|
|||||||
newOut.setItemMeta(meta);
|
newOut.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ItemStack finalOut = newOut;
|
|
||||||
|
|
||||||
this.getPlugin().getScheduler().run(() -> {
|
this.getPlugin().getScheduler().run(() -> {
|
||||||
inventory.setItem(2, finalOut);
|
inventory.setItem(2, newOut);
|
||||||
|
if (!toKeep.isEmpty()) {
|
||||||
|
for (Entity entity : player.getNearbyEntities(10, 10, 10)) {
|
||||||
|
if (entity.getType() == EntityType.EXPERIENCE_ORB) {
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user