Simple Plugin Help

Discussion in 'Bukkit Help' started by ColbyHep55, Sep 2, 2011.

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

    ColbyHep55

    Does anyone know what is wrong with this? It wont even pickup in game that a plugin is installed.

    Code:
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Basic extends JavaPlugin {
    
        public static Basic plugin;
    
        public Basic(Basic instance) {
    
            public static Basic plugin;
    
            plugin BasicPlayerListener(Basic instance) {
                    plugin = instance;
            }
    
            public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                if(cmd.getName().equalsIgnoreCase("L")){
                    public void onPlayerMove(PlayerMoveEvent event){
    
                        Player player = event.getPlayer();
                        Location playerLoc = player.getLocation();
    
                        player.sendMessage("Your X Coordinates : " + playerLoc.getX());
                        player.sendMessage("Your Y Coordinates : " + playerLoc.getX());
                        player.sendMessage("Your Z Coordinates : " + playerLoc.getX());
                    }
     
                    return true;
                }
                return false;
            }
      
        }
    
    
    
    
    
        
    Here is the Yml file.

    Code:
    name: Basic
    main: me.colby.Basic.Basic
    version: 1.0.0
    author: colby
    description: >
                 My fisrt plugin.
    commands:
       L:
        description: Shows your player location
        usage: |
     
  2. Offline

    scranner

    this should be on the Development section and yes you have nothing enabeling the plugin here is the start of my plugin

    Code:
    package scranner.colourchat;
    
    import java.util.logging.Logger;
    import org.bukkit.ChatColor;
    import org.bukkit.Server;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class colourchat extends JavaPlugin
    
        {
        private final signlistener signListener = new signlistener(this);
        Logger log = Logger.getLogger("Minecraft");
    
        public void onDisable()
        {
    
            log.info("Plugin enabled");
    
    
        public void onEnable()
        {
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.SIGN_CHANGE, this.signListener, Event.Priority.Monitor, this);
            log.info("plugin disabled");
     
        }
     
  3. Offline

    ColbyHep55

    Sorry, for the wrong place just joined Bukkit, so kinda new. So, what would I add to the code?
     
  4. Offline

    Samkio

    Code:java
    1. public void onDisable()
    2. {
    3. //Plugin Disabled
    4. }
    5. public void onEnable()
    6. {
    7. //Plugin enabled.
    8. }


    Copy and paste after:
    Code:java
    1.  
    2. plugin BasicPlayerListener(Basic instance) { plugin = instance; }
    3.  
     
  5. Offline

    Pencil

    Weird :S When you extend JavaPlugin it should be underlined with red and should give you the option : "Implement unimplemented methods or something like that " that way you should have noticed something was missing XD
     
  6. Offline

    ColbyHep55

    Here's what it looks like now,still not registering that it's installed on the server.

    Code:
    package me.colby.Basic;
    
    import org.bukkit.Location;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerMoveEvent;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Basic extends JavaPlugin {
      
            public static Basic plugin;
    
            Plugin BasicPlayerListener(Basic instance) {           plugin = instance;
            }
     
                public void onDisable()
                {
                    //Plugin Disabled
            }
                public void onEnable()
                {
                    //Plugin enabled.
                }
    
                Plugin instance;
     
            public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                if(cmd.getName().equalsIgnoreCase("L")){
     
                    public void onPlayerMove(PlayerMoveEvent event){
    
                        Player player = event.getPlayer();
                        Location playerLoc = player.getLocation();
    
                        player.sendMessage("Your X Coordinates : " + playerLoc.getX());
                        player.sendMessage("Your Y Coordinates : " + playerLoc.getX());
                        player.sendMessage("Your Z Coordinates : " + playerLoc.getX());
                    }
       
                    }
            }
    
                    return true;
                }
                return false;
            }
    
        }
     
  7. Offline

    Pencil

    add this public static final Logger log = Logger.getLogger("Minecraft");

    then do log.info("plugin enabled");
    into onEnable and the other one in disable, then it should tell you its getting loaded D:

    also make sure you register the event and put it into your plugin.yml
     
  8. Offline

    ColbyHep55

    I'm sorry for all the questions i'm just confused. Here is a pic of my coding i'm still getting errors. Also how do I register then event into my yml folder?

    [​IMG]

    Here's the yml at the moment.

    Code:
    name: Basic
    main: me.colby.Basic.Basic
    version: 1.0.0
    author: colby
    description: >
                 My fisrt plugin.
    commands:
       L:
        description: Shows your player location
        usage: /<command> 
     
Thread Status:
Not open for further replies.

Share This Page