本文整理汇总了Java中org.bukkit.event.player.PlayerQuitEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerQuitEvent.getPlayer方法的具体用法?Java PlayerQuitEvent.getPlayer怎么用?Java PlayerQuitEvent.getPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerQuitEvent
的用法示例。
在下文中一共展示了PlayerQuitEvent.getPlayer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePlayerQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
private void handlePlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
teams.values().forEach(t -> {
t.unsubscribe(player, true);
t.removePlayer(player);
});
objectives.values().forEach(o -> o.unsubscribe(player, true));
Map<String, PacketScoreboardObjective> playerObjectives = this.playerObjectives.remove(player.getUniqueId());
if (playerObjectives != null) {
playerObjectives.values().forEach(o -> o.unsubscribe(player, true));
}
Map<String, PacketScoreboardTeam> playerTeams = this.playerTeams.remove(player.getUniqueId());
if (playerTeams != null) {
playerTeams.values().forEach(t -> {
t.unsubscribe(player, true);
t.removePlayer(player);
});
}
}
示例2: onQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
PlaceHolderSetup(player);
if (enableQuitMessage) {
broadcastQuitMessage("chatassets.loghandler.quitmessage.receive", event);
}
int index = 0;
if (Commander.msgsender.contains(player)) {
index = Commander.msgsender.indexOf(player);
Commander.msgsender.remove(index);
Commander.msgreceiver.remove(index);
} else if (Commander.msgreceiver.contains(player)) {
index = Commander.msgreceiver.indexOf(player);
Commander.msgsender.remove(index);
Commander.msgreceiver.remove(index);
}
}
示例3: hideAbandonedServer
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void hideAbandonedServer(PlayerQuitEvent event) {
final Server local = minecraftService.getLocalServer();
if(local.startup_visibility() != ServerDoc.Visibility.PUBLIC && // If server was initially not public and
local.visibility() == ServerDoc.Visibility.PUBLIC && // server was made public and
event.getPlayer().hasPermission(VISIBILITY_PERMISSION)) { // someone with perms to do that is leaving...
// ...check if there is still someone online with that permission
for(Player player : event.getPlayer().getServer().getOnlinePlayers()) {
// If someone else with perms is online, we're cool
if(player != event.getPlayer() && player.hasPermission(VISIBILITY_PERMISSION)) return;
}
// If nobody with perms is online, make the server non-public again
logger.info("Reverting server visibility to " + local.startup_visibility() + " because nobody with permissions is online");
setVisibility(local.startup_visibility());
}
}
示例4: onQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onQuit(PlayerQuitEvent e) {
Player p = e.getPlayer();
if (FakeAPI.getFakeEntities().containsKey(p.getName())) {
PlayerFakeUtil.unFollowPlayer(p);
PlayerFakeUtil.normalizeLook(p);
PlayerFakeUtil.cancelAllSplittedTasks(p);
ArmorstandFakeUtil.unFollowArmorstand(p);
ArmorstandFakeUtil.cancelAllSplittedTasks(p);
EndercrystalFakeUtil.cancelAllSplittedTasks(p);
MobFakeUtil.unFollowPlayer(p);
MobFakeUtil.normalizeLook(p);
MobFakeUtil.cancelAllSplittedTasks(p);
BigItemFakeUtil.cancelAllSplittedTasks(p);
FakeAPI.getFakeEntities().remove(p.getName());
}
}
示例5: onLeave
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onLeave(PlayerQuitEvent event) {
Player player = event.getPlayer();
event.setQuitMessage(null);
Game game = Skywars.getInstance().getGame(player);
if (game != null && game.getGamePlayer(player) != null) {
GamePlayer gamePlayer = game.getGamePlayer(player);
if (gamePlayer.isTeamClass()) {
if (gamePlayer.getTeam().isPlayer(player)) {
player.damage(player.getMaxHealth()); // Kill player to make game process this as a death
}
} else {
if (gamePlayer.getPlayer() == player) {
player.damage(player.getMaxHealth()); // Kill player to make game process this as a death
}
}
}
}
示例6: onPlayerLogout
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerLogout (PlayerQuitEvent event)
{
Player eventPlayer = event.getPlayer ();
PlayerManager.Instance ().removePlayer (eventPlayer.getUniqueId ());
}
示例7: onQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
if (this.profiles.containsKey(player.getUniqueId())) {
this.profiles.get(player.getUniqueId()).save(new GenericCallback() {
@Override
public void call(boolean result) {
profiles.remove(player.getUniqueId());
}
});
}
}
示例8: dec
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void dec(PlayerQuitEvent evt){
Player player = evt.getPlayer();
names.remove(player.getName());
players.remove(player);
if (!quit.isEmpty()) {
for (QuitReactor re : quit) re.react(evt);
}
}
示例9: onQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onQuit(PlayerQuitEvent e){
Player p = e.getPlayer();
RagePlayer u = RageGames.getPlayer(p);
plugin.getGm().removePlayerFromGame(u);
RageGames.players.remove(u);
Utils.broadcastMsg("&7Ha salido del juego &e" + p.getDisplayName() + " &3(&b" + plugin.getGm().getPlaying().size() + "&d/&b" + plugin.getAm().getMaxPlayers() + "&3)");
}
示例10: onQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onQuit(PlayerQuitEvent e){
Player p = e.getPlayer();
if(PlayerManager.confirmationReady.contains(p)){
PlayerManager.confirmationReady.remove(p);
}
}
示例11: onPlayerQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
Craft craft = Craft.getPlayerCraft(player);
if (craft != null) {
if (craft.isNameOnBoard.get(player.getName())) {
Craft.reboardNames.put(player.getName(), craft);
craft.isNameOnBoard.put(player.getName(), false);
if (craft.driverName == player.getName()) {
craft.haveControl = false;
craft.releaseHelm();
}
boolean abandonCheck = true;
for (String s : craft.isNameOnBoard.keySet()) {
if (craft.isNameOnBoard.get(s)) {
abandonCheck = false;
}
}
if (abandonCheck) {
craft.abandoned = true;
craft.captainAbandoned = true;
} else if (player.getName() == craft.captainName) {
craft.captainAbandoned = true;
}
}
for (Periscope p : craft.periscopes) {
if (p.user == player) {
p.user = null;
break;
}
}
}
}
示例12: onPlayerQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
/**
* Remove the player from all maps and lists.
*
* @param event the event.
*/
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
Arc.getExemptionManager().clearData(player);
Arc.getViolationHandler().removeViolationData(player);
// clear check data.
MovingData.removeData(player);
FightData.removeData(player);
InventoryData.removeData(player);
Arc.getViolationHandler().clearPlayerData(player);
}
示例13: onPlayerQuitEvent
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerQuitEvent(PlayerQuitEvent event) {
Player player = event.getPlayer();
PlayerTab playerTab = PlayerTab.getByPlayer(player);
if (playerTab != null) {
for (Team team : new HashSet<>(playerTab.getScoreboard().getTeams())) {
team.unregister();
}
PlayerTab.getPlayerTabs().remove(playerTab);
Bukkit.getPluginManager().callEvent(new PlayerTabRemoveEvent(playerTab));
}
}
示例14: onQuit
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
PlayerScoreboard board = null;
if ((board = scoreboards.remove(player.getUniqueId())) != null) {
board.disable();
}
}
示例15: onDisconnect
import org.bukkit.event.player.PlayerQuitEvent; //导入方法依赖的package包/类
@EventHandler
public void onDisconnect(PlayerQuitEvent event) {
Player player = event.getPlayer();
if (isInProgress(player)) {
popInProgressCommit(player).cleanup();
}
popSignEditCommit(player);
}