mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-04 15:41:31 +00:00
Fix fakeplayer equipment not update by inventory
This commit is contained in:
@@ -565,10 +565,10 @@ index 0000000000000000000000000000000000000000..6b7fb541d4d1fb6d4f3239ec59da26e3
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/bot/BotInventoryContainer.java b/src/main/java/top/leavesmc/leaves/bot/BotInventoryContainer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..566905463d6a086e051db94ef10bbef148ccb5b8
|
||||
index 0000000000000000000000000000000000000000..9fce8c91bf0c211c2d87993cc0e2d4e8f5fe3d19
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/bot/BotInventoryContainer.java
|
||||
@@ -0,0 +1,177 @@
|
||||
@@ -0,0 +1,180 @@
|
||||
+package top.leavesmc.leaves.bot;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableList;
|
||||
@@ -678,14 +678,16 @@ index 0000000000000000000000000000000000000000..566905463d6a086e051db94ef10bbef1
|
||||
+ public ItemStack removeItem(int slot, int amount) {
|
||||
+ Pair<NonNullList<ItemStack>, Integer> pair = getItemSlot(slot);
|
||||
+ NonNullList<ItemStack> list = null;
|
||||
+ ItemStack itemStack = ItemStack.EMPTY;
|
||||
+ if (pair != null) {
|
||||
+ list = pair.getFirst();
|
||||
+ slot = pair.getSecond();
|
||||
+ }
|
||||
+ if (list != null && !list.get(slot).isEmpty()) {
|
||||
+ return ContainerHelper.removeItem(list, slot, amount);
|
||||
+ itemStack = ContainerHelper.removeItem(list, slot, amount);
|
||||
+ player.detectEquipmentUpdates();
|
||||
+ }
|
||||
+ return ItemStack.EMPTY;
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -715,6 +717,7 @@ index 0000000000000000000000000000000000000000..566905463d6a086e051db94ef10bbef1
|
||||
+ }
|
||||
+ if (list != null) {
|
||||
+ list.set(slot, stack);
|
||||
+ player.detectEquipmentUpdates();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -942,10 +945,10 @@ index 0000000000000000000000000000000000000000..d6466ee4db637106e1394bb462d875e5
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/bot/ServerBot.java b/src/main/java/top/leavesmc/leaves/bot/ServerBot.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f3d5b3c4189784e2eff852a23e1c4d6d159b2045
|
||||
index 0000000000000000000000000000000000000000..b9eb0f1d0c9a82cba9dd255a0cd6c9be5d5adc7f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/bot/ServerBot.java
|
||||
@@ -0,0 +1,779 @@
|
||||
@@ -0,0 +1,781 @@
|
||||
+package top.leavesmc.leaves.bot;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
@@ -1627,8 +1630,10 @@ index 0000000000000000000000000000000000000000..f3d5b3c4189784e2eff852a23e1c4d6d
|
||||
+ @Override
|
||||
+ public @NotNull InteractionResult interact(@NotNull Player player, @NotNull InteractionHand hand) {
|
||||
+ if (LeavesConfig.openFakeplayerInventory) {
|
||||
+ player.openMenu(new SimpleMenuProvider((i, inventory, p) -> ChestMenu.sixRows(i, inventory, container), getDisplayName()));
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ if (player.getMainHandItem().isEmpty()) {
|
||||
+ player.openMenu(new SimpleMenuProvider((i, inventory, p) -> ChestMenu.sixRows(i, inventory, container), getDisplayName()));
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
+ return super.interact(player, hand);
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user