1.7.10 Plugin help

Discussion in 'Plugin Development' started by Ashley123477, Feb 25, 2017.

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

    Ashley123477

    Ok, im extremely new to this. Basically i made a plugin via tutorials and such. And basically what i wanted to do was make it so that Boseconomy instead of having to put /econ i could do /money

    I got everything to work plugin wise, it loads properly etc but when i do /money my server console returns Unknown command. so obviously its not changing /money to /econ somewhere :/
     
  2. Offline

    Zombie_Striker

    Last edited by a moderator: Feb 25, 2017
  3. Offline

    Ashley123477

    Its a modded server, cant really update it xD

    Plugin is being enabled but i dont know if i have correctly registered the command

    I can tell the plugin is enabled as it says its enabled in console and its visible in /pl

    Also the code

    Code:
    package me.UOC.CustomPlugin;
    
    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin{
    
        public void onEnable() {
            getLogger().info("Plugin Enabled");
        }
     
        public void onDisable() {
            getLogger().info("Plugin Disabled");
        }
     
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if(sender instanceof org.bukkit.entity.Player) {
                Player player = (org.bukkit.entity.Player) sender;
                if(cmd.getName().equalsIgnoreCase("money")){
                    String money = "econ " + player.getName();
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), money);
                }
            }
         
        return    false;
        }
     
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Feb 25, 2017
  4. Offline

    Zombie_Striker

    @Ashley123477
    From PM:
    1. Package names should be lower case.
    2. You should not log your own plugins. Bukkit does that for you. Because of that, you can delete the onEnable and onDisable
    3. You do not need the full path for Player. Just reference player
    Besides that, your code should not cause your problem. Can you post your plugin.yml?
     
  5. Offline

    Ashley123477

    Code:
    name: UOCCustomPlugin
    author: Ashley1
    version: 1
    description: Changes /money to /ec
    main: me.UOC.CustomPlugin.Main
    commands:
      money:
        description: Changes /money to /ec!
     
    Last edited by a moderator: Feb 25, 2017
  6. Offline

    timtower Administrator Administrator Moderator

    Locked
    Modded servers are not supported by Bukkit
     
Thread Status:
Not open for further replies.

Share This Page