Procházet zdrojové kódy

fixed the world obtaining for uskyblock

mastercake10 před 7 roky
rodič
revize
2bff090c81
2 změnil soubory, kde provedl 13 přidání a 9 odebrání
  1. 11 7
      src/de/Linus122/customoregen/Main.java
  2. 2 2
      src/plugin.yml

+ 11 - 7
src/de/Linus122/customoregen/Main.java

@@ -26,13 +26,13 @@ public class Main extends JavaPlugin {
 	public static List<GeneratorConfig> generatorConfigs = new ArrayList<GeneratorConfig>();
 	public static List<String> disabledWorlds = new ArrayList<String>();
 
-	public static World activeInWorld;
-
 	public static ConsoleCommandSender clogger;
 	
 	private static HashMap<UUID, Integer> cachedOregenConfigs = new HashMap<UUID, Integer>();
 	private static JSONConfig cachedOregenJsonConfig;
 	
+	public static String activeInWorldName = "";
+	
 	public void onEnable() {
 		clogger = getServer().getConsoleSender();
 		PluginManager pm = Bukkit.getPluginManager();
@@ -50,16 +50,15 @@ public class Main extends JavaPlugin {
 		}
 		disabledWorlds = getConfig().getStringList("disabled-worlds");
 		if(Bukkit.getServer().getPluginManager().isPluginEnabled("ASkyBlock")) {
-			activeInWorld = com.wasteofplastic.askyblock.ASkyBlock.getIslandWorld();
+			activeInWorldName = com.wasteofplastic.askyblock.ASkyBlock.getIslandWorld().getName();
 			clogger.sendMessage("§6[CustomOreGen] §aUsing ASkyBlock as SkyBlock-Plugin");
 		}else if(Bukkit.getServer().getPluginManager().isPluginEnabled("AcidIsland")) {
-			activeInWorld = com.wasteofplastic.acidisland.ASkyBlock.getIslandWorld();
+			activeInWorldName = com.wasteofplastic.acidisland.ASkyBlock.getIslandWorld().getName();
 			clogger.sendMessage("§6[CustomOreGen] §aUsing AcidIsland as SkyBlock-Plugin");
 		}else if(Bukkit.getServer().getPluginManager().isPluginEnabled("uSkyBlock")) {
 			us.talabrek.ultimateskyblock.api.uSkyBlockAPI api = (us.talabrek.ultimateskyblock.api.uSkyBlockAPI) Bukkit.getPluginManager().getPlugin("uSkyBlock");
 			api.getConfig().getString("options.general.worldName");
-			activeInWorld = Bukkit.getWorld(api.getConfig().getString("options.general.worldName"));
-
+			activeInWorldName = api.getConfig().getString("options.general.worldName");
 			clogger.sendMessage("§6[CustomOreGen] §aUsing uSkyBlock as SkyBlock-Plugin");
 		}
 		new Metrics(this);
@@ -68,6 +67,10 @@ public class Main extends JavaPlugin {
 	public void onDisable() {
 		cachedOregenJsonConfig.saveToDisk(cachedOregenConfigs);
 	}
+	
+	public static World getActiveWorld(){
+		return Bukkit.getWorld(activeInWorldName);
+	}
 
 	public static int getLevel(UUID uuid) {
 		if(Bukkit.getServer().getPluginManager().isPluginEnabled("ASkyBlock")) {
@@ -173,7 +176,8 @@ public class Main extends JavaPlugin {
 
 			if(p.isOnline()){
 				Player realP = p.getPlayer();
-				if (Main.activeInWorld.getName().equals(realP.getWorld().getName())) {
+				if (activeInWorldName.equals(
+						realP.getWorld().getName())) {
 					for (GeneratorConfig gc2 : Main.generatorConfigs) {
 						if (gc2 == null) {
 							continue;

+ 2 - 2
src/plugin.yml

@@ -1,8 +1,8 @@
 name: CustomOreGen
-version: 1.2.35
+version: 1.2.36
 description: Controls the Ore-Generator
 author: Linus122
-soft-depends: [ASkyBlock, AcidIsland, uSkyBlock]
+softdepend: [ASkyBlock, AcidIsland, uSkyBlock]
 main: de.Linus122.customoregen.Main
 commands:
    customoregen: