Skip to content

Commit 85319c4

Browse files
authored
Merge pull request Ghost-chu#1585 from Ghost-chu/master
5.0.0.12
2 parents 9fe00d2 + 07d1ac8 commit 85319c4

File tree

13 files changed

+107
-95
lines changed

13 files changed

+107
-95
lines changed

crowdin/lang/fr-FR/messages.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@
177177
"unban": "&eDébannir un joueur de la boutique",
178178
"freeze": "&eDésactiver ou activer le trading en magasin",
179179
"lock": "&eChanger l'état de verrouillage de la boutique",
180-
"taxaccount": "&eSet the tax account that shop using",
181-
"toggledisplay": "&eToggle the shop display item status",
182-
"purge": "&eStart the shop purge task in background"
180+
"taxaccount": "&eDéfinir le compte de taxe que la boutique utilise",
181+
"toggledisplay": "&eActiver/désactiver l'affichage de l'item de la boutique",
182+
"purge": "&eLancer la purge des boutiques en arrière-plan"
183183
},
184184
"disabled": "&cCette commande est désactivée : &e{0}",
185185
"feature-not-enabled": "Cette fonctionnalité n'est pas activée dans le fichier de configuration."
@@ -229,8 +229,8 @@
229229
"lock-hover": "&eActiver/Désactiver la protection de verrouillage de la boutique.",
230230
"freeze": "&eVerrouillage de la boutique : &b{0} &e[&d&lActiver&e]",
231231
"freeze-hover": "&eActiver/désactiver le statut de blocage de la boutique.",
232-
"toggledisplay": "&eDisplayItem: &b{0} &e[&d&lToggle&e]",
233-
"toggledisplay-hover": "&eToggle the shop's displayitem status"
232+
"toggledisplay": "&eVisibilité des items: &b{0} &e[&d&lActiver/Désactiver&r&e]",
233+
"toggledisplay-hover": "&eActiver/désactiver l'affichage de l'item de la boutique"
234234
},
235235
"tableformat": {
236236
"full_line": "+---------------------------------------------------+",
@@ -333,19 +333,19 @@
333333
"unlimited-shop-owner-keeped": "&eAttention : Le propriétaire de la boutique est toujours propriétaire de la boutique illimitée, vous devez re-définir nouveau propriétaire de la boutique par vous-même.",
334334
"server-crash-warning": "&cLe serveur peut planter après l’éxécution de la commande /qs reload si vous remplacez ou supprimez le fichier Jar du plugin QuickShop pendant l’exécution du serveur.",
335335
"reloading-status": {
336-
"success": "&aReload completed without any errors.",
337-
"require-restart": "&aReload completed. &e(Some changes require server restart to affect)",
338-
"failed": "&cReload failed, check the server console",
339-
"scheduled": "&aReload completed. &7(Some changes required a while to affect)"
336+
"success": "&aRechargement effectué sans erreurs.",
337+
"require-restart": "&aRechargement terminé. &e(Certaines modifications nécessitent un redémarrage du serveur pour prendre effet)",
338+
"failed": "&cRechargement échoué, vérifiez la console du serveur",
339+
"scheduled": "&aRechargement terminé. &7(Certaines modifications nécessitent un certain temps)"
340340
},
341-
"client-language-changed": "&aQuickShop detected your client language setting has been changed, we're now using {0} locale for you.",
342-
"client-language-unsupported": "&eQuickShop doesn't support your client language, we're fallback to {0} locale now.",
343-
"taxaccount-set": "&aThis shop's tax account has been set to &e{0}",
344-
"taxaccount-unset": "&aThis shop's tax account now following server global setting.",
345-
"taxaccount-invalid": "&cTarget account not invalid, please enter a valid player name or uuid(with dashes).",
346-
"display-turn-on": "&aSuccessfully turn on the shop display.",
347-
"display-turn-off": "&aSuccessfully turn off the shop display.",
348-
"shop-purged-start": "&aShop purge started, check the console for details.",
349-
"purchase-out-of-stock": "&cThis shop run out of the stock, Contact shop owner or staffs to refill the stock.",
350-
"purchase-out-of-space": "&cThis shop run out of the space, Contact shop owner or staffs to empty the shop."
341+
"client-language-changed": "&aQuickShop a détecté que votre paramètre de langue client a été modifié, nous utilisons maintenant la locale {0} pour vous.",
342+
"client-language-unsupported": "&eQuickShop ne prend pas en charge la langue de votre client, nous sommes maintenant passés à la locale {0}.",
343+
"taxaccount-set": "&aLe compte de taxe de cette boutique a été défini à &e{0}",
344+
"taxaccount-unset": "&aLe compte de taxe de cette boutique suit maintenant le paramètre global du serveur.",
345+
"taxaccount-invalid": "&cLe compte que vous avez défini est invalide, veuillez entrer un nom de joueur ou un uuid (avec les tirets) valide.",
346+
"display-turn-on": "&aActivation réussie de l'affichage de la boutique.",
347+
"display-turn-off": "Désactivation réussie de l'affichage de la boutique.",
348+
"shop-purged-start": "&aLa purge a commencé, vérifiez la console pour plus de détails.",
349+
"purchase-out-of-stock": "&cCette boutique est en rupture de stock, contactez le propriétaire ou le personnel de la boutique pour recharger le stock.",
350+
"purchase-out-of-space": "&cCette boutique est à court d'espace, contactez le propriétaire ou le personnel de la boutique pour vider la boutique."
351351
}

