Make PlayerStorage.getAllCharacters() return a copy (#386)

* Clear continent drops when using !reloaddrops

* Return a copy on PlayerStorage.getAllCharacters()
This commit is contained in:
MedicOP
2019-02-03 13:50:51 +01:00
committed by Ronan Lana
parent a95728da84
commit 0a7aa8b05e
2 changed files with 5 additions and 5 deletions

View File

@@ -84,7 +84,7 @@ public class PlayerStorage {
public Collection<MapleCharacter> getAllCharacters() {
rlock.lock();
try {
return storage.values();
return new ArrayList<>(storage.values());
} finally {
rlock.unlock();
}

View File

@@ -293,7 +293,7 @@ public class World {
}
public void setExpRate(int exp) {
List<MapleCharacter> list = new LinkedList<>(getPlayerStorage().getAllCharacters());
Collection<MapleCharacter> list = getPlayerStorage().getAllCharacters();
for(MapleCharacter chr : list) {
if(!chr.isLoggedin()) continue;
@@ -311,7 +311,7 @@ public class World {
}
public void setDropRate(int drop) {
List<MapleCharacter> list = new LinkedList<>(getPlayerStorage().getAllCharacters());
Collection<MapleCharacter> list = getPlayerStorage().getAllCharacters();
for(MapleCharacter chr : list) {
if(!chr.isLoggedin()) continue;
@@ -337,8 +337,8 @@ public class World {
}
public void setMesoRate(int meso) {
List<MapleCharacter> list = new LinkedList<>(getPlayerStorage().getAllCharacters());
Collection<MapleCharacter> list = getPlayerStorage().getAllCharacters();
for(MapleCharacter chr : list) {
if(!chr.isLoggedin()) continue;
chr.revertWorldRates();