本文整理匯總了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);
}
}
示例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());
}
}
}
示例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
}
}
示例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());
}
}
示例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));
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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();
// }
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
}
}