Help (Read Me)

Discussion in 'Plugin Development' started by AgentBeatzPH, Apr 10, 2015.

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

    AgentBeatzPH

    How can i make work Minecraft Plugin??
    I already made Basic Plugin but it didnt work at Minecraft Server .--.
    External JARs - bukkit-1.7.2-R0.2.jar
    Javadoc location path: http://ci.bukkkit.org
    Can anyone can help me???
    Can you download it here: <redacted>

    heres the Codes...

    package me.HELP;

    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 HELPmain extends JavaPlugin
    {
    public void onEnable()
    {
    getLogger().info("Plugin successfully enabled");
    }

    public void onDisable() {
    getLogger().info("");
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    Player player = (Player)sender;

    if (cmd.getName().equalsIgnoreCase("command1")) {
    player.sendMessage("This is only a Test Command #2");
    player.sendMessage(ChatColor.BLUE + "By AgentBeatzPH");
    return true;
    }

    if (cmd.getName().equalsIgnoreCase("command2")) {
    player.sendMessage("This is only a Test Command #2");
    return true;
    }

    return false;
    }
    }
     
    Last edited by a moderator: Apr 13, 2015
  2. Offline

    mine-care

    @AgentBeatzPH Please use code tags to surround your code.
    You dont need enable or disable messages, bukkit has them by default
    This ^ will throw a ClassCastException each time ANY command is called, Check before casting! (See my signature)
    Dont use
    if(command is X)
    if(Command is Y)
    if(command is Z)
    Use a nested if:
    if(command is X)
    else if(command is Y)
    else if (Command is Z)

    So the messages are not displayed? can we see your plugin.yml?
     
    CodePlaysMinecraft likes this.
  3. Not if it's sent by a Player it wouldn't :) This particular piece would only throw a ClassCastException when a non-player performs a command registered in this plugin's plugin.yml
    That's just and "if-then-else" really, a nested if would be more like this:
    Code:
    if(command is X)
        if(command is Y)
            if(command is Z)
    @AgentBeatzPH Putting "(Read Me)" in the title doesn't make you any more likely to receive an answer - if anything it makes it less likely as your title isn't helpful to describe briefly what the problem is.
     
    mine-care likes this.
  4. Offline

    mine-care

    @AdamQpzm Oh yes! thanks for the corrections, really missed them. At the first part i had trouble with autocorrect -yes it is Sh...- so it couldnt underrstand ConsoleSender as a word.
    Also yes indeed but in the book called "Big java objects first" (thats what we are fored to have and learn in school D:) So umm generally speaking as with nested loops it is what you said above; (thats why i thrown an example)
    Ty :- )
     
    AdamQpzm likes this.
  5. Offline

    Rocoty

    Did you ever consider telling us what problems you are facing? Might help a great deal.
     
    mine-care likes this.
  6. Offline

    WishMachine

    I'm not sure if this is the cause of your specific problem but our javadoc location isn't good, or at least it seems to me. This is the one I use and it works really well. https://hub.spigotmc.org/javadocs/bukkit/
     
Thread Status:
Not open for further replies.

Share This Page