本文整理汇总了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();
}
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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);
}
}