Переглянути джерело

Fixed Spout not being able to precache our resources properly, and
therefore making our XP bars fail. Fixes #587

GJ 12 роки тому
батько
коміт
bfa29cbf02

+ 1 - 0
Changelog.txt

@@ -19,6 +19,7 @@ Version 1.4.00-dev
  + Added timeout on party teleport requests
  + Added XP bonus for Archery based on distance from shooter to target
  + Added ability to config Hylian Luck drops through treasures.yml
+ = Fixed Spout not being able to precache our resources properly, and therefore making our XP bars fail
  = Fixed Spout config files loading / generating when they shouldn't have
  = Fixed mod config files loading / generating when they shouldn't have
  = Fixed bug where Green Terra could activate on crops that weren't fully grown.

+ 5 - 1
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -77,6 +77,7 @@ import com.gmail.nossr50.skills.taming.TamingCommand;
 import com.gmail.nossr50.skills.unarmed.UnarmedCommand;
 import com.gmail.nossr50.skills.woodcutting.WoodcuttingCommand;
 import com.gmail.nossr50.spout.SpoutStart;
+import com.gmail.nossr50.spout.SpoutStuff;
 import com.gmail.nossr50.spout.commands.MchudCommand;
 import com.gmail.nossr50.spout.commands.XplockCommand;
 import com.gmail.nossr50.util.Anniversary;
@@ -127,6 +128,9 @@ public class mcMMO extends JavaPlugin {
         p = this;
         setupFilePaths();
 
+        SpoutStuff.setSpoutEnabled();
+        SpoutStuff.preCacheFiles();
+
         // Force the loading of config files
         Config configInstance = Config.getInstance();
         TreasuresConfig.getInstance();
@@ -198,7 +202,7 @@ public class mcMMO extends JavaPlugin {
         BukkitScheduler scheduler = getServer().getScheduler();
 
         // Schedule Spout Activation 1 second after start-up
-        scheduler.scheduleSyncDelayedTask(this, new SpoutStart(this), 20);
+        scheduler.scheduleSyncDelayedTask(this, new SpoutStart(), 20);
         // Periodic save timer (Saves every 10 minutes by default)
         scheduler.scheduleSyncRepeatingTask(this, new SaveTimer(), 0, configInstance.getSaveInterval() * 1200);
         // Regen & Cooldown timer (Runs every second)

+ 0 - 19
src/main/java/com/gmail/nossr50/spout/SpoutStart.java

@@ -1,35 +1,16 @@
 package com.gmail.nossr50.spout;
 
-import org.getspout.spoutapi.SpoutManager;
-import org.getspout.spoutapi.player.FileManager;
-
 import com.gmail.nossr50.mcMMO;
 
 public class SpoutStart implements Runnable{
-    private final mcMMO plugin;
-
-    public SpoutStart(final mcMMO plugin) {
-        this.plugin = plugin;
-    }
 
     @Override
     public void run() {
-        if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
-            mcMMO.spoutEnabled = true;
-        }
-        else {
-            mcMMO.spoutEnabled = false;
-        }
-
         //Spout Stuff
         if (mcMMO.spoutEnabled) {
             SpoutConfig.getInstance();
             SpoutStuff.setupSpoutConfigs();
             SpoutStuff.registerCustomEvent();
-            SpoutStuff.extractFiles(); //Extract source materials
-
-            FileManager FM = SpoutManager.getFileManager();
-            FM.addToPreLoginCache(plugin, SpoutStuff.getFiles());
 
             //Handle spout players after a /reload
             SpoutStuff.reloadSpoutPlayers();

+ 19 - 0
src/main/java/com/gmail/nossr50/spout/SpoutStuff.java

@@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
 import org.getspout.spoutapi.SpoutManager;
 import org.getspout.spoutapi.event.spout.SpoutCraftEnableEvent;
 import org.getspout.spoutapi.keyboard.Keyboard;
+import org.getspout.spoutapi.player.FileManager;
 import org.getspout.spoutapi.player.SpoutPlayer;
 
 import com.gmail.nossr50.mcMMO;
@@ -592,4 +593,22 @@ public class SpoutStuff {
             mcMMO.p.getServer().getPluginManager().callEvent(spoutCraftEnableEvent);
         }
     }
+
+    public static void setSpoutEnabled() {
+        if (plugin.getServer().getPluginManager().getPlugin("Spout") != null) {
+            mcMMO.spoutEnabled = true;
+        }
+        else {
+            mcMMO.spoutEnabled = false;
+        }
+    }
+
+    public static void preCacheFiles() {
+        if (mcMMO.spoutEnabled) {
+            extractFiles(); //Extract source materials
+    
+            FileManager FM = SpoutManager.getFileManager();
+            FM.addToPreLoginCache(plugin, getFiles());
+        }
+    }
 }