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


Java PlayerRespawnEvent.setRespawnLocation方法代碼示例

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


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

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

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

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

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

示例5: respawn

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

示例6: onPlayerRespawn

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

示例7: onPlayerRespawn

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

示例8: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
private void onPlayerRespawn(PlayerRespawnEvent event) {

    UUID playerId = event.getPlayer().getUniqueId();

    // release prisoner
    if (isLateRelease(playerId)) {
        release(playerId);
    }
    else if (isPrisoner(playerId)) {

        // send prisoner back to jail
        IJailSession session = getSession(playerId);
        if (session != null) {
            Location location = session.getJail().getRandomTeleport();
            if (location != null) {
                event.setRespawnLocation(location);
            }
        }
    }
}
 
開發者ID:JCThePants,項目名稱:NucleusFramework,代碼行數:22,代碼來源:NucleusJailProvider.java

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

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

示例11: onPlayerRespawn

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

示例12: onPlayerRespawn

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

示例13: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@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);

}
 
開發者ID:RoyalDev,項目名稱:PopulationDensity,代碼行數:23,代碼來源:PlayerEventHandler.java

示例14: onRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
    if (arena.started) {
        if (teams.getTeam(event.getPlayer()).equals("blue")) {
            event.setRespawnLocation(arena.blueSpawn);
        }
        else if (teams.getTeam(event.getPlayer()).equals("purple")) {
            event.setRespawnLocation(arena.purpleSpawn);
        }
        teams.getChampion(event.getPlayer()).returnInventory();
    }
    else {
        if (teams.getTeam(event.getPlayer()).equals("blue")) {
            event.setRespawnLocation(teams.blueLobby);
        }
        else if (teams.getTeam(event.getPlayer()).equals("purple")) {
            event.setRespawnLocation(teams.purpleLobby);
        }
    }
    
}
 
開發者ID:GaryQian,項目名稱:League,代碼行數:22,代碼來源:GeneralListeners.java

示例15: onPlayerRespawn

import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event){
	if(Minigame.getCurrentMinigame()!=null){
		switch(Minigame.getCurrentMinigame().getMap().getType()){
		case CIRCLE_OF_BOOM:
			event.setRespawnLocation(Minigame.getObservers().getSpawn());
			break;
		case KEY_QUEST:
			break;
		case WATER_THE_MONUMENT:
			break;
		default:
			break;

		}
	}
}
 
開發者ID:tatanpoker09,項目名稱:TCMinigames,代碼行數:18,代碼來源:PlayerListener.java


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