SteamWar/BauSystem2.0
Archiviert
12
0

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

+Add OTHER_ITEMS_INVENTORY_FILL_NAME in BauSystem.properties
Dieser Commit ist enthalten in:
MoBrot 2022-09-04 21:16:57 +02:00
Ursprung 60f10ae765
Commit f878efab32
4 geänderte Dateien mit 44 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -885,6 +885,7 @@ OTHER_ITEMS_GAMEMODE_LORE_2=§eLeft-Click§8:§7 Toggle between survival and adv
OTHER_ITEMS_KILLALL_NAME=§eKillAll
OTHER_ITEMS_KILLALL_LORE_1=§eWithout Shift§8:§7 only this region
OTHER_ITEMS_KILLALL_LORE_2=§eWith Shift§8:§7 global
OTHER_ITEMS_INVENTORY_FILL_NAME=§eInventoryFill
OTHER_SLOT_INVALID_SLOT=§cInvalid slot
OTHER_NOCLIP_SLOT_INFO=§7With /slot you can change the selected slot and take another block in the slot.
OTHER_NOCLIP_SLOT_HELP_PICK = §8/§eslot pick §8-§7 Take the faced block into your inventory.

Datei anzeigen

@ -39,7 +39,6 @@ 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);
@ -61,7 +60,6 @@ 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();

Datei anzeigen

@ -17,14 +17,13 @@ public class InventoryFillerCommand extends SWCommand {
@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) {
if (!inventoryFill) {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player));
BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player);
}else
}else {
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_DISABLE", player));
}
}
}

Datei anzeigen

@ -0,0 +1,40 @@
package de.steamwar.bausystem.features.util.items;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.inventoryfiller.InventoryFillerCommand;
import de.steamwar.bausystem.linkage.LinkageType;
import de.steamwar.bausystem.linkage.Linked;
import de.steamwar.bausystem.linkage.LinkedInstance;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
@Linked(LinkageType.BAU_GUI_ITEM)
public class InventoryFillBauGuiItem extends BauGuiItem {
public InventoryFillBauGuiItem() {
super(34);
}
@LinkedInstance
public InventoryFillerCommand command;
@Override
public Permission permission() {
return Permission.MEMBER;
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.BARREL, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), null, false, clickType -> {}).getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
command.toggle(p);
return false;
}
}