mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-01-10 09:47:42 +01:00
Fix for biomes broken in 2.3.4 in Nether and End
This commit is contained in:
parent
7d11802471
commit
b40afbe167
@ -213,6 +213,7 @@ public class SkyBlock extends SongodaPlugin {
|
||||
pluginManager.registerEvents(new Grow(this), this);
|
||||
pluginManager.registerEvents(new Piston(this), this);
|
||||
pluginManager.registerEvents(new FallBreak(this), this);
|
||||
pluginManager.registerEvents(new World(this), this);
|
||||
|
||||
if (pluginManager.isPluginEnabled("EpicSpawners"))
|
||||
pluginManager.registerEvents(new EpicSpawners(this), this);
|
||||
|
48
src/main/java/com/songoda/skyblock/listeners/World.java
Normal file
48
src/main/java/com/songoda/skyblock/listeners/World.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.songoda.skyblock.listeners;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleBiome;
|
||||
import com.songoda.skyblock.SkyBlock;
|
||||
import com.songoda.skyblock.biome.BiomeManager;
|
||||
import com.songoda.skyblock.island.Island;
|
||||
import com.songoda.skyblock.island.IslandManager;
|
||||
import com.songoda.skyblock.island.IslandWorld;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
|
||||
public class World implements Listener {
|
||||
|
||||
private final SkyBlock plugin;
|
||||
|
||||
public World(SkyBlock plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
// Hotfix for wrong biome in other worlds;
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onWorldChange(PlayerChangedWorldEvent event) {
|
||||
IslandManager islandManager = plugin.getIslandManager();
|
||||
BiomeManager biomeManager = plugin.getBiomeManager();
|
||||
|
||||
Location to = event.getPlayer().getLocation();
|
||||
Island island = islandManager.getIslandAtLocation(to);
|
||||
|
||||
if(island != null) {
|
||||
switch (to.getWorld().getEnvironment()) {
|
||||
case NORMAL:
|
||||
break;
|
||||
case NETHER:
|
||||
if(!to.getBlock().getBiome().equals(CompatibleBiome.NETHER_WASTES.getBiome())) {
|
||||
biomeManager.setBiome(island, IslandWorld.Nether, CompatibleBiome.NETHER_WASTES.getBiome(), null);
|
||||
}
|
||||
break;
|
||||
case THE_END:
|
||||
if(!to.getBlock().getBiome().equals(CompatibleBiome.THE_END.getBiome())) {
|
||||
biomeManager.setBiome(island, IslandWorld.End, CompatibleBiome.THE_END.getBiome(), null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user