Delete ArrayMap which filled no function
This commit is contained in:
@@ -46,7 +46,6 @@ import server.life.Monster;
|
||||
import server.maps.*;
|
||||
import server.partyquest.CarnivalFactory;
|
||||
import server.partyquest.CarnivalFactory.MCSkill;
|
||||
import tools.ArrayMap;
|
||||
import tools.PacketCreator;
|
||||
import tools.Pair;
|
||||
|
||||
@@ -422,7 +421,7 @@ public class StatEffect {
|
||||
ret.itemCon = DataTool.getInt("itemCon", source, 0);
|
||||
ret.itemConNo = DataTool.getInt("itemConNo", source, 0);
|
||||
ret.moveTo = DataTool.getInt("moveTo", source, -1);
|
||||
Map<MonsterStatus, Integer> monsterStatus = new ArrayMap<>();
|
||||
Map<MonsterStatus, Integer> monsterStatus = new EnumMap<>(MonsterStatus.class);
|
||||
if (skill) {
|
||||
switch (sourceid) {
|
||||
// BEGINNER
|
||||
|
||||
@@ -35,14 +35,11 @@ import server.maps.MapObject;
|
||||
import server.maps.MapObjectType;
|
||||
import server.maps.MapleMap;
|
||||
import server.maps.Mist;
|
||||
import tools.ArrayMap;
|
||||
import tools.Randomizer;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Danny (Leifde)
|
||||
@@ -196,7 +193,7 @@ public class MobSkill {
|
||||
// TODO: avoid output argument banishPlayersOutput
|
||||
public void applyEffect(Character player, Monster monster, boolean skill, List<Character> banishPlayersOutput) {
|
||||
Disease disease = null;
|
||||
Map<MonsterStatus, Integer> stats = new ArrayMap<>();
|
||||
Map<MonsterStatus, Integer> stats = new EnumMap<>(MonsterStatus.class);
|
||||
List<Integer> reflection = new ArrayList<>();
|
||||
switch (type) {
|
||||
case ATTACK_UP, ATTACK_UP_M, PAD -> stats.put(MonsterStatus.WEAPON_ATTACK_UP, x);
|
||||
@@ -419,7 +416,7 @@ public class MobSkill {
|
||||
}
|
||||
|
||||
public List<Integer> getSummons() {
|
||||
return new ArrayList<>(toSummon);
|
||||
return toSummon;
|
||||
}
|
||||
|
||||
public int getSpawnEffect() {
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
|
||||
Matthias Butz <matze@odinms.de>
|
||||
Jan Christian Meyer <vimes@odinms.de>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation version 3 as published by
|
||||
the Free Software Foundation. You may not use, modify or distribute
|
||||
this program under any other version of the GNU Affero General Public
|
||||
License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package tools;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
// TODO: remove
|
||||
public class ArrayMap<K, V> extends AbstractMap<K, V> {
|
||||
|
||||
static class Entry<K, V> implements Map.Entry<K, V> {
|
||||
protected K key;
|
||||
protected V value;
|
||||
|
||||
public Entry(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V setValue(V newValue) {
|
||||
V oldValue = value;
|
||||
value = newValue;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof Map.Entry<?, ?> e) {
|
||||
return (key == null ? e.getKey() == null : key.equals(e.getKey())) && (value == null ? e.getValue() == null : value.equals(e.getValue()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int keyHash = (key == null ? 0 : key.hashCode());
|
||||
int valueHash = (value == null ? 0 : value.hashCode());
|
||||
return keyHash ^ valueHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + "=" + value;
|
||||
}
|
||||
}
|
||||
|
||||
private Set<? extends java.util.Map.Entry<K, V>> entries = null;
|
||||
private final ArrayList<Entry<K, V>> list;
|
||||
|
||||
public ArrayMap() {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ArrayMap(Map<K, V> map) {
|
||||
list = new ArrayList<>();
|
||||
putAll(map);
|
||||
}
|
||||
|
||||
public ArrayMap(int initialCapacity) {
|
||||
list = new ArrayList<>(initialCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<java.util.Map.Entry<K, V>> entrySet() {
|
||||
if (entries == null) {
|
||||
entries = new AbstractSet<Entry<K, V>>() {
|
||||
@Override
|
||||
public void clear() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Entry<K, V>> iterator() {
|
||||
return list.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return list.size();
|
||||
}
|
||||
};
|
||||
}
|
||||
return (Set<java.util.Map.Entry<K, V>>) entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V put(K key, V value) {
|
||||
int size = list.size();
|
||||
Entry<K, V> entry = null;
|
||||
int i;
|
||||
if (key == null) {
|
||||
for (i = 0; i < size; i++) {
|
||||
entry = (list.get(i));
|
||||
if (entry.getKey() == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < size; i++) {
|
||||
entry = (list.get(i));
|
||||
if (key.equals(entry.getKey())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
V oldValue = null;
|
||||
if (i < size) {
|
||||
oldValue = entry.getValue();
|
||||
entry.setValue(value);
|
||||
} else {
|
||||
list.add(new Entry<>(key, value));
|
||||
}
|
||||
return oldValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user