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


Java PlayerRespawnEvent類代碼示例

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


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

示例1: onPlayerRespawn

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

示例2:

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

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

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

示例5: run

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

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

示例7: acceptChange

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

示例8: onPlayerRespawn

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

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

示例10: onPlayerRespawn

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

示例11: onPlayerRespawn

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

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

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

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

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


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