Solved Whitelist Message ( CHANGE )

Discussion in 'Plugin Development' started by WATWtomanik3, Jun 8, 2015.

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

    WATWtomanik3

    Hello I was wondering how can you change whitelist message ?
     
    Last edited: Jun 8, 2015
  2. Offline

    Konato_K

    @WATWtomanik3 In the original CraftBukkit the message is hardcoded.

    In Spigot there is an option on the config and can be changed from there, the String object that holds this seems to have public access, so a plugin can change it at run time.

    Alternative, I guess this can also be done with ProtocolLib, but I wouldn't know since I have never done this.
     
  3. Offline

    mine-care

    @WATWtomanik3 @Konato_K morr likely it can be done in craftbukkit with reflection or overriding (a) class(es) or both. You need to find the class in the source where whiltelist is handled and change the message via these methods, otherwise you can handle whitelisting by yourself by kicking players when the login with a custom message ect.
     
  4. Offline

    pie_flavor

  5. Offline

    WATWtomanik3

  6. Offline

    mine-care

    @pie_flavor
    :- )
     
  7. Offline

    pie_flavor

    @WATWtomanik3 It depends. All you have to do is store a list of players who are allowed on the server, and deny anyone not on that list.
     
  8. Offline

    WATWtomanik3

    @pie_flavor If i get it i just need to make an configuration file that saves the player in when the ./whitelist add (name) command is typed. And do an @EventHandler onPlayerJoin(PlayerJoinEvent e) if he doesnt have a permisiion and if whitelist is on kick him with message "blablabla".
     
  9. Offline

    Konato_K

    @mine-care No, in the original CraftBukkit this can't be changed with reflection, since it's an actual string literal in the method
    Code:
    event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!");
    However, in spigot/craftbukkit builds it appears with a reference to a field of the SpigotConfig class
    Code:
    event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, SpigotConfig.whitelistMessage);
    This field is public and static, so it can be easily changed.
     
  10. Offline

    mine-care

    @Konato_K thats why i mentioned overriding but clearly i am not familiar with this :3 anyway the reason why i insist on cbukkit is because in Bukkit forums spigot is not supported (in this section atleast)
     
Thread Status:
Not open for further replies.

Share This Page