1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-01-12 13:14:41 +01:00
parent 51dfbaed8a
commit 8a267cad3e
2 changed files with 10 additions and 7 deletions

View File

@ -39,6 +39,7 @@
* Fixed Localization mistakes
* Fixed #1366
* Fixed GitHub cache
* Fixed #1364
## Release Candidate 4 (06 Jan 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4

View File

@ -13,6 +13,7 @@ import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
@ -135,14 +136,14 @@ public class Talisman extends SlimefunItem {
if (p.getInventory().containsAtLeast(talisman.getItem(), 1)) {
if (Slimefun.hasUnlocked(p, talisman.getItem(), true)) {
executeTalismanAttributes(e,p,talisman);
activateTalisman(e, p, p.getInventory(), talisman);
return true;
}
else return false;
}
else if (p.getEnderChest().containsAtLeast(talisman.upgrade(), 1)) {
if (Slimefun.hasUnlocked(p, talisman.upgrade(), true)) {
executeTalismanAttributes(e,p,talisman);
activateTalisman(e, p, p.getEnderChest(), talisman);
return true;
}
else return false;
@ -150,8 +151,8 @@ public class Talisman extends SlimefunItem {
else return false;
}
private static void executeTalismanAttributes(Event e, Player p, Talisman talisman) {
consumeItem(p, talisman);
private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman) {
consumeItem(inv, talisman);
applyTalismanEffects(p, talisman);
cancelEvent(e, talisman);
sendMessage(p, talisman);
@ -175,9 +176,10 @@ public class Talisman extends SlimefunItem {
}
}
private static void consumeItem(Player p, Talisman talisman){
if (talisman.isConsumable())
p.getInventory().removeItem(talisman.getItem());
private static void consumeItem(Inventory inv, Talisman talisman){
if (talisman.isConsumable()) {
inv.removeItem(talisman.getItem());
}
}
private static Player getPlayerByEventType(Event e) {