Custom Whitelist/Full message

Discussion in 'Plugin Development' started by MrConHD, Sep 22, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    MrConHD

    My friend and I are trying to create a custom whitelist/full message, however nothing seems to work. We have tried events, setting kick messages, and nothing works. Anyone have a snippet of code that works for them?
     
  2. Offline

    Totom3

    MrConHD You want spoonfeed or help with your code ?
     
  3. Offline

    Eats_Rainbows

    Eh, this code should work. With a few minutes of work you could turn it into a full fledge whitelist plugin, but yeah..
    Code:java
    1. @EventHandler
    2. public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
    3. String player = event.getName();
    4. if (player) //Your whitelist validation
    5. event.disallow(Result.KICK_WHITELIST, ChatColor.YELLOW + "Whitelisted");
    6. }
     
  4. Offline

    MineStein

    Eats_Rainbows AsyncPlayerPreLoginEvent? Here is what I do.

    Code:java
    1. @EventHandler
    2. public void onLogin(PlayerLoginEvent e) {
    3. final Player p = e.getPlayer();
    4.  
    5. if (Boolean) {
    6. if (p.isOp()) return;
    7.  
    8. e.disallow(PlayerLoginEvent.Result.<Result>, "<Insert Message Here>");
    9. }
    10. }


    This is a pseudo-code, format it to however you need!
     
  5. Offline

    Eats_Rainbows

    Actually PlayerPreLoginEvent is deprecated, AsyncPlayerPreLoginEvent should be used in it's place.
     
  6. Offline

    MineStein

    Eats_Rainbows Ok. I personally just use the PlayerLoginEvent and it works perfect for my server's maintenance mode.
     
Thread Status:
Not open for further replies.

Share This Page