java类org.bukkit.event.player.PlayerRespawnEvent的实例源码

SkyFactory.java 文件源码 项目:SamaGamesAPI 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler
private void onRespawn(final PlayerRespawnEvent event)
{
    new BukkitRunnable()
    {
        @Override
        public void run()
        {
            try
            {
                Player p = event.getPlayer();

                if (worldEnvironments.containsKey(p.getWorld().getName()))
                    Reflection.sendPacket(p, getPacket(p));
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }.runTaskLater(this.plugin, 1);
}
PlayerDeathEventListener.java 文件源码 项目:KingdomFactions 阅读 28 收藏 0 点赞 0 评论 0
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
    KingdomFactionsPlayer p = PlayerModule.getInstance().getPlayer(e.getPlayer());
    Bukkit.getScheduler().runTaskLater(KingdomFactionsPlugin.getInstance(), new Runnable(){
        @Override
        public void run(){

            if (p.getKingdom() != null) {
                if (p.hasFaction()) {
                    if (p.getFaction().hasHome()) {
                        p.teleport(p.getFaction().getHome().getLocation());
                    } else {
                        p.teleport(p.getKingdom().getSpawn());
                    }
                } else {
                    p.teleport(p.getKingdom().getSpawn());
                }
            }
        }
    }, 20);
}
PlayerListener.java 文件源码 项目:SkyWarsReloaded 阅读 35 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
    Player player = e.getPlayer();
    final GamePlayer gPlayer = SkyWarsReloaded.getPC().getPlayer(e.getPlayer().getUniqueId());
    if (gPlayer.isSpectating()) {
        SkyWarsReloaded.get().getServer().getScheduler().scheduleSyncDelayedTask(SkyWarsReloaded.get(), new Runnable() {
            public void run() {
                if (gPlayer.getP() != null) {
                    if (gPlayer.getSpecGame() != null) {
                        gPlayer.spectateMode(true, gPlayer.getSpecGame(), gPlayer.getSpecGame().getSpawn(), false);
                        gPlayer.getP().sendMessage(new Messaging.MessageFormatter().withPrefix().format("game.spectating"));
                    }
                }
            }
          }, 3);
    } else {
        if (inLobbyWorld(player)) {
            givePlayerItems(player);
        } else {
            removePlayerItems(player);
        }
    }
}
GameEvents.java 文件源码 项目:mczone 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
    final Gamer g = Gamer.get(event.getPlayer());

    new BukkitRunnable() {

        @Override
        public void run() {
            Team t = Nexus.getRotary().getCurrentMap().getTeam(g);

            if (t == null) {
                g.teleport(Nexus.getRotary().getCurrentMap().getSpawnLocation());
                return;
            }

            g.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 20 * 5, 3));

            g.teleport(t.getSpawnLocation());
            g.run("give-kit");
        }

    }.runTaskLater(Nexus.getPlugin(), 1);
}
DeathbanListener.java 文件源码 项目:HCFCore 阅读 32 收藏 0 点赞 0 评论 0
@EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
/*     */   public void onPlayerRequestRespawn(PlayerRespawnEvent event) {
/* 122 */     Player player = event.getPlayer();
/* 123 */     FactionUser user = this.plugin.getUserManager().getUser(player.getUniqueId());
/* 124 */     Deathban deathban = user.getDeathban();
/* 125 */     if ((deathban != null) && (deathban.getRemaining() > 0L)) {
/* 126 */       if (player.hasPermission("hcf.deathban.bypass")) {
/* 127 */         cancelRespawnKickTask(player);
/* 128 */         user.removeDeathban();
/* 129 */         new DelayedMessageRunnable(player, ChatColor.RED + "Bypass access granted.").runTask(this.plugin);
/*     */
/* 131 */         return;
/*     */       }
/*     */
/*     */
/*     */
/* 136 */       handleKick(player, deathban);
/*     */     }
/*     */   }
DeathbanListener.java 文件源码 项目:HCFCore 阅读 30 收藏 0 点赞 0 评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerRequestRespawn(PlayerRespawnEvent event) {
    Player player = event.getPlayer();
    FactionUser user = this.plugin.getUserManager().getUser(player.getUniqueId());
    Deathban deathban = user.getDeathban();
    if (deathban != null && deathban.getRemaining() > 0L) {
        if (player.hasPermission(DeathbanListener.DEATH_BAN_BYPASS_PERMISSION)) {
            this.cancelRespawnKickTask(player);
            user.removeDeathban();
            new DelayedMessageRunnable(player, ChatColor.RED + "You would be death-banned for " + deathban.getReason() + ChatColor.RED + ", but you have access to bypass.").runTask(this.plugin);

            return;
        }

        //TODO: FIX setcancelled
        //event.setCancelled(true);
        this.handleKick(player, deathban);
    }
}
PlayerListener.java 文件源码 项目:ArchersBattle 阅读 27 收藏 0 点赞 0 评论 0
@EventHandler
public void onSpawn(PlayerRespawnEvent e) {
    Player p = e.getPlayer();
    if (Utils.isInArena(p)) {
        Arena arena = Utils.getAreana(p);
        Location loc = arena.getRandomSpawnLocation();
        if (loc == null) {
            p.sendMessage(Messages.prefix + Messages.SpawnLocationsNotFound);
        } else {
            e.setRespawnLocation(loc);
        }
        Utils.fillInventory(p);
        p.setLevel(0);
        Utils.flushSkillSelection(p);
    }
}
RespawnTask.java 文件源码 项目:Chambers 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void run() {
    if (profile == null || player == null || !player.isOnline()) {
        cancel();
        return;
    }
    if (profile.getTeam().isRaidable()) {
        player.sendMessage(ChatColor.RED + "Your team has gone raidable and you will not respawn.");
        cancel();
        return;
    }
    if (startingLocation.distance(player.getLocation()) > 40) {
        player.teleport(startingLocation);
        player.sendMessage(ChatColor.RED + "You cannot move more than 40 blocks from where you died.");
    }
    if (profile.getRespawnTime() > 0) {
        profile.setRespawnTime(profile.getRespawnTime() - 1);
    } else {
        profile.setProfileStatus(ProfileStatus.PLAYING);
        player.spigot().respawn();
        player.teleport(profile.getTeam().getHome());
        Bukkit.getOnlinePlayers().forEach(other -> other.showPlayer(player));
        Bukkit.getServer().getPluginManager().callEvent(new PlayerRespawnEvent(player, profile.getTeam().getHome(), false));
    }
}
PlayerListener.java 文件源码 项目:BiteSkywars 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler
    public void forceRespawn(final PlayerRespawnEvent event){   
        final Player p = event.getPlayer();     
        Skywars.giveLobbyItem(p);
        if(new ArenaManager().getArena(p)==null){

        if(!Skywars.pl.getConfig().contains("spawn")){
        p.sendMessage(Skywars.p + ChatColor.RED +  "The Global Spawn Does Not Exist Please Set With /sw spawn");
        p.sendMessage(Skywars.p + ChatColor.RED +  "The Global Spawn Does Not Exist Please Set With /sw spawn");
        p.sendMessage(Skywars.p + ChatColor.RED +  "The Global Spawn Does Not Exist Please Set With /sw spawn");
        return;
        }
new BukkitRunnable() {

            @SuppressWarnings("static-access")
            @Override
            public void run() {

                p.teleport(new ArenaManager().getLoc(Skywars.pl.getConfig().getString("spawn")));

            }
        }.runTaskLater(Skywars.pl, 1L);
    }

    }
