SteamWar/BauSystem2.0
Archiviert
12
0

+Add InventoryFillerCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

+Add INVENTORY_FILL_HELP in BauSystem.properties
+Add INVENTORY_FILL_INFO in BauSystem.properties
Dieser Commit ist enthalten in:
MoBrot 2022-09-03 16:35:06 +02:00
Ursprung b4466e6444
Commit 60f10ae765
4 geänderte Dateien mit 48 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -17,9 +17,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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;

Datei anzeigen

@ -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));
}
}