Solved Is there anybody?

Discussion in 'Spigot Plugin Development' started by Dhtjgmryh95, Jun 17, 2018.

  1. Code (Java):
    public enum Buttons {
        Close(new ItemStack(Material.BARRIER));
        Add10(new ItemStack(Material.STAINED_GLASS, 10, (short) 13));

        private final ItemStack item;

        Buttons(ItemStack value) {
            this.item = value;
        }

        public ItemStack getButton() {
            return item;
        }
    }
     
  2. Simpler way without enum:
    Code (Text):
    public class Buttons {
        public static final ItemStack Close = new ItemStack(Material.BARRIER);
        .....

        private Buttons(){}
    }
     
  3. Would be better to do this with a buttons util class with static methods, passing an integer for one of methods...

    public final class Button {
    public static void add(int i) {
    //add i or 10
    }
    }

    That way you can still use Button.add(10); but easier to manage.


    Sent from my iPhone using Tapatalk