Fix groupless players being inside dungeons; resolves #414

This commit is contained in:
Daniel Saukel 2018-06-12 00:17:07 +02:00
parent ef17d01ab8
commit 2da4e74261
2 changed files with 15 additions and 7 deletions

View File

@ -756,6 +756,13 @@ public class DGroup {
game.removeDGroup(this);
}
for (UUID uuid : players.getUniqueIds()) {
DGlobalPlayer member = dPlayers.getByUniqueId(uuid);
if (member instanceof DInstancePlayer) {
((DInstancePlayer) member).leave();
}
}
if (timeIsRunningTask != null) {
timeIsRunningTask.cancel();
}

View File

@ -31,6 +31,7 @@ import de.erethon.dungeonsxl.world.DEditWorld;
import de.erethon.dungeonsxl.world.DGameWorld;
import de.erethon.dungeonsxl.world.block.LockedDoor;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -520,17 +521,17 @@ public class DPlayerListener implements Listener {
if (isCitizensNPC(player)) {
return;
}
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
DGlobalPlayer dPlayer = dPlayers.getByPlayer(player);
if (dPlayer == null) {
World toWorld = event.getTo().getWorld();
if (dPlayer instanceof DInstancePlayer && ((DInstancePlayer) dPlayer).getWorld() == toWorld) {
return;
}
if (dPlayer.getWorld() == event.getTo().getWorld()) {
return;
}
if (!DPermission.hasPermission(player, DPermission.BYPASS)) {
if (plugin.getDWorlds().getInstanceByWorld(toWorld) != null) {
dPlayer.sendMessage(DMessage.ERROR_JOIN_GROUP.getMessage());
dPlayer.sendMessage(ChatColor.GOLD + DMessage.HELP_CMD_ENTER.getMessage());
event.setCancelled(true);
}
}