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 server.maps.MapleMap;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class WarpAreaCommand extends Command {
|
public class WarpAreaCommand extends Command {
|
||||||
{
|
{
|
||||||
@@ -52,7 +54,9 @@ public class WarpAreaCommand extends Command {
|
|||||||
|
|
||||||
Point pos = player.getPosition();
|
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) {
|
if (victim.getPosition().distanceSq(pos) <= 50000) {
|
||||||
victim.saveLocationOnWarp();
|
victim.saveLocationOnWarp();
|
||||||
victim.changeMap(target, target.getRandomPlayerSpawnpoint());
|
victim.changeMap(target, target.getRandomPlayerSpawnpoint());
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import client.MapleClient;
|
|||||||
import client.command.Command;
|
import client.command.Command;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class WarpMapCommand extends Command {
|
public class WarpMapCommand extends Command {
|
||||||
{
|
{
|
||||||
setDescription("");
|
setDescription("");
|
||||||
@@ -48,7 +51,9 @@ public class WarpMapCommand extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MapleCharacter victim : player.getMap().getCharacters()) {
|
Collection<MapleCharacter> characters = new ArrayList<>(player.getMap().getCharacters());
|
||||||
|
|
||||||
|
for (MapleCharacter victim : characters) {
|
||||||
victim.saveLocationOnWarp();
|
victim.saveLocationOnWarp();
|
||||||
victim.changeMap(target, target.getRandomPlayerSpawnpoint());
|
victim.changeMap(target, target.getRandomPlayerSpawnpoint());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import client.MapleClient;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import server.maps.MapleMap;
|
import server.maps.MapleMap;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public class ReloadMapCommand extends Command {
|
public class ReloadMapCommand extends Command {
|
||||||
{
|
{
|
||||||
setDescription("");
|
setDescription("");
|
||||||
@@ -36,11 +39,12 @@ public class ReloadMapCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(MapleClient c, String[] params) {
|
public void execute(MapleClient c, String[] params) {
|
||||||
MapleCharacter player = c.getPlayer();
|
MapleCharacter player = c.getPlayer();
|
||||||
MapleMap oldMap = c.getPlayer().getMap();
|
|
||||||
MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId());
|
MapleMap newMap = c.getChannelServer().getMapFactory().resetMap(player.getMapId());
|
||||||
int callerid = c.getPlayer().getId();
|
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.saveLocationOnWarp();
|
||||||
chr.changeMap(newMap);
|
chr.changeMap(newMap);
|
||||||
if (chr.getId() != callerid)
|
if (chr.getId() != callerid)
|
||||||
|
|||||||
Reference in New Issue
Block a user