当前位置: 首页>>代码示例>>Java>>正文


Java LoadWorldEvent.getTargetWorld方法代码示例

本文整理汇总了Java中org.spongepowered.api.event.world.LoadWorldEvent.getTargetWorld方法的典型用法代码示例。如果您正苦于以下问题:Java LoadWorldEvent.getTargetWorld方法的具体用法?Java LoadWorldEvent.getTargetWorld怎么用?Java LoadWorldEvent.getTargetWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongepowered.api.event.world.LoadWorldEvent的用法示例。


在下文中一共展示了LoadWorldEvent.getTargetWorld方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onWorldLoad

import org.spongepowered.api.event.world.LoadWorldEvent; //导入方法依赖的package包/类
@Listener
public void onWorldLoad(LoadWorldEvent event)
{
    World world = event.getTargetWorld();
    logger.info("World loaded: "+ world.getName());
    UUID uniqueId = world.getUniqueId();
    claimedChunks.put(uniqueId, new HashMap<>());
    try
    {
        worldContexts.put(uniqueId, loadWorldContext(world));
    }
    catch (IOException e)
    {
        logger.error("Failed to load world data");
        Sponge.getServer().shutdown();
    }
}
 
开发者ID:GameModsBR,项目名称:MyChunks,代码行数:18,代码来源:MyChunks.java

示例2: onWorldLoad

import org.spongepowered.api.event.world.LoadWorldEvent; //导入方法依赖的package包/类
@Listener(order = Order.EARLY, beforeModifications = true)
public void onWorldLoad(LoadWorldEvent event) {
    if (!SpongeImpl.getServer().isServerRunning() || !GriefPreventionPlugin.instance.claimsEnabledForWorld(event.getTargetWorld().getProperties())) {
        return;
    }

    GPTimings.WORLD_LOAD_EVENT.startTimingIfSync();
    GriefPreventionPlugin.instance.dataStore.loadWorldData(event.getTargetWorld());
    net.minecraft.world.World world = (net.minecraft.world.World) event.getTargetWorld();
    world.addEventListener(new EntityRemovalListener());
    GPTimings.WORLD_LOAD_EVENT.stopTimingIfSync();
    if (!GriefPreventionPlugin.getActiveConfig(event.getTargetWorld().getProperties()).getConfig().claim.bankTaxSystem) {
        return;
    }
    if (GriefPreventionPlugin.instance.economyService.isPresent()) {
        // run tax task
        TaxApplyTask taxTask = new TaxApplyTask(event.getTargetWorld().getProperties());
        int taxHour = GriefPreventionPlugin.getActiveConfig(event.getTargetWorld().getProperties()).getConfig().claim.taxApplyHour;
        long delay = TaskUtils.computeDelay(taxHour, 0, 0);
        Sponge.getScheduler().createTaskBuilder().async().delay(delay, TimeUnit.SECONDS).interval(1, TimeUnit.DAYS).execute(taxTask).submit(GriefPreventionPlugin.instance);
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:23,代码来源:WorldEventHandler.java

示例3: onWorldLoads

import org.spongepowered.api.event.world.LoadWorldEvent; //导入方法依赖的package包/类
@Listener
public void onWorldLoads(LoadWorldEvent evt) {
    WorldLoadsScriptEvent event = (WorldLoadsScriptEvent) clone();
    event.internal = evt;
    event.world = new WorldTag(evt.getTargetWorld());
    event.cancelled = evt.isCancelled();
    event.run();
    evt.setCancelled(event.cancelled);
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:10,代码来源:WorldLoadsScriptEvent.java

示例4: onWorldLoad

import org.spongepowered.api.event.world.LoadWorldEvent; //导入方法依赖的package包/类
@Listener
public void onWorldLoad(LoadWorldEvent e) {
    World w = e.getTargetWorld();
    try {
        RedProtect.get().rm.load(w);
        RedProtect.get().cfgs.loadPerWorlds(w);  
        RedProtect.get().logger.warning("World loaded: " + w.getName());
        
    }
    catch (Exception ex) {
    	RedProtect.get().logger.severe("redprotect problem on load world:");
        ex.printStackTrace();
    }
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:15,代码来源:RPWorldListener.java

示例5: onLoadWorld

import org.spongepowered.api.event.world.LoadWorldEvent; //导入方法依赖的package包/类
@Listener
public void onLoadWorld(LoadWorldEvent event) {
    final World world = event.getTargetWorld();
    final String name = world.getName();
    WorldGenerator generator = world.getWorldGenerator();
    GenerationPopulator terrain = generator.getBaseGenerationPopulator();
    if (terrain instanceof GeneratorWrapper) {
        GeneratorWrapper stg = (GeneratorWrapper) terrain;
        PS.get().loadWorld(name, stg);
    }
    else {
        PS.get().loadWorld(name, null);
    }
}
 
开发者ID:IntellectualSites,项目名称:PlotSquared,代码行数:15,代码来源:WorldEvents.java


注:本文中的org.spongepowered.api.event.world.LoadWorldEvent.getTargetWorld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。