Solved onEnable getPlayer

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

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

    Code (Text):

        public void PluginManager(){
            PluginManager pm = Bukkit.getServer().getPluginManager();
            pm.registerEvents(new test(), this);
            check(HOW TO GET PLAYER)
        }
     
    OOPS SORRY NO ONENABLE PLUGINMANAGER (REGISTER EVENT LIST)
     
  2. Read the javadocs dear god

    Sent from my SGH-I747M using Tapatalk
     
    • Agree Agree x 1
    • Funny Funny x 1
  3. I know. in my opinion not possible. And maybe other method :)
     
  4. Why are you getting the player onEnable?
     
  5. OOPS SORRY NO ONENABLE PLUGINMANAGER (REGISTER EVENT LIST)
     
  6. It's impossible for you to read the Javadocs?

    Sent from my SGH-I747M using Tapatalk
     
  7. Sorry, no onenable PluginManager (Register event list)
     
  8. well, you can get the player on join event or on enable loop through all the online players to get them.
    for(Object var : Bukkit.getOnlinePlayers(){

    }
     
  9. Such a general variable type o_O

    Sent from my SGH-I747M using Tapatalk
     
    • Like Like x 1
  10. Thanks testing.
     
  11. Please use getServer instead of Bukkit in the main class, it makes katz happeh :3
     
    • Like Like x 1
    • Optimistic Optimistic x 1
  12. There's really no advantage.
     
    • Agree Agree x 2
  13. What is this plugin even trying to do?
    I am guessing on plugin enable get all the players on the server?
     
  14. its not that code exactly, show me what you put. Use basic java / spigot api knowledge
     
  15. I tried to do (Example)

    Main.java

    Code (Text):

    package com.bukkit.spigot;

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

    public class Main extends JavaPlugin implements Listener {
        public static Plugin plugin;
        public void onEnable(){
            plugin = this;
            PluginManager();
        }
        public void PluginManager(){
            PluginManager pm = Bukkit.getServer().getPluginManager();
            Player.player(PLEASE PLAYER)
        }
    }
     
    Player.java

    Code (Text):

    package com.bukkit.spigot;


    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;

    public class Player implements Listener {
        public static void player(Player player){
            Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.plugin, new Runnable(){
                @Override
                public void run() {
                   PLEASE RUN CODE! AND NOT WORKİNG.
                }
            }, 0, 40);
        }
    }
     
     
  16. It's cleaner (imo) and makes katz happeh :3
     
  17. I recommend using Java not English
     
    • Like Like x 3

  18.  
  19. Learn java.. Please.
     
    • Agree Agree x 2
    • Winner Winner x 1
Thread Status:
Not open for further replies.