[Solved] Player Join Event is not work?


First of all, remove Player & String, you are only supposed to have the event in the parameters.

You already have a config file so I don’t understand why you would need a string in the event’s parameters. Remember your class has to implement Listener if we could see your main class that would be great so we can see that you have the right code.

Does color codes work? I’m wondering because there is no
ChatColor.translateAlternateColorCodes('&', message)

or

ChatColor.YELLOW + "" + ChatColor.BOLD + p + ChatColor.AQUA + "Join Server"

Check here if you don’t understand this.

Example on a fix:

   @EventHandler
   public void onPlayerJoin(PlayerJoinEvent e){ // Removed the extra parameters Player & String
    Player p = e.getPlayer();
    e.setJoinMessage(null);
    Bukkit.broadcastMessage("&e&l" + p.getDisplayName() + "&bJoin Server") //I would recommend doing 'p.getName();' instead of 'p'
    Bukkit.getServer().getLogger().info(p.getDisplayName() + "join server");
    p.sendMessage(getConfig().getString("motd")); // Removed 'e.getPlayer().sendMessage("")'
    p.sendMessage("&aWelcome to Server");
   } // Could not see a close brace here in your code

If this isn’t your issue then please explain because most people will not understand your issue.

1

solved Player Join Event is not work?