mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
Fix requested changes
This commit is contained in:
parent
4d474de290
commit
6a250d6d00
@ -135,11 +135,11 @@ public class Talisman extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItemStack stack) {
|
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItemStack stack) {
|
||||||
return (tryActivateAndGet(e, stack.getItem()) != null);
|
return tryActivateAndGet(e, stack.getItem()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItem item) {
|
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItem item) {
|
||||||
return (tryActivateAndGet(e, item) != null);
|
return tryActivateAndGet(e, item) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack tryActivateAndGet(@Nonnull Event e, @Nonnull SlimefunItemStack stack) {
|
public static ItemStack tryActivateAndGet(@Nonnull Event e, @Nonnull SlimefunItemStack stack) {
|
||||||
@ -162,20 +162,16 @@ public class Talisman extends SlimefunItem {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Slimefun.hasUnlocked(p, talisman, true)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack possibleTalisman = retrieveTalismanFromInventory(p.getInventory(), talisman);
|
ItemStack possibleTalisman = retrieveTalismanFromInventory(p.getInventory(), talisman);
|
||||||
|
|
||||||
if (possibleTalisman != null) {
|
if (possibleTalisman != null && Slimefun.hasUnlocked(p, talisman, true)) {
|
||||||
activateTalisman(e, p, p.getInventory(), talisman);
|
activateTalisman(e, p, p.getInventory(), talisman);
|
||||||
return possibleTalisman;
|
return possibleTalisman;
|
||||||
}
|
}
|
||||||
|
|
||||||
possibleTalisman = retrieveTalismanFromInventory(p.getEnderChest(), talisman);
|
possibleTalisman = retrieveTalismanFromInventory(p.getEnderChest(), talisman);
|
||||||
|
|
||||||
if (possibleTalisman != null) {
|
if (possibleTalisman != null && Slimefun.hasUnlocked(p, talisman, true)) {
|
||||||
activateTalisman(e, p, p.getEnderChest(), talisman);
|
activateTalisman(e, p, p.getEnderChest(), talisman);
|
||||||
return possibleTalisman;
|
return possibleTalisman;
|
||||||
}
|
}
|
||||||
@ -194,10 +190,6 @@ public class Talisman extends SlimefunItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The point of this method is that it only gets called when youre sure there is
|
|
||||||
* a talisman in the inventory, so that it never returns null.
|
|
||||||
* However, this method will be nullable since there is an if statement and it needs
|
|
||||||
* to return something */
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ public class TalismanListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(BlockBreakEvent e) {
|
public void onBlockBreak(BlockBreakEvent e) {
|
||||||
if (SlimefunTag.CAVEMAN_TALISMAN_TRIGGERS.isTagged(e.getBlock().getType())) {
|
if (SlimefunTag.CAVEMAN_TALISMAN_TRIGGERS.isTagged(e.getBlock().getType())) {
|
||||||
Talisman.tryActivate(e, SlimefunItems.TALISMAN_WISE);
|
Talisman.tryActivate(e, SlimefunItems.TALISMAN_CAVEMAN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user