diff --git a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java index eab5f8e..5b6cc1f 100644 --- a/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java +++ b/src/main/java/de/epiceric/shopchest/language/LanguageUtils.java @@ -1054,6 +1054,7 @@ public class LanguageUtils { messages.add(new LocalizedMessage(LocalizedMessage.Message.SHOP_LIMIT_REACHED, langConfig.getString("message.shop-limit-reached", "&cYou reached your limit of &6%LIMIT% &cshop/s."), Placeholder.LIMIT)); messages.add(new LocalizedMessage(LocalizedMessage.Message.OCCUPIED_SHOP_SLOTS, langConfig.getString("message.occupied-shop-slots", "&6You have &c%AMOUNT%/%LIMIT% &6shop slot/s occupied."), Placeholder.AMOUNT, Placeholder.LIMIT)); messages.add(new LocalizedMessage(LocalizedMessage.Message.CANNOT_SELL_ITEM, langConfig.getString("message.cannot-sell-item", "&cYou cannot create a shop with this item."))); + messages.add(new LocalizedMessage(LocalizedMessage.Message.USE_IN_CREATIVE, langConfig.getString("message.use-in-creative", "&cYou cannot use a shop in creative mode."))); messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, langConfig.getString("message.update.update-available", "&6&lVersion &c%VERSION% &6of &cShopChest &6is available &chere."), Placeholder.VERSION)); messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD, langConfig.getString("message.update.click-to-download", "Click to download"))); messages.add(new LocalizedMessage(LocalizedMessage.Message.UPDATE_NO_UPDATE, langConfig.getString("message.update.no-update", "&6&lNo new update available."))); diff --git a/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java b/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java index b2d0581..046acaf 100644 --- a/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java +++ b/src/main/java/de/epiceric/shopchest/language/LocalizedMessage.java @@ -99,6 +99,7 @@ public class LocalizedMessage { SHOP_LIMIT_REACHED, OCCUPIED_SHOP_SLOTS, CANNOT_SELL_ITEM, + USE_IN_CREATIVE, UPDATE_AVAILABLE, UPDATE_CLICK_TO_DOWNLOAD, UPDATE_NO_UPDATE, diff --git a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java index ae31a10..5fdbebe 100644 --- a/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java +++ b/src/main/java/de/epiceric/shopchest/listeners/ShopInteractListener.java @@ -15,7 +15,11 @@ import com.wasteofplastic.askyblock.Island; import de.epiceric.shopchest.ShopChest; import de.epiceric.shopchest.config.Config; import de.epiceric.shopchest.config.Placeholder; -import de.epiceric.shopchest.event.*; +import de.epiceric.shopchest.event.ShopBuySellEvent; +import de.epiceric.shopchest.event.ShopCreateEvent; +import de.epiceric.shopchest.event.ShopInfoEvent; +import de.epiceric.shopchest.event.ShopOpenEvent; +import de.epiceric.shopchest.event.ShopRemoveEvent; import de.epiceric.shopchest.external.PlotSquaredShopFlag; import de.epiceric.shopchest.external.WorldGuardShopFlag; import de.epiceric.shopchest.language.LanguageUtils; @@ -35,6 +39,7 @@ import me.ryanhamshire.GriefPrevention.Claim; import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.EconomyResponse; import org.bukkit.Bukkit; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -54,7 +59,11 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerArmorStandManipulateEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.*; +import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryHolder; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.meta.BookMeta; import org.bukkit.scheduler.BukkitRunnable; import pl.islandworld.api.IslandWorldApi; @@ -396,6 +405,12 @@ public class ShopInteractListener implements Listener { return; } + if (p.getGameMode() == GameMode.CREATIVE) { + e.setCancelled(true); + p.sendMessage(LanguageUtils.getMessage(LocalizedMessage.Message.USE_IN_CREATIVE)); + return; + } + if ((e.getAction() == Action.RIGHT_CLICK_BLOCK && !inverted) || (e.getAction() == Action.LEFT_CLICK_BLOCK && inverted)) { e.setCancelled(true); diff --git a/src/main/resources/lang/de_DE.lang b/src/main/resources/lang/de_DE.lang index 6b2c327..da8afb1 100644 --- a/src/main/resources/lang/de_DE.lang +++ b/src/main/resources/lang/de_DE.lang @@ -55,6 +55,7 @@ message.reloaded-shops=&a%AMOUNT% Shop/s wurden erfolgreich neu geladen. message.shop-limit-reached=&cDu hast dein Limit von &6%LIMIT% &cShop/s erreicht. message.occupied-shop-slots=&6Du hast &c%AMOUNT%/%LIMIT% &6Shop Slot/s benutzt. message.cannot-sell-item=&cDu kannst für diesen Artikel keinen Shop erstellen. +message.use-in-creative=&cDu kannst im Kreativ-Modus keine Shops benutzen. message.update.update-available=&6&lVersion &c%VERSION% &6von &cShopChest &6ist verfügbar. message.update.click-to-download=Klicke hier zum Herunterladen message.update.no-update=&6&lKeine neue Aktualisierung verfügbar. diff --git a/src/main/resources/lang/en_US.lang b/src/main/resources/lang/en_US.lang index 7fbd370..f2ff937 100644 --- a/src/main/resources/lang/en_US.lang +++ b/src/main/resources/lang/en_US.lang @@ -199,6 +199,9 @@ message.occupied-shop-slots=&6You have &c%AMOUNT%/%LIMIT% &6shop slot/s occupied # Set the message when the player tries to create a shop with an item which is listed in the blacklist. message.cannot-sell-item=&cYou cannot create a shop with this item. +# Set the message when the player tries to use a shop in creative mode. +message.use-in-creative=&cYou cannot use a shop in creative mode. + # Set the message when an update is available. # Usable Placeholders: %VERSION% message.update.update-available=&6&lVersion &c%VERSION% &6of &cShopChest &6is available &chere.