mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-07 19:30:48 +01:00
World loading performance improvement
This commit is contained in:
parent
5a0723b145
commit
cd2ee3421f
@ -187,6 +187,14 @@ public class DWorldCache {
|
||||
return editWorlds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param world the world
|
||||
* @return true if the world is a DXL instance, false if not
|
||||
*/
|
||||
public boolean isInstance(World world) {
|
||||
return world.getName().startsWith("DXL_");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name of the map; can either be the resource name or the instance name
|
||||
* @return if a map with this name exists
|
||||
|
@ -23,6 +23,7 @@ import de.erethon.caliburn.mob.ExMob;
|
||||
import de.erethon.dungeonsxl.DungeonsXL;
|
||||
import de.erethon.dungeonsxl.game.Game;
|
||||
import java.util.Set;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -41,6 +42,7 @@ import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||
import org.bukkit.event.world.WorldInitEvent;
|
||||
|
||||
/**
|
||||
* @author Daniel Saukel, Frank Baumann, Milan Albrecht
|
||||
@ -55,6 +57,14 @@ public class DWorldListener implements Listener {
|
||||
dWorlds = plugin.getDWorldCache();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInit(WorldInitEvent event) {
|
||||
World world = event.getWorld();
|
||||
if (dWorlds.isInstance(world)) {
|
||||
world.setKeepSpawnInMemory(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Block block = event.getBlock();
|
||||
|
Loading…
Reference in New Issue
Block a user