Fix MapleMap.getCharacters() CME in 3 commands (#369)

This commit is contained in:
MedicOP
2019-01-26 01:18:43 +01:00
committed by Ronan Lana
parent 5d63f0bd9d
commit 08e4a05641
3 changed files with 17 additions and 4 deletions

View File

@@ -29,6 +29,8 @@ import client.command.Command;
import server.maps.MapleMap;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collection;
public class WarpAreaCommand extends Command {
{
@@ -52,7 +54,9 @@ public class WarpAreaCommand extends Command {
Point pos = player.getPosition();
for (MapleCharacter victim : player.getMap().getCharacters()) {
Collection<MapleCharacter> characters = new ArrayList<>(player.getMap().getCharacters());
for (MapleCharacter victim : characters) {
if (victim.getPosition().distanceSq(pos) <= 50000) {
victim.saveLocationOnWarp();
victim.changeMap(target, target.getRandomPlayerSpawnpoint());

View File

@@ -28,6 +28,9 @@ import client.MapleClient;
import client.command.Command;
import server.maps.MapleMap;
import java.util.ArrayList;
import java.util.Collection;
public class WarpMapCommand extends Command {
{
setDescription("");
@@ -48,7 +51,9 @@ public class WarpMapCommand extends Command {
return;
}
for (MapleCharacter victim : player.getMap().getCharacters()) {
Collection<MapleCharacter> characters = new ArrayList<>(player.getMap().getCharacters());
for (MapleCharacter victim : characters) {
victim.saveLocationOnWarp();
victim.changeMap(target, target.getRandomPlayerSpawnpoint());
}

View File

@@ -28,6 +28,9 @@ import client.MapleClient;
import client.MapleCharacter;
import server.maps.MapleMap;
import java.util.ArrayList;
import java.util.Collection;
public class ReloadMapCommand extends Command {
{
setDescription("");
@@ -36,11 +39,12 @@ public class ReloadMapCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
MapleCharacter player = c.getPlayer();
MapleMap oldMap = c.getPlayer().getMap();
MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId());
int callerid = c.getPlayer().getId();
for (MapleCharacter chr : oldMap.getCharacters()) {
Collection<MapleCharacter> characters = new ArrayList<>(player.getMap().getCharacters());
for (MapleCharacter chr : characters) {
chr.saveLocationOnWarp();
chr.changeMap(newMap);
if (chr.getId() != callerid)