1
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:
svr333 2020-10-21 22:28:59 +02:00
parent 4d474de290
commit 6a250d6d00
2 changed files with 5 additions and 13 deletions

View File

@ -135,11 +135,11 @@ public class Talisman extends SlimefunItem {
}
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) {
return (tryActivateAndGet(e, item) != null);
return tryActivateAndGet(e, item) != null;
}
public static ItemStack tryActivateAndGet(@Nonnull Event e, @Nonnull SlimefunItemStack stack) {
@ -162,20 +162,16 @@ public class Talisman extends SlimefunItem {
return null;
}
if (!Slimefun.hasUnlocked(p, talisman, true)) {
return null;
}
ItemStack possibleTalisman = retrieveTalismanFromInventory(p.getInventory(), talisman);
if (possibleTalisman != null) {
if (possibleTalisman != null && Slimefun.hasUnlocked(p, talisman, true)) {
activateTalisman(e, p, p.getInventory(), talisman);
return possibleTalisman;
}
possibleTalisman = retrieveTalismanFromInventory(p.getEnderChest(), talisman);
if (possibleTalisman != null) {
if (possibleTalisman != null && Slimefun.hasUnlocked(p, talisman, true)) {
activateTalisman(e, p, p.getEnderChest(), talisman);
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;
}

View File

@ -302,7 +302,7 @@ public class TalismanListener implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
if (SlimefunTag.CAVEMAN_TALISMAN_TRIGGERS.isTagged(e.getBlock().getType())) {
Talisman.tryActivate(e, SlimefunItems.TALISMAN_WISE);
Talisman.tryActivate(e, SlimefunItems.TALISMAN_CAVEMAN);
}
}