Discussion in 'Spigot Plugin Development' started by Olivier062001, May 2, 2017.

Thread Status:
Not open for further replies.
    #1 Olivier062001, May 2, 2017
    Last edited: Aug 11, 2017
  2. You can create an ArrayList and put him when a player open the call. When a player type in chat the number to call with AsyncPlayerChatEvent it recive the number only if the player is in the arraylist. And After type in chat remove the player from the array
    • Agree Agree x 1
  3. List<Player>#add(Player)

    If you want, I'll submit a Pull Request on GitHub with the documented code

    // edit:: you're better off storing uuids.
    • Useful Useful x 1
  4. Code (Text):
    ArrayList<Player> using = new ArrayList<Player>();
    Code (Text):
    using.add(p); // when he open the inventory

    using.remove(p); // when he send the number to call
    • Funny Funny x 1
    • Useful Useful x 1
  5. Not. Use only called991.contains(p), why you add instance and equals?
    Code (Text):
    If(e.getMessage().equals precise("911")) {
      // If has permissions bla bla blah
  6. Choco


    Well, for one, why the hell are you using such an outdated build? You will not receive any support from Spigot whatsoever if you happen to come across any issues. Second of all, whether you're using 1.7 or not, you should be storing UUID's regardless. Storing a Player instance is just a bad idea in general because it's keeping a reference to an object when it may or not still exist. (i.e. if the player re-logs, that Player instance is invalid). You're also much more prone to memory leaks (more severe ones, anyways) which can cause some issues if servers don't particularly have a lot of memory to spare. Invoking Bukkit#getPlayer(UUID) is not intensive at all and simply retrieves a value from a Map. It's superior to just storing an instance of Player

    TL;DR: Use UUID's anyways and hop off your dinosaur
    • Like Like x 1
  7. Choco


    UUID's have been present since the game was created, as far as I'm aware. It's a unique identifier for each player's account. It's just that UUID's were not identified as the primary reference point because usernames were unchangeable before 1.8. I'm surprised that most mods are not updated to 1.10 at this point, because I'm seeing more and more popular mods updating including Applied Energistics 2, Ender IO, etc.

    EDIT: Apparently UUID's were only added in 1.7.6. The more you know. You are using 1.7.10, though, so you should be fine
    #7 Choco, May 3, 2017
    Last edited: May 3, 2017
  8. Go to the Spigot Development help discussion please!
  9. Are you registering events? Are you implementing Listener?
Thread Status:
Not open for further replies.