本文整理汇总了Java中org.spongepowered.api.event.world.LoadWorldEvent类的典型用法代码示例。如果您正苦于以下问题:Java LoadWorldEvent类的具体用法?Java LoadWorldEvent怎么用?Java LoadWorldEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadWorldEvent类属于org.spongepowered.api.event.world包,在下文中一共展示了LoadWorldEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onLoadWorldEvent
import org.spongepowered.api.event.world.LoadWorldEvent; //导入依赖的package包/类
/**
* Chargement du monde
*/
@Listener
public void onLoadWorldEvent(final LoadWorldEvent event) {
if (!event.isCancelled()) {
this.plugin.getELogger().debug("Load world : " + event.getTargetWorld().getName());
this.plugin.getService().registerWorldType(event.getTargetWorld().getName());
}
}
示例5: onWorldLoad
import org.spongepowered.api.event.world.LoadWorldEvent; //导入依赖的package包/类
@Listener
public void onWorldLoad(LoadWorldEvent event) {
// Even though the world is loaded, it looks like nothing exists at this time.
// Need to runLater in order for our stuff to hook into existing object etc.
// The real solution is to hook into chunk load/unloads
Utils.runLater(() -> {
try {
Industrialization.instance().loadDataForWorld(event.getTargetWorld());
} catch (IOException e) {
e.printStackTrace();
}
});
}
示例6: 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();
}
}
示例7: onLoadWorld
import org.spongepowered.api.event.world.LoadWorldEvent; //导入依赖的package包/类
@Listener(order = Order.LAST)
public void onLoadWorld(LoadWorldEvent event)
{
if (loaded)
{
tm.runAsynchronousTask(Locker.class, () -> loadLocksInWorld(event.getTargetWorld()));
}
}
示例8: 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);
}
}
示例9: onWorldLoad
import org.spongepowered.api.event.world.LoadWorldEvent; //导入依赖的package包/类
@Listener
public void onWorldLoad(LoadWorldEvent event)
{
this.loadRepairBlocks(this.persister.getAll(event.getTargetWorld()));
}
示例10: PoreWorldLoadEvent
import org.spongepowered.api.event.world.LoadWorldEvent; //导入依赖的package包/类
public PoreWorldLoadEvent(LoadWorldEvent handle) {
super(null);
this.handle = checkNotNull(handle, "handle");
}
示例11: getHandle
import org.spongepowered.api.event.world.LoadWorldEvent; //导入依赖的package包/类
@Override
public LoadWorldEvent getHandle() {
return handle;
}