Issues with pdfFile.getVersion()

Discussion in 'Bukkit Help' started by nubpro, Jun 26, 2011.

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

    nubpro

    When I wrote /broadcast info, it shows me:
    Information:
    Error
    Error
    Error
    Code:
    else if ((args[0].equalsIgnoreCase("info"))) {
                sender.sendMessage (ChatColor.DARK_PURPLE + "Information:");
                sender.sendMessage (ChatColor.LIGHT_PURPLE + "Plugin" + "Name:" +  pdfFile.getName());
                sender.sendMessage (ChatColor.LIGHT_PURPLE + "Current" + "Version:" + pdfFile.getVersion());
                sender.sendMessage (ChatColor.LIGHT_PURPLE + "Author:" +  pdfFile.getAuthors());
                }
               }
            return true;
          }
        private PluginDescriptionFile getDescription() {
            return null;
        }
    }
    
    Is there any problem?
    In the other side, I added
    Code:
    import org.bukkit.plugin.PluginDescriptionFile;
    
    Still looking for help!
    @CaiusTSM

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

    CaiusTSM

    Can you post how you initialized your pdfFile variable?
     
  3. Offline

    nubpro

    Code:
    package net.nubpro.project.plugin.TagYourName;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.util.config.Configuration;
    
    public class Data implements CommandExecutor
    {
        PluginDescriptionFile pdfFile = getDescription();
        private Announce plugin;
        public Data(Announce broadcast)
          {
            this.plugin = broadcast;
          }
    
          public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            String commandName = command.getName().toLowerCase();
            Configuration config = this.plugin.load();
            if ((sender instanceof Player)) {
              if (commandName.equalsIgnoreCase("broadcast"));}
            {
                  if (args.length == 0) {
                  sender.sendMessage (ChatColor.LIGHT_PURPLE + "  Broadcast Custom v0.1 Commands:");
                  sender.sendMessage(ChatColor.AQUA + "/broadcast send" + ChatColor.DARK_AQUA + " - Sends new announcement");
                  sender.sendMessage(ChatColor.AQUA + "/broadcast tag <InsertTag>" + ChatColor.DARK_AQUA + " - Set new tag name");
                }
                else if ((args.length > 1) && (args[0].equalsIgnoreCase("send"))) {
                  {
                    String fullMessage = "";
                    for (int i = 1; i < args.length; i++) {
                      fullMessage = fullMessage + " " + args[i];
                    }
                    String tagName = config.getProperty("tagname").toString();
                    sender.getServer().broadcastMessage( "[" + tagName + "]" + fullMessage);
                  }
                }else if ((args.length == 2) && (args[0].equalsIgnoreCase("tag"))) {
                  config.setProperty("tagname", args[1]);
                  config.save();
                  sender.sendMessage(ChatColor.GOLD + "Tag Name has been changed to: " + args[1]);
                  this.plugin.load();
                }
                else if ((args[0].equalsIgnoreCase("info"))) {
                sender.sendMessage (ChatColor.DARK_PURPLE + "Information:");
                sender.sendMessage (ChatColor.LIGHT_PURPLE + "Plugin" + "Name:" +  pdfFile.getName());
                sender.sendMessage (ChatColor.LIGHT_PURPLE + "Current" + "Version:" + pdfFile.getVersion());
                sender.sendMessage (ChatColor.LIGHT_PURPLE + "Author:" +  pdfFile.getAuthors());
                }
               }
            return true;
          }
        private PluginDescriptionFile getDescription() {
            return null;
        }
    }
    Hope nothing goes wrong, but I will try to fix it.
     
Thread Status:
Not open for further replies.

Share This Page