Skip to content

Commit 5c91bb3

Browse files
authored
Merge pull request Ghost-chu#1604 from Ghost-chu/master
5.0.0.15
2 parents 753e35c + 6c95a6d commit 5c91bb3

File tree

25 files changed

+71
-240
lines changed

25 files changed

+71
-240
lines changed

pom.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<artifactId>QuickShop</artifactId>
2626

2727
<properties>
28-
<pluginver>5.0.0.14</pluginver>
28+
<pluginver>5.0.0.15</pluginver>
2929
<package>org.maxgamer.quickshop</package>
3030
<developer>Ghost-chu</developer>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -365,10 +365,6 @@
365365
<id>IridiumDevelopment</id>
366366
<url>https://nexus.iridiumdevelopment.net/repository/maven-releases/</url>
367367
</repository>
368-
<repository>
369-
<id>MG-Dev Jenkins CI Maven Repository</id>
370-
<url>https://ci.mg-dev.eu/plugin/repository/everything/</url>
371-
</repository>
372368
<repository>
373369
<id>Sparky</id>
374370
<url>https://nexus.sparky.ac/repository/Sparky/</url>
@@ -840,12 +836,6 @@
840836
<version>2.11.0</version>
841837
<scope>compile</scope>
842838
</dependency>
843-
<dependency>
844-
<groupId>com.bergerkiller.bukkit</groupId>
845-
<artifactId>BKCommonLib</artifactId>
846-
<version>1.17.1-v3</version>
847-
<scope>provided</scope>
848-
</dependency>
849839
<dependency>
850840
<groupId>org.maxgamer.storage</groupId>
851841
<artifactId>simplixstorage</artifactId>

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,18 @@ public class BuildInfo {
4444
private final String pomGroupId;
4545
private final String pomArtifactId;
4646
private final String jobName;
47+
private static final String UNKNOWN = "Unknown";
4748

4849
public BuildInfo(@Nullable InputStream inputStream) {
4950
if (inputStream == null) {
5051
buildId = 0;
51-
buildTag = "Unknown";
52-
buildUrl = "Unknown";
52+
buildTag = UNKNOWN;
53+
buildUrl = UNKNOWN;
5354
gitCommit = "Custom Build";
54-
gitBranch = "Unknown";
55-
pomGroupId = "Unknown";
56-
pomArtifactId = "Unknown";
57-
jobName = "Unknown";
55+
gitBranch = UNKNOWN;
56+
pomGroupId = UNKNOWN;
57+
pomArtifactId = UNKNOWN;
58+
jobName = UNKNOWN;
5859
jobUrl = "https://ci.codemc.io/job/Ghost-chu/job/QuickShop-Reremake/";
5960
return;
6061
}

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,12 @@ private void updateConfig(int selectedVersion) throws IOException {
19561956
getConfiguration().remove("language");
19571957
getConfiguration().set("config-version", ++selectedVersion);
19581958
}
1959+
if (selectedVersion == 147) {
1960+
// Updater set it to true because plugin upgrading
1961+
// Default configuration disable it cause probably fresh install
1962+
getConfiguration().remove("plugin.BKCommonLib");
1963+
getConfiguration().set("config-version", ++selectedVersion);
1964+
}
19591965
if (getConfiguration().getInt("matcher.work-type") != 0 && GameVersion.get(ReflectFactory.getServerVersion()).name().contains("1_16")) {
19601966
getLogger().warning("You are not using QS Matcher, it may meeting item comparing issue mentioned there: https://hub.spigotmc.org/jira/browse/SPIGOT-5063");
19611967
}
@@ -1970,9 +1976,9 @@ private void updateConfig(int selectedVersion) throws IOException {
19701976
reloadConfiguration();
19711977

19721978
//Delete old example configuration files
1973-
new File(getDataFolder(), "example.config.yml").delete();
1974-
new File(getDataFolder(), "example-configuration.txt").delete();
1975-
new File(getDataFolder(), "example-configuration.yml").delete();
1979+
Files.deleteIfExists(new File(getDataFolder(), "example.config.yml").toPath());
1980+
Files.deleteIfExists(new File(getDataFolder(), "example-configuration.txt").toPath());
1981+
Files.deleteIfExists(new File(getDataFolder(), "example-configuration.yml").toPath());
19761982

19771983
try {
19781984
if (new File(getDataFolder(), "messages.json").exists())

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

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
package org.maxgamer.quickshop.api.economy;
2121

22-
import org.bukkit.OfflinePlayer;
2322
import org.bukkit.World;
24-
import org.bukkit.plugin.Plugin;
2523
import org.jetbrains.annotations.NotNull;
2624
import org.jetbrains.annotations.Nullable;
2725
import org.maxgamer.quickshop.QuickShop;
@@ -80,69 +78,11 @@ public boolean transfer(@NotNull UUID from, @NotNull UUID to, double amount, @No
8078
return false;
8179
}
8280

83-
@Override
84-
public abstract boolean deposit(@NotNull UUID name, double amount, @NotNull World world, @Nullable String currency);
85-
86-
@Override
87-
public abstract boolean deposit(@NotNull OfflinePlayer trader, double amount, @NotNull World world, @Nullable String currency);
88-
89-
/**
90-
* Formats the given number... E.g. 50.5 becomes $50.5 Dollars, or 50 Dollars 5 Cents
91-
*
92-
* @param balance The given number
93-
* @return The balance in human readable text.
94-
*/
95-
@Override
96-
public abstract String format(double balance, @NotNull World world, @Nullable String currency);
97-
// return Util.parseColours(core.format(balance, world, currency));
98-
// // Fix color issue from some stupid economy plugin....
99-
//}
100-
101-
@Override
102-
public abstract double getBalance(@NotNull UUID name, @NotNull World world, @Nullable String currency);
103-
104-
@Override
105-
public abstract double getBalance(@NotNull OfflinePlayer player, @NotNull World world, @Nullable String currency);
106-
107-
@Override
108-
public abstract boolean withdraw(@NotNull UUID name, double amount, @NotNull World world, @Nullable String currency);
109-
110-
@Override
111-
public abstract boolean withdraw(@NotNull OfflinePlayer trader, double amount, @NotNull World world, @Nullable String currency);
112-
113-
/**
114-
* Gets the currency does exists
115-
*
116-
* @param currency Currency name
117-
* @return exists
118-
*/
119-
@Override
120-
public abstract boolean hasCurrency(@NotNull World world, @NotNull String currency);
121-
122-
/**
123-
* Gets currency supports status
124-
*
125-
* @return true if supports
126-
*/
127-
@Override
128-
public abstract boolean supportCurrency();
129-
130-
/**
131-
* Checks that this economy is valid. Returns false if it is not valid.
132-
*
133-
* @return True if this economy will work, false if it will not.
134-
*/
135-
@Override
136-
public abstract boolean isValid();
137-
13881
@Override
13982
public @NotNull String getName() {
14083
return "BuiltIn-Economy Processor";
14184
}
14285

143-
@Override
144-
public abstract @NotNull Plugin getPlugin();
145-
14686
/**
14787
* Callback for reloading
14888
*

src/main/java/org/maxgamer/quickshop/api/event/AbstractQSEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static HandlerList getHandlerList() {
4545
@NotNull
4646
@Override
4747
public HandlerList getHandlers() {
48-
return HANDLERS;
48+
return getHandlerList();
4949
}
5050

5151
/**

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.maxgamer.quickshop.QuickShop;
3232
import org.maxgamer.quickshop.shop.ShopProtectionFlag;
3333
import org.maxgamer.quickshop.util.JsonUtil;
34+
import org.maxgamer.quickshop.util.MsgUtil;
3435
import org.maxgamer.quickshop.util.Util;
3536
import org.maxgamer.quickshop.util.reload.ReloadResult;
3637
import org.maxgamer.quickshop.util.reload.ReloadStatus;
@@ -91,7 +92,7 @@ public static boolean checkIsGuardItemStack(@Nullable final ItemStack itemStack)
9192
//noinspection ConstantConditions
9293
for (String lore : iMeta.getLore()) {
9394
try {
94-
if (!lore.startsWith("{")) {
95+
if (!MsgUtil.isJson(lore)) {
9596
continue;
9697
}
9798
ShopProtectionFlag shopProtectionFlag = JsonUtil.getGson().fromJson(lore, ShopProtectionFlag.class);

src/main/java/org/maxgamer/quickshop/chat/platform/minedown/BungeeQuickChat.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
8282
try {
8383
String json = ReflectFactory.convertBukkitItemStackToJson(itemStack);
8484
ComponentBuilder builder = new ComponentBuilder();
85+
builder.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ComponentBuilder(json).create()));
8586
TextSplitter.SpilledString spilledString = TextSplitter.deBakeItem(text);
8687
if (spilledString == null) {
8788
Util.debugLog("Spilled string is null");
@@ -92,7 +93,6 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
9293
builder.append(spilledString.getComponents()).color(color);
9394
builder.appendLegacy(spilledString.getRight()).color(color);
9495
}
95-
builder.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ComponentBuilder(json).create()));
9696
BaseComponent[] components = builder.create();
9797
Util.debugLog("Sending debug: " + ComponentSerializer.toString(components));
9898
player.spigot().sendMessage(components);
@@ -111,28 +111,27 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
111111
return new QuickComponentImpl(errorComponent);
112112
}
113113
ComponentBuilder builder = new ComponentBuilder();
114+
builder.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ComponentBuilder(json).create()));
114115
TextSplitter.SpilledString spilledString = TextSplitter.deBakeItem(message);
115116
if (spilledString == null) {
116117
builder.appendLegacy(message);
117118
} else {
118119
builder.appendLegacy(spilledString.getLeft());
119120
net.md_5.bungee.api.ChatColor color = builder.getCurrentComponent().getColorRaw();
120121
builder.append(spilledString.getComponents()).color(color);
121-
builder.appendLegacy(spilledString.getRight()).color(color);
122+
builder.reset().appendLegacy(spilledString.getRight()).color(color);
122123
}
123124

124125
builder.appendLegacy(" ").appendLegacy(plugin.text().of(player, "menu.preview").forLocale());
125-
// builder.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ComponentBuilder(json).create()));
126126
if (QuickShop.getPermissionManager().hasPermission(player, "quickshop.preview")) {
127127
builder.event(new ClickEvent(
128128
ClickEvent.Action.RUN_COMMAND,
129129
MsgUtil.fillArgs(
130130
"/qs silentpreview {0}",
131131
shop.getRuntimeRandomUniqueId().toString())));
132132
}
133-
builder.event(new HoverEvent(HoverEvent.Action.SHOW_ITEM, new ComponentBuilder(json).create()));
134133
return new QuickComponentImpl(builder.create());
135-
} catch (Throwable t) {
134+
} catch (Exception t) {
136135
plugin.getLogger().log(Level.WARNING, "Failed to process chat component", t);
137136
return new QuickComponentImpl(errorComponent);
138137
}
@@ -145,7 +144,7 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
145144
String json;
146145
try {
147146
json = ReflectFactory.convertBukkitItemStackToJson(itemStack);
148-
} catch (Throwable throwable) {
147+
} catch (Exception throwable) {
149148
plugin.getLogger().log(Level.SEVERE, "Failed to saving item to json for holochat", throwable);
150149
return new QuickComponentImpl(errorComponent);
151150
}

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,8 @@ public void onCommand(@NotNull Player sender, @NotNull String commandLabel, @Not
9595
}
9696
}
9797
if (excludeOutOfStock) {
98-
if (shop.isSelling()) {
99-
if (shop.getRemainingStock() == 0) {
100-
continue;
101-
}
102-
} else if (shop.isBuying()) {
103-
if (shop.getRemainingSpace() == 0) {
104-
continue;
105-
}
98+
if ((shop.isSelling() && shop.getRemainingStock() == 0) || (shop.isBuying() && shop.getRemainingSpace() == 0)) {
99+
continue;
106100
}
107101
}
108102
aroundShops.put(shop, distance);

src/main/java/org/maxgamer/quickshop/database/SQLiteCore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ synchronized void close() {
5656

5757

5858
@Override
59-
synchronized protected DatabaseConnection getConnection0() {
59+
protected synchronized DatabaseConnection getConnection0() {
6060
if (this.connection == null) {
6161
return connection = genConnection();
6262
}
@@ -75,7 +75,7 @@ synchronized protected DatabaseConnection getConnection0() {
7575
}
7676

7777
@Nullable
78-
synchronized private DatabaseConnection genConnection() {
78+
private synchronized DatabaseConnection genConnection() {
7979
if (this.dbFile.exists()) {
8080
try {
8181
Class.forName("org.sqlite.JDBC");

src/main/java/org/maxgamer/quickshop/database/SimpleDatabaseHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ public SimpleWarpedResultSet selectTable(String table) throws SQLException {
297297
Statement st = databaseConnection.get().createStatement();
298298
String sql = "SELECT * FROM " + plugin.getDbPrefix() + table;
299299
ResultSet resultSet = st.executeQuery(sql);
300+
//Resource closes will complete in this class
300301
return new SimpleWarpedResultSet(st, resultSet, databaseConnection);
301302
}
302303

0 commit comments

Comments
 (0)