示例#1
0
 @EventHandler
 public void onServerLeave(PlayerDisconnectEvent event) {
   String name = event.getPlayer().getName();
   String ip = event.getPlayer().getAddress().getHostString();
   PMCommand.filter.remove(name);
   Data.storeLastSeen(name);
   Data.storeIP(name, ip);
 }
 @EventHandler
 public void onPlayerLogout(PlayerDisconnectEvent event) {
   handleConnection(event.getPlayer().getPendingConnection());
 }
  @EventHandler(priority = Byte.MAX_VALUE)
  public void onLeave(PlayerDisconnectEvent e) {

    uuidMap.remove(e.getPlayer().getUniqueId());
    nameMap.remove(e.getPlayer().getName());
  }
示例#4
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onDisconnect(PlayerDisconnectEvent event) {
   manager.onDisconnect(event.getPlayer());
 }
	/**
	 * Will be executed on player disconnect
	 * 
	 * @author Simonsator
	 * @version 1.0.0
	 * @param e
	 *            The disconnect event
	 * @throws SQLException
	 *             Can throw a {@link SQLException}
	 */
	@EventHandler
	public void onPlayerDisconnect(PlayerDisconnectEvent e) throws SQLException {
		ProxiedPlayer player = e.getPlayer();
		if (PartyManager.getParty(player) != null) {
			PlayerParty party = PartyManager.getParty(player);
			if (party.isleader(player)) {
				ArrayList<ProxiedPlayer> liste = party.getPlayer();
				if (liste.size() > 1) {
					ProxiedPlayer newLeader = liste.get(0);
					for (ProxiedPlayer p : party.getPlayer()) {
						if (Main.main.language.equalsIgnoreCase("english")) {
							p.sendMessage(new TextComponent(Main.main.partyPrefix
									+ "The Leader has left the Party. The new Leader is "
									+ newLeader.getDisplayName() + "."));
						} else {
							if (Main.main.language.equalsIgnoreCase("own")) {
								p.sendMessage(new TextComponent(Main.main.partyPrefix
										+ Main.main.messagesYml.getString("Party.Command.Leave.NewLeaderIs")
												.replace("[NEWLEADER]", newLeader.getDisplayName())));
							} else {
								p.sendMessage(new TextComponent(Main.main.partyPrefix
										+ "Der Leader hat die Party verlassen. Der neue Leader ist "
										+ newLeader.getDisplayName() + "."));
							}
						}
					}
					party.setLeader(newLeader);
					liste.remove(newLeader);
					party.setPlayer(liste);
				} else {
					for (ProxiedPlayer p : party.getPlayer()) {
						if (Main.main.language.equalsIgnoreCase("english")) {
							p.sendMessage(new TextComponent(Main.main.partyPrefix
									+ "�he �arty �as �issolved �ecause �f �o �ess �layers."));
						} else {
							if (Main.main.language.equalsIgnoreCase("own")) {
								p.sendMessage(new TextComponent(Main.main.partyPrefix + Main.main.messagesYml
										.getString("Party.Command.General.DissolvedPartyCauseOfNotEnoughPlayers")));
							} else {
								p.sendMessage(new TextComponent(Main.main.partyPrefix
										+ "�ie �arty �urde �egen �u �enig �itgliedern �ufgel鰏t."));
							}
						}
					}
					PartyManager.deleteParty(party);
				}
			} else {
				party.removePlayer(player);
				for (ProxiedPlayer p : party.getPlayer()) {
					if (Main.main.language.equalsIgnoreCase("english")) {
						p.sendMessage(new TextComponent(Main.main.partyPrefix + "The player �
								+ player.getDisplayName() + " has left the party."));
					} else {
						if (Main.main.language.equalsIgnoreCase("own")) {
							p.sendMessage(new TextComponent(Main.main.partyPrefix
									+ Main.main.messagesYml.getString("Party.Command.General.PlayerHasLeftTheParty")
											.replace("[PLAYER]", player.getDisplayName())));
						} else {
							p.sendMessage(new TextComponent(Main.main.partyPrefix + "Der Spieler �
									+ player.getDisplayName() + " hat die Party verlassen."));
						}
					}
				}

				if (Main.main.language.equalsIgnoreCase("english")) {
					party.getleader().sendMessage(new TextComponent(Main.main.partyPrefix + "The player �
							+ player.getDisplayName() + " has left the party."));
				} else {
					if (Main.main.language.equalsIgnoreCase("own")) {
						party.getleader()
								.sendMessage(new TextComponent(Main.main.partyPrefix
										+ Main.main.messagesYml.getString("Party.Command.General.PlayerHasLeftTheParty")
												.replace("[PLAYER]", player.getDisplayName())));
					} else {
						party.getleader().sendMessage(new TextComponent(Main.main.partyPrefix + "Der Spieler �
								+ player.getDisplayName() + " hat die Party verlassen."));
					}
				}
				ArrayList<ProxiedPlayer> liste = party.getPlayer();
				if (liste.size() == 1) {
					if (Main.main.language.equalsIgnoreCase("english")) {
						party.getleader().sendMessage(new TextComponent(Main.main.partyPrefix
								+ "�he �arty �as �issolved �ecause �f �o �ess �layers."));
					} else {
						if (Main.main.language.equalsIgnoreCase("own")) {
							party.getleader()
									.sendMessage(new TextComponent(Main.main.partyPrefix + Main.main.messagesYml
											.getString("Party.Command.General.DissolvedPartyCauseOfNotEnoughPlayers")));
						} else {
							party.getleader().sendMessage(new TextComponent(Main.main.partyPrefix
									+ "�ie �arty �urde �egen �u �enig �itgliedern �ufgel鰏t."));
						}
					}
				}
			}
		}
		try {
			int[] freundeArrayID = Main.main.verbindung
					.getFreundeArray(Main.main.verbindung.getIDByPlayerName(player.getName()));
			if (freundeArrayID.length == 0) {
				return;
			}
			for (int i = 0; i < freundeArrayID.length; i++) {
				String befreundeterSpieler = Main.main.verbindung.getNameDesSpielers(freundeArrayID[i]);
				ProxiedPlayer freundGeladen = BungeeCord.getInstance().getPlayer(befreundeterSpieler);
				if (freundGeladen != null) {
					if (Main.main.language.equalsIgnoreCase("english")) {
						freundGeladen.sendMessage(new TextComponent("��Friends�" + ChatColor.RESET
								+ " �our friend " + player.getDisplayName() + " �s �ow offline."));
					} else {
						if (Main.main.language.equalsIgnoreCase("own")) {
							freundGeladen.sendMessage(new TextComponent(Main.main.friendsPrefix
									+ Main.main.messagesYml.getString("Friends.General.PlayerIsNowOffline")
											.replace("[PLAYER]", player.getDisplayName())));
						} else {
							freundGeladen.sendMessage(new TextComponent("��Friends�" + ChatColor.RESET
									+ " �er Freund " + player.getDisplayName() + " �st �un Offline."));
						}
					}
				}
			}
		} catch (NullPointerException exceptionNull) {

		}
	}