+Add InventoryFillerCommand #135
@ -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_NAME=§eKillAll
|
||||||
OTHER_ITEMS_KILLALL_LORE_1=§eWithout Shift§8:§7 only this region
|
OTHER_ITEMS_KILLALL_LORE_1=§eWithout Shift§8:§7 only this region
|
||||||
OTHER_ITEMS_KILLALL_LORE_2=§eWith Shift§8:§7 global
|
OTHER_ITEMS_KILLALL_LORE_2=§eWith Shift§8:§7 global
|
||||||
|
OTHER_ITEMS_INVENTORY_FILL_NAME=§eInventoryFill
|
||||||
OTHER_SLOT_INVALID_SLOT=§cInvalid slot
|
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_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.
|
OTHER_NOCLIP_SLOT_HELP_PICK = §8/§eslot pick §8-§7 Take the faced block into your inventory.
|
||||||
|
@ -39,7 +39,6 @@ public class InventoryFiller implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
|
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
|
|||||||
if (!event.getPlayer().isSneaking()) return;
|
if (!event.getPlayer().isSneaking()) return;
|
||||||
Block block = event.getPlayer().getTargetBlockExact(5);
|
Block block = event.getPlayer().getTargetBlockExact(5);
|
||||||
@ -61,7 +60,6 @@ public class InventoryFiller implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||||
|
|
||||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||||
if (!event.getPlayer().isSneaking()) return;
|
if (!event.getPlayer().isSneaking()) return;
|
||||||
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
||||||
|
@ -17,14 +17,13 @@ public class InventoryFillerCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(description = {"INVENTORY_FILL_HELP", "INVENTORY_FILL_INFO"})
|
@Register(description = {"INVENTORY_FILL_HELP", "INVENTORY_FILL_INFO"})
|
||||||
public void toggle(Player player) {
|
public void toggle(Player player) {
|
||||||
|
|
||||||
boolean inventoryFill = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false);
|
boolean inventoryFill = Config.getInstance().get(player).getPlainValueOrDefault("inventoryfill", false);
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
YoyoNow
hat
Leere Zeile? Leere Zeile?
|
|||||||
Config.getInstance().get(player).put("inventoryfill", !inventoryFill);
|
Config.getInstance().get(player).put("inventoryfill", !inventoryFill);
|
||||||
|
if (!inventoryFill) {
|
||||||
if(!inventoryFill) {
|
|
||||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player));
|
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_ENABLE", player));
|
||||||
Chaoscaot
hat
evt. nicht immer die Nachricht senden, vllt. nur unter help evt. nicht immer die Nachricht senden, vllt. nur unter help
|
|||||||
BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player);
|
BauSystem.MESSAGE.send("INVENTORY_FILL_INFO", player);
|
||||||
YoyoNow markierte diese Unterhaltung als gelöst
YoyoNow
hat
Ein if mag auch ' ' danach Ein if mag auch ' ' danach
|
|||||||
}else
|
}else {
|
||||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_DISABLE", player));
|
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("INVENTORY_FILL_DISABLE", player));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren
Leere Zeile?