I am completely lost, please help

Discussion in 'Plugin Development' started by Cmurphy, Jan 16, 2011.

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

    Cmurphy

    Hey I was sifting through the documentation and decided to give bukkit plugins a shot.
    I get a bunch of errors and here is my code(I know this plugin does't do much but I just want to make I'm getting it right):
    The Main Class:
    Code:
    package com.bukkit.Cmurphy.IronFist2;
    
    import java.io.File;
    import java.util.HashMap;
    import org.bukkit.Player;
    import org.bukkit.Server;
    import org.bukkit.event.Event.Priority;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.plugin.PluginManager;
    
    /**
    * IronFist2 for Bukkit
    *
    * @author Cmurphy
    */
    public class IronFist2 extends JavaPlugin {
        private final IronFist2PlayerListener playerListener = new IronFist2PlayerListener(this);
        private final IronFist2BlockListener blockListener = new IronFist2BlockListener(this);
        private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
    
        public IronFist2(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File plugin, ClassLoader cLoader) {
            super(pluginLoader, instance, desc, plugin, cLoader);
            // TODO: Place any custom initialisation code here
    
            // NOTE: Event registration should be done in onEnable not here as all events are unregistered when a plugin is disabled
        }
      
        public void onEnable() {
            // TODO: Place any custom enable code here including the registration of any events
    
            // Register our events
            PluginManager pm = getServer().getPluginManager();
            pm.registerEvent(Event.Type.PLAYER_COMMAND, playerListener , Priority.Normal, this);
     
            // EXAMPLE: Custom code, here we just output some info so we can check all is well
            PluginDescriptionFile pdfFile = this.getDescription();
            System.out.println( pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
        }
        public void onDisable() {
            // TODO: Place any custom disable code here
    
            // NOTE: All registered events are automatically unregistered when a plugin is disabled
    
            // EXAMPLE: Custom code, here we just output some info so we can check all is well
            System.out.println("Goodbye world!");
        }
        public boolean isDebugging(final Player player) {
            if (debugees.containsKey(player)) {
                return debugees.get(player);
            } else {
                return false;
            }
        }
    
        public void setDebugging(final Player player, final boolean value) {
            debugees.put(player, value);
        }}
    Code:
    package com.bukkit.Cmurphy.IronFist2;
    import org.bukkit.Location;
    import org.bukkit.Player;
    import org.bukkit.event.player.PlayerChatEvent;
    import org.bukkit.event.player.PlayerEvent;
    import org.bukkit.event.player.PlayerListener;
    import org.bukkit.event.player.PlayerMoveEvent;
    /**
     * Handle events for all Player related events
     * @author <yourname>
     */
    public class IronFist2PlayerListener extends PlayerListener {
        private final IronFist2 plugin;
        public IronFist2PlayerListener(IronFist2 instance) {
            plugin = instance;
        }
        boolean  dispatchCommand (Player sender, String cmdLine){
      if(cmdLine=="/ironfist"){
       sender.sendMessage("Command test");
      }
         return false;
         
        }
        //Insert Player related code here
    }
    
     
  2. Offline

    lostaris

    Posting your errors will help.
     
  3. Offline

    Cmurphy

    I will in the morning but anyone have any ideas as to how i can fix this?
     
Thread Status:
Not open for further replies.

Share This Page