Solved My plugin not work.

Discussion in 'Spigot Plugin Development' started by Frealy1995, May 14, 2016.

  1. Main:

    Code (Text):

    package com.kit.pvp;

    import org.bukkit.Bukkit;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;

    import Events.PlayerJoin;

    public class Main extends JavaPlugin implements Listener {
        public void onEnable(){
            PluginManager();
        }
        public void PluginManager(){
            PluginManager pm = Bukkit.getServer().getPluginManager();
            pm.registerEvents(new PlayerJoin(), this);
        }
    }
     
    Package Events => PlayerJoin

    Code (Text):

    package Events;

    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;

    public class PlayerJoin implements Listener {
        public void onJoin(PlayerJoinEvent e){
            e.setJoinMessage("Welcome " + e.getPlayer().getName());
        }
    }
     
    Server join to Join message not works.
    Console Error: None

    plugin.yml

    Code (Text):

    name: KitPvP
    main: com.kit.pvp.Main
    author: test
    version: 1.0
    description: KitPvP Description
     
     
  2. you forgot the eventhandler annotation
     
    • Like Like x 1
    • Agree Agree x 1
  3. You forgot to put @EventHandler on top of your onJoin method :)
     
    • Like Like x 1
  4. Thanks.
     
  5. Set this to solved, please.
     
    • Informative Informative x 1