Im very new to this and i need help on this problem

Discussion in 'Plugin Development' started by porrinialex, Aug 18, 2013.

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

    porrinialex

    I cant seem to figure out why this isnt working any suggestions?




    package me.porrinialex;

    import java.util.logging.Logger;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;

    public class pvp extends JavaPlugin{
    public final Logger logger = Logger.getLogger("Minecraft");
    public static pvp plugin;


    public void onDisable() {
    PluginDescriptionFile pdfFile = this.getDescription();
    this.logger.info(pdfFile.getName()+"Has been disable");
    }

    public void onEnable() {
    PluginDescriptionFile pdfFile = this.getDescription();
    this.logger.info(pdfFile.getName() + " Versions " + pdfFile.getVersion() + "Has been enabled");

    }
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    Player player = (Player) sender;
    if(commandLabel.equalsIgnoreCase("Info")){
    player.sendMessage("Welcome to PerfectPvP");

    }
    return false;
    }
    }
     
  2. Offline

    JPG2000

    porrinialex Ok. Could you post your plugin.yml? Also, you can add me on skype (Message me, I prefer not to say my skype name publicly). As far as I see you did everything well(Im guessing you followed theBcBroz's tut).
     
  3. Um for one you dont wanna use the PdfFile its better too use variables its also easier and less typing and it will always work sense variables are in java not bukkit
     
  4. Offline

    Quantix

    In your onCommand method you assume the sender of the command is a player without really making sure if it is one. It could also be someone typing a command from the console in which case it would be a ConsoleCommandSender not a Player executing or sending the command. Check if the sender is a Player first by typing:
    Code:java
    1. if (sender instanceof Player) {
    2. Player player = (Player) sender;
    3. }
     
  5. I saw your other post and was in the middle of creating a reponse to it, anyways here:

    Just a theory, try doing this for your plugin.yml
    Code:
    name: pvp
    main: me.porrinialex.pvp
    version: 1.0
    description: pvp Plugin.
    commands:
        Info:
            description: Sends info about the server!
    
    Notice the "main: me.porrinialex.pvp" is not "me.porrini.pvp" what this means is see at the top of your class you see
    "package me.porrinialex;"? That's what needs to be in the main: part. What you do is grab the package
    "me.porrinialex" and then add your main class' name. So, this would become
    "main: me.porrinialex.pvp"
     
  6. Offline

    Sabersamus


    pdfFile is a variable.
     
  7. Offline

    callum.thepro

    is the plugin successfully loaded?
     
  8. No a PdfFile is just a file with variables in them
     
  9. Offline

    Sabersamus

    Did you even read the code?

    Code:
    PluginDescriptionFile pdfFile = this.getDescription();
    pdfFile is a variable of PluginDescriptionFile
     
    TheGreenGamerHD likes this.
  10. Oh sorry silly old me of a walrus you right my walrusy bad
     
Thread Status:
Not open for further replies.

Share This Page