Skip to content

Commit 97002f0

Browse files
committed
Use correct way to remove the configuration key
1 parent d50c0c3 commit 97002f0

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,12 +1138,12 @@ private void updateConfig(int selectedVersion) throws IOException {
11381138
selectedVersion = 10;
11391139
}
11401140
if (selectedVersion == 10) {
1141-
getConfiguration().set("shop.pay-player-from-unlimited-shop-owner", null); // Removed
1141+
getConfiguration().remove("shop.pay-player-from-unlimited-shop-owner"); // Removed
11421142
getConfiguration().set("config-version", 11);
11431143
selectedVersion = 11;
11441144
}
11451145
if (selectedVersion == 11) {
1146-
getConfiguration().set("shop.enable-enderchest", null); // Removed
1146+
getConfiguration().remove("shop.enable-enderchest"); // Removed
11471147
getConfiguration().set("plugin.OpenInv", true);
11481148
List<String> shoppable = getConfiguration().getStringList("shop-blocks");
11491149
shoppable.add("ENDER_CHEST");
@@ -1152,12 +1152,12 @@ private void updateConfig(int selectedVersion) throws IOException {
11521152
selectedVersion = 12;
11531153
}
11541154
if (selectedVersion == 12) {
1155-
getConfiguration().set("plugin.ProtocolLib", null); // Removed
1156-
getConfiguration().set("plugin.BKCommonLib", null); // Removed
1157-
getConfiguration().set("database.use-varchar", null); // Removed
1158-
getConfiguration().set("database.reconnect", null); // Removed
1155+
getConfiguration().remove("plugin.ProtocolLib"); // Removed
1156+
getConfiguration().remove("plugin.BKCommonLib"); // Removed
1157+
getConfiguration().remove("database.use-varchar"); // Removed
1158+
getConfiguration().remove("database.reconnect"); // Removed
11591159
getConfiguration().set("display-items-check-ticks", 1200);
1160-
getConfiguration().set("shop.bypass-owner-check", null); // Removed
1160+
getConfiguration().remove("shop.bypass-owner-check"); // Removed
11611161
getConfiguration().set("config-version", 13);
11621162
selectedVersion = 13;
11631163
}
@@ -1166,13 +1166,13 @@ private void updateConfig(int selectedVersion) throws IOException {
11661166
selectedVersion = 14;
11671167
}
11681168
if (selectedVersion == 14) {
1169-
getConfiguration().set("plugin.AreaShop", null);
1170-
getConfiguration().set("shop.special-region-only", null);
1169+
getConfiguration().remove("plugin.AreaShop");
1170+
getConfiguration().remove("shop.special-region-only");
11711171
getConfiguration().set("config-version", 15);
11721172
selectedVersion = 15;
11731173
}
11741174
if (selectedVersion == 15) {
1175-
getConfiguration().set("ongoingfee", null);
1175+
getConfiguration().remove("ongoingfee");
11761176
getConfiguration().set("shop.display-item-show-name", false);
11771177
getConfiguration().set("shop.auto-fetch-shop-messages", true);
11781178
getConfiguration().set("config-version", 16);
@@ -1184,7 +1184,7 @@ private void updateConfig(int selectedVersion) throws IOException {
11841184
}
11851185
if (selectedVersion == 17) {
11861186
getConfiguration().set("ignore-cancel-chat-event", false);
1187-
getConfiguration().set("float", null);
1187+
getConfiguration().remove("float");
11881188
getConfiguration().set("config-version", 18);
11891189
selectedVersion = 18;
11901190
}
@@ -1214,11 +1214,11 @@ private void updateConfig(int selectedVersion) throws IOException {
12141214
selectedVersion = 23;
12151215
}
12161216
if (selectedVersion == 23) {
1217-
getConfiguration().set("lockette.enable", null);
1218-
getConfiguration().set("lockette.item", null);
1219-
getConfiguration().set("lockette.lore", null);
1220-
getConfiguration().set("lockette.displayname", null);
1221-
getConfiguration().set("float", null);
1217+
getConfiguration().remove("lockette.enable");
1218+
getConfiguration().remove("lockette.item");
1219+
getConfiguration().remove("lockette.lore");
1220+
getConfiguration().remove("lockette.displayname");
1221+
getConfiguration().remove("float");
12221222
getConfiguration().set("lockette.enable", true);
12231223
getConfiguration().set("shop.blacklist-world", Lists.newArrayList("disabled_world_name"));
12241224
getConfiguration().set("config-version", 24);
@@ -1253,7 +1253,7 @@ private void updateConfig(int selectedVersion) throws IOException {
12531253
selectedVersion = 29;
12541254
}
12551255
if (selectedVersion == 29) {
1256-
getConfiguration().set("plugin.Multiverse-Core", null);
1256+
getConfiguration().remove("plugin.Multiverse-Core");
12571257
getConfiguration().set("shop.protection-checking", true);
12581258
getConfiguration().set("config-version", 30);
12591259
selectedVersion = 30;
@@ -1295,7 +1295,7 @@ private void updateConfig(int selectedVersion) throws IOException {
12951295
selectedVersion = 35;
12961296
}
12971297
if (selectedVersion == 35) {
1298-
getConfiguration().set("queue", null); // Close it for everyone
1298+
getConfiguration().remove("queue"); // Close it for everyone
12991299
getConfiguration().set("config-version", 36);
13001300
selectedVersion = 36;
13011301
}
@@ -1313,8 +1313,8 @@ private void updateConfig(int selectedVersion) throws IOException {
13131313
getConfiguration().set("protect.inventorymove", true);
13141314
getConfiguration().set("protect.spread", true);
13151315
getConfiguration().set("protect.fromto", true);
1316-
getConfiguration().set("protect.minecart", null);
1317-
getConfiguration().set("protect.hopper", null);
1316+
getConfiguration().remove("protect.minecart");
1317+
getConfiguration().remove("protect.hopper");
13181318
getConfiguration().set("config-version", 39);
13191319
selectedVersion = 39;
13201320
}
@@ -1361,16 +1361,16 @@ private void updateConfig(int selectedVersion) throws IOException {
13611361
selectedVersion = 48;
13621362
}
13631363
if (selectedVersion == 48) {
1364-
getConfiguration().set("permission-type", null);
1365-
getConfiguration().set("shop.use-protection-checking-filter", null);
1366-
getConfiguration().set("shop.protection-checking-filter", null);
1364+
getConfiguration().remove("permission-type");
1365+
getConfiguration().remove("shop.use-protection-checking-filter");
1366+
getConfiguration().remove("shop.protection-checking-filter");
13671367
getConfiguration().set("config-version", 49);
13681368
selectedVersion = 49;
13691369
}
13701370
if (selectedVersion == 49 || selectedVersion == 50) {
13711371
getConfiguration().set("shop.enchance-display-protect", false);
13721372
getConfiguration().set("shop.enchance-shop-protect", false);
1373-
getConfiguration().set("protect", null);
1373+
getConfiguration().remove("protect");
13741374
getConfiguration().set("config-version", 51);
13751375
selectedVersion = 51;
13761376
}
@@ -1379,7 +1379,7 @@ private void updateConfig(int selectedVersion) throws IOException {
13791379
selectedVersion = 60;
13801380
}
13811381
if (selectedVersion == 60) { // Ahhh fuck versions
1382-
getConfiguration().set("shop.strict-matches-check", null);
1382+
getConfiguration().remove("shop.strict-matches-check");
13831383
getConfiguration().set("shop.display-auto-despawn", true);
13841384
getConfiguration().set("shop.display-despawn-range", 10);
13851385
getConfiguration().set("shop.display-check-time", 10);
@@ -1426,7 +1426,7 @@ private void updateConfig(int selectedVersion) throws IOException {
14261426
}
14271427
if (selectedVersion == 67) {
14281428
getConfiguration().set("disable-debuglogger", false);
1429-
getConfiguration().set("matcher.use-bukkit-matcher", null);
1429+
getConfiguration().remove("matcher.use-bukkit-matcher");
14301430
getConfiguration().set("config-version", 68);
14311431
selectedVersion = 68;
14321432
}
@@ -1460,7 +1460,7 @@ private void updateConfig(int selectedVersion) throws IOException {
14601460
} else {
14611461
getConfiguration().set("use-decimal-format", false);
14621462
}
1463-
getConfiguration().set("use-deciaml-format", null);
1463+
getConfiguration().remove("use-deciaml-format");
14641464

14651465
getConfiguration().set("shop.force-load-downgrade-items.enable", false);
14661466
getConfiguration().set("shop.force-load-downgrade-items.method", 0);
@@ -1475,7 +1475,7 @@ private void updateConfig(int selectedVersion) throws IOException {
14751475
}
14761476
if (selectedVersion == 74) {
14771477
String langUtilsLanguage = getConfiguration().getOrDefault("langutils-language", "en_us");
1478-
getConfiguration().set("langutils-language", null);
1478+
getConfiguration().remove("langutils-language");
14791479
if ("en_us".equals(langUtilsLanguage)) {
14801480
langUtilsLanguage = "default";
14811481
}
@@ -1485,8 +1485,8 @@ private void updateConfig(int selectedVersion) throws IOException {
14851485
selectedVersion = 75;
14861486
}
14871487
if (selectedVersion == 75) {
1488-
getConfiguration().set("langutils-language", null);
1489-
if (getConfiguration().getString("game-language") == null) {
1488+
getConfiguration().remove("langutils-language");
1489+
if (getConfiguration().get("game-language") == null) {
14901490
getConfiguration().set("game-language", "default");
14911491
}
14921492
getConfiguration().set("config-version", 76);
@@ -1533,13 +1533,13 @@ private void updateConfig(int selectedVersion) throws IOException {
15331533
getConfiguration().set("integration.factions.trade.require.safezone", false);
15341534
getConfiguration().set("integration.factions.trade.require.own", false);
15351535
getConfiguration().set("integration.factions.trade.require.warzone", false);
1536-
getConfiguration().set("anonymous-metrics", null);
1536+
getConfiguration().remove("anonymous-metrics");
15371537
getConfiguration().set("shop.ongoing-fee.async", true);
15381538
getConfiguration().set("config-version", 78);
15391539
selectedVersion = 78;
15401540
}
15411541
if (selectedVersion == 78) {
1542-
getConfiguration().set("shop.display-type-specifics", null);
1542+
getConfiguration().remove("shop.display-type-specifics");
15431543
getConfiguration().set("config-version", 79);
15441544
selectedVersion = 79;
15451545
}
@@ -1569,7 +1569,7 @@ private void updateConfig(int selectedVersion) throws IOException {
15691569
selectedVersion = 84;
15701570
}
15711571
if (selectedVersion == 84) {
1572-
getConfiguration().set("disable-debuglogger", null);
1572+
getConfiguration().remove("disable-debuglogger");
15731573
getConfiguration().set("config-version", 85);
15741574
selectedVersion = 85;
15751575
}
@@ -1628,9 +1628,9 @@ private void updateConfig(int selectedVersion) throws IOException {
16281628
selectedVersion = 93;
16291629
}
16301630
if (selectedVersion == 93) {
1631-
getConfiguration().set("disable-creative-mode-trading", null);
1632-
getConfiguration().set("disable-super-tool", null);
1633-
getConfiguration().set("allow-owner-break-shop-sign", null);
1631+
getConfiguration().remove("disable-creative-mode-trading");
1632+
getConfiguration().remove("disable-super-tool");
1633+
getConfiguration().remove("allow-owner-break-shop-sign");
16341634
getConfiguration().set("shop.disable-creative-mode-trading", true);
16351635
getConfiguration().set("shop.disable-super-tool", true);
16361636
getConfiguration().set("shop.allow-owner-break-shop-sign", false);
@@ -1640,11 +1640,11 @@ private void updateConfig(int selectedVersion) throws IOException {
16401640
if (selectedVersion == 94) {
16411641
if (getConfiguration().get("price-restriction") != null) {
16421642
getConfiguration().set("shop.price-restriction", getConfiguration().getStringList("price-restriction"));
1643-
getConfiguration().set("price-restriction", null);
1643+
getConfiguration().remove("price-restriction");
16441644
} else {
16451645
getConfiguration().set("shop.price-restriction", new ArrayList<>(0));
16461646
}
1647-
getConfiguration().set("enable-log4j", null);
1647+
getConfiguration().remove("enable-log4j");
16481648
getConfiguration().set("config-version", 95);
16491649
selectedVersion = 95;
16501650
}
@@ -1681,7 +1681,7 @@ private void updateConfig(int selectedVersion) throws IOException {
16811681
}
16821682
if (selectedVersion == 101) {
16831683
getConfiguration().set("matcher.work-type", 1);
1684-
getConfiguration().set("work-type", null);
1684+
getConfiguration().remove("work-type");
16851685
getConfiguration().set("plugin.LWC", true);
16861686
getConfiguration().set("config-version", 102);
16871687
selectedVersion = 102;
@@ -1700,17 +1700,17 @@ private void updateConfig(int selectedVersion) throws IOException {
17001700
selectedVersion = 104;
17011701
}
17021702
if (selectedVersion == 104) {
1703-
getConfiguration().set("cachingpool", null);
1703+
getConfiguration().remove("cachingpool");
17041704
getConfiguration().set("config-version", 105);
17051705
selectedVersion = 105;
17061706
}
17071707
if (selectedVersion == 105) {
17081708
getConfiguration().set("shop.interact.sneak-to-create", getConfiguration().getBoolean("shop.sneak-to-create"));
1709-
getConfiguration().set("shop.sneak-to-create", null);
1709+
getConfiguration().remove("shop.sneak-to-create");
17101710
getConfiguration().set("shop.interact.sneak-to-trade", getConfiguration().getBoolean("shop.sneak-to-trade"));
1711-
getConfiguration().set("shop.sneak-to-trade", null);
1711+
getConfiguration().remove("shop.sneak-to-trade");
17121712
getConfiguration().set("shop.interact.sneak-to-control", getConfiguration().getBoolean("shop.sneak-to-control"));
1713-
getConfiguration().set("shop.sneak-to-control", null);
1713+
getConfiguration().remove("shop.sneak-to-control");
17141714
getConfiguration().set("config-version", 106);
17151715
selectedVersion = 106;
17161716
}
@@ -1748,7 +1748,7 @@ private void updateConfig(int selectedVersion) throws IOException {
17481748
getConfiguration().set("logging.file-size", 10);
17491749
getConfiguration().set("debug.disable-debuglogger", false);
17501750
getConfiguration().set("trying-fix-banlance-insuffient", false);
1751-
getConfiguration().set("log-actions", null);
1751+
getConfiguration().remove("log-actions");
17521752
getConfiguration().set("config-version", 112);
17531753
selectedVersion = 112;
17541754
}
@@ -1764,7 +1764,7 @@ private void updateConfig(int selectedVersion) throws IOException {
17641764
}
17651765
if (selectedVersion == 114) {
17661766
getConfiguration().set("shop.interact.interact-mode", getConfiguration().getBoolean("shop.interact.switch-mode") ? 0 : 1);
1767-
getConfiguration().set("shop.interact.switch-mode", null);
1767+
getConfiguration().remove("shop.interact.switch-mode");
17681768
getConfiguration().set("config-version", 115);
17691769
selectedVersion = 115;
17701770
}
@@ -1785,7 +1785,7 @@ private void updateConfig(int selectedVersion) throws IOException {
17851785
if (selectedVersion == 117) {
17861786
getConfiguration().set("shop.finding.distance", getConfiguration().getInt("shop.find-distance"));
17871787
getConfiguration().set("shop.finding.limit", 10);
1788-
getConfiguration().set("shop.find-distance", null);
1788+
getConfiguration().remove("shop.find-distance");
17891789
getConfiguration().set("config-version", ++selectedVersion);
17901790
}
17911791
if (selectedVersion == 118) {
@@ -1880,22 +1880,22 @@ private void updateConfig(int selectedVersion) throws IOException {
18801880
getConfiguration().set("config-version", ++selectedVersion);
18811881
}
18821882
if (selectedVersion == 136) {
1883-
getConfiguration().set("shop.use-global-virtual-item-queue", null);
1883+
getConfiguration().remove("shop.use-global-virtual-item-queue");
18841884
getConfiguration().set("config-version", ++selectedVersion);
18851885
}
18861886
if (selectedVersion == 137) {
1887-
getConfiguration().set("integration.griefprevention.create", null);
1887+
getConfiguration().remove("integration.griefprevention.create");
18881888
getConfiguration().set("integration.griefprevention.create", "INVENTORY");
18891889

1890-
getConfiguration().set("integration.griefprevention.trade", null);
1890+
getConfiguration().remove("integration.griefprevention.trade");
18911891
getConfiguration().set("integration.griefprevention.trade", Collections.emptyList());
18921892

18931893
boolean oldValueUntrusted = getConfiguration().getOrDefault("integration.griefprevention.delete-on-untrusted", false);
1894-
getConfiguration().set("integration.griefprevention.delete-on-untrusted", null);
1894+
getConfiguration().remove("integration.griefprevention.delete-on-untrusted");
18951895
getConfiguration().set("integration.griefprevention.delete-on-claim-trust-changed", oldValueUntrusted);
18961896

18971897
boolean oldValueUnclaim = getConfiguration().getOrDefault("integration.griefprevention.delete-on-unclaim", false);
1898-
getConfiguration().set("integration.griefprevention.delete-on-unclaim", null);
1898+
getConfiguration().remove("integration.griefprevention.delete-on-unclaim");
18991899
getConfiguration().set("integration.griefprevention.delete-on-claim-unclaimed", oldValueUnclaim);
19001900

19011901
getConfiguration().set("integration.griefprevention.delete-on-subclaim-created", false);
@@ -1923,11 +1923,11 @@ private void updateConfig(int selectedVersion) throws IOException {
19231923
getConfiguration().set("purge.banned", true);
19241924
getConfiguration().set("purge.skip-op", true);
19251925
getConfiguration().set("purge.return-create-fee", true);
1926-
getConfiguration().set("shop.use-fast-shop-search-algorithm", null);
1926+
getConfiguration().remove("shop.use-fast-shop-search-algorithm");
19271927
getConfiguration().set("config-version", ++selectedVersion);
19281928
}
19291929
if (selectedVersion == 142) {
1930-
getConfiguration().set("disabled-languages", null);
1930+
getConfiguration().remove("disabled-languages");
19311931
getConfiguration().set("enabled-languages", Collections.singletonList("*"));
19321932
getConfiguration().set("config-version", ++selectedVersion);
19331933
}
@@ -1953,7 +1953,7 @@ private void updateConfig(int selectedVersion) throws IOException {
19531953
if (selectedVersion == 146) {
19541954
// Updater set it to true because plugin upgrading
19551955
// Default configuration disable it cause probably fresh install
1956-
getConfiguration().set("language", null);
1956+
getConfiguration().remove("language");
19571957
getConfiguration().set("config-version", ++selectedVersion);
19581958
}
19591959
if (getConfiguration().getInt("matcher.work-type") != 0 && GameVersion.get(ReflectFactory.getServerVersion()).name().contains("1_16")) {

0 commit comments

Comments
 (0)