Fix MapleMap.getCharacters() CME in 3 commands (#369)
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user