Java 类org.bukkit.event.player.PlayerRespawnEvent 实例源码

项目:SamaGamesAPI    文件:SkyFactory.java   
@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);
}
项目:KingdomFactions    文件:PlayerDeathEventListener.java   
@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);
}
项目:SkyWarsReloaded    文件:PlayerListener.java   
@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);
        }
    }
}
项目:mczone    文件:GameEvents.java   
@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);
}
项目:HCFCore    文件:DeathbanListener.java   
@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);
/*     */     }
/*     */   }
项目:HCFCore    文件:DeathbanListener.java   
@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);
    }
}
项目:ArchersBattle    文件:PlayerListener.java   
@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);
    }
}
项目:Chambers    文件:RespawnTask.java   
@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));
    }
}
项目:BiteSkywars    文件:PlayerListener.java   
@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);
    }

    }
项目:Skript    文件:ExprLevel.java   
@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};
}
项目:Arcade2    文件:Sessions.java   
@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());
        }
    }
}
项目:HoloGUIApi    文件:PlayerRespawnEventListener.java   
@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);
        }
    }
}
项目:Breakpoint    文件:CTFListener.java   
@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);
}
项目:Breakpoint    文件:DMListener.java   
@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);
    }
}
项目:Breakpoint    文件:PVPListener.java   
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);
    }
}
项目:FastHungryKeeper    文件:EventListener.java   
@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);
                }
            }
        });
    }
}
项目:AnnihilationPro    文件:GameListeners.java   
@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
    }
}
项目:AnimulusLib    文件:NPCManager.java   
@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);
}
项目:BiteSkywars    文件:PlayerListener.java   
@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);
    }

    }
项目:SurvivalCG    文件:PlayerRespawnListener.java   
@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));
}
项目:BedwarsRel    文件:PlayerListener.java   
@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());
  }
}
项目:Ultra-Hardcore-1.8    文件:EvGame.java   
@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));
        }
    }
}
项目:Breakpoint    文件:CTFListener.java   
@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);
}
项目:Breakpoint    文件:DMListener.java   
@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);
    }
}
项目:Breakpoint    文件:PVPListener.java   
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);
    }
}
项目:COD-Warfare    文件:Listeners.java   
@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);
                        }
                    }
                }
            }
        }
    });
}
项目:COD-Warfare    文件:Listeners.java   
@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);
                        }
                    }
                }
            }
            }
        });
    }
