diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 9a709a1f..c878ab57 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -632,6 +632,12 @@ SMART_PLACE_INFO = §7Places rotatable blocks §eaway§7 from you when §esneaki SMART_PLACE_ENABLE = §aSmartPlace activated SMART_PLACE_DISABLE = §cSmartPlace deactivated +# InventoryFiller +INVENTORY_FILL_HELP = §8/§einventoryfill §8- §7Toggles InventoryFill +INVENTORY_FILL_INFO = §7Helps you fill containers by looking at them while sneaking and dropping the item. Or just scroll on a container to change the amount of the item inside. +INVENTORY_FILL_ENABLE = §aInventoryFiller activated +INVENTORY_FILL_DISABLE = §cInventoryFiller deactivated + # BlockCounter BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Toggle on/off BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Toggles BlockCounter on diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 37dda73a..778aef4e 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -613,6 +613,12 @@ SMART_PLACE_INFO = §7Plaziert rotierbare Blöcke beim §esneaken§7 von dir §e SMART_PLACE_ENABLE = §aSmartPlace aktiviert SMART_PLACE_DISABLE = §cSmartPlace deaktiviert +# InventoryFiller +INVENTORY_FILL_HELP = §8/§einventoryfill §8- §7Toggled InventoryFill +INVENTORY_FILL_INFO = §7Hilft dir, Behälter zu füllen, indem du sie beim sneaken ansiehst und den Gegenstand fallen lässt. Oder scrolle einfach auf einen Behälter, um die Menge des gehaltenen Gegenstandes darin zu ändern. +INVENTORY_FILL_ENABLE = §aInventoryFiller activated +INVENTORY_FILL_DISABLE = §cInventoryFiller deactivated + # BlockCounter BLOCK_COUNTER_HELP_TOGGLE = §8/§eblockcounter §8- §7Wechsel zwischen an und aus BLOCK_COUNTER_HELP_ENABLE = §8/§eblockcounter enable §8- §7Schalte den BlockCounter an diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/util/InventoryFiller.java b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java similarity index 93% rename from BauSystem_Main/src/de/steamwar/bausystem/features/util/InventoryFiller.java rename to BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java index 37c957bc..068aaf2d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/util/InventoryFiller.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFiller.java @@ -17,9 +17,10 @@ * along with this program. If not, see . */ -package de.steamwar.bausystem.features.util; +package de.steamwar.bausystem.features.inventoryfiller; import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.configplayer.Config; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; import net.md_5.bungee.api.ChatMessageType; @@ -38,6 +39,8 @@ public class InventoryFiller implements Listener { @EventHandler public void onPlayerDropItem(PlayerDropItemEvent event) { + + if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return; if (!event.getPlayer().isSneaking()) return; Block block = event.getPlayer().getTargetBlockExact(5); if (block == null) return; @@ -58,6 +61,8 @@ public class InventoryFiller implements Listener { */ @EventHandler public void onPlayerItemHeld(PlayerItemHeldEvent event) { + + if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return; if (!event.getPlayer().isSneaking()) return; ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand(); if (itemStack.getType() == Material.AIR) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java new file mode 100644 index 00000000..1c13d8b5 --- /dev/null +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/inventoryfiller/InventoryFillerCommand.java @@ -0,0 +1,30 @@ +package de.steamwar.bausystem.features.inventoryfiller; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.SWUtils; +import de.steamwar.bausystem.configplayer.Config; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; +import de.steamwar.command.SWCommand; +import org.bukkit.entity.Player; + +@Linked(LinkageType.COMMAND) +public class InventoryFillerCommand extends SWCommand { + + public InventoryFillerCommand() { + super("inventoryfill"); + } + + @Register(description = {"INVENTORY_FILL_HELP", "INVENTORY_FILL_INFO"}) + public void toggle(Player player) { + + boolean inventoryFill = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false); + Config.getInstance().get(player).put("inventoryfill", !inventoryFill); + + if(!inventoryFill) { + SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player)); + BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player); + }else + SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_DISABLE", player)); + } +}