Skip to content

Commit

Permalink
Fix a bug where spectator bots would count towards botsDontSleep
Browse files Browse the repository at this point in the history
  • Loading branch information
alikindsys committed Jan 4, 2024
1 parent 7c79f68 commit 549d006
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import carpet.patches.EntityPlayerMPFake;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.server.world.SleepManager;
import net.minecraft.world.GameMode;
import org.blocovermelho.bvextension.Settings;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -26,7 +27,7 @@ public class BotsDontSleep {
var players = CarpetServer.minecraft_server.getPlayerManager().getPlayerList();

var bots = (int) players.stream().filter(p -> {
return p instanceof EntityPlayerMPFake;
return p instanceof EntityPlayerMPFake && p.interactionManager.getGameMode() != GameMode.SPECTATOR;
}).count();

return original - bots;
Expand Down

0 comments on commit 549d006

Please sign in to comment.