From ec933bac3fb85e2312c27132b28a0f476ecd52fa Mon Sep 17 00:00:00 2001 From: EpiCanard Date: Mon, 15 Jul 2019 21:42:14 +0200 Subject: [PATCH 1/6] Add blacklist/whitelist for world allowed --- .../globalmarketchest/utils/WorldUtils.java | 5 ++++- src/main/resources/1.12/config.yml | 18 +++++++++++------- src/main/resources/1.13/config.yml | 18 +++++++++++------- src/main/resources/1.14/config.yml | 13 +++++++++++-- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/main/java/fr/epicanard/globalmarketchest/utils/WorldUtils.java b/src/main/java/fr/epicanard/globalmarketchest/utils/WorldUtils.java index b8c54cf9..698e8847 100644 --- a/src/main/java/fr/epicanard/globalmarketchest/utils/WorldUtils.java +++ b/src/main/java/fr/epicanard/globalmarketchest/utils/WorldUtils.java @@ -181,7 +181,10 @@ public Boolean compareLocations(Location first, Location second) { public Boolean isAllowedWorld(String worldName) throws WorldDoesntExist { if (Bukkit.getWorld(worldName) == null) throw new WorldDoesntExist(worldName); - return GlobalMarketChest.plugin.getConfigLoader().getConfig().getStringList("WorldAllowed").contains(worldName); + final Boolean containsWorld = GlobalMarketChest.plugin.getConfigLoader().getConfig().getStringList("ShopWorlds.Worlds").contains(worldName); + final Boolean whitelist = GlobalMarketChest.plugin.getConfigLoader().getConfig().getString("ShopWorlds.Type", "blacklist").equals("whitelist"); + + return (whitelist) ? containsWorld : !containsWorld; } /** diff --git a/src/main/resources/1.12/config.yml b/src/main/resources/1.12/config.yml index 0a8f34ab..df95397e 100644 --- a/src/main/resources/1.12/config.yml +++ b/src/main/resources/1.12/config.yml @@ -33,7 +33,7 @@ Options: EnableMaxInOne: true # Define if the button MaxRepeat in CreateAuction view must be here EnableMaxRepeat: true - # Define if a player can find similar auctions with drag and drop on category view + # Define if a player can find similar auctions with drag and drop on category view EnableSimilarAuctions: true # Default price for new auctions DefaultPrice: 100 @@ -63,11 +63,15 @@ Logs: HidePrefix: false # Define the prefix displayed inside messages Prefix: "&a[GlobalMarketChest]" -# Worlds on which you can create shop -WorldAllowed: - - world - - world_the_end - - world_nether +# Define on which worlds you can or can't create a shop +ShopWorlds: + # Define which type of filter is used + # Possible value : whitelist or blacklist (default blacklist if not specified) + Type: 'blacklist' + # List of world allowed (whitelist) or forbidden (blacklist) + Worlds: + # - world + # - world_the_end # Block that you can link with shop's sign AllowedLinkBlock: - minecraft:ender_chest @@ -83,7 +87,7 @@ Price: - 1 - 0.1 - 0.01 - # Items used for price ranges, if there is less items than price ranges the last item + # Items used for price ranges, if there is less items than price ranges the last item Items: - minecraft:emerald_block - minecraft:emerald diff --git a/src/main/resources/1.13/config.yml b/src/main/resources/1.13/config.yml index a7dda4f5..6302055b 100644 --- a/src/main/resources/1.13/config.yml +++ b/src/main/resources/1.13/config.yml @@ -33,7 +33,7 @@ Options: EnableMaxInOne: true # Define if the button MaxRepeat in CreateAuction view must be here EnableMaxRepeat: true - # Define if a player can find similar auctions with drag and drop on category view + # Define if a player can find similar auctions with drag and drop on category view EnableSimilarAuctions: true # Default price for new auctions DefaultPrice: 100 @@ -63,11 +63,15 @@ Logs: HidePrefix: false # Define the prefix displayed inside messages Prefix: "&a[GlobalMarketChest]" -# Worlds on which you can create shop -WorldAllowed: - - world - - world_the_end - - world_nether +# Define on which worlds you can or can't create a shop +ShopWorlds: + # Define which type of filter is used + # Possible value : whitelist or blacklist (default blacklist if not specified) + Type: 'blacklist' + # List of world allowed (whitelist) or forbidden (blacklist) + Worlds: + # - world + # - world_the_end # Block that you can link with shop's sign AllowedLinkBlock: - minecraft:ender_chest @@ -83,7 +87,7 @@ Price: - 1 - 0.1 - 0.01 - # Items used for price ranges, if there is less items than price ranges the last item + # Items used for price ranges, if there is less items than price ranges the last item Items: - minecraft:emerald_block - minecraft:emerald diff --git a/src/main/resources/1.14/config.yml b/src/main/resources/1.14/config.yml index 34975077..3f8537f1 100644 --- a/src/main/resources/1.14/config.yml +++ b/src/main/resources/1.14/config.yml @@ -33,7 +33,7 @@ Options: EnableMaxInOne: true # Define if the button MaxRepeat in CreateAuction view must be here EnableMaxRepeat: true - # Define if a player can find similar auctions with drag and drop on category view + # Define if a player can find similar auctions with drag and drop on category view EnableSimilarAuctions: true # Default price for new auctions DefaultPrice: 100 @@ -68,6 +68,15 @@ WorldAllowed: - world - world_the_end - world_nether +# Define on which worlds you can or can't create a shop +ShopWorlds: + # Define which type of filter is used + # Possible value : whitelist or blacklist (default blacklist if not specified) + Type: 'blacklist' + # List of world allowed (whitelist) or forbidden (blacklist) + Worlds: + # - world + # - world_the_end # Block that you can link with shop's sign AllowedLinkBlock: - minecraft:ender_chest @@ -83,7 +92,7 @@ Price: - 1 - 0.1 - 0.01 - # Items used for price ranges, if there is less items than price ranges the last item + # Items used for price ranges, if there is less items than price ranges the last item Items: - minecraft:emerald_block - minecraft:emerald From d07c19ff4989796f8fa10811168c3fdcf6512dc2 Mon Sep 17 00:00:00 2001 From: EpiCanard Date: Mon, 15 Jul 2019 22:17:14 +0200 Subject: [PATCH 2/6] Add Turkish translation for fix command --- src/main/resources/langs/lang-tr_TR.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/langs/lang-tr_TR.yml b/src/main/resources/langs/lang-tr_TR.yml index 7a3c10c6..d40d58c3 100644 --- a/src/main/resources/langs/lang-tr_TR.yml +++ b/src/main/resources/langs/lang-tr_TR.yml @@ -195,10 +195,10 @@ InfoMessages: WriteItemName: "Aradığınız öğenin adını yazın" WritePlayerName: "Aradığınız oyuncunun adını yazın" DeleteShopQuestion: "Bu mağazayı silmek istediğinden emin misin?" - ConvertingShopAuctions: "Converting auctions of shop : &6%s&7" - ShopAuctionsConverted: "Shop &6%s&7 : &3%d&9/%d&7 auctions converted" - ShopTemporarilyLocked: "This shop is temporarily locked" - ConversionMode: "Conversion mode : &6%s&7" + ConvertingShopAuctions: "Market açık arttırmalarını dönüştürme : &6%s&7" + ShopAuctionsConverted: "Market &6%s&7 : &3%d&9/%d&7 açık arttırma dönüştürme yapıldı" + ShopTemporarilyLocked: "Bu mağaza geçici olarak kilitlendi" + ConversionMode: "Dönüşüm modu : &6%s&7" Commands: Buttons: OpenText: "Open" @@ -220,4 +220,4 @@ Commands: Open: "&c/globalmarketchest open &6 - Open a globalshop" AdminOpen: "&c/globalmarketchest open [player]&6 - Open a globalshop" Close: "&c/globalmarketchest close &6 - Close the shop of a player" - FixAuctions: "&c/globalmarketchest fix auctions [active | all]&6 - Convert old minecraft itemMeta to new minecraft version" + FixAuctions: "&c/globalmarketchest açık arttrıma düzelt [active | all]&6 - Eski minecraft itemMeta'yı yeni minecraft sürümüne dönüştür" \ No newline at end of file From f44d611c7475a86b9f0ed107e84b3e7b42f973fe Mon Sep 17 00:00:00 2001 From: EpiCanard Date: Mon, 22 Jul 2019 22:34:19 +0200 Subject: [PATCH 3/6] Fix #92 - Can't get item namespace with 1.14.4 --- pom.xml | 4 ++-- .../utils/reflection/VersionSupportUtils.java | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index d5de3105..305f2cc4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 fr.epicanard globalmarketchest - 1.3.1 + 1.3.2-snapshot GlobalMarketChest Shop plugin to create economy between user @@ -11,7 +11,7 @@ 1.8 1.8 1.7.1 - 1.14.3-R0.1-SNAPSHOT + 1.14.4-R0.1-SNAPSHOT ${project.name}-${project.version} diff --git a/src/main/java/fr/epicanard/globalmarketchest/utils/reflection/VersionSupportUtils.java b/src/main/java/fr/epicanard/globalmarketchest/utils/reflection/VersionSupportUtils.java index 69b4d009..c89f6d54 100644 --- a/src/main/java/fr/epicanard/globalmarketchest/utils/reflection/VersionSupportUtils.java +++ b/src/main/java/fr/epicanard/globalmarketchest/utils/reflection/VersionSupportUtils.java @@ -10,6 +10,7 @@ import fr.epicanard.globalmarketchest.exceptions.MissingMethodException; import fr.epicanard.globalmarketchest.utils.annotations.AnnotationCaller; import fr.epicanard.globalmarketchest.utils.annotations.Version; +import net.minecraft.server.v1_14_R1.MinecraftKey; public class VersionSupportUtils { @@ -183,7 +184,12 @@ public String getMinecraftKey(ItemStack itemStack) { minecraftKey = registry.getClass().getMethod("getKey", Object.class).invoke(registry, invokeMethod(nmsItemStack, "getItem")); } - return invokeMethod(minecraftKey, "b").toString() + ":" + invokeMethod(minecraftKey, "getKey").toString(); + Object namespace = invokeMethod(minecraftKey, "b"); + if (namespace == null) { + namespace = invokeMethod(minecraftKey, "getNamespace"); + } + + return namespace.toString() + ":" + invokeMethod(minecraftKey, "getKey").toString(); } catch(ClassNotFoundException | InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { e.printStackTrace(); @@ -275,7 +281,7 @@ public void updateInventoryName_latest(String title, Player player) { /** * Define if the GMC NBT TAG is set on this item - * + * * @param itemStack Item to analyze * @return Return if the item as gmc nbt tag */ @@ -296,7 +302,7 @@ public boolean hasNbtTag(ItemStack itemStack) { /** * Set the custom GMC NBT TAG on item in parameter - * + * * @param itemStack Item on which add NBT TAG * @return ItemStack modified */ From c4f410a540e95817b14734314813da0ba1813d93 Mon Sep 17 00:00:00 2001 From: EpiCanard Date: Mon, 22 Jul 2019 22:41:13 +0200 Subject: [PATCH 4/6] Add Polish translation for fix command --- src/main/resources/langs/lang-pl_PL.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/langs/lang-pl_PL.yml b/src/main/resources/langs/lang-pl_PL.yml index d6394f11..0a8bedef 100644 --- a/src/main/resources/langs/lang-pl_PL.yml +++ b/src/main/resources/langs/lang-pl_PL.yml @@ -195,10 +195,10 @@ InfoMessages: WriteItemName: "Wpisz nazwę itemu, którego szukasz" WritePlayerName: "Wpisz nazwę gracza, którego szukasz" DeleteShopQuestion: "Jesteś pewien, że chcesz usunąć ten sklep?" - ConvertingShopAuctions: "Converting auctions of shop : &6%s&7" - ShopAuctionsConverted: "Shop &6%s&7 : &3%d&9/%d&7 auctions converted" - ShopTemporarilyLocked: "This shop is temporarily locked" - ConversionMode: "Conversion mode : &6%s&7" + ConvertingShopAuctions: "Przetwarzanie aukcji sklepu : &6%s&7" + ShopAuctionsConverted: "Sklep &6%s&7 : &3%d&9/%d&7 aukcje przetworzone" + ShopTemporarilyLocked: "Ten sklep jest czasowo niedostępny" + ConversionMode: "Tryb konwersji : &6%s&7" Commands: Buttons: OpenText: "Otwórz" @@ -220,4 +220,4 @@ Commands: Open: "&c/globalmarketchest open &6 - Otwórz GlobalShop" AdminOpen: "&c/globalmarketchest open [player]&6 - Otwórz GlobalShop" Close: "&c/globalmarketchest close &6 - Zamknij sklep gracza" - FixAuctions: "&c/globalmarketchest fix auctions [active | all]&6 - Convert old minecraft itemMeta to new minecraft version" + FixAuctions: "&c/globalmarketchest fix auctions [active | all]&6 - Przetwarza stare itemMeta do nowszej wersji" \ No newline at end of file From 621404ff39ea8ff8a0ed4c52a62171bbf49c0eed Mon Sep 17 00:00:00 2001 From: EpiCanard Date: Mon, 22 Jul 2019 22:56:25 +0200 Subject: [PATCH 5/6] Set version 1.3.2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 305f2cc4..255b74b8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ - 4.0.0 fr.epicanard globalmarketchest - 1.3.2-snapshot + 1.3.2 GlobalMarketChest Shop plugin to create economy between user From 20d5e02e4d9902582d2188b2a9593da684354f3f Mon Sep 17 00:00:00 2001 From: EpiCanard Date: Mon, 22 Jul 2019 23:02:12 +0200 Subject: [PATCH 6/6] Add missing possible values for polish and turkish --- src/main/resources/1.12/config.yml | 2 +- src/main/resources/1.13/config.yml | 2 +- src/main/resources/1.14/config.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/1.12/config.yml b/src/main/resources/1.12/config.yml index df95397e..5c02547c 100644 --- a/src/main/resources/1.12/config.yml +++ b/src/main/resources/1.12/config.yml @@ -7,7 +7,7 @@ # =================================================================== General: - # Possible values : lang-fr_FR.yml, lang-en_US.yml, lang-zh_CN.yml, lang-de_DE.yml + # Possible values : lang-fr_FR.yml, lang-en_US.yml, lang-zh_CN.yml, lang-de_DE.yml, lang-pl_PL.yml, lang-tr_TR.yml Lang: "lang-en_US.yml" Connection: # The url/ip to access to your database server diff --git a/src/main/resources/1.13/config.yml b/src/main/resources/1.13/config.yml index 6302055b..80484877 100644 --- a/src/main/resources/1.13/config.yml +++ b/src/main/resources/1.13/config.yml @@ -7,7 +7,7 @@ # =================================================================== General: - # Possible values : lang-fr_FR.yml, lang-en_US.yml, lang-zh_CN.yml, lang-de_DE.yml + # Possible values : lang-fr_FR.yml, lang-en_US.yml, lang-zh_CN.yml, lang-de_DE.yml, lang-pl_PL.yml, lang-tr_TR.yml Lang: "lang-en_US.yml" Connection: # The url/ip to access to your database server diff --git a/src/main/resources/1.14/config.yml b/src/main/resources/1.14/config.yml index 3f8537f1..4f6d29bf 100644 --- a/src/main/resources/1.14/config.yml +++ b/src/main/resources/1.14/config.yml @@ -7,7 +7,7 @@ # =================================================================== General: - # Possible values : lang-fr_FR.yml, lang-en_US.yml, lang-zh_CN.yml, lang-de_DE.yml + # Possible values : lang-fr_FR.yml, lang-en_US.yml, lang-zh_CN.yml, lang-de_DE.yml, lang-pl_PL.yml, lang-tr_TR.yml Lang: "lang-en_US.yml" Connection: # The url/ip to access to your database server