• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RespawnPlayerEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent的典型用法代码示例。如果您正苦于以下问题:Java RespawnPlayerEvent类的具体用法?Java RespawnPlayerEvent怎么用?Java RespawnPlayerEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RespawnPlayerEvent类属于org.spongepowered.api.event.entity.living.humanoid.player包,在下文中一共展示了RespawnPlayerEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: onPlayerRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener(order = Order.LAST)
public void onPlayerRespawn(RespawnPlayerEvent event) {
    GPTimings.PLAYER_RESPAWN_EVENT.startTimingIfSync();
    Player player = event.getTargetEntity();
    if (!GriefPreventionPlugin.instance.claimsEnabledForWorld(player.getWorld().getProperties())) {
        GPTimings.PLAYER_RESPAWN_EVENT.stopTimingIfSync();
        return;
    }

    GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
    playerData.lastSpawn = Calendar.getInstance().getTimeInMillis();
    playerData.lastPvpTimestamp = 0; // no longer in pvp combat

    // also send him any messaged from grief prevention he would have
    // received while dead
    if (playerData.messageOnRespawn != null) {
        // color is already embedded inmessage in this case
        GriefPreventionPlugin.sendMessage(player, Text.of(playerData.messageOnRespawn), 40L);
        playerData.messageOnRespawn = null;
    }

    GriefPreventionPlugin.instance.checkPvpProtectionNeeded(player);
    GPTimings.PLAYER_RESPAWN_EVENT.stopTimingIfSync();
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:25,代码来源:PlayerEventHandler.java


示例3: onRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener
public void onRespawn(RespawnPlayerEvent event) {
  EntityPlayer player = tf(event.getTargetEntity());
  NonNullList<net.minecraft.item.ItemStack> mainInv = player.inventory.mainInventory;
  Task.builder().delayTicks(1).execute(() -> {
    Deque<ItemStack> queue = playerQueue.remove(player.getUniqueID());
    if (queue != null) {
      for (int i = 0; !queue.isEmpty() && i < mainInv.size(); ++i) {
        if (mainInv.get(i) == net.minecraft.item.ItemStack.EMPTY) {
          mainInv.set(i, tf(queue.poll()));
        }
      }
      if (!queue.isEmpty()) {
        enque(tf(player), queue);
      }
    }
  }).submit(SkreePlugin.inst());
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:19,代码来源:RespawnQueueServiceImpl.java


示例4: onRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener
public void onRespawn(RespawnPlayerEvent event)
{
    World from = event.getFromTransform().getExtent();
    World to = event.getToTransform().getExtent();
    Entity target = event.getTargetEntity();

    if (from.equals(to) || module.getUniverse(from).equals(module.getUniverse(to)))
    {
        return;
    }

    MultiverseData data = target.get(MultiverseData.class).get();
    data.from(module.getUniverse(from), from).applyFromPlayer(((Player)target)); // save playerdata
    data.from(module.getUniverse(to), to).applyToPlayer(((Player)target)); // load playerdata
    target.offer(data);
}
 
开发者ID:CubeEngine,项目名称:modules-main,代码行数:18,代码来源:MultiverseListener.java


示例5: handleRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
public void handleRespawn() {
    Transform<World> transform = getTransform();
    final LanternWorld world = (LanternWorld) transform.getExtent();
    if (isDead()) {
        // TODO: Get the proper spawn location
        final Transform<World> toTransform = new Transform<>(transform.getExtent(), new Vector3d(0, 100, 0));

        // Make the player less dead...
        setDead(false);
        // Reset player settings
        offer(Keys.HEALTH, get(Keys.MAX_HEALTH).get());
        offer(Keys.FOOD_LEVEL, get(LanternKeys.MAX_FOOD_LEVEL).get());
        offer(Keys.ABSORPTION, 0.0);
        offer(Keys.EXHAUSTION, DEFAULT_EXHAUSTION);
        offer(Keys.SATURATION, DEFAULT_SATURATION);
        offer(Keys.POTION_EFFECTS, new ArrayList<>());
        offer(LanternKeys.SCORE, 0);

        final CauseStack causeStack = CauseStack.current();
        try (CauseStack.Frame frame = causeStack.pushCauseFrame()) {
            frame.pushCause(this);
            frame.addContext(EventContextKeys.PLAYER, this);

            final RespawnPlayerEvent event = SpongeEventFactory.createRespawnPlayerEvent(causeStack.getCurrentCause(),
                    transform, toTransform, this, this, false, true);
            Sponge.getEventManager().post(event);

            // Get the to transform, this can be overridden in the event
            transform = event.getToTransform();
        }
    }
    setWorld(world, (LanternWorld) transform.getExtent());
    setPosition(transform.getPosition());
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:35,代码来源:LanternPlayer.java


示例6: onRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener
public void onRespawn(RespawnPlayerEvent event) {
	Entity type = event.getTargetEntity();
	if (type.getType() == EntityTypes.PLAYER) {
		IActiveCharacter character = characterService.getCharacter(type.getUniqueId());
		if (character.isStub())
			return;
		characterService.respawnCharacter(character, event.getTargetEntity());

	}
}
 
开发者ID:NeumimTo,项目名称:NT-RPG,代码行数:12,代码来源:BasicListener.java


示例7: 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


示例8: onPlayerRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener(order = Order.LAST)
public void onPlayerRespawn(RespawnPlayerEvent event) {
  Player player = event.getTargetEntity();
  if (hasReleasedInventoryStored(player)) {
    try {
      loadInventory(player);
    } catch (InventoryStorageStateException e) {
      e.printStackTrace();
    }
  }
}
 
开发者ID:Skelril,项目名称:Skree,代码行数:12,代码来源:PlayerStateServiceImpl.java


示例9: 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


示例10: onSpawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener(order = Order.LATE)
public void onSpawn(RespawnPlayerEvent event)
{
    if (!event.isBedSpawn())
    {
        Subject subject = pm.getUserSubjects().loadSubject(event.getTargetEntity().getIdentifier()).join();
        subject.getOption(SpawnCommands.ROLESPAWN).ifPresent(s -> event.setToTransform(getSpawnLocation(s)));
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:10,代码来源:SpawnListener.java


示例11: handle

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Override
public void handle(RespawnPlayerEvent e)  {
    millisLived.put(e.getOriginalPlayer(), System.currentTimeMillis());
}
 
开发者ID:Proximyst,项目名称:Bukkit2Sponge,代码行数:5,代码来源:LifeLength.java


示例12: onRespawn

import org.spongepowered.api.event.entity.living.humanoid.player.RespawnPlayerEvent; //导入依赖的package包/类
@Listener
public void onRespawn(RespawnPlayerEvent e) {
    sendDelayedArmorUpdate(e.getTargetEntity());
}
 
开发者ID:MylesIsCool,项目名称:ViaVersion,代码行数:5,代码来源:Sponge5ArmorListener.java


示例13: 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


示例14: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultRoutePlanner类代码示例发布时间:2022-05-22
下一篇:
Java LibFunction类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap