Skip to content

Commit 75431ef

Browse files
committed
Switch to LightningStorage lib
1 parent 9bb8080 commit 75431ef

File tree

70 files changed

+1530
-1263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1530
-1263
lines changed

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@
195195
<pattern>com.squareup.</pattern>
196196
<shadedPattern>org.maxgamer.quickshop.shade.org.com.squareup.</shadedPattern>
197197
</relocation>
198+
<relocation>
199+
<pattern>de.leonhard.storage.</pattern>
200+
<shadedPattern>org.maxgamer.quickshop.shade.de.leonhard.storage.</shadedPattern>
201+
</relocation>
198202
</relocations>
199203
<transformers>
200204
<transformer
@@ -845,5 +849,10 @@
845849
<version>1.17.1-v3</version>
846850
<scope>provided</scope>
847851
</dependency>
852+
<dependency>
853+
<groupId>com.github.simplix-softworks</groupId>
854+
<artifactId>simplixstorage</artifactId>
855+
<version>3.2.3</version>
856+
</dependency>
848857
</dependencies>
849858
</project>

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

Lines changed: 543 additions & 520 deletions
Large diffs are not rendered by default.

src/main/java/org/maxgamer/quickshop/api/economy/AbstractEconomy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is a part of project QuickShop, the name is Economy.java
2+
* This file is a part of project QuickShop, the name is AbstractEconomy.java
33
* Copyright (C) PotatoCraft Studio and contributors
44
*
55
* This program is free software: you can redistribute it and/or modify it
@@ -44,7 +44,7 @@ public AbstractEconomy() {
4444
* @return Economy type that QuickShop now using
4545
*/
4646
public static EconomyType getNowUsing() {
47-
return EconomyType.fromID(QuickShop.getInstance().getConfig().getInt("economy-type"));
47+
return EconomyType.fromID(QuickShop.getInstance().getConfiguration().getInt("economy-type"));
4848
}
4949

5050
@Override

src/main/java/org/maxgamer/quickshop/api/economy/EconomyTransaction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.jetbrains.annotations.NotNull;
2626
import org.jetbrains.annotations.Nullable;
2727
import org.maxgamer.quickshop.QuickShop;
28-
import org.maxgamer.quickshop.economy.Trader;
2928
import org.maxgamer.quickshop.api.event.EconomyCommitEvent;
29+
import org.maxgamer.quickshop.economy.Trader;
3030
import org.maxgamer.quickshop.util.CalculateUtil;
3131
import org.maxgamer.quickshop.util.JsonUtil;
3232
import org.maxgamer.quickshop.util.Util;
@@ -101,7 +101,7 @@ public EconomyTransaction(@Nullable UUID from, @Nullable UUID to, double amount,
101101
//For passing Test
102102
//noinspection ConstantConditions
103103
if (QuickShop.getInstance() != null) {
104-
this.tryingFixBalanceInsufficient = QuickShop.getInstance().getConfig().getBoolean("trying-fix-banlance-insuffient");
104+
this.tryingFixBalanceInsufficient = QuickShop.getInstance().getConfiguration().getBoolean("trying-fix-banlance-insuffient");
105105
} else {
106106
this.tryingFixBalanceInsufficient = false;
107107
}

src/main/java/org/maxgamer/quickshop/api/shop/AbstractDisplayItem.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is a part of project QuickShop, the name is DisplayItem.java
2+
* This file is a part of project QuickShop, the name is AbstractDisplayItem.java
33
* Copyright (C) PotatoCraft Studio and contributors
44
*
55
* This program is free software: you can redistribute it and/or modify it
@@ -174,11 +174,11 @@ public static boolean checkIsTargetShopDisplay(@NotNull final ItemStack itemStac
174174
*/
175175
@NotNull
176176
public static DisplayType getNowUsing() {
177-
DisplayType displayType = DisplayType.fromID(PLUGIN.getConfig().getInt("shop.display-type"));
177+
DisplayType displayType = DisplayType.fromID(PLUGIN.getConfiguration().getInt("shop.display-type"));
178178
//Falling back to RealDisplayItem when VirtualDisplayItem is unsupported
179179
if (isNotSupportVirtualItem && displayType == DisplayType.VIRTUALITEM) {
180-
PLUGIN.getConfig().set("shop.display-type", 0);
181-
PLUGIN.saveConfig();
180+
PLUGIN.getConfiguration().set("shop.display-type", 0);
181+
PLUGIN.saveConfiguration();
182182
PLUGIN.getLogger().log(Level.WARNING, "Falling back to RealDisplayItem because VirtualDisplayItem is unsupported");
183183
return DisplayType.REALITEM;
184184
}
@@ -203,7 +203,7 @@ public static ItemStack createGuardItemStack(@NotNull ItemStack itemStack, @NotN
203203
Util.debugLog("ItemStack " + itemStack + " cannot getting or creating ItemMeta, failed to create guarded ItemStack.");
204204
return itemStack;
205205
}
206-
if (PLUGIN.getConfig().getBoolean("shop.display-item-use-name")) {
206+
if (PLUGIN.getConfiguration().getBoolean("shop.display-item-use-name")) {
207207
if (iMeta.hasDisplayName()) {
208208
iMeta.setDisplayName(iMeta.getDisplayName());
209209
} else {
@@ -233,7 +233,7 @@ public static ShopProtectionFlag createShopProtectionFlag(
233233
}
234234

235235
protected void init() {
236-
DISPLAY_ALLOW_STACKS = PLUGIN.getConfig().getBoolean("shop.display-allow-stacks");
236+
DISPLAY_ALLOW_STACKS = PLUGIN.getConfiguration().getBoolean("shop.display-allow-stacks");
237237
if (DISPLAY_ALLOW_STACKS) {
238238
//Prevent stack over the normal size
239239
originalItemStack.setAmount(Math.min(originalItemStack.getAmount(), originalItemStack.getMaxStackSize()));

src/main/java/org/maxgamer/quickshop/command/JavaCommandManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* This file is a part of project QuickShop, the name is CommandManager.java
2+
* This file is a part of project QuickShop, the name is JavaCommandManager.java
33
* Copyright (C) PotatoCraft Studio and contributors
44
*
55
* This program is free software: you can redistribute it and/or modify it
@@ -395,7 +395,7 @@ public boolean onCommand(
395395
return true;
396396
}
397397
}
398-
if (sender instanceof Player && plugin.getConfig().getBoolean("effect.sound.oncommand")) {
398+
if (sender instanceof Player && plugin.getConfiguration().getBoolean("effect.sound.oncommand")) {
399399
Player player = (Player) sender;
400400
((Player) sender)
401401
.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 80.0F, 1.0F);
@@ -510,7 +510,7 @@ public boolean isAdapt(CommandContainer container, CommandSender sender) {
510510
if (plugin.getBootError() != null) {
511511
return Collections.emptyList();
512512
}
513-
if (sender instanceof Player && plugin.getConfig().getBoolean("effect.sound.ontabcomplete")) {
513+
if (sender instanceof Player && plugin.getConfiguration().getBoolean("effect.sound.ontabcomplete")) {
514514
Player player = (Player) sender;
515515
((Player) sender).playSound(player.getLocation(), Sound.BLOCK_DISPENSER_FAIL, 80.0F, 1.0F);
516516
}

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Convert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
package org.maxgamer.quickshop.command.subcommand;
2121

22+
import de.leonhard.storage.sections.FlatFileSection;
2223
import lombok.SneakyThrows;
2324
import org.bukkit.ChatColor;
2425
import org.bukkit.command.CommandSender;
2526
import org.bukkit.command.ConsoleCommandSender;
26-
import org.bukkit.configuration.ConfigurationSection;
2727
import org.jetbrains.annotations.NotNull;
2828
import org.jetbrains.annotations.Nullable;
2929
import org.maxgamer.quickshop.QuickShop;
@@ -73,7 +73,7 @@ public void onCommand(@NotNull ConsoleCommandSender sender, @NotNull String comm
7373
sender.sendMessage(ChatColor.RED + "Your database is already in MySQL!");
7474
return;
7575
}
76-
ConfigurationSection dbCfg = plugin.getConfig().getConfigurationSection("database");
76+
FlatFileSection dbCfg = plugin.getConfiguration().getSection("database");
7777
String user = dbCfg.getString("user");
7878
String pass = dbCfg.getString("password");
7979
String host = dbCfg.getString("host");

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Debug.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@ public List<String> onTabComplete(
117117
}
118118

119119
public void switchDebug(@NotNull CommandSender sender) {
120-
final boolean debug = plugin.getConfig().getBoolean("dev-mode");
120+
final boolean debug = plugin.getConfiguration().getBoolean("dev-mode");
121121

122122
if (debug) {
123-
plugin.getConfig().set("dev-mode", false);
124-
plugin.saveConfig();
123+
plugin.getConfiguration().set("dev-mode", false);
124+
plugin.saveConfiguration();
125125
plugin.reload();
126126
plugin.text().of(sender, "command.now-nolonger-debuging").send();
127127
return;
128128
}
129129

130-
plugin.getConfig().set("dev-mode", true);
131-
plugin.saveConfig();
130+
plugin.getConfiguration().set("dev-mode", true);
131+
plugin.saveConfiguration();
132132
plugin.reload();
133133
plugin.text().of(sender, "command.now-debuging").send();
134134
}

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Find.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
5959

6060

6161
final String lookFor = sb.toString().toLowerCase();
62-
final double maxDistance = plugin.getConfig().getInt("shop.finding.distance");
63-
final boolean usingOldLogic = plugin.getConfig().getBoolean("shop.finding.oldLogic");
64-
final int shopLimit = usingOldLogic ? 1 : plugin.getConfig().getInt("shop.finding.limit");
65-
final boolean allShops = plugin.getConfig().getBoolean("shop.finding.all");
66-
final boolean excludeOutOfStock = plugin.getConfig().getBoolean("shop.finding.exclude-out-of-stock");
62+
final double maxDistance = plugin.getConfiguration().getInt("shop.finding.distance");
63+
final boolean usingOldLogic = plugin.getConfiguration().getBoolean("shop.finding.oldLogic");
64+
final int shopLimit = usingOldLogic ? 1 : plugin.getConfiguration().getInt("shop.finding.limit");
65+
final boolean allShops = plugin.getConfiguration().getBoolean("shop.finding.all");
66+
final boolean excludeOutOfStock = plugin.getConfiguration().getBoolean("shop.finding.exclude-out-of-stock");
6767

6868
//Rewrite by Ghost_chu - Use vector to replace old chunks finding.
6969

src/main/java/org/maxgamer/quickshop/command/subcommand/SubCommand_Item.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
6464
itemStack.setAmount(1);
6565
}
6666
JavaPriceLimiter limiter = new JavaPriceLimiter(
67-
plugin.getConfig().getDouble("shop.minimum-price"),
68-
plugin.getConfig().getInt("shop.maximum-price"),
69-
plugin.getConfig().getBoolean("shop.allow-free-shop"),
70-
plugin.getConfig().getBoolean("whole-number-prices-only"));
67+
plugin.getConfiguration().getDouble("shop.minimum-price"),
68+
plugin.getConfiguration().getInt("shop.maximum-price"),
69+
plugin.getConfiguration().getBoolean("shop.allow-free-shop"),
70+
plugin.getConfiguration().getBoolean("whole-number-prices-only"));
7171
PriceLimiterCheckResult checkResult = limiter.check(itemStack, shop.getPrice());
7272
if (checkResult.getStatus() != PriceLimiterStatus.PASS) {
7373
plugin.text().of(sender, "restricted-prices", Util.getItemStackName(shop.getItem()),

0 commit comments

Comments
 (0)