pom.xml

Lines changed: 7 additions & 7 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.11</pluginver>
28+
<pluginver>5.0.0.12</pluginver>
2929
<package>org.maxgamer.quickshop</package>
3030
<developer>Ghost-chu</developer>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -798,12 +798,12 @@
798798
</exclusion>
799799
</exclusions>
800800
</dependency>
801-
<dependency>
802-
<groupId>com.github.alex9849.arm-shopbridge</groupId>
803-
<artifactId>armshopbridge</artifactId>
804-
<version>1.2.5</version>
805-
<scope>provided</scope>
806-
</dependency>
801+
<!-- <dependency>-->
802+
<!-- <groupId>com.github.alex9849.arm-shopbridge</groupId>-->
803+
<!-- <artifactId>armshopbridge</artifactId>-->
804+
<!-- <version>1.2.5</version>-->
805+
<!-- <scope>provided</scope>-->
806+
<!-- </dependency>-->
807807
<dependency>
808808
<groupId>com.github.alex9849</groupId>
809809
<artifactId>advanced-region-market</artifactId>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ public static QuickShop getInstance() {
280280
}
281281

282282
/**
283-
* Returns QS version, this method only exist on QSRR forks If running other QSRR forks,, result
284-
* may not is "Reremake x.x.x" If running QS offical, Will throw exception.
283+
* Returns QS version, this method only exist on QuickShop forks If running other QuickShop forks,, result
284+
* may not is "Reremake x.x.x" If running QS official, Will throw exception.
285285
*
286286
* @return Plugin Version
287287
*/

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class EconomyTransaction {
5555
@Getter
5656
private final World world;
5757
@Getter
58+
@Nullable
5859
private final String currency;
5960
@JsonUtil.Hidden
6061
private final QuickShop plugin = QuickShop.getInstance();

src/main/java/org/maxgamer/quickshop/integration/advancedregionmarket/AdvancedShopRegionMarketIntegration.java

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,15 @@
1919

2020
package org.maxgamer.quickshop.integration.advancedregionmarket;
2121

22-
import net.alex9849.arm.events.RemoveRegionEvent;
2322
import net.alex9849.arm.events.RestoreRegionEvent;
23+
import net.alex9849.arm.events.UnsellRegionEvent;
2424
import net.alex9849.arm.regions.Region;
25-
import net.alex9849.armshopbridge.ArmShopBridge;
26-
import net.alex9849.armshopbridge.adapters.QuickShop4Adapter;
27-
import net.alex9849.armshopbridge.adapters.QuickShopAdapter;
28-
import net.alex9849.armshopbridge.interfaces.IShopPluginAdapter;
29-
import org.bukkit.Bukkit;
3025
import org.bukkit.Chunk;
3126
import org.bukkit.Location;
3227
import org.bukkit.World;
3328
import org.bukkit.entity.Player;
3429
import org.bukkit.event.EventHandler;
3530
import org.bukkit.event.EventPriority;
36-
import org.bukkit.event.server.PluginEnableEvent;
3731
import org.bukkit.util.Vector;
3832
import org.jetbrains.annotations.NotNull;
3933
import org.maxgamer.quickshop.QuickShop;
@@ -44,8 +38,10 @@
4438
import org.maxgamer.quickshop.util.reload.ReloadResult;
4539
import org.maxgamer.quickshop.util.reload.ReloadStatus;
4640

47-
import java.util.*;
48-
import java.util.logging.Level;
41+
import java.util.HashMap;
42+
import java.util.HashSet;
43+
import java.util.Map;
44+
import java.util.Set;
4945

5046
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
5147
public class AdvancedShopRegionMarketIntegration extends AbstractQSIntegratedPlugin {
@@ -94,36 +90,35 @@ public boolean canTradeShopHere(@NotNull Player player, @NotNull Location locati
9490
*/
9591
@Override
9692
public void load() {
97-
scanAndUnregister();
9893
registerListener();
9994
}
10095

101-
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
102-
public void onPluginLoad(PluginEnableEvent event) {
103-
if ("ArmShopBridge".equals(event.getPlugin().getName())) {
104-
scanAndUnregister();
105-
}
106-
}
107-
108-
private void scanAndUnregister() {
109-
try {
110-
if (Bukkit.getPluginManager().getPlugin("ArmShopBridge") == null || ArmShopBridge.getInstance() == null) {
111-
return;
112-
}
113-
Iterator<IShopPluginAdapter> adapterListIterator = ArmShopBridge.getInstance().getShopPluginAdapters().iterator();
114-
//noinspection
115-
//Use legacy way to prevent lambda internal method causing listener load failed
116-
while (adapterListIterator.hasNext()) {
117-
IShopPluginAdapter adapter = adapterListIterator.next();
118-
if (adapter instanceof QuickShopAdapter || adapter instanceof QuickShop4Adapter) {
119-
adapterListIterator.remove();
120-
plugin.getLogger().log(Level.INFO, "Successfully remove redundant ARM-ShopBridge handlers!");
121-
}
122-
}
123-
} catch (Throwable exception) {
124-
plugin.getLogger().log(Level.WARNING, "Cannot to handle ARM-ShopBridge handlers, ignoring...", exception);
125-
}
126-
}
96+
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
97+
// public void onPluginLoad(PluginEnableEvent event) {
98+
// if ("ArmShopBridge".equals(event.getPlugin().getName())) {
99+
// scanAndUnregister();
100+
// }
101+
// }
102+
//
103+
// private void scanAndUnregister() {
104+
// try {
105+
// if (Bukkit.getPluginManager().getPlugin("ArmShopBridge") == null || ArmShopBridge.getInstance() == null) {
106+
// return;
107+
// }
108+
// Iterator<IShopPluginAdapter> adapterListIterator = ArmShopBridge.getInstance().getShopPluginAdapters().iterator();
109+
// //noinspection
110+
// //Use legacy way to prevent lambda internal method causing listener load failed
111+
// while (adapterListIterator.hasNext()) {
112+
// IShopPluginAdapter adapter = adapterListIterator.next();
113+
// if (adapter instanceof QuickShopAdapter || adapter instanceof QuickShop4Adapter) {
114+
// adapterListIterator.remove();
115+
// plugin.getLogger().log(Level.INFO, "Successfully remove redundant ARM-ShopBridge handlers!");
116+
// }
117+
// }
118+
// } catch (Throwable exception) {
119+
// plugin.getLogger().log(Level.WARNING, "Cannot to handle ARM-ShopBridge handlers, ignoring...", exception);
120+
// }
121+
// }
127122

128123
/**
129124
* Unloding logic
@@ -136,9 +131,9 @@ public void unload() {
136131

137132
private void handleDeletion(Region region) {
138133
Vector minPoint = region.getRegion().getMinPoint();
139-
Vector maxPoint = region.getRegion().getMaxPoint();
134+
Vector maxPoint = region.getRegion().getMinPoint();
140135
World world = region.getRegionworld();
141-
Set<Chunk> chuckLocations = new HashSet<>();
136+
Set<Chunk> chuckLocations = new HashSet<Chunk>();
142137

143138
for (int x = minPoint.getBlockX(); x <= maxPoint.getBlockX() + 16; x += 16) {
144139
for (int z = minPoint.getBlockZ(); z <= maxPoint.getBlockZ() + 16; z += 16) {
@@ -155,12 +150,10 @@ private void handleDeletion(Region region) {
155150
shopMap.putAll(shopsInChunk);
156151
}
157152
}
158-
for (Map.Entry<Location, Shop> shopEntry : shopMap.entrySet()) {
159-
Location shopLocation = shopEntry.getKey();
153+
for (Location shopLocation : shopMap.keySet()) {
160154
if (region.getRegion().contains(shopLocation.getBlockX(), shopLocation.getBlockY(), shopLocation.getBlockZ())) {
161-
Shop shop = shopEntry.getValue();
155+
Shop shop = shopMap.get(shopLocation);
162156
if (shop != null) {
163-
shop.onUnload();
164157
shop.delete(false);
165158
}
166159
}
@@ -172,8 +165,13 @@ public void onShopNeedDeletion(RestoreRegionEvent event) {
172165
handleDeletion(event.getRegion());
173166
}
174167

168+
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
169+
// public void onShopNeedDeletion(RemoveRegionEvent event) {
170+
// handleDeletion(event.getRegion());
171+
// }
172+
175173
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
176-
public void onShopNeedDeletion(RemoveRegionEvent event) {
174+
public void onShopNeedDeletion(UnsellRegionEvent event) {
177175
handleDeletion(event.getRegion());
178176
}
179177

src/main/java/org/maxgamer/quickshop/listener/PlayerListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ private void postControlPanel(PlayerInteractEvent e) {
141141
MsgUtil.sendControlPanelInfo(p, Objects.requireNonNull(plugin.getShopManager().getShop(block.getLocation())));
142142
this.playClickSound(e.getPlayer());
143143
Objects.requireNonNull(plugin.getShopManager().getShop(block.getLocation())).setSignText();
144+
e.setCancelled(true);
144145
}
145146
}
146147
}
@@ -185,6 +186,7 @@ private void postTrade(PlayerInteractEvent e) {
185186
if (!InteractUtil.check(InteractUtil.Action.TRADE, p.isSneaking())) {
186187
return;
187188
}
189+
e.setCancelled(true);
188190
shop.onClick();
189191
this.playClickSound(e.getPlayer());
190192
// Text menu
@@ -276,9 +278,9 @@ else if (e.useInteractedBlock() == Event.Result.ALLOW
276278
}
277279
// Send creation menu.
278280
final SimpleInfo info = new SimpleInfo(b.getLocation(), ShopAction.CREATE, e.getItem(), last, false);
279-
280281
plugin.getShopManager().getActions().put(p.getUniqueId(), info);
281282
plugin.text().of(p, "how-much-to-trade-for", MsgUtil.getTranslateText(Objects.requireNonNull(e.getItem())), Integer.toString(plugin.isAllowStack() && QuickShop.getPermissionManager().hasPermission(p, "quickshop.create.stacks") ? item.getAmount() : 1)).send();
283+
e.setCancelled(true);
282284
}
283285
}
284286

src/main/java/org/maxgamer/quickshop/shop/ContainerShop.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ public void refresh() {
937937
attachedShop.refresh();
938938
}
939939
// Don't make an item for this chest if it's a left shop.
940-
if (!isLeftShop && !isDisableDisplay()) {
940+
if (!isLeftShop && !isDisableDisplay() && displayItem != null) {
941941
displayItem.spawn();
942942
}
943943
}

src/main/java/org/maxgamer/quickshop/shop/ShopLoader.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,19 @@ public void loadShops(@Nullable String worldName) {
144144
continue;
145145
}
146146
++valid;
147+
148+
Location shopLocation = shop.getLocation();
147149
//World unloaded but found
148-
if (!shop.getLocation().isWorldLoaded()) {
150+
if (!shopLocation.isWorldLoaded()) {
149151
++loadAfterWorldLoaded;
150152
continue;
151153
}
152154
// Load to RAM
153-
plugin.getShopManager().loadShop(data.getWorld().getName(), shop);
155+
plugin.getShopManager().loadShop(shopLocation.getWorld().getName(), shop);
154156

155-
if (Util.isLoaded(shop.getLocation())) {
157+
if (Util.isLoaded(shopLocation)) {
156158
// Load to World
157-
if (!Util.canBeShop(shop.getLocation().getBlock())) {
159+
if (!Util.canBeShop(shopLocation.getBlock())) {
158160
Util.debugLog("Target block can't be a shop, removing it from the memory...");
159161
// shop.delete();
160162
plugin.getShopManager().removeShop(shop); // Remove from Mem
@@ -170,7 +172,11 @@ public void loadShops(@Nullable String worldName) {
170172
}
171173
Bukkit.getScheduler().runTaskLater(plugin, () -> {
172174
for (Shop shop : pendingLoading) {
173-
shop.onLoad();
175+
try {
176+
shop.onLoad();
177+
} catch (IllegalStateException exception) {
178+
exceptionHandler(exception, shop.getLocation());
179+
}
174180
shop.update();
175181
}
176182
}, 1);

src/main/java/org/maxgamer/quickshop/util/economyformatter/EconomyFormatter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public ReloadResult reloadModule() {
6262
String[] splits = entry.split(";", 2);
6363
if (splits.length < 2) {
6464
plugin.getLogger().warning("Invalid entry in alternate-currency-symbol-list: " + entry);
65+
return;
6566
}
6667
CURRENCY_SYMBOL_MAPPING.put(splits[0], splits[1]);
6768
});

src/main/java/org/maxgamer/quickshop/util/matcher/item/BukkitItemMatcherImpl.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.maxgamer.quickshop.util.matcher.item;
2121

22+
import de.tr7zw.nbtapi.NBTItem;
2223
import lombok.AllArgsConstructor;
2324
import org.bukkit.inventory.ItemStack;
2425
import org.bukkit.plugin.Plugin;
@@ -27,6 +28,8 @@
2728
import org.maxgamer.quickshop.QuickShop;
2829
import org.maxgamer.quickshop.api.shop.ItemMatcher;
2930

31+
import java.util.Objects;
32+
3033
/**
3134
* A simple impl for ItemMatcher
3235
*
@@ -78,13 +81,13 @@ public boolean matches(@Nullable ItemStack original, @Nullable ItemStack tester)
7881
tester = tester.clone();
7982
tester.setAmount(1);
8083

81-
// if (plugin.getNbtapi() != null) {
82-
// NBTItem nbtItemOriginal = new NBTItem(original);
83-
// NBTItem nbtItemTester = new NBTItem(tester);
84-
// if (Objects.equals(nbtItemOriginal.getString("shopId"), nbtItemTester.getString("shopId"))) {
85-
// return true;
86-
// }
87-
// }
84+
if (plugin.getNbtapi() != null) {
85+
NBTItem nbtItemOriginal = new NBTItem(original);
86+
NBTItem nbtItemTester = new NBTItem(tester);
87+
if (Objects.equals(nbtItemOriginal.getString("shopItemId"), nbtItemTester.getString("shopItemId"))) {
88+
return true;
89+
}
90+
}
8891
return tester.isSimilar(original);
8992
}
9093
}

0 commit comments

Comments
 (0)