My plugin

Discussion in 'Plugin Development' started by Dezarith, Sep 9, 2011.

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

    Dezarith

    ok so im new bukkit this is my first plugin im getting this error

    Code:
    09:56:17 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'rage
    quit' in plugin RAGE v1
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:12
    9)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    20)
            at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.
    java:713)
            at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:677)
    
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:670)
            at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:85)
            at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.Error: Unresolved compilation problem:
            Syntax error, insert ") Statement" to complete IfStatement
    
            at me.dezarith.ThisBin.ThisBin.onCommand(ThisBin.java:22)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
            ... 12 more

    This is the source:

    Code:
    package me.dezarith.ThisBin;
    
    import java.util.logging.Logger;
    
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class ThisBin extends JavaPlugin {
    private static final Logger log = Logger.getLogger("Minecraft");
    
        public void onDisable() {
        }
    
        public void onEnable() {
            log.info("[RAGE IS UP");
            }
       public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
            if (commandLabel.equalsIgnoreCase("ragequit"));
            player.kickPlayer(commandLabel);
            System.out.println("[RAGE] " + player.getDisplayName() + "HAS RAGE QUIT! ");
            getServer().broadcastMessageplayer.getDisplayName() + HAS RAGEQUIT!!!());
            return false;
    }
    
    }

    No idea what the problem is anyhelp would be apreciated.
    What it does: Allows you to type /ragequit it kicks you then broadcasts a message.
    Bukkit recognizes it as a plugin when i type /ragequit it doesnt work.


    1. OS: Windows 7
    2. Architecture: 64bit
    3. Wrappers :none
    4. Build 1060

    Thanks, Dez
     
  2. Offline

    zipfe

  3. Offline

    Dezarith

    My bad.
     
  4. Offline

    Plague

    moved
     
  5. Offline

    RROD

    You're trying to kick the commandLabel, which is a player named ragequit =/.
    Do this instead.
    Code:
    package me.dezarith.ThisBin;
    
    import java.util.logging.Logger;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class ThisBin extends JavaPlugin {
    private static final Logger log = Logger.getLogger("Minecraft");
    
        public void onDisable() {
        }
    
        public void onEnable() {
            log.info("[RAGE IS UP]");
            }
       public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            Player player = (Player) sender;
            if (commandLabel.equalsIgnoreCase("ragequit"));
            player.kickPlayer("Rage Quit");
            log.info("[RAGE] " + player.getName() + " HAS RAGE QUIT! ");
            getServer().broadcastMessage(ChatColor.RED + player.getName() + " HAS RAGEQUIT! ");
        //Grammar, noob - Multiple '!!!' is bad :P
            return false;
    }
    
    }
    Lol 9 times I've edited it before the website reads it properly. Well, it's better than making a new post every time ;)

    Plus, for effect, I've added RED coloured text. In eclipse you'll need to import ChatColor.
    You'll still recieve the "Player has left the game. " as well as the RageQuit. If you want that you'll have to figure it out. Look at the Bukkit Documentation, it might help.
     
  6. Offline

    NeoSilky

    this line is wrong anyway.....

    getServer().broadcastMessageplayer.getDisplayName() + HAS RAGEQUIT!!!());
     
  7. Offline

    RROD

    Yeh I kinda corrected it, lol.
     
  8. Offline

    NeoSilky

    Good :)
     
Thread Status:
Not open for further replies.

Share This Page