本文整理匯總了Java中org.bukkit.event.world.WorldInitEvent類的典型用法代碼示例。如果您正苦於以下問題:Java WorldInitEvent類的具體用法?Java WorldInitEvent怎麽用?Java WorldInitEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WorldInitEvent類屬於org.bukkit.event.world包,在下文中一共展示了WorldInitEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onWorldInit(WorldInitEvent event) {
World world = event.getWorld();
plugin.createConfig(world);
/*if (plugin.isFeatureEnabled(world.getName(), Feature.SPAWN_CONTROL)){
WorldServer worldServer = ((CraftWorld) world).getHandle();
try{
IChunkLoader chunkLoader = ReflectionUtils.getFieldValue(net.minecraft.server.v1_8_R1.ChunkProviderServer.class, "chunkLoader", IChunkLoader.class, worldServer.chunkProviderServer);
ChunkProviderServer newProvider = new ChunkProviderServer(this.plugin, worldServer, chunkLoader, worldServer.chunkProviderServer.chunkProvider);
newProvider.chunks = worldServer.chunkProviderServer.chunks;
newProvider.forceChunkLoad = worldServer.chunkProviderServer.forceChunkLoad;
worldServer.chunkProviderServer = newProvider;
}catch (NoSuchFieldException e){
e.printStackTrace();
}
}*/
}
示例2: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldInit(WorldInitEvent event) {
World world = event.getWorld();
String name = world.getName();
PlotAreaManager manager = PS.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager single = (SinglePlotAreaManager) manager;
if (single.isWorld(name)) {
world.setKeepSpawnInMemory(false);
return;
}
}
ChunkGenerator gen = world.getGenerator();
if (gen instanceof GeneratorWrapper) {
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
} else {
PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
}
}
示例3: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event)
{
String worldName = event.getWorld().getName();
if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName))
{
GroupManager.logger.info("New world detected...");
GroupManager.logger.info("Creating data for: " + worldName);
plugin.getWorldsHolder().setupWorldFolder(worldName);
plugin.getWorldsHolder().loadWorld(worldName);
if (plugin.getWorldsHolder().isInList(worldName))
{
GroupManager.logger.info("Don't forget to configure/mirror this world in config.yml.");
}
else
{
GroupManager.logger.severe("Failed to configure this world.");
}
}
}
示例4: initialize
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler (priority = EventPriority.NORMAL)
public void initialize(final WorldInitEvent evt) {
StringBuilder players = new StringBuilder();
for (Player pls : evt.getWorld().getPlayers()) {
players.append(pls);
}
for (Player pl : Bukkit.getServer().getOnlinePlayers()) {
if (pl.hasPermission("masters.debug")) {
pl.sendMessage(ChatColor.RED + "World " + evt.getWorld().getName() + " has been loaded by " + players + ".");
}
}
//set string to null
players.setLength(0);
players.replace(0, 0, " ");
}
示例5: onWorldLoad
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public void onWorldLoad(WorldInitEvent evt) {
if (noSpawnChunks) {
World world = evt.getWorld();
world.setKeepSpawnInMemory(false);
AzureAPI.log("已為世界 " + world.getName() + " 設定不保留出生區塊.");
}
}
示例6: WorldSeterLimitor
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public void WorldSeterLimitor(WorldInitEvent event) {
World world = event.getWorld();
FileConfiguration config = EscapeLag.configOptimize.getValue();
if (config.getBoolean("WorldSpawnLimitor." + world.getName() + ".enable")) {
world.setMonsterSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkMonsters"));
world.setAnimalSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkAnimals"));
world.setAmbientSpawnLimit(config.getInt("WorldSpawnLimitor." + world.getName() + ".PerChunkAmbient"));
EscapeLag.MainThis.getLogger().info("已為世界 " + world.getName() + " 設定了生物刷新速率~");
}
}
示例7: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
World world = event.getWorld();
world.setAutoSave(false);
world.setKeepSpawnInMemory(false);
world.setSpawnFlags(false, false);
}
示例8: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public void onWorldInit(WorldInitEvent event) {
WorldServer nmsworld = ((CraftWorld) event.getWorld()).getHandle();
IChunkProvider genprovider = nmsworld.chunkProviderServer.chunkProvider;
if (genprovider instanceof SkyLandsChunkGenerator) {
ReflectionUtils.setFieldValue(NormalChunkGenerator.class, "provider", genprovider, new NewChunkProviderTheEnd(nmsworld, nmsworld.getSeed()));
}
}
示例9: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onWorldInit(WorldInitEvent event) {
World world = event.getWorld();
if (plugin.isEnabled(world) && plugin.isFeatureEnabled(world, Feature.DUNGEONS)) {
world.getPopulators().add(new DungeonGenerator(plugin));
}
}
示例10: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public void onWorldInit(WorldInitEvent event) throws NoSuchFieldException, IllegalAccessException {
WorldServer world = ((CraftWorld) event.getWorld()).getHandle();
if (seigeHandlerField == null) {
seigeHandlerField = WorldServer.class.getDeclaredField("siegeManager");
seigeHandlerField.setAccessible(true);
}
seigeHandlerField.set(world, new CustomZombieSeige(world));
}
示例11: onWorldLoad
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public static void onWorldLoad(WorldInitEvent event) {
if (disableChunkLoad) {
World world = event.getWorld();
world.setKeepSpawnInMemory(false);
}
}
示例12: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler
public void onWorldInit(WorldInitEvent evt) {
if(safeSpawnMode){
Location spawn = WorldManagerHelper.getSafestSpawnPoint(evt.getWorld());
evt.getWorld().setSpawnLocation(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
logInfo("Safe Spawn: Updated spawn location " + spawn);
}
WorldManagerHelper.saveWorldConfig(evt.getWorld());
}
示例13: onInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onInit(WorldInitEvent event)
{
//Bukkit.getLogger().info("On World Init called");
if (event.getWorld().equals(getBeaconzWorld())) {
if (!getBeaconzWorld().getPopulators().contains(getBlockPopulator())) {
event.getWorld().getPopulators().add(getBlockPopulator());
}
}
}
示例14: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void onWorldInit(final WorldInitEvent event) {
final World world = event.getWorld();
String name = getName(world);
final ChunkGenerator gen = world.getGenerator();
if (gen instanceof PlotGenerator) {
//
PlotSquared.loadWorld(name, (PlotGenerator) gen);
} else {
if (PlotSquared.config.contains("worlds." + name)) {
PlotSquared.loadWorld(name, null);
}
}
lastWorld = null;
}
示例15: onWorldInit
import org.bukkit.event.world.WorldInitEvent; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldInit(WorldInitEvent event)
{
World world = event.getWorld();
plugin.getDataHandler().loadWorld(world);
plugin.getPermissionHandler().registerWorld(world);
}