use of net.md_5.bungee.api.event.PlayerDisconnectEvent in project BungeeCord by SpigotMC.
the class UpstreamBridge method disconnected.
@Override
public void disconnected(ChannelWrapper channel) throws Exception {
// We lost connection to the client
PlayerDisconnectEvent event = new PlayerDisconnectEvent(con);
bungee.getPluginManager().callEvent(event);
con.getTabListHandler().onDisconnect();
BungeeCord.getInstance().removeConnection(con);
if (con.getServer() != null) {
// Manually remove from everyone's tab list
// since the packet from the server arrives
// too late
// TODO: This should only done with server_unique
// tab list (which is the only one supported
// currently)
PlayerListItem packet = new PlayerListItem();
packet.setAction(PlayerListItem.Action.REMOVE_PLAYER);
PlayerListItem.Item item = new PlayerListItem.Item();
item.setUuid(con.getUniqueId());
packet.setItems(new PlayerListItem.Item[] { item });
for (ProxiedPlayer player : con.getServer().getInfo().getPlayers()) {
player.unsafe().sendPacket(packet);
}
con.getServer().disconnect("Quitting");
}
}
use of net.md_5.bungee.api.event.PlayerDisconnectEvent in project SubServers-2 by ME1312.
the class ExProxy method disconnected.
@EventHandler(priority = Byte.MAX_VALUE)
public void disconnected(PlayerDisconnectEvent e) {
UUID id = e.getPlayer().getUniqueId();
fallback.remove(id);
SubCommand.permitted.remove(id);
synchronized (rPlayers) {
if (rPlayers.containsKey(id) && (!rPlayerLinkP.containsKey(id) || rPlayerLinkP.get(id).equalsIgnoreCase(api.getName()))) {
CachedPlayer player = rPlayers.get(id);
rPlayerLinkS.remove(id);
rPlayerLinkP.remove(id);
rPlayers.remove(id);
if (api.getSubDataNetwork()[0] != null) {
((SubDataClient) api.getSubDataNetwork()[0]).sendPacket(new PacketExSyncPlayer(false, player));
}
}
}
}
use of net.md_5.bungee.api.event.PlayerDisconnectEvent in project MSLibrary by TravelRPG.
the class JoinQuitListener method onQuit.
@EventHandler
public void onQuit(PlayerDisconnectEvent event) {
if (event.getPlayer().getServer() == null)
return;
int port = event.getPlayer().getServer().getAddress().getPort();
BCSPProxyAPI.getInst().sendPacketToSpecificServers(port, new ProxyQuitPacket(event.getPlayer().getUniqueId(), event.getPlayer().getName()));
}
use of net.md_5.bungee.api.event.PlayerDisconnectEvent in project CloudNet-v3 by CloudNetService.
the class BungeeCloudNetCloudPermissionsPlayerListener method handle.
@EventHandler
public void handle(PlayerDisconnectEvent event) {
UUID uniqueId = event.getPlayer().getUniqueId();
this.permissionsManagement.getCachedPermissionUsers().remove(uniqueId);
}
use of net.md_5.bungee.api.event.PlayerDisconnectEvent in project DiscordBot by LXGaming.
the class PlayerListener method onPlayerDisconnect.
// EventPriority is on Lowest due to LuckPerms unloading player data which causes permissions to be null.
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerDisconnect(PlayerDisconnectEvent event) {
if (!DiscordBotCore.getInstance().getConfiguration().isPlayerQuit() || event.getPlayer().hasPermission("DiscordBot.Silent")) {
return;
}
Message message = new Message().setChannel(DiscordBotCore.getInstance().getConfiguration().getChannels().get("Global").getChannel()).setFormat(DiscordBotCore.getInstance().getConfiguration().getPlayerFormat().get("Quit")).setName(event.getPlayer().getName()).setNick(event.getPlayer().getDisplayName()).setServer("Unknown").setMessage("Quit").setDiscord(true).setMinecraft(false).setConsole(false).setRedis(false);
if (event.getPlayer().getServer() != null && event.getPlayer().getServer().getInfo() != null) {
message.setServer(event.getPlayer().getServer().getInfo().getName());
}
DiscordBotCore.getInstance().getMessageSender().sendMessage(message);
return;
}
Aggregations