ExprLevel.java 文件源码 项目:Skript 阅读 27 收藏 0 点赞 0 评论 0
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
    if (mode == ChangeMode.REMOVE_ALL)
        return null;
    if (ScriptLoader.isCurrentEvent(PlayerRespawnEvent.class) && !ScriptLoader.hasDelayBefore.isTrue()) {
        Skript.error("Cannot change a player's level in a respawn event. Add a delay of 1 tick or change the 'new level' in a death event.");
        return null;
    }
    if (ScriptLoader.isCurrentEvent(PlayerDeathEvent.class) && getTime() == 0 && getExpr().isDefault() && !ScriptLoader.hasDelayBefore.isTrue()) {
        Skript.warning("Changing the player's level in a death event will change the player's level before he dies. " +
                "Use either 'past level of player' or 'new level of player' to clearly state whether to change the level before or after he dies.");
    }
    if (getTime() == -1 && !ScriptLoader.isCurrentEvent(PlayerDeathEvent.class))
        return null;
    return new Class[] {Number.class};
}
Sessions.java 文件源码 项目:Arcade2 阅读 25 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent event) {
    ArcadePlayer player = this.plugin.getPlayer(
            event.getPlayer().getUniqueId());

    Game game = this.plugin.getGames().getCurrentGame();
    if (game != null) {
        pl.themolka.arcade.respawn.PlayerRespawnEvent respawnEvent =
                new pl.themolka.arcade.respawn.PlayerRespawnEvent(
                        this.plugin, player);
        respawnEvent.setRespawnPosition(game.getMap().getSpawn());

        this.postEvent(respawnEvent);
        if (respawnEvent.getRespawnPosition() != null) {
            event.setRespawnLocation(respawnEvent.getRespawnPosition());
        }
    }
}
PlayerRespawnEventListener.java 文件源码 项目:HoloGUIApi 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler
public void playerRespawnEvent(PlayerRespawnEvent event)
{
    Player player = event.getPlayer();

    for(StationaryGUIDisplayContainer stationaryDisplay : holoGUI.getStationaryDisplays())
    {
        if(stationaryDisplay.playerInRange(player))
        {
            if(!stationaryDisplay.isDisplayingToPlayer(player))//player in range of display but not currently viewing the stationary gui, make gui visible
            {
                stationaryDisplay.display(player);
            }
        }
        else if(stationaryDisplay.isDisplayingToPlayer(player))//player was viewing the stationary gui, but moved out of range. Remove the gui for that player
        {
            stationaryDisplay.destroy(player);
        }
    }
}
CTFListener.java 文件源码 项目:Breakpoint 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void onPlayerRespawn(PlayerRespawnEvent event, BPPlayer bpPlayer, boolean leaveAfterDeath)
{
    CTFProperties props = (CTFProperties) bpPlayer.getGameProperties();
    CharacterType qct = bpPlayer.getQueueCharacter();
    CTFGame game = getGame();

    if(qct != null)
    {
        if(qct != null)
            props.chooseCharacter(qct, false);
        bpPlayer.setQueueCharacter(null);
    }

    if(leaveAfterDeath)
        game.updateTeamMapViews();
    else
        game.spawn(bpPlayer);
}
DMListener.java 文件源码 项目:Breakpoint 阅读 29 收藏 0 点赞 0 评论 0
@Override
public void onPlayerRespawn(PlayerRespawnEvent event, BPPlayer bpPlayer, boolean leaveAfterDeath)
{
    DMProperties props = (DMProperties) bpPlayer.getGameProperties();
    CharacterType qct = bpPlayer.getQueueCharacter();

    if(qct != null)
    {
        if(qct != null)
            props.chooseCharacter(qct, false);

        bpPlayer.setQueueCharacter(null);
    }

    if(!leaveAfterDeath)
    {
        DMGame game = getGame();

        game.spawn(bpPlayer);
    }
}
PVPListener.java 文件源码 项目:Breakpoint 阅读 28 收藏 0 点赞 0 评论 0
public void onPlayerRespawn(PlayerRespawnEvent event)
{
    Player player = event.getPlayer();
    BPPlayer bpPlayer = BPPlayer.get(player);
    boolean leaveAfterDeath = bpPlayer.isLeaveAfterDeath();
    Game game = bpPlayer.getGame();
    Location stl = bpPlayer.getSingleTeleportLocation();

    //TODO REMOVE
//  PlayerManager.updatePosDelayed(player);
    //TODO REMOVE

    if(game != null)
        game.getListener().onPlayerRespawn(event, bpPlayer, leaveAfterDeath);
    else
        bpPlayer.spawn();

    if(stl != null)
    {
        bpPlayer.teleport(stl, false);
        bpPlayer.setSingleTeleportLocation(null);
    }
}
EventListener.java 文件源码 项目:FastHungryKeeper 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler
public final void onPlayerRespawn(final PlayerRespawnEvent evt) {
    final Player player = evt.getPlayer();
    if (!player.hasPermission("fasthungrykeeper.unkeep")) {
        Bukkit.getScheduler().runTaskAsynchronously(FastHungryKeeper.plugin, new Runnable() {
            @Override
            public void run() {
                FastHungryKeeper.plugin.hungryDamageDelayMap.put(player.getName(), System.currentTimeMillis());
                final Integer playerFoodLevel = FastHungryKeeper.plugin.playersFoodLevel.remove(player.getName());
                if (playerFoodLevel != null) {
                    player.setFoodLevel(playerFoodLevel);
                }
            }
        });
    }
}
GameListeners.java 文件源码 项目:AnnihilationPro 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled = true)
public void respawnHandler(PlayerRespawnEvent event)
{
    final Player player = event.getPlayer();
    final AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
    if(p != null)
    {
        if(Game.isGameRunning())
        {
            if(p.getTeam() != null && !p.getTeam().isTeamDead())
            {
                event.setRespawnLocation(p.getTeam().getRandomSpawn());
                p.getKit().onPlayerSpawn(player);
                return;
            }
        }
        if(Game.LobbyMap != null && Game.LobbyMap.getSpawn() != null)
            event.setRespawnLocation(Game.LobbyMap.getSpawn());  //Set people to respawn in the lobby
    }
}
NPCManager.java 文件源码 项目:AnimulusLib 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler public void playerRespawn(PlayerRespawnEvent event)
{
    Player player = event.getPlayer();
    // this is needed since the world is sent anew when the player respawns
    // delay because this event is called before the respawn and the location is not right

    Runnable run = ()->
    {
        for(StateNPC npc : this.npcs.values())
        {
            npc.becomeInvisibleFor(player, true);
            npc.updateVisibilityForPlayer((player));
        }
    };

    Bukkit.getScheduler().runTaskLater(AnimulusLib.getInstance().getPlugin(), run, 1);
}
PlayerListener.java 文件源码 项目:BiteSkywars 阅读 21 收藏 0 点赞 0 评论 0
@EventHandler
    public void forceRespawn(final PlayerRespawnEvent event){   
        final Player p = event.getPlayer();     
        Skywars.giveLobbyItem(p);
        if(new ArenaManager().getArena(p)==null){

        if(!Skywars.pl.getConfig().contains("spawn")){
        p.sendMessage(Skywars.p + ChatColor.RED +  "The Global Spawn Does Not Exist Please Set With /sw spawn");
        p.sendMessage(Skywars.p + ChatColor.RED +  "The Global Spawn Does Not Exist Please Set With /sw spawn");
        p.sendMessage(Skywars.p + ChatColor.RED +  "The Global Spawn Does Not Exist Please Set With /sw spawn");
        return;
        }
new BukkitRunnable() {

            @SuppressWarnings("static-access")
            @Override
            public void run() {

                p.teleport(new ArenaManager().getLoc(Skywars.pl.getConfig().getString("spawn")));

            }
        }.runTaskLater(Skywars.pl, 1L);
    }

    }
