Optimise check for wand item

This commit is contained in:
Julian Krings
2023-11-17 11:49:23 +01:00
parent e7e46f78c7
commit c809f50c3b
@@ -54,6 +54,7 @@ import java.util.Objects;
public class WandSVC implements IrisService { public class WandSVC implements IrisService {
private static ItemStack dust; private static ItemStack dust;
private static ItemStack wand;
public static void pasteSchematic(IrisObject s, Location at) { public static void pasteSchematic(IrisObject s, Location at) {
s.place(at); s.place(at);
@@ -253,7 +254,6 @@ public class WandSVC implements IrisService {
* @return True if it is * @return True if it is
*/ */
public static boolean isWand(ItemStack is) { public static boolean isWand(ItemStack is) {
ItemStack wand = createWand();
if (is.getItemMeta() == null) return false; if (is.getItemMeta() == null) return false;
return is.getType().equals(wand.getType()) && return is.getType().equals(wand.getType()) &&
is.getItemMeta().getDisplayName().equals(wand.getItemMeta().getDisplayName()) && is.getItemMeta().getDisplayName().equals(wand.getItemMeta().getDisplayName()) &&
@@ -263,7 +263,7 @@ public class WandSVC implements IrisService {
@Override @Override
public void onEnable() { public void onEnable() {
ItemStack wand = createWand(); wand = createWand();
dust = createDust(); dust = createDust();
J.ar(() -> { J.ar(() -> {