What am I doing wrong?

Discussion in 'Plugin Development' started by admiralflip, Oct 6, 2012.

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


    This code is supposed to ignite a player with the command: /ignite <player name>.

    However, it does not work and if I type it from the console or from within the game I simply get "/ignite [playername]" in the chat.

    package me.lloydatkinson.plugins.ic2cb;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    public class Ic2cb extends JavaPlugin implements Listener {
        public void onDisable() {
            // TODO: Place any custom disable code here.
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
        public void onPlayerJoin(PlayerJoinEvent event) {
            event.getPlayer().sendMessage("Welcome, " + event.getPlayer().getDisplayName() + "!");
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
                Player s = (Player)sender;
                Player target = s.getServer().getPlayer(args[0]); // Gets the player who was typed in the command.
                // For instance, if the command was "/ignite notch", then the player would be just "notch".
                // Note: The first argument starts with [0], not [1]. So arg[0] will get the player typed.
                return true;
            return false;
    Heres what I've put in the plugin.yml file:
    author: Lloyd Atkinson
    database: false
    generator: http://dinnerbone.com/minecraft/tools/pluginator/
    main: me.lloydatkinson.plugins.ic2cb.Ic2cb
    name: ic2cb
    startup: postworld
    version: '1.0'
          description: Fire.
          usage: /<command> [player]
          permission: <plugin name>.ignite
          permission-message: You don't have <permission>
    Any ideas?

    Thank you
  2. Offline


  3. Offline


    Yes, I copied it from the tutorial as I thought it would be a good place to start. And as for the version number speech marks, I didn't put them in, I used this to generate a plugin template: http://dinnerbone.com/minecraft/tools/pluginator/

    But the code definitely isn't working, the player is not being ignited.

    Hmm odd. It seems to have started working now! I have not changed anything (as far as I am aware) and recompiled the code and it works now.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 29, 2016
  4. Offline


    change this to solved, it should've worked from the beginning
Thread Status:
Not open for further replies.

Share This Page