Merge pull request '+Add InventoryFillerCommand' (#135) from InventoryFillToggle into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #135 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
718247a3d4
@ -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
|
||||
@ -879,6 +885,9 @@ 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_ITEMS_INVENTORY_FILL_LORE_ACTIVE=§aActivated
|
||||
OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE=§aDisabled
|
||||
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.
|
||||
|
@ -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
|
||||
@ -860,6 +866,8 @@ OTHER_ITEMS_GAMEMODE_LORE_2=§eLinks-Click§8:§7 Umschalten zwischen Survival u
|
||||
OTHER_ITEMS_KILLALL_NAME=§eKillAll
|
||||
OTHER_ITEMS_KILLALL_LORE_1=§eOhne Shift§8:§7 nur die Region
|
||||
OTHER_ITEMS_KILLALL_LORE_2=§eMit Shift§8:§7 Global
|
||||
OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE=§aAktiviert
|
||||
OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE=§aDeaktiviert
|
||||
OTHER_SLOT_INVALID_SLOT=§cInvalider Slot
|
||||
OTHER_NOCLIP_SLOT_INFO=§7Mit /slot kannst du den ausgewählten Slot ändern und einen anderen Block in den Slot nehmen.
|
||||
OTHER_NOCLIP_SLOT_HELP_PICK = §8/§eslot pick §8-§7 Lege den angeguckten Block ins Inventar
|
||||
|
@ -0,0 +1,44 @@
|
||||
package de.steamwar.bausystem.features.inventoryfiller;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
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;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@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) {
|
||||
String loreKey = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false) ? "OTHER_ITEMS_INVENTORY_FILL_LORE_ACTIVE" : "OTHER_ITEMS_INVENTORY_FILL_LORE_INACTIVE";
|
||||
return new SWItem(Material.HOPPER, BauSystem.MESSAGE.parse("OTHER_ITEMS_INVENTORY_FILL_NAME", player), Collections.singletonList(BauSystem.MESSAGE.parse(loreKey, player)), false, clickType -> {}).getItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
command.toggle(p);
|
||||
return false;
|
||||
}
|
||||
}
|
@ -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,7 @@ 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 +60,7 @@ 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;
|
@ -0,0 +1,29 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren