Filled Kick On Join

Discussion in 'Archived: Plugin Requests' started by Ventality, Dec 26, 2013.

  1. Offline

    Ventality

    Plugin category: EXAMPLE

    Suggested name: KickJoin

    What I want: I need a plugin where a player without the permissions Kick.Bypass when joining the sever will get kicked with a configurable message. If a player has the perm Kick.Bypass they will join the server normally.

    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: Kick.Bypass

    When I'd like it by: Anytime.
     
  2. Offline

    MajikalBlood

    That would mean anyone who joins your server will be kicked without knowing their name to personally give them the rank

    Skript

    Code:
    on connect:
        player has permission "kick.bypass":
            stop
        else:
            kick the player due to "your message here"
            stop
    That simple :D
     
  3. Offline

    reider45

    <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 4, 2016
  4. Offline

    CrazyGuy3000

    Why not whitelist them .__.
     
    Commander9292 likes this.
  5. Offline

    Ventality

    CrazyGuy3000 No customized message on player join event.
     
  6. Offline

    timtower Administrator Administrator Moderator

    Possible to create that though
     
  7. Offline

    CrazyGuy3000

    ...theres like a event to do that...
    not to mention a config would take no time at all to add.
     
  8. Ventality I can do it for you if you want.

    Lol, this is painful, but I can't get it work :D If you join the server, you get kicked on the first time with the right message, and then you get kicked with this: "Internal Exception: java.lang.ClassCastException: bju cannot be cast to fm." What the hell? :D Does someone know how fix this, timtower maybe?
     
  9. Offline

    timtower Administrator Administrator Moderator

    Seems like minecraft classes, code?
     
  10. Offline

    Zarko

  11. timtower here:
    Code:java
    1. package de.mineteria.Lionhard98.KickOnJoin;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.Server;
    5. import org.bukkit.command.ConsoleCommandSender;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.event.EventHandler;
    8. import org.bukkit.event.Listener;
    9. import org.bukkit.event.player.PlayerJoinEvent;
    10. import org.bukkit.plugin.PluginDescriptionFile;
    11. import org.bukkit.plugin.PluginManager;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. public final class KickOnJoin extends JavaPlugin implements Listener {
    15.  
    16. public static KickOnJoin plugin;
    17.  
    18. public String getPluginPrefix(){
    19. String prefix = "&b[&3Kick&bOn&3Join&b]";
    20. return prefix;
    21. }
    22.  
    23. public void onEnable(){
    24. PluginDescriptionFile pluginYml = this.getDescription();
    25.  
    26. PluginManager pm = this.getServer().getPluginManager();
    27. pm.registerEvents(this, this);
    28.  
    29. Server server = this.getServer();
    30. ConsoleCommandSender console = server.getConsoleSender();
    31.  
    32. console.sendMessage(getPluginPrefix() + ": " + ChatColor.DARK_AQUA + pluginYml.getName() + " v" + pluginYml.getVersion() + " has been enabled!");
    33. }
    34.  
    35. public void onDisable(){
    36. PluginDescriptionFile pluginYml = this.getDescription();
    37.  
    38. Server server = this.getServer();
    39. ConsoleCommandSender console = server.getConsoleSender();
    40.  
    41. console.sendMessage(getPluginPrefix() + ": " + ChatColor.DARK_AQUA + pluginYml.getName() + " v" + pluginYml.getVersion() + " has been disabled!");
    42. }
    43.  
    44. @EventHandler
    45. public void onPlayerJoin(PlayerJoinEvent event){
    46. //Player player = event.getPlayer();
    47. if(event.getPlayer() instanceof Player){
    48. Player player = event.getPlayer();
    49. if(!player.hasPermission(new Permissions().KickOnJoinBypass)){
    50. Player[] allOnlinePlayers = this.getServer().getOnlinePlayers();
    51. for(Player onlinePlayer : allOnlinePlayers){
    52. if(onlinePlayer.hasPermission(new Permissions().KickOnJoinAdmin)){
    53. onlinePlayer.sendMessage(ChatColor.translateAlternateColorCodes('&', getPluginPrefix() + ": " + this.getConfig().getString("inGameAdminNotification").replace("%player%", player.getName())));
    54. }
    55. }
    56. //player.kickPlayer("test");
    57. player.kickPlayer(ChatColor.translateAlternateColorCodes('&', this.getConfig().getString("kickMessage").replace("%player%", player.getName())));
    58. }
    59. }
    60. }
    61. }
    62.  


    I tried to google it, found just something about isntances so tried to check if the player is a instance of player, doesn't work either. :D
     
  12. Offline

    timtower Administrator Administrator Moderator

    Lionhard Why do you use the permission class? Normal string works as well
     
  13. Offline

    ZpixThaTurtle

    Hey i made the plugin for you: KickJoin.jar
    I will make a dev.bukkit.org page for it later :)

    Commands:

    /kickjoin
    info: display the plugin info.
    permission: None

    /kickjoin reload
    info: Reload the config file
    permission: kickjoin.reload

    Permission to join the server: kick.bypass

    EDIT: Now on Bukkit Dev: http://dev.bukkit.org/bukkit-plugins/kickjoin/
     
  14. timtower I can change then the permission without having to search for the the code. (In this one it is not hard to find it, but in bigger projects I preffer the class, anyway, that isnt the problem :D)
     
  15. Offline

    timtower Administrator Administrator Moderator

    Static strings at the main class :p
     
  16. Offline

    andrewpo

    http://dev.bukkit.org/bukkit-plugins/whitelist-message/

    What's wrong with plugins that already exist? There are more than just the one linked above.

    Before you complain about it being for an old minecraft version, take the time to test it - many plugins of this nature aren't adversely affected by different MC versions.
     
    malandrix_bunny and timtower like this.
  17. Offline

    Ventality

Share This Page