From ccc76cf363e96ebc59b6be8847bae4ab5a2bf35b Mon Sep 17 00:00:00 2001 From: blablubbabc Date: Mon, 23 Nov 2020 12:08:02 +0100 Subject: [PATCH] Changed: Players in creative mode are no longer ignored when using the shop creation item. This seems to cause more confusion than it helps. Also, this is less of an issue, because the default shop creation item is a villager egg with specific display name since some time now. --- CHANGELOG.md | 1 + .../nisovin/shopkeepers/shopcreation/CreateListener.java | 9 --------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb940074..3a18dc5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Date format: (YYYY-MM-DD) * Config: Changed the default language from 'en' to 'en-default'. Existing configs get automatically migrated. * Fixed: Text#parse can now also parse alternative color codes starting with '&'. This has an effect when some messages of the specified language file cannot be loaded and the plugin then uses the default messages instead. * Added warning output when the language file misses messages, or contains unexpected messages. +* Changed: Players in creative mode are no longer ignored when using the shop creation item. Migration notes: * The folder structure has changed: diff --git a/src/main/java/com/nisovin/shopkeepers/shopcreation/CreateListener.java b/src/main/java/com/nisovin/shopkeepers/shopcreation/CreateListener.java index 0b8831ea..90f7eefb 100644 --- a/src/main/java/com/nisovin/shopkeepers/shopcreation/CreateListener.java +++ b/src/main/java/com/nisovin/shopkeepers/shopcreation/CreateListener.java @@ -1,7 +1,6 @@ package com.nisovin.shopkeepers.shopcreation; import org.bukkit.Bukkit; -import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -52,7 +51,6 @@ class CreateListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) void onItemHeld(PlayerItemHeldEvent event) { Player player = event.getPlayer(); - if (player.getGameMode() == GameMode.CREATIVE) return; ItemStack newItemInHand = player.getInventory().getItem(event.getNewSlot()); if (!Settings.isShopCreationItem(newItemInHand)) { return; @@ -88,12 +86,6 @@ class CreateListener implements Listener { Player player = event.getPlayer(); Log.debug(() -> "Player " + player.getName() + " is interacting with the shop creation item"); - // Ignore creative mode players: - if (player.getGameMode() == GameMode.CREATIVE) { - Log.debug(" Ignoring creative mode player"); - return; - } - // Capture event's cancellation state: Result useItemInHand = event.useItemInHand(); @@ -240,7 +232,6 @@ class CreateListener implements Listener { private void handleEntityInteraction(PlayerInteractEntityEvent event) { if (!Settings.preventShopCreationItemRegularUsage) return; Player player = event.getPlayer(); - if (player.getGameMode() == GameMode.CREATIVE) return; // Creative mode players are ignored // We check the permission first since this check is fast: if (PermissionUtils.hasPermission(player, ShopkeepersPlugin.BYPASS_PERMISSION)) return; ItemStack itemInHand = ItemUtils.getItem(player.getInventory(), event.getHand());