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 16:49:24 -07:00
committed by Ronan Lana
parent e169971384
commit 181573dc74
163 changed files with 1531 additions and 1113 deletions

View File

@@ -25,6 +25,7 @@ package client.command.commands.gm0;
import client.MapleClient;
import client.command.Command;
import config.YamlConfig;
import constants.ServerConstants;
public class DropLimitCommand extends Command {
@@ -35,10 +36,10 @@ public class DropLimitCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
int dropCount = c.getPlayer().getMap().getDroppedItemCount();
if(((float) dropCount) / ServerConstants.ITEM_LIMIT_ON_MAP < 0.75f) {
c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300);
if(((float) dropCount) / YamlConfig.config.server.ITEM_LIMIT_ON_MAP < 0.75f) {
c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300);
} else {
c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300);
c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300);
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleCharacter;
import client.MapleClient;
import config.YamlConfig;
import constants.ServerConstants;
import server.maps.MapleMap;
@@ -40,7 +41,7 @@ public class MapOwnerClaimCommand extends Command {
try {
MapleCharacter chr = c.getPlayer();
if (ServerConstants.USE_MAP_OWNERSHIP_SYSTEM) {
if (YamlConfig.config.server.USE_MAP_OWNERSHIP_SYSTEM) {
if (chr.getEventInstance() == null) {
MapleMap ownedMap = chr.getOwnedMap(); // thanks Conrad for suggesting not unlease a map as soon as player exits it
if (ownedMap != null) {

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.command.Command;
import client.MapleClient;
import config.YamlConfig;
import constants.ServerConstants;
public class RatesCommand extends Command {
@@ -43,7 +44,7 @@ public class RatesCommand extends Command {
showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n";
showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n";
showMsg_ += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n";
if(ServerConstants.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
if(YamlConfig.config.server.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
player.showHint(showMsg_, 300);
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.command.Command;
import client.MapleClient;
import config.YamlConfig;
import constants.ServerConstants;
public class ShowRatesCommand extends Command {
@@ -60,7 +61,7 @@ public class ShowRatesCommand extends Command {
if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n";
showMsg += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n";
if(ServerConstants.USE_QUEST_RATE) {
if(YamlConfig.config.server.USE_QUEST_RATE) {
showMsg += "\r\n" + "#eQUEST RATE#n" + "\r\n";
showMsg += "World QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n";
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import config.YamlConfig;
import constants.ServerConstants;
public class StatDexCommand extends Command {
@@ -47,10 +48,10 @@ public class StatDexCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getDex());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getDex());
}
if (!player.assignDex(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import config.YamlConfig;
import constants.ServerConstants;
public class StatIntCommand extends Command {
@@ -47,10 +48,10 @@ public class StatIntCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getInt());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getInt());
}
if (!player.assignInt(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import config.YamlConfig;
import constants.ServerConstants;
public class StatLukCommand extends Command {
@@ -47,10 +48,10 @@ public class StatLukCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getLuk());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getLuk());
}
if (!player.assignLuk(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import config.YamlConfig;
import constants.ServerConstants;
public class StatStrCommand extends Command {
@@ -46,11 +47,11 @@ public class StatStrCommand extends Command {
return;
}
} else {
amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getStr());
amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getStr());
}
if (!player.assignStr(Math.max(amount, 0))) {
player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute.");
player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute.");
}
}
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import config.YamlConfig;
import constants.ServerConstants;
public class ApCommand extends Command {
@@ -44,7 +45,7 @@ public class ApCommand extends Command {
if (params.length < 2) {
int newAp = Integer.parseInt(params[0]);
if (newAp < 0) newAp = 0;
else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP;
player.changeRemainingAp(newAp, false);
} else {
@@ -52,7 +53,7 @@ public class ApCommand extends Command {
if (victim != null) {
int newAp = Integer.parseInt(params[1]);
if (newAp < 0) newAp = 0;
else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP;
else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP;
victim.changeRemainingAp(newAp, false);
} else {

View File

@@ -28,6 +28,7 @@ import client.MapleClient;
import client.MapleCharacter;
import client.inventory.MaplePet;
import client.inventory.manipulator.MapleInventoryManipulator;
import config.YamlConfig;
import constants.ItemConstants;
import constants.ServerConstants;
import server.MapleItemInformationProvider;
@@ -57,7 +58,7 @@ public class ItemCommand extends Command {
short quantity = 1;
if(params.length >= 2) quantity = Short.parseShort(params[1]);
if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
player.yellowMessage("You cannot create a cash item with this command.");
return;
}

View File

@@ -29,6 +29,7 @@ import client.MapleCharacter;
import client.inventory.Item;
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import config.YamlConfig;
import constants.ItemConstants;
import constants.ServerConstants;
import server.MapleItemInformationProvider;
@@ -58,7 +59,7 @@ public class ItemDropCommand extends Command {
short quantity = 1;
if(params.length >= 2) quantity = Short.parseShort(params[1]);
if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) {
player.yellowMessage("You cannot create a cash item with this command.");
return;
}

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import config.YamlConfig;
import constants.ServerConstants;
public class LevelCommand extends Command {
@@ -45,7 +46,7 @@ public class LevelCommand extends Command {
player.setLevel(Math.min(Integer.parseInt(params[0]), player.getMaxClassLevel()) - 1);
player.resetPlayerRates();
if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
player.setWorldRates();
player.levelUp(false);

View File

@@ -27,6 +27,7 @@ import client.MapleStat;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import config.YamlConfig;
import constants.ServerConstants;
public class MaxStatCommand extends Command {
@@ -40,7 +41,7 @@ public class MaxStatCommand extends Command {
player.loseExp(player.getExp(), false, false);
player.setLevel(255);
player.resetPlayerRates();
if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates();
player.setWorldRates();
player.updateStrDexIntLuk(Short.MAX_VALUE);
player.setFame(13337);

View File

@@ -26,6 +26,7 @@ package client.command.commands.gm2;
import client.command.Command;
import client.MapleClient;
import client.MapleCharacter;
import config.YamlConfig;
import constants.ServerConstants;
public class SpCommand extends Command {
@@ -44,7 +45,7 @@ public class SpCommand extends Command {
if (params.length == 1) {
int newSp = Integer.parseInt(params[0]);
if (newSp < 0) newSp = 0;
else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP;
player.updateRemainingSp(newSp);
} else {
@@ -52,7 +53,7 @@ public class SpCommand extends Command {
if (victim != null) {
int newSp = Integer.parseInt(params[1]);
if (newSp < 0) newSp = 0;
else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP;
else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP;
victim.updateRemainingSp(newSp);

View File

@@ -25,6 +25,7 @@ package client.command.commands.gm5;
import client.command.Command;
import client.MapleClient;
import config.YamlConfig;
import constants.ServerConstants;
public class SetCommand extends Command {
@@ -35,7 +36,7 @@ public class SetCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
for (int i = 0; i < params.length; i++) {
ServerConstants.DEBUG_VALUES[i] = Integer.parseInt(params[i]);
YamlConfig.config.server.DEBUG_VALUES[i] = Integer.parseInt(params[i]);
}
}
}

View File

@@ -25,6 +25,7 @@ package client.command.commands.gm5;
import client.command.Command;
import client.MapleClient;
import config.YamlConfig;
import constants.ServerConstants;
public class ShowMoveLifeCommand extends Command {
@@ -34,6 +35,6 @@ public class ShowMoveLifeCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE = !ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE;
YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE;
}
}

View File

@@ -25,6 +25,7 @@ package client.command.commands.gm5;
import client.command.Command;
import client.MapleClient;
import config.YamlConfig;
import constants.ServerConstants;
public class ShowPacketsCommand extends Command {
@@ -34,6 +35,6 @@ public class ShowPacketsCommand extends Command {
@Override
public void execute(MapleClient c, String[] params) {
ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET = !ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET;
YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET;
}
}

View File

@@ -22,6 +22,7 @@ package client.command.commands.gm6;
import client.MapleCharacter;
import client.MapleClient;
import client.command.Command;
import config.YamlConfig;
import constants.ServerConstants;
public class SupplyRateCouponCommand extends Command {
@@ -37,7 +38,7 @@ public class SupplyRateCouponCommand extends Command {
return;
}
ServerConstants.USE_SUPPLY_RATE_COUPONS = params[0].compareToIgnoreCase("no") != 0;
player.dropMessage(5, "Rate coupons are now " + (ServerConstants.USE_SUPPLY_RATE_COUPONS ? "enabled" : "disabled") + " for purchase at the Cash Shop.");
YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS = params[0].compareToIgnoreCase("no") != 0;
player.dropMessage(5, "Rate coupons are now " + (YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS ? "enabled" : "disabled") + " for purchase at the Cash Shop.");
}
}