Solved ArrayList toggleable stuff not working

Discussion in 'Spigot Plugin Development' started by pcrunn, Aug 3, 2018.

Thread Status:
Not open for further replies.
  1. Hi, I'm trying to make a staffmode basically something toggleable and here is my code

    Code (Java):
    public static ArrayList<UUID> staffmode = new ArrayList<UUID>();
     
        public static void toggleStaffMode(Player p) {
            if(staffmode.contains(p.getUniqueId())) {
                staffmode.remove(p.getUniqueId());
                p.sendMessage(C.c(Base.PREFIX + "You have disabled StaffMode"));
            }
            if(!staffmode.contains(p.getUniqueId())) {
                staffmode.add(p.getUniqueId());
                p.sendMessage(C.c(Base.PREFIX + "You have enabled StaffMode"));
            }
        }
    and when I execute this void ingame (with a command) it enables the staffmode then disables. I have tried to do i before and the same thing happened.

    What do I do here?

    EDIT: Fixed, just needed to put the second if at the line with the bracket and make it else if
     
Thread Status:
Not open for further replies.