Override the whitelist message!

Discussion in 'Plugin Development' started by jusjus112, Mar 2, 2014.

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

    jusjus112

    I have an problem with the whitelist, when i remove someone to the whitelist it cancels the join. But when i override the whitelist message onPlayerLogin, it does say "You are not whitelisted on this server" But my question is, how do i override the whitelst message for my own. I have tried this, but it doesnt work:
    Code:java
    1. @EventHandler(priority=EventPriority.HIGHEST)
    2. public void onPlayerLogin(PlayerLoginEvent e) {
    3. Player player = e.getPlayer();
    4. if (!player.isWhitelisted()) {
    5. player.kickPlayer("The server is in MAINTENANCE, Please come back later!");
    6. }
    7. }
     
  2. Offline

    tommycake50

    Try EventPriority.LOGGING(not reccomended and shouldn't really make a difference) or just implement your own whitelist.
     
    legostarwarszach likes this.
  3. Offline

    jusjus112

  4. Offline

    Gater12

    jusjus112
    Disallow the player: Set the Reason to KICK_WHITELIST and set the kick message to whatever you want.
     
  5. Offline

    Jombi

    Code:java
    1. @EventHandler(priority=EventPriority.HIGHEST)
    2. public void onJoin(PlayerLoginEvent event){
    3. if(!event.getPlayer().isWhitelisted()){
    4. event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "Custom whitelist kick message!");
    5. }
    6. }
     
  6. Offline

    jusjus112

    Jombi
    I have already tried that, and other ways. but it doesnt seem to work!
     
  7. Offline

    badboysteee98

    Hmmm... Just change the HIGHEST to MONITOR maybe? Like this...
    Code:java
    1. @EventHandler(priority=EventPriority.MONITOR)
    2. public void onJoin(PlayerLoginEvent event) {
    3. if(!event.getPlayer().isWhitelisted()) {
    4. event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "Custom Message!");
    5. }
    6. }


    Because MONITOR going on the Event API Reference - on BukkitWiki the EventPriority MONITOR is higher then HIGHEST so hopefully that will override it :)
     
  8. Offline

    Jombi

    The code works. Try changing the event priority like badboysteee98 suggested.
     
  9. Offline

    badboysteee98

    Jombi WOW! Really does it work :p Well that's made my day because I didn't think it would aha :)

    jusjus112 Jombi Tested my Code and it works so set the Event.priority to MONITOR

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  10. Offline

    jusjus112

    badboysteee98
    I dont understand why its not working to me? i have everything what you said! If it is doing it by your server, and not by my server. Maybe it cant because i have bungeecord? I tried different methods, and different event e.t.c but cant get it work!
     
  11. Offline

    badboysteee98

    Bungee is not bukkit there for we can not help any longer
     
  12. Offline

    jusjus112

    badboysteee98
    But i have it on my bukkit server, thats for bukkit plugins, so why cant i ask it?
     
  13. Offline

    tommycake50

    It is in very poor taste to use event priority MONITOR, I'm sure there's a way that respects the conventions.
     
    Garris0n likes this.
  14. Offline

    Garris0n

    Changing it to MONITOR doesn't even make sense, the only way it would make a difference is if he had another plugin on MONITOR allowing players in.
     
    tommycake50 likes this.
  15. Offline

    badboysteee98

    Garris0n Jombi Said he tested it and it worked I have not yet tested it for my self
     
  16. Offline

    Garris0n

    It works but the priority is not needed and goes against the convention that you do not change the outcome of an event under monitor.
     
  17. Offline

    badboysteee98

    Garris0n Oh thank you for that I will remember this for the future

    Also I'm quite new to developing so I mite get stuff wrong :)
     
Thread Status:
Not open for further replies.

Share This Page