diff --git a/api/src/main/java/fr/skytasul/quests/api/localization/Lang.java b/api/src/main/java/fr/skytasul/quests/api/localization/Lang.java index 5131f2f0..c2aee23a 100644 --- a/api/src/main/java/fr/skytasul/quests/api/localization/Lang.java +++ b/api/src/main/java/fr/skytasul/quests/api/localization/Lang.java @@ -51,6 +51,7 @@ public enum Lang implements Locale { QUEST_ITEM_DROP("msg.questItem.drop"), QUEST_ITEM_CRAFT("msg.questItem.craft"), QUEST_ITEM_EAT("msg.questItem.eat"), + QUEST_ITEM_PLACE("msg.questItem.place"), STAGE_MOBSLIST("msg.stageMobs.listMobs"), diff --git a/core/src/main/java/fr/skytasul/quests/QuestsListener.java b/core/src/main/java/fr/skytasul/quests/QuestsListener.java index 944baf79..865915d4 100644 --- a/core/src/main/java/fr/skytasul/quests/QuestsListener.java +++ b/core/src/main/java/fr/skytasul/quests/QuestsListener.java @@ -9,6 +9,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.CraftItemEvent; @@ -195,6 +196,14 @@ public void onDeath(PlayerDeathEvent e) { if (BeautyQuests.getInstance().isRunningPaper()) Paper.handleDeathItems(e, Utils::isQuestItem); } + @EventHandler + public void onPlace(BlockPlaceEvent e) { + if (Utils.isQuestItem(e.getItemInHand())) { + e.setCancelled(true); + Lang.QUEST_ITEM_PLACE.send(e.getPlayer()); + } + } + @EventHandler(priority = EventPriority.HIGHEST) public void onBreak(BlockBreakEvent e) { if (e.isCancelled()) return; diff --git a/core/src/main/resources/locales/en_US.yml b/core/src/main/resources/locales/en_US.yml index 6015bdda..0de2c421 100644 --- a/core/src/main/resources/locales/en_US.yml +++ b/core/src/main/resources/locales/en_US.yml @@ -26,9 +26,10 @@ msg: noAvailable: §7There is no more quest available... maxQuests: §cYou cannot have more than {pool_max_quests} quest(s) at the same time... questItem: - drop: §cYou can't drop a quest item! - craft: §cYou can't use a quest item to craft! + drop: §cYou cannot drop a quest item! + craft: §cYou cannot use a quest item to craft! eat: §cYou cannot eat a quest item! + place: §cYou cannot place a quest item! stageMobs: listMobs: §aYou must kill {mobs}. writeNPCText: '§aWrite the dialog that will be said to the player by the NPC: (Write