本文整理汇总了Java中org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent.setToTransform方法的典型用法代码示例。如果您正苦于以下问题:Java RespawnPlayerEvent.setToTransform方法的具体用法?Java RespawnPlayerEvent.setToTransform怎么用?Java RespawnPlayerEvent.setToTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent
的用法示例。
在下文中一共展示了RespawnPlayerEvent.setToTransform方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRespawnPlayerEvent
import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入方法依赖的package包/类
@Listener
public void onRespawnPlayerEvent(RespawnPlayerEvent event) {
if (event.isBedSpawn()) {
return;
}
World world = event.getToTransform().getExtent();
Vector3d rotation = null;
for (SpawnEntity spawnEntity : SpawnCache.instance.get()) {
if (spawnEntity.getWorld().getIdentifier().equals(world.getUniqueId().toString())) {
rotation = spawnEntity.getRotation();
}
}
if (rotation != null) {
Transform<World> to = new Transform<>(world.getSpawnLocation());
event.setToTransform(to.setRotation(rotation));
}
}
示例2: onRespawn
import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入方法依赖的package包/类
@Listener
public void onRespawn(RespawnPlayerEvent event) {
if (isApplicable(event.getToTransform().getExtent())) {
Optional<WorldService> optWorldService = Sponge.getServiceManager().provide(WorldService.class);
if (optWorldService.isPresent()) {
Collection<World> worlds = optWorldService.get().getEffectWrapper(MainWorldWrapper.class).get().getWorlds();
event.setToTransform(new Transform<>(worlds.iterator().next().getSpawnLocation()));
}
}
}
示例3: onPlayerRespawn
import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入方法依赖的package包/类
@Listener
public void onPlayerRespawn(RespawnPlayerEvent event) {
Player player = event.getTargetEntity();
if (respawnDataPackets.containsKey(player.getUniqueId())) {
RespawnDataPacket packet = respawnDataPackets.remove(player.getUniqueId());
event.setToTransform(event.getToTransform().setRotation(packet.getRespawnRotation()).setPosition(packet.getRespawnLocation().toDouble()));
player.sendMessage(packet.getRespawnMessage());
}
}
示例4: onRespawnPlayer
import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入方法依赖的package包/类
@Listener(order=Order.FIRST)
public void onRespawnPlayer(final RespawnPlayerEvent event) {
event.setToTransform(this.plugin.getEServer().getEPlayer(event.getOriginalPlayer()).getSpawn());
}
示例5: onPlayerRespawn
import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入方法依赖的package包/类
@Listener
public void onPlayerRespawn(RespawnPlayerEvent event) {
Player player = event.getTargetEntity();
event.setToTransform(new Transform<>(pop(player).orElse(getDefault(player))));
}