本文整理匯總了Java中org.bukkit.event.player.PlayerRespawnEvent.getRespawnLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java PlayerRespawnEvent.getRespawnLocation方法的具體用法?Java PlayerRespawnEvent.getRespawnLocation怎麽用?Java PlayerRespawnEvent.getRespawnLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.player.PlayerRespawnEvent
的用法示例。
在下文中一共展示了PlayerRespawnEvent.getRespawnLocation方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPlayerRespawn
import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
public void onPlayerRespawn(PlayerRespawnEvent event) {
if (!plugin.config.handle_player_respawn) {
return;
}
Location respawnLocation = event.getRespawnLocation();
Location defaultLocation = respawnLocation.getWorld().getSpawnLocation();
if (respawnLocation.equals(defaultLocation) || respawnLocation.distance(defaultLocation) <= 2) {
SpawnLocation spawn = plugin.getPlayerSpawn(event.getPlayer());
event.setRespawnLocation(spawn.getLocation());
plugin.getLogger().info(I18n.format("log.respawn", event.getPlayer().getName(), spawn.getName()));
}
}
示例2: onPlayerTeleport
import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerTeleport(final PlayerRespawnEvent event)
{
if(event.getPlayer() != null && event.getRespawnLocation() != null)
{
// final AnniPlayer p = AnniPlayer.getPlayer(event.getPlayer().getUniqueId());
// if(p != null)
// {
// if(permanentBar)
// BarAPI.sendPermDragon(event.getPlayer());
// else
handleTeleport(event.getPlayer(), event.getRespawnLocation().clone());
// }
}
}
示例3: onPlayerRespawn2
import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
/**
* On player respawn2.
*
* @param event
* the event
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// For land listener
public void onPlayerRespawn2(PlayerRespawnEvent event) {
Player player = event.getPlayer();
PlayerConfEntry entry = playerConf.get(player);
Location loc = event.getRespawnLocation();
updatePosInfo(event, entry, loc, false);
}
示例4: onRespawn
import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
if (!this.module.spawnLoc.isPresent()) { return; }
Location respawnLoc = event.getRespawnLocation();
if (this.module.spawnLoc.isPresent()) {
if (!event.isBedSpawn() || respawnLoc.getY() < 4) {
respawnLoc = this.module.spawnLoc.get();
}
}
event.setRespawnLocation(respawnLoc);
}
示例5: PlayerRespawn
import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void PlayerRespawn(final PlayerRespawnEvent event) {
final Player player = event.getPlayer();
if (isLoggedInRespawn(player)) {
return;
}
final Location respawnLocation = event.getRespawnLocation();
if (respawnLocation != null && respawnLocation.getWorld() != null) {
if (plugin.isForceSaveLoginEnabled()) {
savelogin.put(player.getName().toLowerCase(), respawnLocation.clone());
final Location tempSpawnLocation = plugin.getSaveLoginLocation(respawnLocation.getWorld());
event.setRespawnLocation(tempSpawnLocation);
setMovementBlocker(player, tempSpawnLocation);
}
else {
setMovementBlocker(player, respawnLocation);
}
}
final AuthRequestor requestor;
if (plugin.hasPlayerData(player)) {
requestor = new AuthRequestor(plugin, player, "LOGIN.REQUEST");
}
else {
requestor = new AuthRequestor(plugin, player, "REGISTER.REQUEST");
}
if (plugin.getRepeatAuthRequests() > 0) {
requestor.start(5, plugin.getRepeatAuthRequests());
}
else {
requestor.start(5);
}
}
示例6: callRespawnEvent
import org.bukkit.event.player.PlayerRespawnEvent; //導入方法依賴的package包/類
@Override
public Location callRespawnEvent(final Player player, final Location loc, final boolean bedSpawn)
{
final PlayerRespawnEvent pre = new PlayerRespawnEvent(player, loc, bedSpawn);
getServer().getPluginManager().callEvent(pre);
return pre.getRespawnLocation();
}