Riizade/config file (#520)

* added POJO + yaml file

* made config members public

* switched to yaml

* modified files to use YamlConfig over ServerConstants

* removed constants from ServerConstants

* removed unused imports

* removed unused import

* removed world ini

* removed now unused .ini files

* fixed docker-launch.sh

* added jackson dependency JARs

* fixed errors

* removed unused server config values, added world defaults

* don't use env variables for docker

* fixed package imports/specifiers for js files
This commit is contained in:
Adam James-Liebau Johnson
2019-09-20 20:49:24 -03:00
committed by Ronan Lana
parent e169971384
commit 181573dc74
163 changed files with 1531 additions and 1113 deletions
+3 -1
View File
@@ -23,6 +23,8 @@ package server.maps;
import java.awt.Point;
import java.util.Collection;
import config.YamlConfig;
import tools.Pair;
import client.MapleCharacter;
@@ -50,7 +52,7 @@ public class MapleDoor {
this.target = owner.getMap();
if(target.canDeployDoor(targetPosition)) {
if(ServerConstants.USE_ENFORCE_MDOOR_POSITION) {
if(YamlConfig.config.server.USE_ENFORCE_MDOOR_POSITION) {
posStatus = target.getDoorPositionStatus(targetPosition);
}
+4 -3
View File
@@ -31,6 +31,7 @@ import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.MapleKarmaManipulator;
import client.processor.FredrickProcessor;
import com.mysql.jdbc.Statement;
import config.YamlConfig;
import constants.ServerConstants;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -232,7 +233,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
chr.announce(MaplePacketCreator.updateHiredMerchant(this, chr));
}
if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) {
if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) {
chr.saveCharToDB(false);
}
}
@@ -287,7 +288,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
pItem.setDoesExist(false);
}
if(ServerConstants.USE_ANNOUNCE_SHOPITEMSOLD) { // idea thanks to Vcoc
if(YamlConfig.config.server.USE_ANNOUNCE_SHOPITEMSOLD) { // idea thanks to Vcoc
announceItemSold(newItem, price, getQuantityLeft(pItem.getItem().getItemId()));
}
@@ -448,7 +449,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
e.printStackTrace();
}
if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) {
if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) {
c.getPlayer().saveCharToDB(false);
}
+12 -11
View File
@@ -31,6 +31,7 @@ import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import config.YamlConfig;
import constants.GameConstants;
import constants.ItemConstants;
import constants.ServerConstants;
@@ -251,7 +252,7 @@ public class MapleMap {
private static double getRangedDistance() {
return(ServerConstants.USE_MAXRANGE ? Double.POSITIVE_INFINITY : 722500);
return(YamlConfig.config.server.USE_MAXRANGE ? Double.POSITIVE_INFINITY : 722500);
}
public List<MapleMapObject> getMapObjectsInRect(Rectangle box, List<MapleMapObjectType> types) {
@@ -752,7 +753,7 @@ public class MapleMap {
final List<MonsterDropEntry> dropEntry = new ArrayList<>();
final List<MonsterDropEntry> visibleQuestEntry = new ArrayList<>();
final List<MonsterDropEntry> otherQuestEntry = new ArrayList<>();
sortDropEntries(ServerConstants.USE_SPAWN_RELEVANT_LOOT ? mob.retrieveRelevantDrops() : mi.retrieveEffectiveDrop(mob.getId()), dropEntry, visibleQuestEntry, otherQuestEntry, chr);
sortDropEntries(YamlConfig.config.server.USE_SPAWN_RELEVANT_LOOT ? mob.retrieveRelevantDrops() : mi.retrieveEffectiveDrop(mob.getId()), dropEntry, visibleQuestEntry, otherQuestEntry, chr);
registerMobItemDrops(droptype, mobpos, chRate, pos, dropEntry, visibleQuestEntry, otherQuestEntry, globalEntry, chr, mob);
}
@@ -786,7 +787,7 @@ public class MapleMap {
expireItemsTask.cancel(false);
expireItemsTask = null;
if(ServerConstants.USE_SPAWN_LOOT_ON_ANIMATION) {
if(YamlConfig.config.server.USE_SPAWN_LOOT_ON_ANIMATION) {
mobSpawnLootTask.cancel(false);
mobSpawnLootTask = null;
}
@@ -846,16 +847,16 @@ public class MapleMap {
cleanItemMonitor();
}
}
}, ServerConstants.ITEM_MONITOR_TIME, ServerConstants.ITEM_MONITOR_TIME);
}, YamlConfig.config.server.ITEM_MONITOR_TIME, YamlConfig.config.server.ITEM_MONITOR_TIME);
expireItemsTask = TimerManager.getInstance().register(new Runnable() {
@Override
public void run() {
makeDisappearExpiredItemDrops();
}
}, ServerConstants.ITEM_EXPIRE_CHECK, ServerConstants.ITEM_EXPIRE_CHECK);
}, YamlConfig.config.server.ITEM_EXPIRE_CHECK, YamlConfig.config.server.ITEM_EXPIRE_CHECK);
if(ServerConstants.USE_SPAWN_LOOT_ON_ANIMATION) {
if(YamlConfig.config.server.USE_SPAWN_LOOT_ON_ANIMATION) {
lootLock.lock();
try {
mobLootEntries.clear();
@@ -898,7 +899,7 @@ public class MapleMap {
}
private void instantiateItemDrop(MapleMapItem mdrop) {
if(droppedItemCount.get() >= ServerConstants.ITEM_LIMIT_ON_MAP) {
if(droppedItemCount.get() >= YamlConfig.config.server.ITEM_LIMIT_ON_MAP) {
MapleMapObject mapobj;
do {
@@ -930,7 +931,7 @@ public class MapleMap {
}
private void registerItemDrop(MapleMapItem mdrop) {
droppedItems.put(mdrop, !everlast ? Server.getInstance().getCurrentTime() + ServerConstants.ITEM_EXPIRE_TIME : Long.MAX_VALUE);
droppedItems.put(mdrop, !everlast ? Server.getInstance().getCurrentTime() + YamlConfig.config.server.ITEM_EXPIRE_TIME : Long.MAX_VALUE);
}
private void unregisterItemDrop(MapleMapItem mdrop) {
@@ -975,7 +976,7 @@ public class MapleMap {
private void registerMobItemDrops(byte droptype, int mobpos, int chRate, Point pos, List<MonsterDropEntry> dropEntry, List<MonsterDropEntry> visibleQuestEntry, List<MonsterDropEntry> otherQuestEntry, List<MonsterGlobalDropEntry> globalEntry, MapleCharacter chr, MapleMonster mob) {
MobLootEntry mle = new MobLootEntry(droptype, mobpos, chRate, pos, dropEntry, visibleQuestEntry, otherQuestEntry, globalEntry, chr, mob);
if(ServerConstants.USE_SPAWN_LOOT_ON_ANIMATION) {
if(YamlConfig.config.server.USE_SPAWN_LOOT_ON_ANIMATION) {
int animationTime = mob.getAnimationTime("die1");
lootLock.lock();
@@ -2218,7 +2219,7 @@ public class MapleMap {
}
};
getWorldServer().registerTimedMapObject(expireKite, ServerConstants.KITE_EXPIRE_TIME);
getWorldServer().registerTimedMapObject(expireKite, YamlConfig.config.server.KITE_EXPIRE_TIME);
}
public final void spawnItemDrop(final MapleMapObject dropper, final MapleCharacter owner, final Item item, Point pos, final boolean ffaDrop, final boolean playerDrop) {
@@ -3680,7 +3681,7 @@ public class MapleMap {
System.out.println("----------------------------------");
*/
if(ServerConstants.USE_ENABLE_FULL_RESPAWN) {
if(YamlConfig.config.server.USE_ENABLE_FULL_RESPAWN) {
return (monsterSpawn.size() - spawnedMonstersOnMap.get());
}
+2 -1
View File
@@ -23,6 +23,7 @@ package server.maps;
import client.MapleClient;
import client.status.MonsterStatus;
import config.YamlConfig;
import constants.ServerConstants;
import java.awt.Rectangle;
@@ -256,7 +257,7 @@ public class MapleReactor extends AbstractMapleMapObject {
cancelReactorTimeout();
attackHit = wHit;
if (ServerConstants.USE_DEBUG == true) {
if (YamlConfig.config.server.USE_DEBUG == true) {
c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + stats.getType(state) + " STATESIZE " + stats.getStateSize(state));
}
ReactorScriptManager.getInstance().onHit(c, this);