use of com.skelril.skree.content.world.build.BuildWorldWrapper in project Skree by Skelril.
the class RespawnServiceImpl method getDefault.
@Override
public Location<World> getDefault(Player target) {
WorldService service = Sponge.getServiceManager().provideUnchecked(WorldService.class);
Optional<Map<UUID, RespawnLocation>> optRespawnLocations = target.get(Keys.RESPAWN_LOCATIONS);
if (optRespawnLocations.isPresent()) {
BuildWorldWrapper buildWrapper = service.getEffectWrapper(BuildWorldWrapper.class).get();
UUID buildWorldId = buildWrapper.getPrimaryWorld().getUniqueId();
RespawnLocation targetLocation = optRespawnLocations.get().get(buildWorldId);
if (targetLocation != null) {
Optional<Location<World>> optLocation = targetLocation.asLocation();
if (optLocation.isPresent()) {
return optLocation.get();
}
}
}
return service.getEffectWrapper(MainWorldWrapper.class).get().getPrimaryWorld().getSpawnLocation();
}
use of com.skelril.skree.content.world.build.BuildWorldWrapper in project Skree by Skelril.
the class WorldSystem method initWrappers.
private void initWrappers() throws IOException {
List<WorldEffectWrapper> wrappers = Lists.newArrayList(new MainWorldWrapper(), new BuildWorldWrapper(), new InstanceWorldWrapper(), new WildernessWorldWrapper(ConfigLoader.loadConfig("wilderness.json", WildernessConfig.class)));
for (WorldEffectWrapper wrapper : wrappers) {
this.wrappers.put(wrapper.getName(), wrapper);
Sponge.getEventManager().registerListeners(SkreePlugin.inst(), wrapper);
service.registerEffectWrapper(wrapper);
}
}
Aggregations