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


Java RespawnPlayerEvent.setToTransform方法代码示例

本文整理汇总了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));
    }
}
 
开发者ID:mmonkey,项目名称:Destinations,代码行数:20,代码来源:PlayerListeners.java

示例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()));
    }
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:11,代码来源:InstanceWorldWrapper.java

示例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());
    }
}
 
开发者ID:Zerthick,项目名称:Graveyards,代码行数:10,代码来源:Graveyards.java

示例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());
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:5,代码来源:EAListener.java

示例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))));
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:6,代码来源:RespawnServiceImpl.java


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