PlayerRespawnListener.java 文件源码 项目:SurvivalCG 阅读 19 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
    final Player player = e.getPlayer();
    if(player.hasPermission("scg.hardcore.bypass")){
        return;
    }
    User user  = plugin.getManager().getUserManager().getUsers().get(player.getName());
    if(user.isToBan()){
        user.setToBan(false);
        plugin.getManager().getDeathManager().banPlayer(player.getName(), plugin.getManager().getSettingsManager().getHcBanTime());
        long bantime = plugin.getManager().getSettingsManager().getHcBanTime() + System.currentTimeMillis();
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm");
        Date date = new Date(bantime);
        String msg =  plugin.getManager().getSettingsManager().getHcKickMsg().replace("{TIME}", dateFormat.format(date));
        player.kickPlayer(ColoringUtil.colorText(msg));
    }
    player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 64));
}
PlayerListener.java 文件源码 项目:BedwarsRel 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent pre) {
  Player p = pre.getPlayer();
  Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(p);

  if (game == null) {
    return;
  }

  if (game.getState() == GameState.RUNNING) {
    game.getCycle().onPlayerRespawn(pre, p);
    return;
  }

  if (game.getState() == GameState.WAITING) {
    pre.setRespawnLocation(game.getLobby());
  }
}
EvGame.java 文件源码 项目:Ultra-Hardcore-1.8 阅读 28 收藏 0 点赞 0 评论 0
@EventHandler
public void respawn(PlayerRespawnEvent a) {
    UHCPlayer b = eA.mB.getPlayer(a.getPlayer().getName());
    if (eA.mA.i() > 5) {
        if (eA.mE.getIngamePlayers().contains(b.uB.getName())) {
            a.setRespawnLocation(eA.mE.getSpawnLoc(b.uB));
        } else {
            if (eA.mC.cOa) {
                eA.mE.gF.givePlayerItem(b.uB.getName());
            }
            if (eA.mC.cFa && eA.mC.cFv) {
                b.uB.getInventory().setItem(eA.mC.cFy, eA.mE.gC.uG);
            }
            a.setRespawnLocation(new Location(eA.getServer().getWorlds().get(0), 0, 100, 0));
        }
    }
}
CTFListener.java 文件源码 项目:Breakpoint 阅读 27 收藏 0 点赞 0 评论 0
@Override
public void onPlayerRespawn(PlayerRespawnEvent event, BPPlayer bpPlayer, boolean leaveAfterDeath)
{
    CTFProperties props = (CTFProperties) bpPlayer.getGameProperties();
    CharacterType qct = bpPlayer.getQueueCharacter();
    CTFGame game = getGame();

    if(qct != null)
    {
        if(qct != null)
            props.chooseCharacter(qct, false);
        bpPlayer.setQueueCharacter(null);
    }

    if(leaveAfterDeath)
        game.updateTeamMapViews();
    else
        game.spawn(bpPlayer);
}
DMListener.java 文件源码 项目:Breakpoint 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void onPlayerRespawn(PlayerRespawnEvent event, BPPlayer bpPlayer, boolean leaveAfterDeath)
{
    DMProperties props = (DMProperties) bpPlayer.getGameProperties();
    CharacterType qct = bpPlayer.getQueueCharacter();

    if(qct != null)
    {
        if(qct != null)
            props.chooseCharacter(qct, false);

        bpPlayer.setQueueCharacter(null);
    }

    if(!leaveAfterDeath)
    {
        DMGame game = getGame();

        game.spawn(bpPlayer);
    }
}
PVPListener.java 文件源码 项目:Breakpoint 阅读 22 收藏 0 点赞 0 评论 0
public void onPlayerRespawn(PlayerRespawnEvent event)
{
    Player player = event.getPlayer();
    BPPlayer bpPlayer = BPPlayer.get(player);
    boolean leaveAfterDeath = bpPlayer.isLeaveAfterDeath();
    Game game = bpPlayer.getGame();
    Location stl = bpPlayer.getSingleTeleportLocation();

    //TODO REMOVE
//  PlayerManager.updatePosDelayed(player);
    //TODO REMOVE

    if(game != null)
        game.getListener().onPlayerRespawn(event, bpPlayer, leaveAfterDeath);
    else
        bpPlayer.spawn();

    if(stl != null)
    {
        bpPlayer.teleport(stl, false);
        bpPlayer.setSingleTeleportLocation(null);
    }
}
Listeners.java 文件源码 项目:COD-Warfare 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void pRespawn(final PlayerRespawnEvent e) {
    final Player p = e.getPlayer();
    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(ThisPlugin.getPlugin(), new Runnable() {
        @Override
        public void run() {
            if (Main.PlayingPlayers.contains(p)) {
                p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 30, 1));
                if (Main.exoJump) {
                    if (p.hasPermission("cod.exojump")) {
                        p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1200, 2));
                    } else {
                        if (Main.WaitingPlayers.contains(e.getPlayer())) {
                            p.removePotionEffect(PotionEffectType.JUMP);
                        }
                    }
                }
            }
        }
    });
}
Listeners.java 文件源码 项目:COD-Warfare 阅读 27 收藏 0 点赞 0 评论 0
@EventHandler
=======

    @EventHandler
    public void pRespawn(final PlayerRespawnEvent e) {
        final Player p = e.getPlayer();
        Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(ThisPlugin.getPlugin(), new Runnable() {
            @Override
            public void run() {
            if(Main.PlayingPlayers.contains(p)) {
                p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 3000, 2));
                if (Main.exoJump) {
                    if(p.hasPermission("cod.exojump")) {
                        p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1200, 2));
                    }else{
                        if(Main.WaitingPlayers.contains(e.getPlayer())) {
                            p.removePotionEffect(PotionEffectType.JUMP);
                        }
                    }
                }
            }
            }
        });
    }
