當前位置: 首頁>>代碼示例>>Java>>正文


Java PlayerRespawnEvent.getPlayer方法代碼示例

本文整理匯總了Java中org.bukkit.event.player.PlayerRespawnEvent.getPlayer方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerRespawnEvent.getPlayer方法的具體用法?Java PlayerRespawnEvent.getPlayer怎麽用?Java PlayerRespawnEvent.getPlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.event.player.PlayerRespawnEvent的用法示例。


在下文中一共展示了PlayerRespawnEvent.getPlayer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1:

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
/*     */     }
/*     */   }
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:20,代碼來源:DeathbanListener.java

示例2: onPlayerRequestRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:20,代碼來源:DeathbanListener.java

示例3: onSpawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
    }
}
 
開發者ID:Soldier233,項目名稱:ArchersBattle,代碼行數:17,代碼來源:PlayerListener.java

示例4: forceRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
	}
		
	}
 
開發者ID:SpikyBite,項目名稱:BiteSkywars,代碼行數:26,代碼來源:PlayerListener.java

示例5: playerRespawnEvent

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
		}
	}
}
 
開發者ID:Kloudy,項目名稱:HoloGUIApi,代碼行數:21,代碼來源:PlayerRespawnEventListener.java

示例6: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
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);
	}
}
 
開發者ID:Limeth,項目名稱:Breakpoint,代碼行數:24,代碼來源:PVPListener.java

示例7: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
				}
			}
		});
	}
}
 
開發者ID:Recraft,項目名稱:FastHungryKeeper,代碼行數:17,代碼來源:EventListener.java

示例8: respawnHandler

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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
	}
}
 
開發者ID:MrLittleKitty,項目名稱:AnnihilationPro,代碼行數:21,代碼來源:GameListeners.java

示例9: playerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
}
 
開發者ID:domisum,項目名稱:AnimulusLib,代碼行數:18,代碼來源:NPCManager.java

示例10: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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));
}
 
開發者ID:grzegorz2047,項目名稱:SurvivalCG,代碼行數:19,代碼來源:PlayerRespawnListener.java

示例11: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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());
  }
}
 
開發者ID:BedwarsRel,項目名稱:BedwarsRel,代碼行數:19,代碼來源:PlayerListener.java

示例12: pRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
						}
					}
				}
			}
		}
	});
}
 
開發者ID:frostythedev,項目名稱:COD-Warfare,代碼行數:22,代碼來源:Listeners.java

示例13: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:Tabinol,項目名稱:Factoid,代碼行數:22,代碼來源:PlayerListener.java

示例14: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:pavben,項目名稱:Bukkit-DropProtect,代碼行數:21,代碼來源:EntityDeathRespawnListener.java

示例15: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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();
	// }
}
 
開發者ID:toddharrison,項目名稱:5min2live,代碼行數:19,代碼來源:PlayerManager.java


注:本文中的org.bukkit.event.player.PlayerRespawnEvent.getPlayer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。