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