Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix #291, #292 #293

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions patches/server/0010-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1510,10 +1510,10 @@ index 0000000000000000000000000000000000000000..0db337866c71283464d026a4f230016b
+}
diff --git a/src/main/java/org/leavesmc/leaves/bot/ServerBot.java b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java
new file mode 100644
index 0000000000000000000000000000000000000000..f04bd729fbabbf51c432d3d8eb39f059740fd157
index 0000000000000000000000000000000000000000..1314bcb0dfa311d671fcdcfeee4a8394b69834ad
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java
@@ -0,0 +1,766 @@
@@ -0,0 +1,767 @@
+package org.leavesmc.leaves.bot;
+
+import com.google.common.collect.Lists;
Expand Down Expand Up @@ -1788,6 +1788,7 @@ index 0000000000000000000000000000000000000000..f04bd729fbabbf51c432d3d8eb39f059
+ if (!new BotRemoveEvent(this.getBukkitPlayer(), reason, remover).callEvent()) {
+ return;
+ }
+ dropAll();
+ if (this.removeTaskId != -1) {
+ Bukkit.getScheduler().cancelTask(this.removeTaskId);
+ this.removeTaskId = -1;
Expand Down Expand Up @@ -1931,7 +1932,7 @@ index 0000000000000000000000000000000000000000..f04bd729fbabbf51c432d3d8eb39f059
+
+ public Entity getTargetEntity(int maxDistance, Predicate<? super Entity> predicate) {
+ List<Entity> entities = this.level().getEntities((Entity) null, this.getBoundingBox(), (e -> e != this && (predicate == null || predicate.test(e))));
+ if (entities.isEmpty()) {
+ if (!entities.isEmpty()) {
+ return entities.getFirst();
+ } else {
+ EntityHitResult result = this.getBukkitEntity().rayTraceEntity(3, false);
Expand Down