PlayerEvents.java 文件源码 项目:askygrid 阅读 26 收藏 0 点赞 0 评论 0
/**
    * Places player back at their home on the grid if the setting is true
    * @param e
    */
   @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
   public void onPlayerRespawn(final PlayerRespawnEvent e) {
if (DEBUG) {
    plugin.getLogger().info(e.getEventName());
}
if (!Settings.respawnAtHome) {
    return;
}
if (respawn.contains(e.getPlayer().getUniqueId())) {
    if (DEBUG)
    plugin.getLogger().info("DEBUG: found player to respawn");
    respawn.remove(e.getPlayer().getUniqueId());
    Location respawnLocation = plugin.getGrid().getSafeHomeLocation(e.getPlayer().getUniqueId(), 1);
    if (respawnLocation != null) {
    if (DEBUG)
        plugin.getLogger().info("DEBUG: Setting respawn location to " + respawnLocation);
    e.setRespawnLocation(respawnLocation);
    }
}
   }
ArenaListener.java 文件源码 项目:civcraft 阅读 23 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event) {
    Resident resident = CivGlobal.getResident(event.getPlayer());

    if (!resident.isInsideArena()) {
        return;
    }

    Arena arena = resident.getCurrentArena();
    if (arena == null) {
        return;
    }

    Location loc = arena.getRespawnLocation(resident);
    if (loc != null) {
        CivMessage.send(resident, CivColor.LightGray+"Respawned in arena.");
        World world = Bukkit.getWorld(arena.getInstanceName());
        loc.setWorld(world);

        resident.setLastKilledTime(new Date());
        event.setRespawnLocation(loc);
    }
}
PlayerEvents.java 文件源码 项目:acidisland 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Places player back on their island if the setting is true
 * @param e
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerRespawn(final PlayerRespawnEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (!Settings.respawnOnIsland) {
        return;
    }
    if (respawn.contains(e.getPlayer().getUniqueId())) {
        respawn.remove(e.getPlayer().getUniqueId());
        Location respawnLocation = plugin.getGrid().getSafeHomeLocation(e.getPlayer().getUniqueId(), 1);
        if (respawnLocation != null) {
            //plugin.getLogger().info("DEBUG: Setting respawn location to " + respawnLocation);
            e.setRespawnLocation(respawnLocation);
            // Get island
            Island island = plugin.getGrid().getIslandAt(respawnLocation);
            if (island != null) {
                // Run perms etc.
                processPerms(e.getPlayer(), island);
            }
        }
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号