Update Plugin Error?

Discussion in 'Plugin Development' started by FuZioN720, May 10, 2013.

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


    Hello, I think my code is fine there is not errors in the code but when the server starts There is a error in the server can some one help. The error i think is coming from the update function. I have it so that if there is a new file then broadcast a message saying new file available, but is not working. Please help.

    Code Main:
        public void onPlayerJoin(PlayerJoinEvent event) {
            final Player p = event.getPlayer();
            Show = true;
            if (update == true){
                if (this.updateChecker.updateNeeded()){
                    p.sendMessage("A new version is available: " + this.updateChecker.getVersion());
                    p.sendMessage("Get it from " + this.updateChecker.getLink());
            if (Time == true){
                this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
                    public void run() {
                        Show = false;
                        if (TimeMessageOn == true){
                        } else if (TimeMessageOn == false){
                }, TimeAmount);// 60 L == 3 sec, 20 ticks == 1 sec
    static boolean Time = true;
        static boolean TimeMessageOn = true;
        static String TimeMessage = null;
        static boolean ShowMessage = false;
        static long TimeAmount = 1200;
        static Plugin plugin = null;
        static boolean Show = false;
        static boolean update = true;
        static String prefix = ChatColor.GOLD + "[" + ChatColor.DARK_RED + "ScoreBoard MOTD" + ChatColor.GOLD + "]" + ChatColor.RESET;
        UpdateChecker updateChecker;
        Logger log;
        ScoreboardManager manager;
        Scoreboard board;
        Objective objective;
        public void onEnable() {
            Show = false;
            ShowMessage = getConfig().getBoolean("scoreboard.ShowMessage");
            TimeMessage = getConfig().getString("Time.TimeMessage");
            TimeMessageOn = getConfig().getBoolean("Time.TimeMessageOn");
            Time = getConfig().getBoolean("Time.Time");
            TimeAmount = getConfig().getLong("Time.TimeAmount");
            Bukkit.getPluginManager().registerEvents(this, this);
            manager = Bukkit.getScoreboardManager();
            board = manager.getNewScoreboard();
            objective = board.registerNewObjective("MOTD", "dummy");
            update = getConfig().getBoolean("Update");
            this.updateChecker = new UpdateChecker(this, "http://dev.bukkit.org/server-mods/score-board-motd/files.rss");
            if (update == true){
                if (this.updateChecker.updateNeeded()){
                    this.log.info("A new version is available: " + this.updateChecker.getVersion());
                    this.log.info("Get it from " + this.updateChecker.getLink());
            try {
                Metrics metrics = new Metrics(this);
            catch (IOException e) {
                System.out.println("Error Submitting stats!");
            plugin = this;
            this.log = getLogger();
            File f = new File(getDataFolder(), "config.yml");
                this.log.info("No configuration file found, generating a new one");
                this.log.info("Config file saved.");
    Updater Class:
    package plugins.xxfuzion360xx.ScoreboardMOTD;
    import java.io.InputStream;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class UpdateChecker {
        private ScoreboardMOTD plugin;
        private URL filesFeed;
        private String version;
        private String link;
        public UpdateChecker(ScoreboardMOTD plugin, String url){
            this.plugin = plugin;
            try {
                this.filesFeed = new URL(url);
            } catch (MalformedURLException e) {
        public boolean updateNeeded(){
            try {
                InputStream input = this.filesFeed.openConnection().getInputStream();
                Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(input);
                Node lastestFile = document.getElementsByTagName("item").item(0);
                NodeList childern = lastestFile.getChildNodes();
                this.version = childern.item(1).getTextContent().replaceAll("[a-zA-Z ]", "");
                this.link = childern.item(3).getTextContent();
                if(!plugin.getDescription().getVersion().equals(this.version)) {
                    return true;
            } catch (Exception e) {
            return false;
        public String getVersion(){
            return this.version;
        public String getLink(){
            return this.link;
  2. Offline


    Well what's the error..
  3. Offline


    I don't know what you're doing, but this would be an easier way of checking for plugin updates.
  4. Offline


    Tirelessly i forgot here it is

    C:\Users\Timmy\Documents\Files\Local Host>java -Xms1024M -Xmx1024M -jar craftbuk
    kit.jar -o true
    229 recipes
    27 achievements
    19:15:30 [INFO] Starting minecraft server version 1.5.2
    19:15:30 [INFO] Loading properties
    19:15:30 [INFO] Default game type: CREATIVE
    19:15:30 [INFO] Generating keypair
    19:15:30 [INFO] Starting Minecraft server on *:25565
    19:15:30 [INFO] This server is running CraftBukkit version git-Bukkit-1.5.1-R0.2
    -14-g7d19b67-b2767jnks (MC: 1.5.2) (Implementing API version 1.5.2-R0.1-SNAPSHOT
    19:15:31 [INFO] [BetterCast] Loading BetterCast v1.0
    19:15:31 [INFO] [ScoreboardMOTD] Loading ScoreboardMOTD v1.0
    19:15:31 [INFO] Preparing level "world"
    19:15:31 [INFO] Preparing start region for level 0 (Seed: -2819586645922029152)
    19:15:31 [INFO] ----- Bukkit Auto Updater -----
    19:15:35 [INFO] It appears that you're running a Development Build, when you've
    specified in bukkit.yml that you prefer to run Recommended Builds.
    19:15:35 [INFO] Preparing spawn area: 0%
    19:15:35 [INFO] If you would like to be kept informed about new Development Buil
    d releases, it is recommended that you change 'preferred-channel' in your bukkit
    .yml to 'dev'.
    19:15:35 [INFO] With that set, you will be told whenever a new version is availa
    ble for download, so that you can always keep up to date and secure with the lat
    est fixes.
    19:15:35 [INFO] If you would like to disable this warning, simply set 'suggest-c
    hannels' to false in bukkit.yml.
    19:15:35 [INFO] ----- ------------------- -----
    19:15:36 [INFO] Preparing spawn area: 91%
    19:15:36 [INFO] Preparing start region for level 1 (Seed: -2819586645922029152)
    19:15:37 [INFO] [BetterCast] Enabling BetterCast v1.0
    19:15:37 [INFO] [BetterCast] Enabled!
    19:15:37 [INFO] [ScoreboardMOTD] Enabling ScoreboardMOTD v1.0
    19:15:37 [WARNING] [BetterCast] Could not reach BukkitDev file stream for update
    checking. Is dev.bukkit.org offline?
    19:15:37 [SEVERE] java.lang.NullPointerException
    19:15:37 [SEVERE]      at plugins.xxfuzion360xx.ScoreboardMOTD.UpdateChecker.up
    19:15:37 [SEVERE]      at plugins.xxfuzion360xx.ScoreboardMOTD.ScoreboardMOTD.o
    19:15:37 [SEVERE]      at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlug
    19:15:37 [SEVERE]      at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(
    19:15:37 [SEVERE]      at org.bukkit.plugin.SimplePluginManager.enablePlugin(Si
    19:15:37 [SEVERE]      at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugin
    19:15:37 [SEVERE]      at org.bukkit.craftbukkit.v1_5_R3.CraftServer.enablePlug
    19:15:37 [SEVERE]      at net.minecraft.server.v1_5_R3.MinecraftServer.j(Minecr
    19:15:37 [SEVERE]      at net.minecraft.server.v1_5_R3.MinecraftServer.e(Minecr
    19:15:37 [SEVERE]      at net.minecraft.server.v1_5_R3.MinecraftServer.a(Minecr
    19:15:37 [SEVERE]      at net.minecraft.server.v1_5_R3.DedicatedServer.init(Ded
    19:15:37 [SEVERE]      at net.minecraft.server.v1_5_R3.MinecraftServer.run(Mine
    19:15:37 [SEVERE]      at net.minecraft.server.v1_5_R3.ThreadServerApplication.
    19:15:37 [INFO] Server permissions file permissions.yml is empty, ignoring it
    19:15:37 [INFO] Done (6.225s)! For help, type "help" or "?"
    19:15:37 [INFO] Starting GS4 status listener
    19:15:37 [INFO] Starting remote control listener
    19:15:37 [INFO] Query running on
    19:15:37 [WARNING] No rcon password set in 'C:\Users\Timmy\Documents\Files\Local
    Host\server.properties', rcon disabled!
    RROD i can't get that to be configable

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 1, 2016
  5. Offline


    Just only instantiate the updater if its enabled in the config?
Thread Status:
Not open for further replies.

Share This Page