Skip to content

Commit

Permalink
Add bot check
Browse files Browse the repository at this point in the history
  • Loading branch information
Lumine1909 committed Aug 26, 2024
1 parent 986949c commit 01768c0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
18 changes: 15 additions & 3 deletions patches/server/0010-Fakeplayer-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ index b835b259d9e371ff18b1704249b290d1ecbe06e1..49e7d9bc75e029a8800f7369681e43ef
}

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 763cffdc2e1e2e7cc9af88cc46bbaa240a20fd0d..647a6c9dd39e113625377273281d74ae3f902f96 100644
index 763cffdc2e1e2e7cc9af88cc46bbaa240a20fd0d..d6c5d43aea7f9c5175c47a7e9efe9d91ba25cfbf 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -212,7 +212,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
Expand Down Expand Up @@ -197,7 +197,19 @@ index 763cffdc2e1e2e7cc9af88cc46bbaa240a20fd0d..647a6c9dd39e113625377273281d74ae
if (this.levitationStartPos != null) {
CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
}
@@ -1015,7 +1019,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -831,6 +835,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple

public void doTick() {
try {
+ if (this instanceof org.leavesmc.leaves.bot.ServerBot) {
+ super.tick();
+ return;
+ }
+
if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
super.tick();
}
@@ -1015,7 +1024,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
List<DefaultDrop> loot = new java.util.ArrayList<>(this.getInventory().getContainerSize()); // Paper - Restore vanilla drops behavior
boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();

Expand All @@ -206,7 +218,7 @@ index 763cffdc2e1e2e7cc9af88cc46bbaa240a20fd0d..647a6c9dd39e113625377273281d74ae
for (ItemStack item : this.getInventory().getContents()) {
if (!item.isEmpty() && !EnchantmentHelper.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - Restore vanilla drops behavior; drop function taken from Inventory#dropAll (don't fire drop event)
@@ -1417,6 +1421,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1417,6 +1426,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0038-Player-operation-limiter.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Player operation limiter
This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 647a6c9dd39e113625377273281d74ae3f902f96..2852e569c11af9281f5e81659525898bcfea372a 100644
index d6c5d43aea7f9c5175c47a7e9efe9d91ba25cfbf..3c30aae751580c204e5a7106588e9b4721fac743 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -302,6 +302,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
Expand All @@ -28,7 +28,7 @@ index 647a6c9dd39e113625377273281d74ae3f902f96..2852e569c11af9281f5e81659525898b
this.gameMode.tick();
this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime;
@@ -2953,5 +2958,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -2958,5 +2963,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
public CraftPlayer getBukkitEntity() {
return (CraftPlayer) super.getBukkitEntity();
}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0042-MC-Technical-Survival-Mode.patch
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ index 5a97f8a853664a3ced63215a386286873a6c7a95..f10018a3f79744ce0c78ee3020ec0f5d
pearl.ownerUUID = null;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 2852e569c11af9281f5e81659525898bcfea372a..55e8802526effaa30fbf7ae5a1b5db7929d668a7 100644
index 3c30aae751580c204e5a7106588e9b4721fac743..839faa453f3542c43b8a6320d3c86f0d5711858d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1634,7 +1634,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1639,7 +1639,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple

@Override
public boolean isInvulnerableTo(DamageSource damageSource) {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0043-Return-nether-portal-fix.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Return nether portal fix
This patch is powered by NetherPortalFix(https://github.com/TwelveIterationMods/NetherPortalFix)

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 55e8802526effaa30fbf7ae5a1b5db7929d668a7..cc51a2c43028e63fa4bcf6dadb7b5bc3d5a9f4bb 100644
index 839faa453f3542c43b8a6320d3c86f0d5711858d..e87cf25ed2ff7d3cdfd6cebce4db70f8d0694934 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1437,6 +1437,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1442,6 +1442,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
Expand Down

0 comments on commit 01768c0

Please sign in to comment.