mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fixed player leaving / group membership
This commit is contained in:
parent
01c869f897
commit
7ffec6412b
@ -461,25 +461,21 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!(dPlayers.getByPlayer(player) instanceof DInstancePlayer)) {
|
||||
return;
|
||||
}
|
||||
DInstancePlayer dPlayer = (DInstancePlayer) dPlayers.getByPlayer(player);
|
||||
|
||||
if (dPlayer == null) {
|
||||
dPlayers.removePlayer(dPlayer);
|
||||
return;
|
||||
}
|
||||
|
||||
DGlobalPlayer dPlayer = dPlayers.getByPlayer(player);
|
||||
DGroup dGroup = DGroup.getByPlayer(player);
|
||||
|
||||
// Check GameWorld
|
||||
Game game = Game.getByWorld(player.getWorld());
|
||||
if (game != null) {
|
||||
|
||||
if (!(dPlayer instanceof DInstancePlayer)) {
|
||||
dPlayers.removePlayer(dPlayer);
|
||||
if (dGroup != null) {
|
||||
dGroup.removePlayer(player);
|
||||
}
|
||||
|
||||
} else if (game != null) {
|
||||
int timeUntilKickOfflinePlayer = game.getRules().getTimeUntilKickOfflinePlayer();
|
||||
|
||||
if (timeUntilKickOfflinePlayer == 0) {
|
||||
dPlayer.leave();
|
||||
((DGamePlayer) dPlayer).leave();
|
||||
|
||||
} else if (timeUntilKickOfflinePlayer > 0) {
|
||||
dGroup.sendMessage(DMessages.PLAYER_OFFLINE.getMessage(dPlayer.getPlayer().getName(), String.valueOf(timeUntilKickOfflinePlayer)), player);
|
||||
@ -490,10 +486,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
} else if (dPlayer instanceof DEditPlayer) {
|
||||
dPlayer.leave();
|
||||
|
||||
} else if (dGroup != null) {
|
||||
dGroup.removePlayer(player);
|
||||
((DEditPlayer) dPlayer).leave();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,11 @@ public class AnnouncerStartGameTask extends BukkitRunnable {
|
||||
dGroup.setGameWorld(game.getWorld());
|
||||
}
|
||||
|
||||
if (game == null) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : game.getPlayers()) {
|
||||
new DGamePlayer(player, game.getWorld());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user