I need some help with my plugin :)

Discussion in 'Plugin Development' started by Steunzool, Mar 26, 2012.

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

    Steunzool

    So today i started with the development of a plugin, and i got stuck at some errors. i followed a tutorial on Youtube, but since its from January 2011, i think there are some new things that mess up the code.
    I would really like to learn more about java coding so if you could tell me why something is wrong, or what could be better, i would greatly appreciate it :).
    It is just a simple TNT place alerter plugin.

    heres a picture:
    Show Spoiler
    [​IMG]


    Code:
    package me.steunzool.basic;
     
    import java.io.File;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.logging.Logger;
     
    import org.bukkit.Server;
    import org.bukkit.block.Block;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Event;
    import org.bukkit.event.EventPriority;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.ChatColor;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class Basic extends JavaPlugin {
        public static Basic plugin;
     
        public final Logger logger = Logger.getLogger("Minecraft");
        //defined a player listener
        private final BasicBlockListener blockListener = new BasicBlockListener(this);
        //defined block listener.
        public final HashMap<Player,ArrayList<Block>> basicUsers = new HashMap();
        //Creating the HashMap
        private final HashMap<Player, Boolean> debugees = new HashMap<Player, Boolean>();
        //create HashMap Debugee
     
     
    @Override
    public void onDisable() {
        this.logger.info("Basic Disabled");
     
    }
     
     
    @Override
    public void onEnable() {
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, EventPriority.NORMAL, this);
    PluginDescriptionFile pdfFile = this.getDescription();
    this.logger.info( pdfFile.getName() + " version " + pdfFile.getVersion() + "is enabled! :)" );
    }
     
     
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        String commandLabel, String[]; args) {
            if (commandLabel.equalsIgnoreCase("basic")
                || commandLabel.equalsIgnoreCase("b"))
            {
                toggleVision((Player) sender);
        }
     
        return false;
     
    }
     
     
     
     
    public boolean isDebugging(final Player player) {
        if (debugees.containsKey(player)) {
            return debugees.get(player);
        } else {
            return false;
       
        }
    }
     
    public void setBugging(final Player player, final boolean value) {
        debugees.put(player, value);
    }
    //The method enabled which checks to see if the player is in the HashMap
     
    public boolean enabled(Player player) {
        return this.basicUsers.containsKey(player);
    }
     
        public void toggleVision(Player player) {
            if (enabled(player)) {
                this.basicUsers.remove(player);
                player.sendMessage("Basic Disabled");
            } else {
                this.basicUsers.put(player,  null);
                player.sendMessage("Basic enabled");
            }
            }
     
     
     
     
    }
    I hope someone is able to help me.
    the most errors are in this line,
    Show Spoiler
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    String commandLabel, String[]; args) {


    Thanks!


    //edit: Pictures added
    Steunzool
     
  2. Offline

    Perdog

  3. Offline

    Steunzool

    Thanks! will take a look at that in a few minutes.
     
Thread Status:
Not open for further replies.

Share This Page