Resolved preview feature request

Former-commit-id: 9ecd8df38006b5f527d1c3f828e49329b7ac3862
This commit is contained in:
Ghost_chu committed 2020-03-09 10:29:31 +08:00
1 parent 44f0ee6a04
commit 0436995d79
4 files changed
+17 -4

No files matched your search

@@ -251,6 +251,8 @@ public class QuickShop extends JavaPlugin {
private boolean enabledAsyncDisplayDespawn;
private String previewProtectionLore;
/**
* Returns QS version, this method only exist on QSRR forks If running other QSRR forks,, result
* may not is "Reremake x.x.x" If running QS offical, Will throw exception.
@@ -416,6 +418,8 @@ public class QuickShop extends JavaPlugin {
this.display = this.getConfig().getBoolean("shop.display-items");
this.priceChangeRequiresFee = this.getConfig().getBoolean("shop.price-change-requires-fee");
this.displayItemCheckTicks = this.getConfig().getInt("shop.display-items-check-ticks");
this.previewProtectionLore = MsgUtil.getMessageOfflinePlayer("quickshop-gui-preview", null);
;
language = new Language(this); // Init locale
if (this.getConfig().getBoolean("log-actions")) {
logWatcher = new LogWatcher(this, new File(getDataFolder(), "qs.log"));
@@ -34,6 +34,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.maxgamer.quickshop.Event.ShopInventoryPreviewEvent;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Util.MsgUtil;
import org.maxgamer.quickshop.Util.Util;
@@ -63,13 +64,13 @@ public class InventoryPreview implements Listener {
if (Objects.requireNonNull(this.itemStack.getItemMeta()).hasLore()) {
ItemMeta itemMeta = this.itemStack.getItemMeta();
List<String> lores = itemMeta.getLore();
Objects.requireNonNull(lores).add("QuickShop GUI preview item");
Objects.requireNonNull(lores).add(QuickShop.instance.getPreviewProtectionLore());
itemMeta.setLore(lores);
this.itemStack.setItemMeta(itemMeta);
} else {
ItemMeta itemMeta = this.itemStack.getItemMeta();
List<String> lores = new ArrayList<>();
lores.add("QuickShop GUI preview item");
lores.add(QuickShop.instance.getPreviewProtectionLore());
itemMeta.setLore(lores);
this.itemStack.setItemMeta(itemMeta);
}
@@ -84,7 +85,7 @@ public class InventoryPreview implements Listener {
}
List<String> lores = stack.getItemMeta().getLore();
for (String string : lores) {
if ("QuickShop GUI preview item".equals(string)) {
if (QuickShop.instance.getPreviewProtectionLore().equals(string)) {
return true;
}
}
@@ -130,6 +131,7 @@ public class InventoryPreview implements Listener {
if (inventory == null) {
return;
}
Resolved preview feature request
for (HumanEntity player : inventory.getViewers()) {
player.closeInventory();
}
@@ -1324,6 +1324,13 @@ public class MsgUtil {
setAndUpdate("language-version", 27);
selectedVersion = 27;
}
if (selectedVersion == 27) {
setAndUpdate("quickshop-gui-preview", "QuickShop GUI Preview Item");
setAndUpdate("language-version", 28);
selectedVersion = 28;
}
messagei18n.save();
}
@@ -3,7 +3,7 @@
"translation-version": "Support Version: Reremake",
"translation-contributors": "Contributors: Timtower, Netherfoam, KaiNoMood and Mgazul",
"translation-country": "Language Zone: English (en_US)",
"language-version": "28",
"language-version": "29",
"not-looking-at-shop": "&cNo QuickShop was found, you must be looking at one.",
"no-anythings-in-your-hand": "&cThere is nothing in your hand.",
"no-permission": "&cYou do not have permission to do that.",