Skip to content

Commit

Permalink
Fixed a bug that the server did not stop automatically when a player …
Browse files Browse the repository at this point in the history
…was kicked by whitelist, etc.
  • Loading branch information
Kamesuta committed Jun 23, 2024
1 parent 206de47 commit ce8ac54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.kamesuta</groupId>
<artifactId>BungeePteroPower</artifactId>
<version>1.8-SNAPSHOT</version>
<version>1.9-SNAPSHOT</version>
<packaging>jar</packaging>

<name>BungeePteroPower</name>
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/com/kamesuta/bungeepteropower/PlayerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.api.event.ServerSwitchEvent;
import net.md_5.bungee.api.event.*;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

Expand Down Expand Up @@ -167,6 +164,14 @@ public void onPlayerDisconnect(PlayerDisconnectEvent event) {
onPlayerQuit(event.getPlayer(), targetServer);
}

@EventHandler(priority = (byte) 1024)
public void onPlayerKicked(ServerKickEvent event) {
// Called when a player disconnect from proxy IN the target server
ServerInfo targetServer = event.getKickedFrom();

onPlayerQuit(event.getPlayer(), targetServer);
}

@EventHandler
public void onServerSwitch(ServerSwitchEvent event) {
// Called when a player switch the server
Expand Down

0 comments on commit ce8ac54

Please sign in to comment.