mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #1364
This commit is contained in:
parent
51dfbaed8a
commit
8a267cad3e
@ -39,6 +39,7 @@
|
|||||||
* Fixed Localization mistakes
|
* Fixed Localization mistakes
|
||||||
* Fixed #1366
|
* Fixed #1366
|
||||||
* Fixed GitHub cache
|
* Fixed GitHub cache
|
||||||
|
* Fixed #1364
|
||||||
|
|
||||||
## Release Candidate 4 (06 Jan 2020)
|
## Release Candidate 4 (06 Jan 2020)
|
||||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4
|
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4
|
||||||
|
@ -13,6 +13,7 @@ import org.bukkit.event.enchantment.EnchantItemEvent;
|
|||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityEvent;
|
import org.bukkit.event.entity.EntityEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
@ -135,14 +136,14 @@ public class Talisman extends SlimefunItem {
|
|||||||
|
|
||||||
if (p.getInventory().containsAtLeast(talisman.getItem(), 1)) {
|
if (p.getInventory().containsAtLeast(talisman.getItem(), 1)) {
|
||||||
if (Slimefun.hasUnlocked(p, talisman.getItem(), true)) {
|
if (Slimefun.hasUnlocked(p, talisman.getItem(), true)) {
|
||||||
executeTalismanAttributes(e,p,talisman);
|
activateTalisman(e, p, p.getInventory(), talisman);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
else if (p.getEnderChest().containsAtLeast(talisman.upgrade(), 1)) {
|
else if (p.getEnderChest().containsAtLeast(talisman.upgrade(), 1)) {
|
||||||
if (Slimefun.hasUnlocked(p, talisman.upgrade(), true)) {
|
if (Slimefun.hasUnlocked(p, talisman.upgrade(), true)) {
|
||||||
executeTalismanAttributes(e,p,talisman);
|
activateTalisman(e, p, p.getEnderChest(), talisman);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
@ -150,8 +151,8 @@ public class Talisman extends SlimefunItem {
|
|||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void executeTalismanAttributes(Event e, Player p, Talisman talisman) {
|
private static void activateTalisman(Event e, Player p, Inventory inv, Talisman talisman) {
|
||||||
consumeItem(p, talisman);
|
consumeItem(inv, talisman);
|
||||||
applyTalismanEffects(p, talisman);
|
applyTalismanEffects(p, talisman);
|
||||||
cancelEvent(e, talisman);
|
cancelEvent(e, talisman);
|
||||||
sendMessage(p, talisman);
|
sendMessage(p, talisman);
|
||||||
@ -175,9 +176,10 @@ public class Talisman extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void consumeItem(Player p, Talisman talisman){
|
private static void consumeItem(Inventory inv, Talisman talisman){
|
||||||
if (talisman.isConsumable())
|
if (talisman.isConsumable()) {
|
||||||
p.getInventory().removeItem(talisman.getItem());
|
inv.removeItem(talisman.getItem());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Player getPlayerByEventType(Event e) {
|
private static Player getPlayerByEventType(Event e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user