项目:askygrid    文件:PlayerEvents.java   
/**
    * 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);
    }
}
   }
项目:civcraft    文件:ArenaListener.java   
@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);
    }
}
项目:acidisland    文件:PlayerEvents.java   
/**
 * 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);
            }
        }
    }
}
项目:Factoid    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
// Must be after Essentials
public void onPlayerRespawn(PlayerRespawnEvent event) {

    Player player = event.getPlayer();
    IPlayerConfEntry entry = playerConf.get(player);
    IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(
            player.getLocation());
    String strLoc;
    Location loc;

    // For repsawn after death
    if (entry != null
            && land.checkPermissionAndInherit(player,
                    PermissionList.TP_DEATH.getPermissionType())
            && !(strLoc = land.getFlagAndInherit(
                    FlagList.SPAWN.getFlagType()).getValueString()).isEmpty()
            && (loc = StringChanges.stringToLocation(strLoc)) != null) {
        event.setRespawnLocation(loc);
    }
}
项目:societies    文件:SiegingListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void modifyPlayerRespawn(PlayerRespawnEvent event) {
    Member member = getMember(event.getPlayer());
    Besieger besieger = getBesieger(member);

    if (besieger != null) {
        Optional<Siege> siege = siegeController.getSiegeByAttacker(besieger);

        if (!siege.isPresent()) {
            return;
        }

        if (siege.get().isStarted()) {
            event.setRespawnLocation(siege.get().getLocationInitiated().toBukkit());
            member.send("siege.respawn-siegestone");
        }
    }
}
项目:Bukkit-DropProtect    文件:EntityDeathRespawnListener.java   
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event) {
    Player player = event.getPlayer();
    String playerName = player.getName();

    ProtectedItemsSnapshot protectedItemsSnapshot = playerItemSnapshots.get(playerName);

    // if we have an inventory snapshot for this player
    if (protectedItemsSnapshot != null) {
        // merge the snapshot into the player's inventory, dropping overflow items at the respawn location
        protectedItemsSnapshot.mergeIntoPlayerInventory(player, event.getRespawnLocation());

        if (protectedItemsSnapshot.hasNonEmptyItems()) {
            player.sendMessage("[" + ChatColor.GREEN + "DropProtect" + ChatColor.RESET + "] Inventory restored. Type /dropprotect for details.");
        }

        // remove the snapshot since it has now been applied
        playerItemSnapshots.remove(playerName);
    }
}
项目:5min2live    文件:PlayerManager.java   
@EventHandler
public void onPlayerRespawn(final PlayerRespawnEvent event) {
    final Player player = event.getPlayer();
    logDebug("Player " + player.getName() + " respawned");
    if (inFmtl(player)) {
        event.setRespawnLocation(fmtl.getData().getExitLocation(player));
        // fmtl.getData().loadPlayerStats(player);
        Bukkit.getServer().getScheduler().runTask(fmtl, new Runnable() {
            @Override
            public void run() {
                fmtl.getData().loadPlayerStats(player);
            }
        });
    }
    // if (players.isEmpty()) {
    // // worldManager.resetWorld();
    // }
}
项目:askyblock    文件:PlayerEvents.java   
/**
 * 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);
            }
        }
    }
}
项目:Annihilation    文件:PlayerListener.java   
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
    Player player = e.getPlayer();
    PlayerMeta meta = PlayerMeta.getMeta(player);
    if (meta.isAlive()) {
        if (kitsToGive.containsKey(e.getPlayer().getName())) {
            meta.setKit(kitsToGive.get(e.getPlayer().getName()));
            kitsToGive.remove(e.getPlayer().getName());
        }
        e.setRespawnLocation(meta.getTeam().getRandomSpawn());
        meta.getKit().give(player, meta.getTeam());
    } else {
        e.setRespawnLocation(plugin.getMapManager().getLobbySpawnPoint());
        ItemStack selector = new ItemStack(Material.FEATHER);
        ItemMeta itemMeta = selector.getItemMeta();
        itemMeta.setDisplayName(ChatColor.AQUA
                + "Right click to select class");
        selector.setItemMeta(itemMeta);

        player.getInventory().setItem(0, selector);
    }
}
项目:PopulationDensity    文件:PlayerEventHandler.java   
@EventHandler(ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent e) {
    if (!ConfigData.respawnInHomeRegion)
        return;

    Player player = e.getPlayer();

    // if it's NOT a bed respawn, redirect it to the player's home region
    // this keeps players near where they live, even when they die (haha)
    if (e.isBedSpawn())
        return;

    PlayerData playerData = PlayerHelper.getPlayerData(player.getName());

    // find the center of his home region
    Location homeRegionCenter = playerData.homeRegion.getCenter();

    // aim for two blocks above the highest block and teleport
    homeRegionCenter.setY(homeRegionCenter.getWorld().getHighestBlockYAt(homeRegionCenter) + 2);
    e.setRespawnLocation(homeRegionCenter);

}
项目:DDCustomPlugin    文件:CustomPlugin.java   
@EventHandler
public void onPlayerRespawnEvent(PlayerRespawnEvent event) {
    if (event.getPlayer().getName().equals("Esaych")) {
        PlayerInventory eInv = event.getPlayer().getInventory();
        if (eInv.getHelmet() != null)
            return;
        if (eInv.getChestplate() != null)
            return;
        if (eInv.getLeggings() != null)
            return;
        if (eInv.getBoots() != null)
            return;
        eInv.setHelmet(new ItemStack(Material.LEATHER_HELMET));
        eInv.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
        eInv.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
        eInv.setBoots(new ItemStack(Material.LEATHER_BOOTS));
        PlayerInventory inv = event.getPlayer().getInventory();
        colorize(inv.getHelmet(), 47, 0, 111);
        colorize(inv.getChestplate(), 47, 0, 111);
        colorize(inv.getLeggings(), 47, 0, 111);
        colorize(inv.getBoots(), 47, 0, 111);
    }
}
项目:AlmuraForgeBridge    文件:PlayerListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(final PlayerRespawnEvent event) {
    Bukkit.getScheduler().scheduleSyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
        @Override
        public void run() {
            final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
            ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);
            // Send Title

            for (Player player : Bukkit.getServer().getOnlinePlayers()) {
                ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
                TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
                TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
            }
        }
    }, 20L);
    EconUtil.sendCurrencyAmount(event.getPlayer(), EconUtil.economy.getBalance(event.getPlayer().getName()));
}
项目:BetonQuest    文件:QuestItemHandler.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onRespawn(PlayerRespawnEvent event) {
    if (Config.getString("config.remove_items_after_respawn").equals("false"))
        return;
    // some plugins block item dropping after death and add those
    // items after respawning, so the player doesn't loose his
    // inventory after death; this aims to force removing quest
    // items, as they have been added to the backpack already
    if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
        return;
    Inventory inv = event.getPlayer().getInventory();
    for (int i = 0; i < inv.getSize(); i++) {
        if (Utils.isQuestItem(inv.getItem(i))) {
            inv.setItem(i, null);
        }
    }
}