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); game.removeDGroup(this);
} }
for (UUID uuid : players.getUniqueIds()) {
DGlobalPlayer member = dPlayers.getByUniqueId(uuid);
if (member instanceof DInstancePlayer) {
((DInstancePlayer) member).leave();
}
}
if (timeIsRunningTask != null) { if (timeIsRunningTask != null) {
timeIsRunningTask.cancel(); 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.DGameWorld;
import de.erethon.dungeonsxl.world.block.LockedDoor; import de.erethon.dungeonsxl.world.block.LockedDoor;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -520,17 +521,17 @@ public class DPlayerListener implements Listener {
if (isCitizensNPC(player)) { if (isCitizensNPC(player)) {
return; 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; return;
} }
if (dPlayer.getWorld() == event.getTo().getWorld()) { if (plugin.getDWorlds().getInstanceByWorld(toWorld) != null) {
return; dPlayer.sendMessage(DMessage.ERROR_JOIN_GROUP.getMessage());
} dPlayer.sendMessage(ChatColor.GOLD + DMessage.HELP_CMD_ENTER.getMessage());
if (!DPermission.hasPermission(player, DPermission.BYPASS)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }