├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ └── issue.yml ├── dependabot.yml └── workflows │ ├── act-build-launcher.yml │ ├── act-local.yml │ ├── build.yml │ ├── commands-wiki.yml │ ├── prerelease.yml │ ├── release-launcher.yml │ └── release.yml ├── .gitignore ├── .idea └── runConfigurations │ ├── GraalVM_Agent_Run.xml │ └── Run_ZenithProxy.xml ├── .tokeignore ├── LICENSE ├── README-LICENSE.md ├── README.md ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts └── src │ └── main │ └── kotlin │ ├── CommitHashTask.kt │ ├── JavaPathTask.kt │ └── WriteMetadataTxtTask.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── licenses ├── LICENSE-Baritone └── LICENSE-Pork2b2tBot ├── run └── .gitkeep ├── scripts ├── cloud-init.yaml ├── launcher-git.bat ├── launcher-git.sh ├── launcher.py ├── native-image-configure.bat ├── native-image-configure.sh └── windows_help.txt ├── settings.gradle.kts └── src ├── launcher ├── __main__.py ├── github_api.py ├── icon.ico ├── jdk_install.py ├── launch.bat ├── launch.sh ├── launch_config.py ├── launch_platform.py ├── launch_windows.bat ├── launcher.py ├── requirements.txt ├── setup.py ├── update_launcher.py ├── update_zenith.py ├── utils.py └── zip_fixed.py ├── main ├── java │ └── com │ │ └── zenith │ │ ├── Globals.java │ │ ├── Proxy.java │ │ ├── cache │ │ ├── CacheResetType.java │ │ ├── CachedData.java │ │ ├── DataCache.java │ │ └── data │ │ │ ├── PlayerCache.java │ │ │ ├── ServerProfileCache.java │ │ │ ├── bossbar │ │ │ ├── BossBar.java │ │ │ └── BossBarCache.java │ │ │ ├── chat │ │ │ ├── ChatCache.java │ │ │ └── ChatSession.java │ │ │ ├── chunk │ │ │ ├── Chunk.java │ │ │ ├── ChunkCache.java │ │ │ ├── WorldBorderData.java │ │ │ └── WorldTimeData.java │ │ │ ├── config │ │ │ ├── ConfigurationCache.java │ │ │ └── ResourcePack.java │ │ │ ├── cookie │ │ │ └── CookieCache.java │ │ │ ├── entity │ │ │ ├── Entity.java │ │ │ ├── EntityCache.java │ │ │ ├── EntityExperienceOrb.java │ │ │ ├── EntityLiving.java │ │ │ ├── EntityPlayer.java │ │ │ ├── EntityStandard.java │ │ │ └── PotionEffect.java │ │ │ ├── info │ │ │ └── ClientInfoCache.java │ │ │ ├── inventory │ │ │ ├── Container.java │ │ │ └── InventoryCache.java │ │ │ ├── map │ │ │ ├── MapDataCache.java │ │ │ └── StoredMapData.java │ │ │ ├── mcpl │ │ │ └── CachedChunkSectionCountProvider.java │ │ │ ├── recipe │ │ │ └── RecipeCache.java │ │ │ ├── registry │ │ │ └── RegistriesCache.java │ │ │ ├── scoreboard │ │ │ ├── Objective.java │ │ │ ├── Score.java │ │ │ └── ScoreboardCache.java │ │ │ ├── stats │ │ │ └── StatisticsCache.java │ │ │ ├── tab │ │ │ └── TabListCache.java │ │ │ └── team │ │ │ ├── Team.java │ │ │ └── TeamCache.java │ │ ├── command │ │ ├── CommandManager.java │ │ ├── api │ │ │ ├── Command.java │ │ │ ├── CommandCategory.java │ │ │ ├── CommandContext.java │ │ │ ├── CommandErrorHandler.java │ │ │ ├── CommandExecutionErrorHandler.java │ │ │ ├── CommandOutputHelper.java │ │ │ ├── CommandSource.java │ │ │ ├── CommandSources.java │ │ │ ├── CommandSuccessHandler.java │ │ │ ├── CommandUsage.java │ │ │ ├── DiscordCommandContext.java │ │ │ ├── DiscordCommandSource.java │ │ │ ├── IExecutes.java │ │ │ ├── PlayerCommandSource.java │ │ │ └── TerminalCommandSource.java │ │ ├── brigadier │ │ │ ├── BlockArgument.java │ │ │ ├── BlockPosArgument.java │ │ │ ├── BrigadierToMCProtocolLibConverter.java │ │ │ ├── CaseInsensitiveLiteralArgumentBuilder.java │ │ │ ├── CaseInsensitiveLiteralCommandNode.java │ │ │ ├── Coordinates.java │ │ │ ├── CustomStringArgumentType.java │ │ │ ├── DimensionArgument.java │ │ │ ├── EnumStringArgumentType.java │ │ │ ├── ItemArgument.java │ │ │ ├── LocalCoordinates.java │ │ │ ├── ResourceLocationArgument.java │ │ │ ├── RotationArgument.java │ │ │ ├── ToggleArgumentType.java │ │ │ ├── Vec2Argument.java │ │ │ ├── Vec3Argument.java │ │ │ ├── WorldCoordinate.java │ │ │ ├── WorldCoordinates.java │ │ │ └── ZRequiredArgumentBuilder.java │ │ └── impl │ │ │ ├── ActionLimiterCommand.java │ │ │ ├── ActiveHoursCommand.java │ │ │ ├── AntiAFKCommand.java │ │ │ ├── AntiKickCommand.java │ │ │ ├── AntiLeakCommand.java │ │ │ ├── AuthCommand.java │ │ │ ├── AutoArmorCommand.java │ │ │ ├── AutoDisconnectCommand.java │ │ │ ├── AutoEatCommand.java │ │ │ ├── AutoFishCommand.java │ │ │ ├── AutoMendCommand.java │ │ │ ├── AutoOmenCommand.java │ │ │ ├── AutoReconnectCommand.java │ │ │ ├── AutoReplyCommand.java │ │ │ ├── AutoRespawnCommand.java │ │ │ ├── AutoTotemCommand.java │ │ │ ├── AutoUpdateCommand.java │ │ │ ├── ChatHistoryCommand.java │ │ │ ├── ChatRelayCommand.java │ │ │ ├── ChatSchemaCommand.java │ │ │ ├── ClickCommand.java │ │ │ ├── ClientConnectionCommand.java │ │ │ ├── CommandConfigCommand.java │ │ │ ├── ConnectCommand.java │ │ │ ├── ConnectionTestCommand.java │ │ │ ├── CoordinateObfuscationCommand.java │ │ │ ├── DatabaseCommand.java │ │ │ ├── DebugCommand.java │ │ │ ├── DisconnectCommand.java │ │ │ ├── DiscordManageCommand.java │ │ │ ├── DiscordNotificationsCommand.java │ │ │ ├── DisplayCoordsCommand.java │ │ │ ├── ExtraChatCommand.java │ │ │ ├── FriendCommand.java │ │ │ ├── HelpCommand.java │ │ │ ├── IgnoreCommand.java │ │ │ ├── InventoryCommand.java │ │ │ ├── JvmArgsCommand.java │ │ │ ├── KickCommand.java │ │ │ ├── KillAuraCommand.java │ │ │ ├── LicenseCommand.java │ │ │ ├── MapCommand.java │ │ │ ├── PathfinderCommand.java │ │ │ ├── PearlLoader.java │ │ │ ├── PlaytimeCommand.java │ │ │ ├── PluginsCommand.java │ │ │ ├── PrioCommand.java │ │ │ ├── QueueStatusCommand.java │ │ │ ├── QueueWarningCommand.java │ │ │ ├── RateLimiterCommand.java │ │ │ ├── RaycastCommand.java │ │ │ ├── ReconnectCommand.java │ │ │ ├── ReleaseChannelCommand.java │ │ │ ├── ReplayCommand.java │ │ │ ├── RequeueCommand.java │ │ │ ├── RespawnCommand.java │ │ │ ├── RotateCommand.java │ │ │ ├── SeenCommand.java │ │ │ ├── SendMessageCommand.java │ │ │ ├── ServerCommand.java │ │ │ ├── ServerConnectionCommand.java │ │ │ ├── ServerSwitcherCommand.java │ │ │ ├── SessionTimeLimitCommand.java │ │ │ ├── SkinCommand.java │ │ │ ├── SpammerCommand.java │ │ │ ├── SpawnPatrolCommand.java │ │ │ ├── SpectatorCommand.java │ │ │ ├── SpectatorEntityCommand.java │ │ │ ├── SpectatorEntityToggleCommand.java │ │ │ ├── SpectatorPlayerCamCommand.java │ │ │ ├── SpectatorSwapCommand.java │ │ │ ├── SpookCommand.java │ │ │ ├── StalkCommand.java │ │ │ ├── StatsCommand.java │ │ │ ├── StatusCommand.java │ │ │ ├── TablistCommand.java │ │ │ ├── ThemeCommand.java │ │ │ ├── TransferCommand.java │ │ │ ├── UnsupportedCommand.java │ │ │ ├── UpdateCommand.java │ │ │ ├── ViaVersionCommand.java │ │ │ ├── VisualRangeCommand.java │ │ │ └── WhitelistCommand.java │ │ ├── database │ │ ├── ChatDatabase.java │ │ ├── ConnectionPool.java │ │ ├── ConnectionsDatabase.java │ │ ├── Database.java │ │ ├── DatabaseManager.java │ │ ├── DeathsDatabase.java │ │ ├── HikariConnectionFactory.java │ │ ├── LiveDatabase.java │ │ ├── LockingDatabase.java │ │ ├── PlayerCountDatabase.java │ │ ├── PlaytimeDatabase.java │ │ ├── QueryExecutor.java │ │ ├── QueueLengthDatabase.java │ │ ├── QueueWaitDatabase.java │ │ ├── RedisClient.java │ │ ├── RestartsDatabase.java │ │ ├── TablistDatabase.java │ │ ├── TimeDatabase.java │ │ └── dto │ │ │ ├── enums │ │ │ └── Connectiontype.java │ │ │ └── records │ │ │ ├── ChatsRecord.java │ │ │ ├── ConnectionsRecord.java │ │ │ └── DeathsRecord.java │ │ ├── discord │ │ ├── ChatRelayEventListener.java │ │ ├── DiscordBot.java │ │ ├── Embed.java │ │ ├── EmbedSerializer.java │ │ └── NotificationEventListener.java │ │ ├── event │ │ ├── chat │ │ │ ├── DeathMessageChatEvent.java │ │ │ ├── PublicChatEvent.java │ │ │ ├── SystemChatEvent.java │ │ │ └── WhisperChatEvent.java │ │ ├── client │ │ │ ├── ClientBotTick.java │ │ │ ├── ClientConnectEvent.java │ │ │ ├── ClientDeathEvent.java │ │ │ ├── ClientDeathMessageEvent.java │ │ │ ├── ClientDisconnectEvent.java │ │ │ ├── ClientLoginFailedEvent.java │ │ │ ├── ClientOnlineEvent.java │ │ │ ├── ClientStartConnectEvent.java │ │ │ ├── ClientTickEvent.java │ │ │ ├── MsaDeviceCodeLoginEvent.java │ │ │ ├── PrioBanStatusUpdateEvent.java │ │ │ ├── PrioStatusEvent.java │ │ │ └── PrioStatusUpdateEvent.java │ │ ├── db │ │ │ ├── DatabaseTickEvent.java │ │ │ └── RedisRestartEvent.java │ │ ├── message │ │ │ ├── DiscordMainChannelCommandReceivedEvent.java │ │ │ ├── DiscordRelayChannelMessageReceivedEvent.java │ │ │ └── PrivateMessageSendEvent.java │ │ ├── module │ │ │ ├── ActiveHoursConnectEvent.java │ │ │ ├── AutoEatOutOfFoodEvent.java │ │ │ ├── AutoReconnectEvent.java │ │ │ ├── ClientSwingEvent.java │ │ │ ├── EntityFishHookSpawnEvent.java │ │ │ ├── HealthAutoDisconnectEvent.java │ │ │ ├── NoTotemsEvent.java │ │ │ ├── OutboundChatEvent.java │ │ │ ├── PlayerHealthChangedEvent.java │ │ │ ├── PlayerTotemPopAlertEvent.java │ │ │ ├── QueueWarningEvent.java │ │ │ ├── ReplayStartedEvent.java │ │ │ ├── ReplayStoppedEvent.java │ │ │ ├── ServerPlayerAttackedUsEvent.java │ │ │ ├── ServerPlayerInVisualRangeEvent.java │ │ │ ├── ServerPlayerLeftVisualRangeEvent.java │ │ │ ├── ServerPlayerLogoutInVisualRangeEvent.java │ │ │ ├── SessionTimeLimitWarningEvent.java │ │ │ ├── SpawnPatrolTargetAcquiredEvent.java │ │ │ ├── SpawnPatrolTargetKilledEvent.java │ │ │ ├── SplashSoundEffectEvent.java │ │ │ ├── TotemPopEvent.java │ │ │ ├── VisualRangeEnterEvent.java │ │ │ ├── VisualRangeLeaveEvent.java │ │ │ ├── VisualRangeLogoutEvent.java │ │ │ └── WeatherChangeEvent.java │ │ ├── player │ │ │ ├── BlacklistedPlayerConnectedEvent.java │ │ │ ├── NonWhitelistedPlayerConnectedEvent.java │ │ │ ├── PlayerConnectedEvent.java │ │ │ ├── PlayerConnectionAddedEvent.java │ │ │ ├── PlayerConnectionRemovedEvent.java │ │ │ ├── PlayerDisconnectedEvent.java │ │ │ ├── PlayerLoginEvent.java │ │ │ ├── SpectatorConnectedEvent.java │ │ │ ├── SpectatorDisconnectedEvent.java │ │ │ └── SpectatorLoggedInEvent.java │ │ ├── plugin │ │ │ ├── PluginLoadFailureEvent.java │ │ │ └── PluginLoadedEvent.java │ │ ├── queue │ │ │ ├── QueueCompleteEvent.java │ │ │ ├── QueuePositionUpdateEvent.java │ │ │ ├── QueueSkipEvent.java │ │ │ └── QueueStartEvent.java │ │ ├── server │ │ │ ├── CustomTablistFooterBuildEvent.java │ │ │ ├── MotdBuildEvent.java │ │ │ ├── ServerIconBuildEvent.java │ │ │ ├── ServerPlayerConnectedEvent.java │ │ │ ├── ServerPlayerDisconnectedEvent.java │ │ │ └── ServerRestartingEvent.java │ │ └── update │ │ │ ├── UpdateAvailableEvent.java │ │ │ └── UpdateStartEvent.java │ │ ├── feature │ │ ├── actionlimiter │ │ │ └── handlers │ │ │ │ ├── inbound │ │ │ │ ├── ALChatCommandHandler.java │ │ │ │ ├── ALChatHandler.java │ │ │ │ ├── ALClientCommandHandler.java │ │ │ │ ├── ALContainerClickHandler.java │ │ │ │ ├── ALEditBookHandler.java │ │ │ │ ├── ALInteractHandler.java │ │ │ │ ├── ALMovePlayerPosHandler.java │ │ │ │ ├── ALMovePlayerPosRotHandler.java │ │ │ │ ├── ALMoveVehicleHandler.java │ │ │ │ ├── ALPlayerActionHandler.java │ │ │ │ ├── ALSCommandSuggestionHandler.java │ │ │ │ ├── ALSignedChatCommandHandler.java │ │ │ │ ├── ALUseItemHandler.java │ │ │ │ └── ALUseItemOnHandler.java │ │ │ │ └── outbound │ │ │ │ ├── ALCCommandSuggestionsHandler.java │ │ │ │ ├── ALCMoveVehicleHandler.java │ │ │ │ ├── ALForgetLevelChunkHandler.java │ │ │ │ ├── ALLevelChunkWithLightHandler.java │ │ │ │ ├── ALLoginHandler.java │ │ │ │ ├── ALPlayerPositionHandler.java │ │ │ │ └── ALTeleportEntityHandler.java │ │ ├── api │ │ │ ├── Api.java │ │ │ ├── ProfileData.java │ │ │ ├── crafthead │ │ │ │ ├── CraftheadApi.java │ │ │ │ └── model │ │ │ │ │ ├── CraftheadProfileProperties.java │ │ │ │ │ └── CraftheadProfileResponse.java │ │ │ ├── fileio │ │ │ │ ├── FileIOApi.java │ │ │ │ └── model │ │ │ │ │ └── FileIOResponse.java │ │ │ ├── mcsrvstatus │ │ │ │ ├── MCSrvStatusApi.java │ │ │ │ └── model │ │ │ │ │ └── MCSrvStatusResponse.java │ │ │ ├── mcstatus │ │ │ │ ├── MCStatusApi.java │ │ │ │ └── model │ │ │ │ │ └── MCStatusResponse.java │ │ │ ├── minetools │ │ │ │ ├── MinetoolsApi.java │ │ │ │ └── model │ │ │ │ │ ├── MinetoolsProfileResponse.java │ │ │ │ │ ├── MinetoolsProfileResponseDecoded.java │ │ │ │ │ └── MinetoolsUuidResponse.java │ │ │ ├── minotar │ │ │ │ └── MinotarApi.java │ │ │ ├── mojang │ │ │ │ ├── MojangApi.java │ │ │ │ └── model │ │ │ │ │ └── MojangProfileResponse.java │ │ │ ├── prioban │ │ │ │ └── PriobanApi.java │ │ │ ├── sessionserver │ │ │ │ ├── SessionServerApi.java │ │ │ │ └── model │ │ │ │ │ ├── HasJoinedResponse.java │ │ │ │ │ ├── JoinServerErrorResponse.java │ │ │ │ │ ├── JoinServerRequest.java │ │ │ │ │ ├── MojangProfileAndSkin.java │ │ │ │ │ ├── MojangProfileProperties.java │ │ │ │ │ └── SessionProfileResponse.java │ │ │ └── vcapi │ │ │ │ ├── VcApi.java │ │ │ │ └── model │ │ │ │ ├── PlaytimeResponse.java │ │ │ │ ├── QueueEtaEquationResponse.java │ │ │ │ ├── QueueResponse.java │ │ │ │ ├── SeenResponse.java │ │ │ │ ├── SessionTimeLimitResponse.java │ │ │ │ └── StatsResponse.java │ │ ├── autoupdater │ │ │ ├── AutoUpdater.java │ │ │ ├── NoOpAutoUpdater.java │ │ │ └── RestAutoUpdater.java │ │ ├── chatschema │ │ │ ├── ChatParseResult.java │ │ │ ├── ChatSchema.java │ │ │ ├── ChatSchemaParser.java │ │ │ └── ChatType.java │ │ ├── coordobf │ │ │ ├── CoordOffset.java │ │ │ ├── ObfPlayerState.java │ │ │ └── handlers │ │ │ │ ├── inbound │ │ │ │ ├── COAcceptTeleportationHandler.java │ │ │ │ ├── COMovePlayerPosHandler.java │ │ │ │ ├── COMovePlayerPosRotHandler.java │ │ │ │ ├── COPlayerActionHandler.java │ │ │ │ ├── COSMoveVehicleHandler.java │ │ │ │ ├── COSignUpdateHandler.java │ │ │ │ ├── COUseItemHandler.java │ │ │ │ └── COUseItemOnHandler.java │ │ │ │ └── outbound │ │ │ │ ├── COAddEntityHandler.java │ │ │ │ ├── COAddExperienceOrbHandler.java │ │ │ │ ├── COBlockDestructionHandler.java │ │ │ │ ├── COBlockEntityDataHandler.java │ │ │ │ ├── COBlockEventHandler.java │ │ │ │ ├── COBlockUpdateHandler.java │ │ │ │ ├── COCMoveVehicleHandler.java │ │ │ │ ├── COCStartConfigurationHandler.java │ │ │ │ ├── COChunksBiomesHandler.java │ │ │ │ ├── COContainerSetContentHandler.java │ │ │ │ ├── COContainerSetSlotHandler.java │ │ │ │ ├── CODamageEventHandler.java │ │ │ │ ├── COExplodeHandler.java │ │ │ │ ├── COForgetLevelChunkHandler.java │ │ │ │ ├── COLevelChunkWithLightHandler.java │ │ │ │ ├── COLevelEventHandler.java │ │ │ │ ├── COLevelParticlesHandler.java │ │ │ │ ├── COLightUpdateHandler.java │ │ │ │ ├── COLoginHandler.java │ │ │ │ ├── COMoveEntityPosHandler.java │ │ │ │ ├── COMoveEntityPosRotHandler.java │ │ │ │ ├── COMoveEntityRotHandler.java │ │ │ │ ├── COOpenSignEditorHandler.java │ │ │ │ ├── COPlayerLookAtHandler.java │ │ │ │ ├── COPlayerPositionHandler.java │ │ │ │ ├── CORespawnHandler.java │ │ │ │ ├── COSectionBlocksUpdateHandler.java │ │ │ │ ├── COSetChunkCacheCenterHandler.java │ │ │ │ ├── COSetDefaultSpawnPositionHandler.java │ │ │ │ ├── COSetEntityDataHandler.java │ │ │ │ ├── COSetEntityMotionHandler.java │ │ │ │ ├── COSetEquipmentHandler.java │ │ │ │ ├── COSoundHandler.java │ │ │ │ ├── COTagQueryHandler.java │ │ │ │ └── COTeleportEntityHandler.java │ │ ├── deathmessages │ │ │ ├── DeathMessageParseResult.java │ │ │ ├── DeathMessageSchemaInstance.java │ │ │ ├── DeathMessagesParser.java │ │ │ ├── Killer.java │ │ │ ├── KillerType.java │ │ │ └── WordIterator.java │ │ ├── extrachat │ │ │ ├── ECChatCommandIncomingHandler.java │ │ │ ├── ECPlayerChatOutgoingHandler.java │ │ │ ├── ECSignedChatCommandIncomingHandler.java │ │ │ └── ECSystemChatOutgoingHandler.java │ │ ├── inventory │ │ │ ├── InventoryActionRequest.java │ │ │ ├── InventoryManager.java │ │ │ ├── actions │ │ │ │ ├── ClickItem.java │ │ │ │ ├── CloseContainer.java │ │ │ │ ├── ContainerButtonClick.java │ │ │ │ ├── DropItem.java │ │ │ │ ├── DropMouseStack.java │ │ │ │ ├── InventoryAction.java │ │ │ │ ├── MoveToHotbarSlot.java │ │ │ │ ├── PlaceRecipe.java │ │ │ │ ├── SelectTrade.java │ │ │ │ ├── SetHeldItem.java │ │ │ │ ├── ShiftClick.java │ │ │ │ └── WaitAction.java │ │ │ └── util │ │ │ │ ├── InventoryActionMacros.java │ │ │ │ └── InventoryUtil.java │ │ ├── map │ │ │ ├── Brightness.java │ │ │ ├── MapGenerator.java │ │ │ └── MapRenderer.java │ │ ├── pathfinder │ │ │ ├── Baritone.java │ │ │ ├── BlockStateInterface.java │ │ │ ├── IngamePathRenderer.java │ │ │ ├── InputOverrideHandler.java │ │ │ ├── MutableMoveResult.java │ │ │ ├── PathInput.java │ │ │ ├── Pathfinder.java │ │ │ ├── PathingCommand.java │ │ │ ├── PathingCommandType.java │ │ │ ├── PathingControlManager.java │ │ │ ├── PathingRequestFuture.java │ │ │ ├── PlayerContext.java │ │ │ ├── PrecomputedData.java │ │ │ ├── Ternary.java │ │ │ ├── behavior │ │ │ │ ├── Behavior.java │ │ │ │ ├── InventoryBehavior.java │ │ │ │ ├── LookBehavior.java │ │ │ │ └── PathingBehavior.java │ │ │ ├── calc │ │ │ │ ├── AStarPathFinder.java │ │ │ │ ├── AbstractNodeCostSearch.java │ │ │ │ ├── CutoffPath.java │ │ │ │ ├── IPath.java │ │ │ │ ├── Path.java │ │ │ │ ├── PathBase.java │ │ │ │ ├── PathNode.java │ │ │ │ ├── SplicedPath.java │ │ │ │ └── openset │ │ │ │ │ ├── BinaryHeapOpenSet.java │ │ │ │ │ └── IOpenSet.java │ │ │ ├── executor │ │ │ │ └── PathExecutor.java │ │ │ ├── goals │ │ │ │ ├── Goal.java │ │ │ │ ├── GoalBlock.java │ │ │ │ ├── GoalComposite.java │ │ │ │ ├── GoalGetToBlock.java │ │ │ │ ├── GoalNear.java │ │ │ │ ├── GoalRunAway.java │ │ │ │ ├── GoalStrictDirection.java │ │ │ │ ├── GoalTwoBlocks.java │ │ │ │ ├── GoalXZ.java │ │ │ │ ├── GoalY.java │ │ │ │ └── PosGoal.java │ │ │ ├── movement │ │ │ │ ├── ActionCosts.java │ │ │ │ ├── CalculationContext.java │ │ │ │ ├── IMovement.java │ │ │ │ ├── Movement.java │ │ │ │ ├── MovementHelper.java │ │ │ │ ├── MovementState.java │ │ │ │ ├── MovementStatus.java │ │ │ │ ├── Moves.java │ │ │ │ └── movements │ │ │ │ │ ├── MovementAscend.java │ │ │ │ │ ├── MovementDescend.java │ │ │ │ │ ├── MovementDiagonal.java │ │ │ │ │ ├── MovementDownward.java │ │ │ │ │ ├── MovementFall.java │ │ │ │ │ ├── MovementParkour.java │ │ │ │ │ ├── MovementPillar.java │ │ │ │ │ └── MovementTraverse.java │ │ │ ├── process │ │ │ │ ├── BaritoneProcessHelper.java │ │ │ │ ├── CustomGoalProcess.java │ │ │ │ ├── FollowProcess.java │ │ │ │ ├── GetToBlockProcess.java │ │ │ │ ├── IBaritoneProcess.java │ │ │ │ ├── InteractWithProcess.java │ │ │ │ └── MineProcess.java │ │ │ └── util │ │ │ │ ├── BlockOptionalMetaLookup.java │ │ │ │ ├── Favoring.java │ │ │ │ ├── PathCalculationResult.java │ │ │ │ ├── PathEvent.java │ │ │ │ ├── RotationUtils.java │ │ │ │ ├── ToolSet.java │ │ │ │ ├── VecUtils.java │ │ │ │ └── WorldScanner.java │ │ ├── player │ │ │ ├── Bot.java │ │ │ ├── ClickResult.java │ │ │ ├── ClickTarget.java │ │ │ ├── Input.java │ │ │ ├── InputManager.java │ │ │ ├── InputRequest.java │ │ │ ├── InputRequestFuture.java │ │ │ ├── InteractionResult.java │ │ │ ├── PlayerInteractionManager.java │ │ │ ├── Position.java │ │ │ ├── Rotation.java │ │ │ ├── RotationHelper.java │ │ │ ├── World.java │ │ │ └── raycast │ │ │ │ ├── BlockOrEntityRaycastResult.java │ │ │ │ ├── BlockRaycastResult.java │ │ │ │ ├── EntityRaycastResult.java │ │ │ │ ├── RayIntersection.java │ │ │ │ └── RaycastHelper.java │ │ ├── queue │ │ │ ├── Queue.java │ │ │ ├── QueueStatus.java │ │ │ └── mcping │ │ │ │ ├── MCPing.java │ │ │ │ ├── Pinger.java │ │ │ │ ├── data │ │ │ │ └── MCResponse.java │ │ │ │ └── rawData │ │ │ │ ├── Extra.java │ │ │ │ ├── ExtraDescription.java │ │ │ │ ├── Player.java │ │ │ │ ├── Players.java │ │ │ │ └── Version.java │ │ ├── ratelimiter │ │ │ ├── IntervalledCounter.java │ │ │ ├── LoginRateLimiter.java │ │ │ └── PacketRateLimiter.java │ │ ├── replay │ │ │ ├── ReplayMetadata.java │ │ │ ├── ReplayModPacketHandlerCodec.java │ │ │ └── ReplayRecording.java │ │ ├── spectator │ │ │ ├── SpectatorEntityRegistry.java │ │ │ ├── SpectatorPacketProvider.java │ │ │ ├── SpectatorSync.java │ │ │ └── entity │ │ │ │ ├── SpectatorEntity.java │ │ │ │ └── mob │ │ │ │ ├── SpectatorEntityAllay.java │ │ │ │ ├── SpectatorEntityBat.java │ │ │ │ ├── SpectatorEntityCat.java │ │ │ │ ├── SpectatorEntityChicken.java │ │ │ │ ├── SpectatorEntityCreeper.java │ │ │ │ ├── SpectatorEntityDog.java │ │ │ │ ├── SpectatorEntityEndCrystal.java │ │ │ │ ├── SpectatorEntityEnderDragon.java │ │ │ │ ├── SpectatorEntityGhast.java │ │ │ │ ├── SpectatorEntityParrot.java │ │ │ │ ├── SpectatorEntityPlayerHead.java │ │ │ │ ├── SpectatorEntityVex.java │ │ │ │ ├── SpectatorEntityWarden.java │ │ │ │ ├── SpectatorEntityWither.java │ │ │ │ └── SpectatorMob.java │ │ ├── tps │ │ │ └── TPSCalculator.java │ │ └── whitelist │ │ │ ├── PlayerEntry.java │ │ │ ├── PlayerList.java │ │ │ └── PlayerListsManager.java │ │ ├── mc │ │ ├── DynamicRegistry.java │ │ ├── Registry.java │ │ ├── RegistryData.java │ │ ├── block │ │ │ ├── Block.java │ │ │ ├── BlockDataManager.java │ │ │ ├── BlockOffsetType.java │ │ │ ├── BlockPos.java │ │ │ ├── BlockRegistry.java │ │ │ ├── BlockState.java │ │ │ ├── BlockStatePropertyDefinition.java │ │ │ ├── BlockStatePropertyRegistry.java │ │ │ ├── BlockTags.java │ │ │ ├── CollisionBox.java │ │ │ ├── Direction.java │ │ │ ├── FluidState.java │ │ │ ├── LocalizedCollisionBox.java │ │ │ └── properties │ │ │ │ ├── AttachFace.java │ │ │ │ ├── BambooLeaves.java │ │ │ │ ├── BedPart.java │ │ │ │ ├── BellAttachType.java │ │ │ │ ├── ChestType.java │ │ │ │ ├── ComparatorMode.java │ │ │ │ ├── DoorHingeSide.java │ │ │ │ ├── DoubleBlockHalf.java │ │ │ │ ├── DripstoneThickness.java │ │ │ │ ├── FrontAndTop.java │ │ │ │ ├── Half.java │ │ │ │ ├── NoteBlockInstrument.java │ │ │ │ ├── PistonType.java │ │ │ │ ├── RailShape.java │ │ │ │ ├── RedstoneSide.java │ │ │ │ ├── SculkSensorPhase.java │ │ │ │ ├── SlabType.java │ │ │ │ ├── StairsShape.java │ │ │ │ ├── StructureMode.java │ │ │ │ ├── Tilt.java │ │ │ │ ├── TrialSpawnerState.java │ │ │ │ ├── VaultState.java │ │ │ │ ├── WallSide.java │ │ │ │ └── api │ │ │ │ ├── BlockStateProperties.java │ │ │ │ ├── BooleanProperty.java │ │ │ │ ├── EnumProperty.java │ │ │ │ ├── IntegerProperty.java │ │ │ │ ├── Property.java │ │ │ │ └── StringRepresentable.java │ │ ├── chat_type │ │ │ ├── ChatType.java │ │ │ └── ChatTypeRegistry.java │ │ ├── dimension │ │ │ ├── DimensionData.java │ │ │ └── DimensionRegistry.java │ │ ├── enchantment │ │ │ ├── EnchantmentData.java │ │ │ └── EnchantmentRegistry.java │ │ ├── entity │ │ │ ├── EntityData.java │ │ │ ├── EntityDataManager.java │ │ │ └── EntityRegistry.java │ │ ├── food │ │ │ ├── FoodData.java │ │ │ └── FoodRegistry.java │ │ ├── item │ │ │ ├── ContainerTypeInfoRegistry.java │ │ │ ├── ItemData.java │ │ │ ├── ItemRegistry.java │ │ │ ├── ToolTag.java │ │ │ ├── ToolTier.java │ │ │ └── ToolType.java │ │ ├── language │ │ │ └── TranslationRegistryInitializer.java │ │ └── map │ │ │ └── MapBlockColorManager.java │ │ ├── module │ │ ├── ModuleManager.java │ │ ├── api │ │ │ ├── Module.java │ │ │ └── ModuleUtils.java │ │ └── impl │ │ │ ├── AbstractInventoryModule.java │ │ │ ├── ActionLimiter.java │ │ │ ├── ActiveHours.java │ │ │ ├── AntiAFK.java │ │ │ ├── AntiKick.java │ │ │ ├── AntiLeak.java │ │ │ ├── AutoArmor.java │ │ │ ├── AutoDisconnect.java │ │ │ ├── AutoEat.java │ │ │ ├── AutoFish.java │ │ │ ├── AutoMend.java │ │ │ ├── AutoOmen.java │ │ │ ├── AutoReconnect.java │ │ │ ├── AutoReply.java │ │ │ ├── AutoRespawn.java │ │ │ ├── AutoTotem.java │ │ │ ├── ChatHistory.java │ │ │ ├── Click.java │ │ │ ├── CoordObfuscation.java │ │ │ ├── ExtraChat.java │ │ │ ├── KillAura.java │ │ │ ├── QueueWarning.java │ │ │ ├── ReplayMod.java │ │ │ ├── Requeue.java │ │ │ ├── SessionTimeLimit.java │ │ │ ├── Spammer.java │ │ │ ├── SpawnPatrol.java │ │ │ ├── Spook.java │ │ │ └── VisualRange.java │ │ ├── network │ │ ├── ClientPacketPingTask.java │ │ ├── KeepAliveTask.java │ │ ├── UserAuthTask.java │ │ ├── client │ │ │ ├── Authenticator.java │ │ │ ├── ClientSession.java │ │ │ ├── ClientTickManager.java │ │ │ └── handler │ │ │ │ ├── incoming │ │ │ │ ├── AwardStatsHandler.java │ │ │ │ ├── BossEventHandler.java │ │ │ │ ├── CCookieRequestHandler.java │ │ │ │ ├── CCustomQueryHandler.java │ │ │ │ ├── CDisconnectHandler.java │ │ │ │ ├── CFinishConfigurationHandler.java │ │ │ │ ├── CGameProfileHandler.java │ │ │ │ ├── CHelloHandler.java │ │ │ │ ├── CKeepAliveHandler.java │ │ │ │ ├── CLoginCompressionHandler.java │ │ │ │ ├── CRegistryDataHandler.java │ │ │ │ ├── CSelectKnownPacksHandler.java │ │ │ │ ├── CStartConfigurationHandler.java │ │ │ │ ├── CStatusResponseHandler.java │ │ │ │ ├── CStoreCookieHandler.java │ │ │ │ ├── CTransferHandler.java │ │ │ │ ├── ChangeDifficultyHandler.java │ │ │ │ ├── CommandsHandler.java │ │ │ │ ├── CustomPayloadHandler.java │ │ │ │ ├── DisguisedChatHandler.java │ │ │ │ ├── ExplodeHandler.java │ │ │ │ ├── LoginDisconnectHandler.java │ │ │ │ ├── LoginHandler.java │ │ │ │ ├── MapDataHandler.java │ │ │ │ ├── PingHandler.java │ │ │ │ ├── PlayerAbilitiesHandler.java │ │ │ │ ├── PlayerChatHandler.java │ │ │ │ ├── PlayerCombatKillHandler.java │ │ │ │ ├── PlayerInfoRemoveHandler.java │ │ │ │ ├── PlayerInfoUpdateHandler.java │ │ │ │ ├── PlayerPositionHandler.java │ │ │ │ ├── PongResponseHandler.java │ │ │ │ ├── ResourcePackPopHandler.java │ │ │ │ ├── ResourcePackPushHandler.java │ │ │ │ ├── RespawnHandler.java │ │ │ │ ├── SetActionBarTextHandler.java │ │ │ │ ├── SetEntityMotionHandler.java │ │ │ │ ├── SetExperienceHandler.java │ │ │ │ ├── SetHealthHandler.java │ │ │ │ ├── SetSubtitleTextHandler.java │ │ │ │ ├── SetTimeHandler.java │ │ │ │ ├── SoundHandler.java │ │ │ │ ├── SystemChatHandler.java │ │ │ │ ├── TabListDataHandler.java │ │ │ │ ├── UpdateAdvancementsHandler.java │ │ │ │ ├── UpdateEnabledFeaturesHandler.java │ │ │ │ ├── UpdateTagsHandler.java │ │ │ │ ├── WorldBorderInitializeHandler.java │ │ │ │ ├── entity │ │ │ │ │ ├── DamageEventHandler.java │ │ │ │ │ ├── EntityEventHandler.java │ │ │ │ │ ├── EntitySetPassengersHandler.java │ │ │ │ │ ├── MoveEntityPosHandler.java │ │ │ │ │ ├── MoveEntityPosRotHandler.java │ │ │ │ │ ├── MoveEntityRotHandler.java │ │ │ │ │ ├── MoveVehicleHandler.java │ │ │ │ │ ├── RemoveEntitiesHandler.java │ │ │ │ │ ├── RemoveMobEffectHandler.java │ │ │ │ │ ├── RotateHeadHandler.java │ │ │ │ │ ├── SetEntityDataHandler.java │ │ │ │ │ ├── SetEntityLinkHandler.java │ │ │ │ │ ├── SetEquipmentHandler.java │ │ │ │ │ ├── TakeItemEntityHandler.java │ │ │ │ │ ├── TeleportEntityHandler.java │ │ │ │ │ ├── UpdateAttributesHandler.java │ │ │ │ │ └── UpdateMobEffectHandler.java │ │ │ │ ├── inventory │ │ │ │ │ ├── ContainerCloseHandler.java │ │ │ │ │ ├── ContainerOpenScreenHandler.java │ │ │ │ │ ├── ContainerSetContentHandler.java │ │ │ │ │ ├── ContainerSetSlotHandler.java │ │ │ │ │ ├── SetCarriedItemHandler.java │ │ │ │ │ ├── SyncRecipesHandler.java │ │ │ │ │ └── UnlockRecipeHandler.java │ │ │ │ ├── level │ │ │ │ │ ├── BlockEntityDataHandler.java │ │ │ │ │ ├── BlockUpdateHandler.java │ │ │ │ │ ├── ChunkBatchFinishedHandler.java │ │ │ │ │ ├── ChunksBiomesHandler.java │ │ │ │ │ ├── ForgetLevelChunkHandler.java │ │ │ │ │ ├── GameEventHandler.java │ │ │ │ │ ├── LevelChunkWithLightHandler.java │ │ │ │ │ ├── LightUpdateHandler.java │ │ │ │ │ ├── SectionBlocksUpdateHandler.java │ │ │ │ │ ├── SetChunkCacheCenterHandler.java │ │ │ │ │ ├── SetChunkCacheRadiusHandler.java │ │ │ │ │ └── SetSimulationDistanceHandler.java │ │ │ │ ├── scoreboard │ │ │ │ │ ├── ResetScoreHandler.java │ │ │ │ │ ├── SetDisplayObjectiveHandler.java │ │ │ │ │ ├── SetObjectiveHandler.java │ │ │ │ │ ├── SetScoreHandler.java │ │ │ │ │ └── TeamHandler.java │ │ │ │ └── spawn │ │ │ │ │ ├── AddEntityHandler.java │ │ │ │ │ ├── AddExperienceOrbHandler.java │ │ │ │ │ └── SpawnPositionHandler.java │ │ │ │ ├── outgoing │ │ │ │ ├── OutgoingChatCommandSignedHandler.java │ │ │ │ ├── OutgoingChatHandler.java │ │ │ │ └── OutgoingContainerClickHandler.java │ │ │ │ └── postoutgoing │ │ │ │ ├── PostOutgoingAcceptTeleportHandler.java │ │ │ │ ├── PostOutgoingConfigurationAckHandler.java │ │ │ │ ├── PostOutgoingContainerClickHandler.java │ │ │ │ ├── PostOutgoingContainerCloseHandler.java │ │ │ │ ├── PostOutgoingFinishConfigurationHandler.java │ │ │ │ ├── PostOutgoingMoveVehicleHandler.java │ │ │ │ ├── PostOutgoingPlayerActionHandler.java │ │ │ │ ├── PostOutgoingPlayerCommandHandler.java │ │ │ │ ├── PostOutgoingPlayerPositionHandler.java │ │ │ │ ├── PostOutgoingPlayerPositionRotationHandler.java │ │ │ │ ├── PostOutgoingPlayerRotationHandler.java │ │ │ │ ├── PostOutgoingPlayerStatusOnlyHandler.java │ │ │ │ ├── PostOutgoingSetCarriedItemHandler.java │ │ │ │ ├── PostOutgoingSetCreativeModeSlotHandler.java │ │ │ │ └── PostOutgoingSwingHandler.java │ │ ├── codec │ │ │ ├── AsyncPacketHandler.java │ │ │ ├── ClientEventLoopPacketHandler.java │ │ │ ├── CodecRegistry.java │ │ │ ├── PacketCodecRegistries.java │ │ │ ├── PacketHandler.java │ │ │ ├── PacketHandlerCodec.java │ │ │ ├── PacketHandlerStateCodec.java │ │ │ ├── PacketLogPacketHandlerCodec.java │ │ │ └── PostOutgoingPacketHandler.java │ │ └── server │ │ │ ├── LanBroadcaster.java │ │ │ ├── ProxyServerListener.java │ │ │ ├── ServerSession.java │ │ │ ├── ZenithServerInfoBuilder.java │ │ │ └── handler │ │ │ ├── ProxyServerLoginHandler.java │ │ │ ├── player │ │ │ ├── InGameCommandManager.java │ │ │ ├── incoming │ │ │ │ ├── ChatCommandHandler.java │ │ │ │ ├── ChatHandler.java │ │ │ │ ├── CommandSuggestionHandler.java │ │ │ │ ├── SAcceptTeleportHandler.java │ │ │ │ ├── SPlayerPositionRotHandler.java │ │ │ │ └── SignedChatCommandHandler.java │ │ │ ├── outgoing │ │ │ │ └── ClientCommandsOutgoingHandler.java │ │ │ └── postoutgoing │ │ │ │ └── LoginPostHandler.java │ │ │ ├── shared │ │ │ ├── incoming │ │ │ │ ├── ConfigurationAckHandler.java │ │ │ │ ├── FinishConfigurationHandler.java │ │ │ │ ├── IntentionHandler.java │ │ │ │ ├── KeepAliveHandler.java │ │ │ │ ├── KeyHandler.java │ │ │ │ ├── LoginAckHandler.java │ │ │ │ ├── PingRequestHandler.java │ │ │ │ ├── PongHandler.java │ │ │ │ ├── SClientInformationHandler.java │ │ │ │ ├── SCookieResponseHandler.java │ │ │ │ ├── SHelloHandler.java │ │ │ │ └── StatusRequestHandler.java │ │ │ ├── outgoing │ │ │ │ ├── KeepAliveOutgoingHandler.java │ │ │ │ ├── SGameProfileOutgoingHandler.java │ │ │ │ └── ServerTablistDataOutgoingHandler.java │ │ │ └── postoutgoing │ │ │ │ ├── ClientFinishConfigurationPostOutgoingHandler.java │ │ │ │ ├── ClientStartConfigurationPostOutgoingHandler.java │ │ │ │ ├── LoginCompressionPostOutgoingHandler.java │ │ │ │ ├── PingPostOutgoingHandler.java │ │ │ │ └── TransferPostOutgoingHandler.java │ │ │ └── spectator │ │ │ ├── incoming │ │ │ ├── ChatCommandSpectatorHandler.java │ │ │ ├── InteractEntitySpectatorHandler.java │ │ │ ├── PlayerCommandSpectatorHandler.java │ │ │ ├── ServerChatSpectatorHandler.java │ │ │ ├── SignedChatCommandSpectatorHandler.java │ │ │ ├── TeleportToEntitySpectatorHandler.java │ │ │ └── movement │ │ │ │ ├── PlayerPositionRotationSpectatorHandler.java │ │ │ │ ├── PlayerPositionSpectatorHandler.java │ │ │ │ └── PlayerRotationSpectatorHandler.java │ │ │ ├── outgoing │ │ │ ├── ClientCommandsSpectatorOutgoingHandler.java │ │ │ ├── ContainerCloseSpectatorOutgoingHandler.java │ │ │ ├── ContainerSetContentSpectatorOutgoingHandler.java │ │ │ ├── ContainerSetDataSpectatorOutgoingHandler.java │ │ │ ├── ContainerSetSlotSpectatorOutgoingHandler.java │ │ │ ├── GameEventSpectatorOutgoingHandler.java │ │ │ ├── HorseScreenOpenSpectatorOutgoingHandler.java │ │ │ ├── MoveVehicleSpectatorOutgoingHandler.java │ │ │ ├── OpenBookSpectatorOutgoingHandler.java │ │ │ ├── OpenScreenSpectatorOutgoingHandler.java │ │ │ ├── OpenSignEditorSpectatorOutgoingHandler.java │ │ │ ├── PlaceGhostRecipeSpectatorOutgoingHandler.java │ │ │ ├── PlayerAbilitiesSpectatorOutgoingHandler.java │ │ │ ├── PlayerPositionSpectatorOutgoingHandler.java │ │ │ ├── RespawnSpectatorOutgoingPacket.java │ │ │ ├── SetCarriedItemSpectatorOutgoingHandler.java │ │ │ ├── SetExperienceSpectatorOutgoingHandler.java │ │ │ ├── SetHealthSpectatorOutgoingHandler.java │ │ │ └── StartConfigurationSpectatorOutgoingHandler.java │ │ │ └── postoutgoing │ │ │ └── LoginSpectatorPostHandler.java │ │ ├── plugin │ │ ├── PluginManager.java │ │ └── api │ │ │ ├── InstancedPluginAPI.java │ │ │ ├── Plugin.java │ │ │ ├── PluginAPI.java │ │ │ ├── PluginAnnotationProcessor.java │ │ │ ├── PluginInfo.java │ │ │ ├── PluginInstance.java │ │ │ ├── Version.java │ │ │ └── ZenithProxyPlugin.java │ │ ├── terminal │ │ ├── TerminalAutoCompletionWidget.java │ │ ├── TerminalCommandCompleter.java │ │ ├── TerminalManager.java │ │ ├── ZenithComponentLoggerProvider.java │ │ └── logback │ │ │ ├── AnsiStripConverter.java │ │ │ ├── AnsiStripEncoder.java │ │ │ ├── DebugLogConfigurationFilter.java │ │ │ ├── LazyInitRollingFileAppender.java │ │ │ ├── PrintOnlyErrorLogbackStatusListener.java │ │ │ ├── StartupSizeAndTimeBasedTriggeringPolicy.java │ │ │ └── TerminalConsoleAppender.java │ │ ├── util │ │ ├── BrandSerializer.java │ │ ├── ChatUtil.java │ │ ├── Color.java │ │ ├── ComponentSerializer.java │ │ ├── DisconnectMessages.java │ │ ├── DisconnectReasonInfo.java │ │ ├── ImageInfo.java │ │ ├── KotlinUtil.java │ │ ├── MentionUtil.java │ │ ├── ReplayReader.java │ │ ├── RequestFuture.java │ │ ├── Wait.java │ │ ├── WebBrowserHelper.java │ │ ├── config │ │ │ ├── Config.java │ │ │ ├── ConfigColor.java │ │ │ ├── ConfigNullable.java │ │ │ ├── ConfigVerifier.java │ │ │ └── LaunchConfig.java │ │ ├── math │ │ │ ├── MathHelper.java │ │ │ ├── MutableVec3d.java │ │ │ └── MutableVec3i.java │ │ ├── struct │ │ │ ├── CircularFifoQueue.java │ │ │ ├── FastArrayList.java │ │ │ ├── Maps.java │ │ │ ├── Pair.java │ │ │ └── SortedFastArrayList.java │ │ └── timer │ │ │ ├── StandardTimer.java │ │ │ ├── SyncedTickTimer.java │ │ │ ├── TickTimerManager.java │ │ │ ├── Timer.java │ │ │ └── Timers.java │ │ └── via │ │ ├── ProtocolVersionDetector.java │ │ ├── ZenithClientChannelInitializer.java │ │ ├── ZenithServerChannelInitializer.java │ │ ├── ZenithViaConfig.java │ │ ├── ZenithViaInitializer.java │ │ ├── ZenithViaLoader.java │ │ └── ZenithViaPlatform.java └── resources │ ├── META-INF │ ├── gradle │ │ └── incremental.annotation.processors │ └── native-image │ │ ├── agent-access-filter.json │ │ ├── predefined-classes-config.json │ │ ├── proxy-config.json │ │ ├── reachability-metadata.json │ │ └── resource-config.json │ ├── death_message_mobs.schema │ ├── death_messages.schema │ ├── logback.xml │ ├── mcdata │ ├── blockCollisionShapes.json │ ├── blockInteractionShapes.json │ ├── fluidStates.json │ ├── language.json │ ├── mapColorIdToColor.json │ ├── pathfindable.json │ └── replaceable.json │ └── servericon.png └── test ├── java └── com │ └── zenith │ ├── ComponentTest.java │ ├── ConnectConcurrencyTest.java │ ├── PingTest.java │ ├── ReplayRecordingReaderTest.java │ ├── RotationRangeCheckTest.java │ ├── TranslatableTextParserTest.java │ ├── database │ ├── DatabaseUtil.java │ └── LiveChatTest.java │ ├── discord │ └── EmbedSerializerTest.java │ ├── docs │ └── CommandDocsGenerator.java │ ├── feature │ ├── api │ │ ├── CraftheadTest.java │ │ ├── MCStatusApiTest.java │ │ ├── MojangApiTests.java │ │ ├── PriobanApiTest.java │ │ └── VcApiTests.java │ ├── chatschema │ │ └── ChatSchemaParserTest.java │ ├── deathmessages │ │ └── DeathMessageParserTest.java │ ├── player │ │ ├── CollisionTest.java │ │ └── RaytraceTest.java │ └── queue │ │ └── mcping │ │ └── PingTest.java │ └── mc │ └── BlockStatePropertiesTest.java └── resources └── logback-test.xml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | *.java text=auto eol=lf 3 | *.xml text=auto eol=lf 4 | *.json text=auto eol=lf 5 | *.md text=auto eol=lf 6 | *.yml text=auto eol=lf 7 | *.template text=auto eol=lf 8 | *.txt text=auto eol=lf 9 | *.bat text=auto eol=lf 10 | *.gradle text=auto eol=lf 11 | *.sh text=auto eol=lf 12 | *.html text=auto eol=lf 13 | *.settings text=auto eol=lf 14 | Jenkinsfile text=auto eol=lf 15 | gradlew test=auto eol=lf 16 | *.py text=auto eol=lf 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: "Discord for Support and Feature Requests" 4 | url: https://discord.gg/nJZrSaRKtb 5 | about: Best and fastest way to get help or request features 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/issue.yml: -------------------------------------------------------------------------------- 1 | name: i can't use the support discord 2 | description: sad 3 | body: 4 | - type: textarea 5 | id: description 6 | attributes: 7 | label: Description 8 | description: >- 9 | Explain the problem you are trying to solve and what you have tried. 10 | If applicable, include logs - they are in same folder as the launcher: `log/latest.log` - and screenshots/videos 11 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "gradle" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | groups: 13 | dependencies: 14 | patterns: 15 | - "*" 16 | - package-ecosystem: "github-actions" 17 | directory: "/" 18 | schedule: 19 | interval: "weekly" 20 | groups: 21 | actions: 22 | patterns: 23 | - "*" 24 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Note: does not build a jar file, only runs basic build and test tasks 2 | name: ZenithProxy Build 3 | 4 | on: 5 | pull_request: 6 | push: 7 | branches: 8 | - "1.21.0" 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out repository 15 | uses: actions/checkout@v4 16 | with: 17 | persist-credentials: false 18 | 19 | - name: Setup JDK 20 | uses: actions/setup-java@v4 21 | with: 22 | java-version: '24' 23 | distribution: 'temurin' 24 | 25 | - name: Elevate wrapper permissions 26 | run: chmod +x ./gradlew 27 | 28 | - name: Setup Gradle 29 | uses: gradle/actions/setup-gradle@v4 30 | with: 31 | dependency-graph: generate-and-submit 32 | 33 | - name: Build ZenithProxy 34 | run: ./gradlew build 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/* 2 | !/.idea/runConfigurations 3 | *.iml 4 | /run/ 5 | /log/ 6 | /build/ 7 | /.gradle/ 8 | *.class 9 | *.ipr 10 | /out/ 11 | .DS_Store 12 | # any json-like file in top directory, including configs, auth cache, etc. 13 | /*.json* 14 | *.tmp 15 | /.vscode 16 | /launcher 17 | /ViaLoader/ 18 | dist/ 19 | /*.spec 20 | __pycache__/ 21 | *.exe 22 | *.zip 23 | /launcher-python* 24 | maps/ 25 | replays/ 26 | /plugins 27 | 28 | dataGenerator/run 29 | /dataGenerator/.gradle 30 | 31 | /dataGenerator/build 32 | /dataGenerator/.idea 33 | 34 | /.kotlin/ 35 | buildSrc/.gradle 36 | buildSrc/.kotlin 37 | buildSrc/build 38 | -------------------------------------------------------------------------------- /.idea/runConfigurations/GraalVM_Agent_Run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations/Run_ZenithProxy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 14 | -------------------------------------------------------------------------------- /.tokeignore: -------------------------------------------------------------------------------- 1 | /src/main/resources/ 2 | -------------------------------------------------------------------------------- /README-LICENSE.md: -------------------------------------------------------------------------------- 1 | ZenithProxy is licensed under [the GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html). 2 | 3 | This means that you are free to use, modify, and distribute ZenithProxy (including hosting as a free or paid service) as long as: 4 | 1. You make the source code available to users 5 | 2. Any modifications you make to ZenithProxy are licensed under the AGPL 6 | 7 | Compiled releases bundle third party code and data which each remain licensed under their original licenses. 8 | -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | gradlePluginPortal() 8 | } 9 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | org.gradle.console=plain 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfresh2/ZenithProxy/8beb2522b7468c251bd5f40744c0f0428ce72a34/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /run/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfresh2/ZenithProxy/8beb2522b7468c251bd5f40744c0f0428ce72a34/run/.gitkeep -------------------------------------------------------------------------------- /scripts/cloud-init.yaml: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | package_upgrade: true 3 | packages: 4 | - tmux 5 | - zsh 6 | - unzip 7 | - zip 8 | write_files: 9 | - path: /root/.tmux.conf 10 | content: | 11 | set -g mouse on 12 | runcmd: 13 | - [runuser, -l, root, -c, 'chsh -s /usr/bin/zsh root'] 14 | - 'cd /root && wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh && chmod +x install.sh' 15 | - [runuser, -l, root, -c, '/usr/bin/zsh -c "/root/install.sh --unattended"'] 16 | - 'rm /root/install.sh' 17 | - 'cd /root && mkdir ZenithProxy && cd ZenithProxy && wget https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-linux-amd64.zip && unzip ZenithProxy-launcher-linux-amd64.zip' 18 | power_state: 19 | message: Rebooting... 20 | mode: reboot 21 | -------------------------------------------------------------------------------- /scripts/native-image-configure.bat: -------------------------------------------------------------------------------- 1 | java --enable-preview -server -XX:MaxRAMPercentage=30 -XX:MinRAMPercentage=30 -XX:+UseG1GC^ 2 | -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch^ 3 | -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20^ 4 | -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15^ 5 | -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem^ 6 | -XX:MaxTenuringThreshold=1 -Djava.util.concurrent.ForkJoinPool.common.parallelism=2^ 7 | -Dio.netty.allocator.maxOrder=9^ 8 | -agentlib:native-image-agent=config-merge-dir=src\main\resources\META-INF\native-image,access-filter-file=src/main/resources/META-INF/native-image/agent-access-filter.json^ 9 | -jar build\libs\ZenithProxy.jar 10 | -------------------------------------------------------------------------------- /scripts/native-image-configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | java -Xmx300m \ 4 | -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch \ 5 | -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 \ 6 | -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 \ 7 | -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 \ 8 | -Djava.util.concurrent.ForkJoinPool.common.parallelism=2 -Dio.netty.allocator.maxOrder=9 \ 9 | -Dio.netty.leakDetection.level=disabled \ 10 | -agentlib:native-image-agent=config-merge-dir=src/main/resources/META-INF/native-image,access-filter-file=src/main/resources/META-INF/native-image/agent-access-filter.json \ 11 | -jar build/libs/ZenithProxy.jar 12 | -------------------------------------------------------------------------------- /scripts/windows_help.txt: -------------------------------------------------------------------------------- 1 | # Usage Instructions 2 | 3 | Full Guide With Screenshots: https://github.com/rfresh2/ZenithProxy/wiki/Windows-Python-Launcher-Guide 4 | 5 | 1. Open cmd or Windows Terminal 6 | 7 | 2. Switch directories to the location of the launcher files using the "cd" command 8 | Example: cd "C:\Users\rfresh2\Downloads\ZenithProxy-launcher-windows-python-amd64" 9 | 10 | 3. Run the launcher: ".\launch.bat" 11 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | mavenLocal() 5 | } 6 | } 7 | 8 | plugins { 9 | id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" 10 | } 11 | 12 | rootProject.name = "ZenithProxy" 13 | -------------------------------------------------------------------------------- /src/launcher/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfresh2/ZenithProxy/8beb2522b7468c251bd5f40744c0f0428ce72a34/src/launcher/icon.ico -------------------------------------------------------------------------------- /src/launcher/launch.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | 5 | echo Finding python interpreter... 6 | 7 | set "PYTHON_CMD=python3" 8 | 9 | REM Check if 'python3' is not found, then try 'python' 10 | where %PYTHON_CMD% >nul 2>nul || set "PYTHON_CMD=python" 11 | 12 | REM Check if neither 'python' nor 'python3' is found 13 | where %PYTHON_CMD% >nul 2>nul || ( 14 | echo Error: Python interpreter not found. Please install Python from https://www.python.org/downloads/ 15 | exit /b 1 16 | ) 17 | 18 | echo Using Python interpreter: %PYTHON_CMD% 19 | %PYTHON_CMD% -m pip >nul 2>nul 20 | if errorlevel 1 ( 21 | echo Error: pip is required but not installed! 22 | echo Help installing: https://pip.pypa.io/en/stable/installation/ 23 | exit /b 1 24 | ) 25 | echo Verifying requirements... 26 | %PYTHON_CMD% -m pip install --upgrade --requirement requirements.txt -qq --disable-pip-version-check --no-input 27 | echo Starting Launcher... 28 | %PYTHON_CMD% launcher-py.zip %* 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/launcher/requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | certifi 3 | install-jdk 4 | -------------------------------------------------------------------------------- /src/launcher/utils.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | def critical_error(*args): 5 | print("CRITICAL:", args) 6 | sys.exit(69) 7 | -------------------------------------------------------------------------------- /src/launcher/zip_fixed.py: -------------------------------------------------------------------------------- 1 | import os 2 | from zipfile import ZipFile, ZipInfo 3 | 4 | 5 | class ZipFileWithPermissions(ZipFile): 6 | """Custom ZipFile class handling file permissions.""" 7 | 8 | def _extract_member(self, member, targetpath, pwd): 9 | if not isinstance(member, ZipInfo): 10 | member = self.getinfo(member) 11 | 12 | targetpath = super()._extract_member(member, targetpath, pwd) 13 | 14 | attr = member.external_attr >> 16 15 | if attr != 0: 16 | os.chmod(targetpath, attr) 17 | print("Extracted:", targetpath) 18 | return targetpath 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/cache/CacheResetType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.cache; 2 | 3 | public enum CacheResetType { 4 | FULL, // full disconnect 5 | PROTOCOL_SWITCH, // e.g. switch to configuration from play 6 | RESPAWN, // On ClientboundRespawnPacket 7 | LOGIN // on ClientboundLoginPacket. Velocity will also send this on backend server switches 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/cache/CachedData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.cache; 2 | 3 | import org.geysermc.mcprotocollib.network.packet.Packet; 4 | import org.geysermc.mcprotocollib.network.tcp.TcpSession; 5 | import org.jspecify.annotations.NonNull; 6 | 7 | import java.util.function.Consumer; 8 | 9 | 10 | public interface CachedData { 11 | void getPackets(@NonNull Consumer consumer, @NonNull final TcpSession session); 12 | 13 | void reset(CacheResetType type); 14 | 15 | default String getSendingMessage() { 16 | return null; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/cache/data/chunk/WorldBorderData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.cache.data.chunk; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | @Data 7 | @AllArgsConstructor 8 | public class WorldBorderData { 9 | private double centerX; 10 | private double centerZ; 11 | private double size; 12 | private int portalTeleportBoundary; 13 | private int warningBlocks; 14 | private int warningTime; 15 | 16 | public static final WorldBorderData DEFAULT = new WorldBorderData(0.0, 0.0, 5.9999968E7, 29999984, 5, 15); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/cache/data/config/ResourcePack.java: -------------------------------------------------------------------------------- 1 | package com.zenith.cache.data.config; 2 | 3 | import net.kyori.adventure.text.Component; 4 | 5 | import java.util.UUID; 6 | 7 | public record ResourcePack(UUID id, String url, String hash, boolean required, Component prompt) { } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/cache/data/entity/PotionEffect.java: -------------------------------------------------------------------------------- 1 | package com.zenith.cache.data.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | import org.geysermc.mcprotocollib.protocol.data.game.entity.Effect; 7 | import org.jspecify.annotations.NonNull; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @Accessors(chain = true) 12 | public class PotionEffect { 13 | @NonNull 14 | public final Effect effect; 15 | public int amplifier; 16 | public int duration; 17 | public boolean ambient; 18 | public boolean showParticles; 19 | public boolean showIcon; 20 | public boolean blend; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/CommandCategory.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum CommandCategory { 7 | // We should keep the number of categories small 8 | CORE("Core"), 9 | INFO("Info"), 10 | MANAGE("Manage"), 11 | MODULE("Module"), 12 | ALL("All"); // this shouldn't be assigned to any command, used as an info wildcard 13 | private final String name; 14 | 15 | CommandCategory(final String name) { 16 | this.name = name; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/CommandErrorHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 4 | import com.mojang.brigadier.tree.CommandNode; 5 | 6 | import java.util.Map; 7 | 8 | @FunctionalInterface 9 | public interface CommandErrorHandler { 10 | void handle(Map, CommandSyntaxException> exceptions, CommandContext context); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/CommandExecutionErrorHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | @FunctionalInterface 4 | public interface CommandExecutionErrorHandler { 5 | void handle(CommandContext context); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/CommandSource.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | import com.zenith.discord.Embed; 4 | 5 | public interface CommandSource { 6 | String name(); 7 | default String commandPrefix() { 8 | return ""; 9 | } 10 | boolean validateAccountOwner(CommandContext ctx); 11 | void logEmbed(CommandContext ctx, Embed embed); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/CommandSources.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | public final class CommandSources { 4 | public static final DiscordCommandSource DISCORD = new DiscordCommandSource(); 5 | public static final TerminalCommandSource TERMINAL = new TerminalCommandSource(); 6 | public static final PlayerCommandSource PLAYER = new PlayerCommandSource("Controlling Player"); 7 | public static final PlayerCommandSource SPECTATOR = new PlayerCommandSource("Spectator"); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/CommandSuccessHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | @FunctionalInterface 4 | public interface CommandSuccessHandler { 5 | void handle(CommandContext context); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/DiscordCommandContext.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | import com.zenith.discord.Embed; 4 | import lombok.Getter; 5 | import net.dv8tion.jda.api.events.message.MessageReceivedEvent; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class DiscordCommandContext extends CommandContext { 11 | @Getter 12 | private final MessageReceivedEvent messageReceivedEvent; 13 | 14 | public DiscordCommandContext(final String input, Embed embedBuilder, List multiLineOutput, final MessageReceivedEvent messageReceivedEvent) { 15 | super(input, CommandSources.DISCORD, embedBuilder, multiLineOutput); 16 | this.messageReceivedEvent = messageReceivedEvent; 17 | } 18 | 19 | public static DiscordCommandContext create(final String input, final MessageReceivedEvent messageReceivedEvent) { 20 | return new DiscordCommandContext(input.trim(), new Embed(), new ArrayList<>(), messageReceivedEvent); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/IExecutes.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | import com.mojang.brigadier.context.CommandContext; 4 | 5 | @FunctionalInterface 6 | public interface IExecutes { 7 | void execute(CommandContext context); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/api/TerminalCommandSource.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.api; 2 | 3 | import com.zenith.discord.Embed; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class TerminalCommandSource implements CommandSource { 8 | @Override 9 | public String name() { 10 | return "Terminal"; 11 | } 12 | 13 | @Override 14 | public boolean validateAccountOwner(CommandContext ctx) { 15 | return true; 16 | } 17 | 18 | @Override 19 | public void logEmbed(final CommandContext ctx, final Embed embed) { 20 | CommandOutputHelper.logEmbedOutputToTerminal(embed); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/command/brigadier/Coordinates.java: -------------------------------------------------------------------------------- 1 | package com.zenith.command.brigadier; 2 | 3 | import com.zenith.command.api.CommandContext; 4 | import com.zenith.mc.block.BlockPos; 5 | import org.cloudburstmc.math.vector.Vector2d; 6 | import org.cloudburstmc.math.vector.Vector3d; 7 | 8 | public interface Coordinates { 9 | Vector3d getPosition(CommandContext source); 10 | 11 | Vector2d getRotation(CommandContext source); 12 | 13 | default BlockPos getBlockPos(CommandContext source) { 14 | var vec3d = this.getPosition(source); 15 | return new BlockPos(vec3d.getX(), vec3d.getY(), vec3d.getZ()); 16 | } 17 | 18 | boolean isXRelative(); 19 | 20 | boolean isYRelative(); 21 | 22 | boolean isZRelative(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/Database.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database; 2 | 3 | import static com.zenith.Globals.EVENT_BUS; 4 | 5 | public abstract class Database { 6 | protected final QueryExecutor queryExecutor; 7 | boolean isRunning = false; 8 | 9 | public Database(final QueryExecutor queryExecutor) { 10 | this.queryExecutor = queryExecutor; 11 | } 12 | 13 | public void start() { 14 | if (!isRunning) 15 | subscribeEvents(); 16 | isRunning = true; 17 | } 18 | 19 | public void stop() { 20 | EVENT_BUS.unsubscribe(this); 21 | } 22 | 23 | public abstract void subscribeEvents(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/HikariConnectionFactory.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database; 2 | 3 | import lombok.Data; 4 | import org.jdbi.v3.core.ConnectionFactory; 5 | 6 | import java.sql.Connection; 7 | 8 | @Data 9 | public class HikariConnectionFactory implements ConnectionFactory { 10 | private final ConnectionPool connectionPool; 11 | 12 | @Override 13 | public Connection openConnection() { 14 | return connectionPool.getWriteConnection(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/QueryExecutor.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database; 2 | 3 | import com.zenith.util.Wait; 4 | import org.jdbi.v3.core.HandleConsumer; 5 | import org.jdbi.v3.core.Jdbi; 6 | 7 | import java.util.function.Supplier; 8 | 9 | import static com.zenith.Globals.DATABASE_LOG; 10 | 11 | public record QueryExecutor(Jdbi jdbi) { 12 | public void execute(final Supplier queryProvider) { 13 | try (var handle = jdbi.open()) { 14 | queryProvider.get().useHandle(handle); 15 | } catch (final Exception e) { 16 | DATABASE_LOG.error("Failed executing query", e); 17 | Wait.waitMs(3000); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/dto/enums/Connectiontype.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database.dto.enums; 2 | 3 | 4 | import lombok.Getter; 5 | 6 | @Getter 7 | public enum Connectiontype { 8 | 9 | JOIN("JOIN"), 10 | 11 | LEAVE("LEAVE"); 12 | 13 | private final String literal; 14 | 15 | Connectiontype(String literal) { 16 | this.literal = literal; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/dto/records/ChatsRecord.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database.dto.records; 2 | 3 | 4 | import java.time.OffsetDateTime; 5 | import java.util.UUID; 6 | 7 | public record ChatsRecord(OffsetDateTime time, String chat, String playerName, UUID playerUuid) { } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/dto/records/ConnectionsRecord.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database.dto.records; 2 | 3 | 4 | import com.zenith.database.dto.enums.Connectiontype; 5 | 6 | import java.time.OffsetDateTime; 7 | import java.util.UUID; 8 | 9 | public record ConnectionsRecord(OffsetDateTime time, Connectiontype connection, String playerName, UUID playerUuid) { } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/database/dto/records/DeathsRecord.java: -------------------------------------------------------------------------------- 1 | package com.zenith.database.dto.records; 2 | 3 | 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.time.OffsetDateTime; 9 | import java.util.UUID; 10 | 11 | 12 | @Data 13 | @AllArgsConstructor 14 | @Accessors(chain = true) 15 | public class DeathsRecord { 16 | private OffsetDateTime time; 17 | private String deathMessage; 18 | private String victimPlayerName; 19 | private UUID victimPlayerUuid; 20 | private String killerPlayerName; 21 | private UUID killerPlayerUuid; 22 | private String weaponName; 23 | private String killerMob; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/chat/DeathMessageChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.chat; 2 | 3 | import com.zenith.feature.deathmessages.DeathMessageParseResult; 4 | import net.kyori.adventure.text.Component; 5 | 6 | public record DeathMessageChatEvent( 7 | DeathMessageParseResult deathMessage, 8 | Component component, 9 | String message 10 | ) { } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/chat/PublicChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.chat; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record PublicChatEvent( 7 | PlayerListEntry sender, 8 | // full component as sent by the server, including all formatting 9 | Component component, 10 | // extracted message content, i.e. without " " prefix 11 | String message 12 | ) { } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/chat/SystemChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.chat; 2 | 3 | import net.kyori.adventure.text.Component; 4 | 5 | public record SystemChatEvent( 6 | Component component, 7 | String message 8 | ) { } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/chat/WhisperChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.chat; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record WhisperChatEvent( 7 | boolean outgoing, 8 | PlayerListEntry sender, 9 | PlayerListEntry receiver, 10 | // full component as sent by the server, including all formatting 11 | Component component, 12 | // extracted message content, i.e. without "playerName whispers: " prefix 13 | String message 14 | ) { } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientBotTick.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | // Tick emitted when no player is controlling the client 4 | // i.e. when the zenith "bot" handlers are controlling the player 5 | public record ClientBotTick() { 6 | public static final ClientBotTick INSTANCE = new ClientBotTick(); 7 | 8 | public record Starting() { 9 | public static final Starting INSTANCE = new Starting(); 10 | } 11 | 12 | public record Stopped() { 13 | public static final Stopped INSTANCE = new Stopped(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientConnectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record ClientConnectEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientDeathEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record ClientDeathEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientDeathMessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record ClientDeathMessageEvent(String message) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientDisconnectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | import java.time.Duration; 4 | 5 | import static com.zenith.util.DisconnectMessages.MANUAL_DISCONNECT; 6 | 7 | public record ClientDisconnectEvent( 8 | String reason, 9 | boolean manualDisconnect, 10 | Duration onlineDuration, 11 | Duration onlineDurationWithQueueSkip, 12 | boolean wasInQueue, 13 | int queuePosition 14 | ) { 15 | public ClientDisconnectEvent(String reason, final Duration onlineDuration, Duration onlineDurationWithQueueSkip, boolean wasInQueue, int queuePosition) { 16 | this(reason, (MANUAL_DISCONNECT.equals(reason)), onlineDuration, onlineDurationWithQueueSkip, wasInQueue, queuePosition); 17 | } 18 | 19 | public ClientDisconnectEvent(String reason) { 20 | this(reason, Duration.ZERO, Duration.ZERO, false, 0); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientLoginFailedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record ClientLoginFailedEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientOnlineEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | import java.time.Duration; 4 | import java.util.Optional; 5 | 6 | public record ClientOnlineEvent(Optional queueWait) { 7 | 8 | public ClientOnlineEvent() { 9 | this(Optional.empty()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientStartConnectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record ClientStartConnectEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/ClientTickEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record ClientTickEvent() { 4 | /** 5 | * Ticks emitted while the client is online 6 | */ 7 | public static final ClientTickEvent INSTANCE = new ClientTickEvent(); 8 | public record Starting() { 9 | public static final ClientTickEvent.Starting INSTANCE = new ClientTickEvent.Starting(); 10 | } 11 | public record Stopped() { 12 | public static final ClientTickEvent.Stopped INSTANCE = new ClientTickEvent.Stopped(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/MsaDeviceCodeLoginEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | import net.raphimc.minecraftauth.step.msa.StepMsaDeviceCode; 4 | 5 | public record MsaDeviceCodeLoginEvent(StepMsaDeviceCode.MsaDeviceCode deviceCode) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/PrioBanStatusUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record PrioBanStatusUpdateEvent(boolean prioBanned) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/PrioStatusEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record PrioStatusEvent(boolean prio) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/client/PrioStatusUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.client; 2 | 3 | public record PrioStatusUpdateEvent(boolean prio) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/db/DatabaseTickEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.db; 2 | 3 | // Constant tick when we are connected on 2b2t every 5 minutes 4 | public record DatabaseTickEvent() { 5 | public static final int TICK_INTERVAL_SECONDS = 300; 6 | public static final DatabaseTickEvent INSTANCE = new DatabaseTickEvent(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/db/RedisRestartEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.db; 2 | 3 | public record RedisRestartEvent() { 4 | public static final RedisRestartEvent INSTANCE = new RedisRestartEvent(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/message/DiscordMainChannelCommandReceivedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.message; 2 | 3 | import net.dv8tion.jda.api.entities.Member; 4 | import net.dv8tion.jda.api.events.message.MessageReceivedEvent; 5 | 6 | public record DiscordMainChannelCommandReceivedEvent(MessageReceivedEvent event) { 7 | public String message() { 8 | return event.getMessage().getContentRaw(); 9 | } 10 | 11 | public Member member() { 12 | return event.getMember(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/message/DiscordRelayChannelMessageReceivedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.message; 2 | 3 | import lombok.Data; 4 | import lombok.Getter; 5 | import lombok.experimental.Accessors; 6 | import net.dv8tion.jda.api.events.message.MessageReceivedEvent; 7 | 8 | import static com.zenith.util.ChatUtil.sanitizeChatMessage; 9 | 10 | @Data 11 | @Accessors(fluent = true) 12 | public class DiscordRelayChannelMessageReceivedEvent { 13 | private final MessageReceivedEvent event; 14 | @Getter(lazy = true) private final String message = processMessage(); 15 | 16 | public String processMessage() { 17 | return sanitizeChatMessage(event.getMessage().getContentRaw()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ActiveHoursConnectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record ActiveHoursConnectEvent(boolean willWait) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/AutoEatOutOfFoodEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record AutoEatOutOfFoodEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/AutoReconnectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record AutoReconnectEvent(int delaySeconds) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ClientSwingEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record ClientSwingEvent() { 4 | public static final ClientSwingEvent INSTANCE = new ClientSwingEvent(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/EntityFishHookSpawnEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityStandard; 4 | import org.geysermc.mcprotocollib.protocol.data.game.entity.object.ProjectileData; 5 | 6 | public record EntityFishHookSpawnEvent(EntityStandard fishHookObject) { 7 | 8 | public ProjectileData getProjectileData() { 9 | return (ProjectileData) fishHookObject().getObjectData(); 10 | } 11 | 12 | public int getOwnerEntityId() { 13 | return getProjectileData().getOwnerId(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/HealthAutoDisconnectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record HealthAutoDisconnectEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/NoTotemsEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record NoTotemsEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/OutboundChatEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.github.rfresh2.CancellableEvent; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatPacket; 7 | 8 | @Data 9 | @EqualsAndHashCode(callSuper = true) 10 | public class OutboundChatEvent extends CancellableEvent { 11 | private final ServerboundChatPacket packet; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/PlayerHealthChangedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record PlayerHealthChangedEvent(float newHealth, float previousHealth) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/PlayerTotemPopAlertEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record PlayerTotemPopAlertEvent(int totemsRemaining) { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/QueueWarningEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record QueueWarningEvent(int position, boolean mention) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ReplayStartedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record ReplayStartedEvent() { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ReplayStoppedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import org.jspecify.annotations.Nullable; 4 | 5 | import java.io.File; 6 | 7 | public record ReplayStoppedEvent(@Nullable File replayFile) { } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ServerPlayerAttackedUsEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.cloudburstmc.math.vector.Vector3d; 5 | import org.jspecify.annotations.Nullable; 6 | 7 | public record ServerPlayerAttackedUsEvent(EntityPlayer attacker, @Nullable Vector3d sourcePosition) { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ServerPlayerInVisualRangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record ServerPlayerInVisualRangeEvent(PlayerListEntry playerEntry, EntityPlayer playerEntity) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ServerPlayerLeftVisualRangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record ServerPlayerLeftVisualRangeEvent(PlayerListEntry playerEntry, EntityPlayer playerEntity) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/ServerPlayerLogoutInVisualRangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record ServerPlayerLogoutInVisualRangeEvent(PlayerListEntry playerEntry, EntityPlayer playerEntity) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/SessionTimeLimitWarningEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import java.time.Duration; 4 | 5 | public record SessionTimeLimitWarningEvent( 6 | Duration sessionTimeLimit, 7 | Duration durationUntilKick 8 | ) { } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/SpawnPatrolTargetAcquiredEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record SpawnPatrolTargetAcquiredEvent(EntityPlayer target, PlayerListEntry targetProfile) { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/SpawnPatrolTargetKilledEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.feature.deathmessages.DeathMessageParseResult; 4 | import net.kyori.adventure.text.Component; 5 | import org.geysermc.mcprotocollib.auth.GameProfile; 6 | 7 | public record SpawnPatrolTargetKilledEvent(GameProfile profile, Component component, String message, DeathMessageParseResult deathMessageParseResult) { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/SplashSoundEffectEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket; 4 | 5 | public record SplashSoundEffectEvent(ClientboundSoundPacket packet) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/TotemPopEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record TotemPopEvent(int entityId) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/VisualRangeEnterEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record VisualRangeEnterEvent(PlayerListEntry playerEntry, EntityPlayer playerEntity, boolean isFriend) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/VisualRangeLeaveEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record VisualRangeLeaveEvent(PlayerListEntry playerEntry, EntityPlayer playerEntity, boolean isFriend) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/VisualRangeLogoutEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | import com.zenith.cache.data.entity.EntityPlayer; 4 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 5 | 6 | public record VisualRangeLogoutEvent(PlayerListEntry playerEntry, EntityPlayer playerEntity, boolean isFriend) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/module/WeatherChangeEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.module; 2 | 3 | public record WeatherChangeEvent() { 4 | public static final WeatherChangeEvent INSTANCE = new WeatherChangeEvent(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/BlacklistedPlayerConnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import org.geysermc.mcprotocollib.auth.GameProfile; 4 | 5 | import java.net.SocketAddress; 6 | 7 | public record BlacklistedPlayerConnectedEvent(GameProfile gameProfile, SocketAddress remoteAddress) { } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/NonWhitelistedPlayerConnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import org.geysermc.mcprotocollib.auth.GameProfile; 4 | 5 | import java.net.SocketAddress; 6 | 7 | public record NonWhitelistedPlayerConnectedEvent(GameProfile gameProfile, SocketAddress remoteAddress) { } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/PlayerConnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | import org.geysermc.mcprotocollib.auth.GameProfile; 5 | 6 | 7 | public record PlayerConnectedEvent(ServerSession session, GameProfile clientGameProfile) { } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/PlayerConnectionAddedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | 5 | public record PlayerConnectionAddedEvent(ServerSession serverConnection) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/PlayerConnectionRemovedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | 5 | public record PlayerConnectionRemovedEvent(ServerSession serverConnection) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/PlayerDisconnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | import org.geysermc.mcprotocollib.auth.GameProfile; 5 | import org.jspecify.annotations.Nullable; 6 | 7 | public record PlayerDisconnectedEvent(@Nullable String reason, ServerSession session, @Nullable GameProfile clientGameProfile) { 8 | 9 | public PlayerDisconnectedEvent(final String reason, ServerSession session) { 10 | this(reason, session, null); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/PlayerLoginEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | 5 | public record PlayerLoginEvent() { 6 | // after GameProfile but before Login packet is sent 7 | public record Pre(ServerSession session) { } 8 | 9 | // after Login packet is sent 10 | public record Post(ServerSession session) { } // triggered after Login packet is sent 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/SpectatorConnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | import org.geysermc.mcprotocollib.auth.GameProfile; 5 | 6 | public record SpectatorConnectedEvent(ServerSession session, GameProfile clientGameProfile) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/SpectatorDisconnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import org.geysermc.mcprotocollib.auth.GameProfile; 4 | 5 | public record SpectatorDisconnectedEvent(com.zenith.network.server.ServerSession serverSession, GameProfile clientGameProfile) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/player/SpectatorLoggedInEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.player; 2 | 3 | import com.zenith.network.server.ServerSession; 4 | 5 | // the spectator has logged in and been sent the ClientboundLoginPacket 6 | public record SpectatorLoggedInEvent(ServerSession session) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/plugin/PluginLoadFailureEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.plugin; 2 | 3 | import org.jspecify.annotations.Nullable; 4 | 5 | import java.nio.file.Path; 6 | 7 | public record PluginLoadFailureEvent(@Nullable String id, Path jarPath, Throwable exception) { 8 | public String message() { 9 | var cause = exception; 10 | while (cause != null && cause.getCause() != null) { 11 | cause = cause.getCause(); 12 | } 13 | return cause.getClass().getSimpleName() + ": " + cause.getMessage(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/plugin/PluginLoadedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.plugin; 2 | 3 | import com.zenith.plugin.api.PluginInfo; 4 | 5 | public record PluginLoadedEvent(PluginInfo pluginInfo) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/queue/QueueCompleteEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.queue; 2 | 3 | import java.time.Duration; 4 | 5 | public record QueueCompleteEvent(Duration queueDuration) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/queue/QueuePositionUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.queue; 2 | 3 | public record QueuePositionUpdateEvent(int position) { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/queue/QueueSkipEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.queue; 2 | 3 | // note: this may be posted before StartQueueEvent 4 | public record QueueSkipEvent() { 5 | public static final QueueSkipEvent INSTANCE = new QueueSkipEvent(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/queue/QueueStartEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.queue; 2 | 3 | import java.time.Duration; 4 | 5 | public record QueueStartEvent(boolean wasOnline, Duration wasOnlineDuration) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/server/CustomTablistFooterBuildEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.server; 2 | 3 | import net.kyori.adventure.text.Component; 4 | 5 | import java.util.Objects; 6 | 7 | public class CustomTablistFooterBuildEvent { 8 | private Component footerComponent; 9 | 10 | public CustomTablistFooterBuildEvent(Component footerComponent) { 11 | this.footerComponent = footerComponent; 12 | } 13 | 14 | public Component getFooterComponent() { 15 | return footerComponent; 16 | } 17 | 18 | public void setFooterComponent(Component footerComponent) { 19 | Objects.requireNonNull(footerComponent, "Footer component cannot be null"); 20 | this.footerComponent = footerComponent; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/server/MotdBuildEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.server; 2 | 3 | import lombok.AllArgsConstructor; 4 | import net.kyori.adventure.text.Component; 5 | 6 | import java.util.Objects; 7 | 8 | @AllArgsConstructor 9 | public class MotdBuildEvent { 10 | private Component motd; 11 | 12 | public Component getMotd() { 13 | return motd; 14 | } 15 | 16 | public void setMotd(final Component motd) { 17 | Objects.requireNonNull(motd, "motd cannot be null"); 18 | this.motd = motd; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/server/ServerIconBuildEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.server; 2 | 3 | import lombok.AllArgsConstructor; 4 | 5 | import java.util.Objects; 6 | 7 | @AllArgsConstructor 8 | public class ServerIconBuildEvent { 9 | private byte[] icon; 10 | 11 | public byte[] getIcon() { 12 | return icon; 13 | } 14 | 15 | public void setIcon(final byte[] icon) { 16 | Objects.requireNonNull(icon, "icon cannot be null"); 17 | this.icon = icon; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/server/ServerPlayerConnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.server; 2 | 3 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 4 | 5 | public record ServerPlayerConnectedEvent(PlayerListEntry playerEntry) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/server/ServerPlayerDisconnectedEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.server; 2 | 3 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 4 | 5 | public record ServerPlayerDisconnectedEvent(PlayerListEntry playerEntry) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/server/ServerRestartingEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.server; 2 | 3 | public record ServerRestartingEvent(String message) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/update/UpdateAvailableEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.update; 2 | 3 | import java.util.Optional; 4 | 5 | public record UpdateAvailableEvent(String version) { 6 | public Optional getVersion() { 7 | return Optional.ofNullable(version); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/event/update/UpdateStartEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.event.update; 2 | 3 | import java.util.Optional; 4 | 5 | public record UpdateStartEvent(Optional newVersion) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALChatCommandHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatCommandPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALChatCommandHandler implements PacketHandler { 10 | @Override 11 | public ServerboundChatCommandPacket apply(final ServerboundChatCommandPacket packet, final ServerSession session) { 12 | if (CONFIG.client.extra.actionLimiter.allowServerCommands) return packet; 13 | else return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALChatHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALChatHandler implements PacketHandler { 10 | @Override 11 | public ServerboundChatPacket apply(final ServerboundChatPacket packet, final ServerSession session) { 12 | if (CONFIG.client.extra.actionLimiter.allowChat) return packet; 13 | else return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALClientCommandHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALClientCommandHandler implements PacketHandler { 10 | @Override 11 | public ServerboundClientCommandPacket apply(final ServerboundClientCommandPacket packet, final ServerSession session) { 12 | if (CONFIG.client.extra.actionLimiter.allowRespawn) return packet; 13 | session.disconnect("ActionLimiter: Respawn not allowed"); 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALContainerClickHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALContainerClickHandler implements PacketHandler { 10 | @Override 11 | public ServerboundContainerClickPacket apply(final ServerboundContainerClickPacket packet, final ServerSession session) { 12 | if (!CONFIG.client.extra.actionLimiter.allowInventory) return null; 13 | return packet; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALInteractHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALInteractHandler implements PacketHandler { 10 | @Override 11 | public ServerboundInteractPacket apply(final ServerboundInteractPacket packet, final ServerSession session) { 12 | if (!CONFIG.client.extra.actionLimiter.allowInteract) return null; 13 | return packet; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALSCommandSuggestionHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALSCommandSuggestionHandler implements PacketHandler { 10 | @Override 11 | public ServerboundCommandSuggestionPacket apply(final ServerboundCommandSuggestionPacket packet, final ServerSession session) { 12 | if (CONFIG.client.extra.actionLimiter.allowServerCommands) return packet; 13 | return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALSignedChatCommandHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatCommandSignedPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALSignedChatCommandHandler implements PacketHandler { 10 | @Override 11 | public ServerboundChatCommandSignedPacket apply(final ServerboundChatCommandSignedPacket packet, final ServerSession session) { 12 | if (CONFIG.client.extra.actionLimiter.allowServerCommands) return packet; 13 | else return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/inbound/ALUseItemHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.inbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundUseItemPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALUseItemHandler implements PacketHandler { 10 | @Override 11 | public ServerboundUseItemPacket apply(final ServerboundUseItemPacket packet, final ServerSession session) { 12 | if (!CONFIG.client.extra.actionLimiter.allowUseItem) return null; 13 | return packet; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/actionlimiter/handlers/outbound/ALCCommandSuggestionsHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.actionlimiter.handlers.outbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundCommandSuggestionsPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class ALCCommandSuggestionsHandler implements PacketHandler { 10 | @Override 11 | public ClientboundCommandSuggestionsPacket apply(final ClientboundCommandSuggestionsPacket packet, final ServerSession session) { 12 | if (CONFIG.client.extra.actionLimiter.allowServerCommands) return packet; 13 | return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/ProfileData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api; 2 | 3 | import java.util.UUID; 4 | 5 | public interface ProfileData { 6 | String name(); 7 | UUID uuid(); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/crafthead/model/CraftheadProfileProperties.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.crafthead.model; 2 | 3 | public record CraftheadProfileProperties(String name, String value) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/crafthead/model/CraftheadProfileResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.crafthead.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | 5 | import java.util.List; 6 | import java.util.UUID; 7 | 8 | public record CraftheadProfileResponse( 9 | String id, 10 | String name, 11 | List properties 12 | ) implements ProfileData { 13 | @Override 14 | public UUID uuid() { 15 | return UUID.fromString(id.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/fileio/model/FileIOResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.fileio.model; 2 | 3 | public record FileIOResponse(boolean success, String link) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/mcsrvstatus/MCSrvStatusApi.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.mcsrvstatus; 2 | 3 | import com.zenith.feature.api.Api; 4 | import com.zenith.feature.api.mcsrvstatus.model.MCSrvStatusResponse; 5 | 6 | import java.util.Optional; 7 | 8 | public class MCSrvStatusApi extends Api { 9 | public static final MCSrvStatusApi INSTANCE = new MCSrvStatusApi(); 10 | 11 | public MCSrvStatusApi() { 12 | super("https://api.mcsrvstat.us/3"); 13 | } 14 | 15 | public Optional getMCSrvStatus(final String address) { 16 | return get("/" + address, MCSrvStatusResponse.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/mcsrvstatus/model/MCSrvStatusResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.mcsrvstatus.model; 2 | 3 | public record MCSrvStatusResponse( 4 | boolean online, 5 | String ip, 6 | int port 7 | ) { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/mcstatus/MCStatusApi.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.mcstatus; 2 | 3 | import com.zenith.feature.api.Api; 4 | import com.zenith.feature.api.mcstatus.model.MCStatusResponse; 5 | 6 | import java.util.Optional; 7 | 8 | public class MCStatusApi extends Api { 9 | public static final MCStatusApi INSTANCE = new MCStatusApi(); 10 | 11 | public MCStatusApi() { 12 | super("https://api.mcstatus.io/v2/status/java"); 13 | } 14 | 15 | public Optional getMCServerStatus(final String address) { 16 | return get("/" + address, MCStatusResponse.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/mcstatus/model/MCStatusResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.mcstatus.model; 2 | 3 | import org.jspecify.annotations.Nullable; 4 | 5 | public record MCStatusResponse( 6 | boolean online, 7 | String host, 8 | int port, 9 | @Nullable String ip_address 10 | ) { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/minetools/MinetoolsApi.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.minetools; 2 | 3 | import com.zenith.feature.api.Api; 4 | import com.zenith.feature.api.minetools.model.MinetoolsProfileResponse; 5 | import com.zenith.feature.api.minetools.model.MinetoolsUuidResponse; 6 | 7 | import java.util.Optional; 8 | import java.util.UUID; 9 | 10 | public class MinetoolsApi extends Api { 11 | public static final MinetoolsApi INSTANCE = new MinetoolsApi(); 12 | 13 | public MinetoolsApi() { 14 | super("https://api.minetools.eu"); 15 | } 16 | 17 | public Optional getProfileFromUsername(final String username) { 18 | return get("/uuid/" + username, MinetoolsUuidResponse.class).filter(r -> !"ERR".equals(r.status())); 19 | } 20 | 21 | public Optional getProfileFromUUID(final UUID uuid) { 22 | return get("/profile/" + uuid.toString(), MinetoolsProfileResponse.class); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/minetools/model/MinetoolsProfileResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.minetools.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | 5 | import java.util.UUID; 6 | 7 | public record MinetoolsProfileResponse(MinetoolsProfileResponseDecoded decoded) implements ProfileData { 8 | public UUID uuid() { 9 | return UUID.fromString(decoded().profileId().replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 10 | } 11 | 12 | public String name() { 13 | return decoded.profileName(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/minetools/model/MinetoolsProfileResponseDecoded.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.minetools.model; 2 | 3 | public record MinetoolsProfileResponseDecoded( 4 | String profileId, 5 | String profileName 6 | ) { } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/minetools/model/MinetoolsUuidResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.minetools.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | 5 | import java.util.UUID; 6 | 7 | public record MinetoolsUuidResponse(String id, String name, String status) implements ProfileData { 8 | public UUID uuid() { 9 | return UUID.fromString(id.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/mojang/MojangApi.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.mojang; 2 | 3 | import com.zenith.feature.api.Api; 4 | import com.zenith.feature.api.mojang.model.MojangProfileResponse; 5 | 6 | import java.util.Optional; 7 | 8 | public class MojangApi extends Api { 9 | public static final MojangApi INSTANCE = new MojangApi(); 10 | 11 | public MojangApi() { 12 | super("https://api.mojang.com"); 13 | } 14 | 15 | public Optional getProfile(final String username) { 16 | return get("/users/profiles/minecraft/" + username, MojangProfileResponse.class); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/mojang/model/MojangProfileResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.mojang.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | 5 | import java.util.UUID; 6 | 7 | public record MojangProfileResponse(String name, String id) implements ProfileData { 8 | public UUID uuid() { 9 | return UUID.fromString(id.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/sessionserver/model/HasJoinedResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.sessionserver.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | import org.geysermc.mcprotocollib.auth.GameProfile; 5 | 6 | import java.util.List; 7 | import java.util.UUID; 8 | 9 | public record HasJoinedResponse(String id, String name, List properties) implements ProfileData { 10 | @Override 11 | public UUID uuid() { 12 | return UUID.fromString(id.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 13 | } 14 | 15 | public GameProfile toGameProfile() { 16 | var profile = new GameProfile(uuid(), name); 17 | profile.setProperties(properties); 18 | return profile; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/sessionserver/model/JoinServerErrorResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.sessionserver.model; 2 | 3 | import org.jspecify.annotations.Nullable; 4 | 5 | public record JoinServerErrorResponse(@Nullable String error, @Nullable String errorMessage, @Nullable String error_description, @Nullable String cause) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/sessionserver/model/JoinServerRequest.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.sessionserver.model; 2 | 3 | import java.util.UUID; 4 | 5 | public record JoinServerRequest( 6 | UUID selectedProfile, // UUID without dashes 7 | String accessToken, 8 | String serverId 9 | ) { } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/sessionserver/model/MojangProfileAndSkin.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.sessionserver.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | 5 | import java.util.List; 6 | import java.util.UUID; 7 | 8 | public record MojangProfileAndSkin(String id, String name, List properties) implements ProfileData { 9 | @Override 10 | public UUID uuid() { 11 | return UUID.fromString(id.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/sessionserver/model/MojangProfileProperties.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.sessionserver.model; 2 | 3 | public record MojangProfileProperties(String name, String value, String signature) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/sessionserver/model/SessionProfileResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.sessionserver.model; 2 | 3 | import com.zenith.feature.api.ProfileData; 4 | 5 | import java.util.UUID; 6 | 7 | public record SessionProfileResponse(String id, String name) implements ProfileData { 8 | public UUID uuid() { 9 | return UUID.fromString(id.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/vcapi/model/PlaytimeResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.vcapi.model; 2 | 3 | import java.util.UUID; 4 | 5 | public record PlaytimeResponse(UUID uuid, int playtimeSeconds) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/vcapi/model/QueueEtaEquationResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.vcapi.model; 2 | 3 | public record QueueEtaEquationResponse(double factor, double pow) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/vcapi/model/QueueResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.vcapi.model; 2 | 3 | import java.time.OffsetDateTime; 4 | 5 | public record QueueResponse(int prio, int regular, OffsetDateTime time) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/vcapi/model/SeenResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.vcapi.model; 2 | 3 | import java.time.OffsetDateTime; 4 | 5 | public record SeenResponse(OffsetDateTime firstSeen, OffsetDateTime lastSeen) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/vcapi/model/SessionTimeLimitResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.vcapi.model; 2 | 3 | public record SessionTimeLimitResponse(int hours) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/api/vcapi/model/StatsResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api.vcapi.model; 2 | 3 | import java.time.OffsetDateTime; 4 | 5 | public record StatsResponse( 6 | int joinCount, 7 | int leaveCount, 8 | int deathCount, 9 | int killCount, 10 | OffsetDateTime firstSeen, 11 | OffsetDateTime lastSeen, 12 | int playtimeSeconds, 13 | int playtimeSecondsMonth, 14 | int chatsCount, 15 | boolean prio 16 | ) { 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/autoupdater/NoOpAutoUpdater.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.autoupdater; 2 | 3 | public class NoOpAutoUpdater extends AutoUpdater { 4 | public static NoOpAutoUpdater INSTANCE = new NoOpAutoUpdater(); 5 | @Override 6 | public void updateCheck() { 7 | // :) 8 | } 9 | 10 | @Override 11 | public void start() { 12 | // :) 13 | } 14 | 15 | @Override 16 | public void stop() { 17 | // :) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/chatschema/ChatParseResult.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.chatschema; 2 | 3 | import org.geysermc.mcprotocollib.protocol.data.game.PlayerListEntry; 4 | import org.jspecify.annotations.Nullable; 5 | 6 | public record ChatParseResult( 7 | ChatType type, 8 | @Nullable PlayerListEntry sender, 9 | @Nullable PlayerListEntry receiver, 10 | @Nullable String messageContent 11 | ) { 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/chatschema/ChatSchema.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.chatschema; 2 | 3 | public record ChatSchema( 4 | String publicChat, 5 | String whisperInbound, 6 | String whisperOutbound 7 | ) { 8 | public static final ChatSchema DEFAULT_SCHEMA = new ChatSchema( 9 | "<$s> $m", 10 | "$s whispers: $m", 11 | "to $r: $m" 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/chatschema/ChatType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.chatschema; 2 | 3 | public enum ChatType { 4 | PUBLIC_CHAT, 5 | WHISPER_OUTBOUND, 6 | WHISPER_INBOUND, 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/coordobf/handlers/outbound/COSetDefaultSpawnPositionHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.coordobf.handlers.outbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; 6 | 7 | public class COSetDefaultSpawnPositionHandler implements PacketHandler { 8 | @Override 9 | public ClientboundSetDefaultSpawnPositionPacket apply(final ClientboundSetDefaultSpawnPositionPacket packet, final ServerSession session) { 10 | // no need for clients to know this 11 | // and could reveal offset under certain conditions 12 | return new ClientboundSetDefaultSpawnPositionPacket(0, 0, 0, packet.getAngle()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/coordobf/handlers/outbound/COTagQueryHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.coordobf.handlers.outbound; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundTagQueryPacket; 6 | 7 | public class COTagQueryHandler implements PacketHandler { 8 | @Override 9 | public ClientboundTagQueryPacket apply(final ClientboundTagQueryPacket packet, final ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/deathmessages/DeathMessageParseResult.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.deathmessages; 2 | 3 | import java.util.Optional; 4 | 5 | public record DeathMessageParseResult( 6 | String victim, 7 | Optional killer, 8 | Optional weapon, 9 | DeathMessageSchemaInstance deathMessageSchemaInstance 10 | ) { } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/deathmessages/Killer.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.deathmessages; 2 | 3 | public record Killer(String name, KillerType type) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/deathmessages/KillerType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.deathmessages; 2 | 3 | public enum KillerType { 4 | PLAYER, MOB 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/extrachat/ECSignedChatCommandIncomingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.extrachat; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundChatCommandSignedPacket; 6 | 7 | public class ECSignedChatCommandIncomingHandler implements PacketHandler { 8 | @Override 9 | public ServerboundChatCommandSignedPacket apply(final ServerboundChatCommandSignedPacket packet, final ServerSession session) { 10 | if (session.isSpectator()) return packet; 11 | final String command = packet.getCommand(); 12 | if (command.isBlank()) return packet; 13 | return ECChatCommandIncomingHandler.handleExtraChatCommand(command, session) ? packet : null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/inventory/actions/CloseContainer.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.inventory.actions; 2 | 3 | import lombok.Data; 4 | import lombok.RequiredArgsConstructor; 5 | import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | @Data 11 | @RequiredArgsConstructor 12 | public class CloseContainer implements InventoryAction { 13 | private final int containerId; 14 | 15 | public CloseContainer() { 16 | this(CACHE.getPlayerCache().getInventoryCache().getOpenContainerId()); 17 | } 18 | 19 | @Override 20 | public MinecraftPacket packet() { 21 | return new ServerboundContainerClosePacket(containerId); 22 | } 23 | 24 | @Override 25 | public int containerId() { 26 | return containerId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/inventory/actions/ContainerButtonClick.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.inventory.actions; 2 | 3 | import lombok.Data; 4 | import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket; 6 | 7 | @Data 8 | public class ContainerButtonClick implements InventoryAction { 9 | private final int containerId; 10 | private final int buttonId; 11 | 12 | @Override 13 | public MinecraftPacket packet() { 14 | return new ServerboundContainerButtonClickPacket(containerId, buttonId); 15 | } 16 | 17 | @Override 18 | public int containerId() { 19 | return containerId; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/inventory/actions/SelectTrade.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.inventory.actions; 2 | 3 | import lombok.Data; 4 | import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundSelectTradePacket; 6 | import org.jspecify.annotations.Nullable; 7 | 8 | @Data 9 | public class SelectTrade implements InventoryAction { 10 | private final int containerId; 11 | private final int slotId; 12 | 13 | @Override 14 | public int containerId() { 15 | return containerId; 16 | } 17 | 18 | @Override 19 | public @Nullable MinecraftPacket packet() { 20 | return new ServerboundSelectTradePacket(slotId); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/inventory/actions/WaitAction.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.inventory.actions; 2 | 3 | import lombok.Data; 4 | import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket; 5 | import org.jspecify.annotations.Nullable; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | /** 10 | * No-op. Lets you add a delay between actions. 11 | */ 12 | @Data 13 | public class WaitAction implements InventoryAction { 14 | @Override 15 | public int containerId() { 16 | return CACHE.getPlayerCache().getInventoryCache().getOpenContainerId(); 17 | } 18 | 19 | @Override 20 | public @Nullable MinecraftPacket packet() { 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/map/Brightness.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.map; 2 | 3 | public enum Brightness { 4 | LOW(0, 180), 5 | NORMAL(1, 220), 6 | HIGH(2, 255), 7 | LOWEST(3, 135); 8 | 9 | private static final Brightness[] VALUES = new Brightness[]{LOW, NORMAL, HIGH, LOWEST}; 10 | public final int id; 11 | public final int modifier; 12 | 13 | Brightness(int j, int k) { 14 | this.id = j; 15 | this.modifier = k; 16 | } 17 | 18 | static Brightness byId(int i) { 19 | return VALUES[i]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/MutableMoveResult.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder; 2 | 3 | import com.zenith.feature.pathfinder.movement.ActionCosts; 4 | 5 | public class MutableMoveResult { 6 | public int x; 7 | public int y; 8 | public int z; 9 | public double cost; 10 | 11 | public MutableMoveResult() { 12 | reset(); 13 | } 14 | 15 | public final void reset() { 16 | x = 0; 17 | y = 0; 18 | z = 0; 19 | cost = ActionCosts.COST_INF; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/PathInput.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder; 2 | 3 | public enum PathInput { 4 | 5 | /** 6 | * The move forward input 7 | */ 8 | MOVE_FORWARD, 9 | 10 | /** 11 | * The move back input 12 | */ 13 | MOVE_BACK, 14 | 15 | /** 16 | * The move left input 17 | */ 18 | MOVE_LEFT, 19 | 20 | /** 21 | * The move right input 22 | */ 23 | MOVE_RIGHT, 24 | 25 | /** 26 | * The attack input 27 | */ 28 | LEFT_CLICK_BLOCK, 29 | 30 | /** 31 | * The use item input 32 | */ 33 | RIGHT_CLICK_BLOCK, 34 | 35 | /** 36 | * The jump input 37 | */ 38 | JUMP, 39 | 40 | /** 41 | * The sneak input 42 | */ 43 | SNEAK, 44 | 45 | /** 46 | * The sprint input 47 | */ 48 | SPRINT 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/Ternary.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder; 2 | 3 | public enum Ternary { 4 | YES, MAYBE, NO 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/behavior/Behavior.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.behavior; 2 | 3 | import com.zenith.feature.pathfinder.Baritone; 4 | import com.zenith.feature.pathfinder.PlayerContext; 5 | 6 | public class Behavior { 7 | public final Baritone baritone; 8 | public final PlayerContext ctx; 9 | 10 | protected Behavior(Baritone baritone) { 11 | this.baritone = baritone; 12 | this.ctx = PlayerContext.INSTANCE; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/behavior/LookBehavior.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.behavior; 2 | 3 | import com.zenith.feature.pathfinder.Baritone; 4 | import com.zenith.feature.player.Rotation; 5 | import org.jspecify.annotations.Nullable; 6 | 7 | public class LookBehavior extends Behavior { 8 | /** 9 | * The current look target, may be {@code null}. 10 | */ 11 | @Nullable private Rotation targetRotation = null; 12 | @Nullable public Rotation currentRotation = null; 13 | 14 | public LookBehavior(Baritone baritone) { 15 | super(baritone); 16 | } 17 | 18 | public void updateRotation(Rotation rotation) { 19 | this.targetRotation = rotation; 20 | } 21 | 22 | public void onTick() { 23 | if (this.targetRotation == null) { 24 | this.currentRotation = null; 25 | return; 26 | } 27 | this.currentRotation = this.targetRotation; 28 | this.targetRotation = null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/goals/Goal.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.goals; 2 | 3 | import com.zenith.mc.block.BlockPos; 4 | 5 | public interface Goal { 6 | 7 | boolean isInGoal(int x, int y, int z); 8 | 9 | double heuristic(int x, int y, int z); 10 | 11 | default boolean isInGoal(BlockPos pos) { 12 | return this.isInGoal(pos.x(), pos.y(), pos.z()); 13 | } 14 | 15 | default double heuristic(BlockPos pos) { 16 | return this.heuristic(pos.x(), pos.y(), pos.z()); 17 | } 18 | 19 | default double heuristic() { 20 | return 0; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/goals/PosGoal.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.goals; 2 | 3 | import com.zenith.mc.block.BlockPos; 4 | 5 | public interface PosGoal { 6 | BlockPos getGoalPos(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/movement/IMovement.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.movement; 2 | 3 | import com.zenith.mc.block.BlockPos; 4 | 5 | public interface IMovement { 6 | double getCost(); 7 | 8 | MovementStatus update(); 9 | 10 | /** 11 | * Resets the current state status to {@link MovementStatus#PREPPING} 12 | */ 13 | void reset(); 14 | 15 | /** 16 | * Resets the cache for special break, place, and walk into blocks 17 | */ 18 | void resetBlockCache(); 19 | 20 | /** 21 | * @return Whether or not it is safe to cancel the current movement state 22 | */ 23 | boolean safeToCancel(); 24 | 25 | boolean calculatedWhileLoaded(); 26 | 27 | BlockPos getSrc(); 28 | 29 | BlockPos getDest(); 30 | 31 | BlockPos getDirection(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/process/BaritoneProcessHelper.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.process; 2 | 3 | import com.zenith.feature.pathfinder.Baritone; 4 | import com.zenith.feature.pathfinder.PlayerContext; 5 | 6 | public abstract class BaritoneProcessHelper implements IBaritoneProcess { 7 | 8 | protected final Baritone baritone; 9 | protected final PlayerContext ctx; 10 | 11 | public BaritoneProcessHelper(final Baritone baritone) { 12 | this.baritone = baritone; 13 | this.ctx = this.baritone.getPlayerContext(); 14 | } 15 | 16 | @Override 17 | public boolean isTemporary() { 18 | return false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/util/PathCalculationResult.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.util; 2 | 3 | import com.zenith.feature.pathfinder.calc.IPath; 4 | 5 | import java.util.Objects; 6 | import java.util.Optional; 7 | 8 | public class PathCalculationResult { 9 | private final IPath path; 10 | private final Type type; 11 | 12 | public PathCalculationResult(Type type) { 13 | this(type, null); 14 | } 15 | 16 | public PathCalculationResult(Type type, IPath path) { 17 | Objects.requireNonNull(type); 18 | this.path = path; 19 | this.type = type; 20 | } 21 | 22 | public final Optional getPath() { 23 | return Optional.ofNullable(this.path); 24 | } 25 | 26 | public final Type getType() { 27 | return this.type; 28 | } 29 | 30 | public enum Type { 31 | SUCCESS_TO_GOAL, 32 | SUCCESS_SEGMENT, 33 | FAILURE, 34 | CANCELLATION, 35 | EXCEPTION, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/pathfinder/util/PathEvent.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.pathfinder.util; 2 | 3 | public enum PathEvent { 4 | CALC_STARTED, 5 | CALC_FINISHED_NOW_EXECUTING, 6 | CALC_FAILED, 7 | NEXT_SEGMENT_CALC_STARTED, 8 | NEXT_SEGMENT_CALC_FINISHED, 9 | CONTINUING_ONTO_PLANNED_NEXT, 10 | SPLICING_ONTO_NEXT_EARLY, 11 | AT_GOAL, 12 | PATH_FINISHED_NEXT_STILL_CALCULATING, 13 | NEXT_CALC_FAILED, 14 | DISCARD_NEXT, 15 | CANCELED; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/player/InteractionResult.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.player; 2 | 3 | public enum InteractionResult { 4 | SUCCESS, 5 | SUCCESS_NO_ITEM_USED, 6 | CONSUME, 7 | CONSUME_PARTIAL, 8 | PASS, 9 | FAIL; 10 | 11 | public boolean consumesAction() { 12 | return this == SUCCESS || this == CONSUME || this == CONSUME_PARTIAL || this == SUCCESS_NO_ITEM_USED; 13 | } 14 | 15 | public boolean shouldSwing() { 16 | return this == SUCCESS || this == SUCCESS_NO_ITEM_USED; 17 | } 18 | 19 | public boolean indicateItemUse() { 20 | return this == SUCCESS || this == CONSUME; 21 | } 22 | 23 | public static InteractionResult sidedSuccess(boolean isClientSide) { 24 | return isClientSide ? SUCCESS : CONSUME; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/player/raycast/BlockRaycastResult.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.player.raycast; 2 | 3 | import com.zenith.mc.block.Block; 4 | import com.zenith.mc.block.BlockRegistry; 5 | import com.zenith.mc.block.Direction; 6 | import org.jspecify.annotations.NonNull; 7 | import org.jspecify.annotations.Nullable; 8 | 9 | public record BlockRaycastResult(boolean hit, int x, int y, int z, @Nullable RayIntersection intersection, Block block) { 10 | public static BlockRaycastResult miss() { 11 | return new BlockRaycastResult(false, 0, 0, 0, null, BlockRegistry.AIR); 12 | } 13 | 14 | public @NonNull Direction direction() { 15 | return intersection == null ? Direction.UP : intersection.intersectingFace(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/player/raycast/RayIntersection.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.player.raycast; 2 | 3 | import com.zenith.mc.block.Direction; 4 | 5 | public record RayIntersection(double x, double y, double z, Direction intersectingFace) { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/queue/QueueStatus.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.queue; 2 | 3 | public record QueueStatus( 4 | int prio, 5 | int regular, 6 | long epochSecond 7 | ) { 8 | public int total() { 9 | return prio + regular; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/queue/mcping/data/MCResponse.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.queue.mcping.data; 2 | 3 | import com.zenith.feature.queue.mcping.rawData.Players; 4 | import com.zenith.feature.queue.mcping.rawData.Version; 5 | 6 | import java.util.regex.Pattern; 7 | 8 | public record MCResponse(Players players, Version version, String favicon, String description) { 9 | 10 | private static final Pattern STRIP_PATTERN = Pattern.compile("(? extra) { } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/queue/mcping/rawData/Player.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.queue.mcping.rawData; 2 | 3 | public record Player(String name, String id) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/queue/mcping/rawData/Players.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.queue.mcping.rawData; 2 | 3 | import java.util.List; 4 | 5 | public record Players( 6 | int max, 7 | int online, 8 | List sample) { } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/queue/mcping/rawData/Version.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.queue.mcping.rawData; 2 | 3 | public record Version(String name, int protocol) { } 4 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/feature/whitelist/PlayerEntry.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.whitelist; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | import java.util.UUID; 8 | 9 | @Data 10 | @EqualsAndHashCode(exclude = {"lastRefreshed"}) 11 | @AllArgsConstructor 12 | public class PlayerEntry { 13 | private String username; 14 | private UUID uuid; 15 | // epoch second 16 | private long lastRefreshed; 17 | public PlayerEntry() {} // for gson deserialization 18 | public String getNameMCLink() { 19 | return "https://namemc.com/profile/" + uuid.toString(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/RegistryData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc; 2 | 3 | public interface RegistryData { 4 | int id(); 5 | // equivalent to resource key (minus the 'minecraft:' prefix 6 | String name(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/BlockTags.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block; 2 | 3 | public enum BlockTags { 4 | MINEABLE_WITH_AXE, 5 | MINEABLE_WITH_HOE, 6 | MINEABLE_WITH_PICKAXE, 7 | MINEABLE_WITH_SHOVEL, 8 | SWORD_EFFICIENT, 9 | NEEDS_DIAMOND_TOOL, 10 | NEEDS_IRON_TOOL, 11 | NEEDS_STONE_TOOL, 12 | CLIMBABLE 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/CollisionBox.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block; 2 | 3 | public record CollisionBox(double minX, double maxX, double minY, double maxY, double minZ, double maxZ) { 4 | public boolean intersects(final CollisionBox collisionBox) { 5 | return this.maxX >= collisionBox.minX && this.minX <= collisionBox.maxX 6 | && this.maxZ >= collisionBox.minZ && this.minZ <= collisionBox.maxZ 7 | && this.maxY >= collisionBox.minY && this.minY <= collisionBox.maxY; 8 | } 9 | 10 | public boolean isFullBlock() { 11 | return this.minX == 0.0 && this.maxX == 1.0 12 | && this.minY == 0.0 && this.maxY == 1.0 13 | && this.minZ == 0.0 && this.maxZ == 1.0; 14 | } 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/FluidState.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block; 2 | 3 | public record FluidState(boolean water, boolean source, int amount, boolean falling) { 4 | public boolean lava() { 5 | return !water; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/AttachFace.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum AttachFace implements StringRepresentable { 6 | FLOOR("floor"), 7 | WALL("wall"), 8 | CEILING("ceiling"); 9 | 10 | private final String name; 11 | 12 | private AttachFace(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String getSerializedName() { 18 | return this.name; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/BambooLeaves.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum BambooLeaves implements StringRepresentable { 6 | NONE("none"), 7 | SMALL("small"), 8 | LARGE("large"); 9 | 10 | private final String name; 11 | 12 | private BambooLeaves(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return this.name; 19 | } 20 | 21 | @Override 22 | public String getSerializedName() { 23 | return this.name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/BedPart.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum BedPart implements StringRepresentable { 6 | HEAD("head"), 7 | FOOT("foot"); 8 | 9 | private final String name; 10 | 11 | private BedPart(final String name) { 12 | this.name = name; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return this.name; 18 | } 19 | 20 | @Override 21 | public String getSerializedName() { 22 | return this.name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/BellAttachType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum BellAttachType implements StringRepresentable { 6 | FLOOR("floor"), 7 | CEILING("ceiling"), 8 | SINGLE_WALL("single_wall"), 9 | DOUBLE_WALL("double_wall"); 10 | 11 | private final String name; 12 | 13 | private BellAttachType(final String name) { 14 | this.name = name; 15 | } 16 | 17 | @Override 18 | public String getSerializedName() { 19 | return this.name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/ChestType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum ChestType implements StringRepresentable { 6 | SINGLE("single"), 7 | LEFT("left"), 8 | RIGHT("right"); 9 | 10 | private final String name; 11 | 12 | private ChestType(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String getSerializedName() { 18 | return this.name; 19 | } 20 | 21 | public ChestType getOpposite() { 22 | return switch (this) { 23 | case SINGLE -> SINGLE; 24 | case LEFT -> RIGHT; 25 | case RIGHT -> LEFT; 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/ComparatorMode.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum ComparatorMode implements StringRepresentable { 6 | COMPARE("compare"), 7 | SUBTRACT("subtract"); 8 | 9 | private final String name; 10 | 11 | private ComparatorMode(final String name) { 12 | this.name = name; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return this.name; 18 | } 19 | 20 | @Override 21 | public String getSerializedName() { 22 | return this.name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/DoorHingeSide.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum DoorHingeSide implements StringRepresentable { 6 | LEFT, 7 | RIGHT; 8 | 9 | @Override 10 | public String toString() { 11 | return this.getSerializedName(); 12 | } 13 | 14 | @Override 15 | public String getSerializedName() { 16 | return this == LEFT ? "left" : "right"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/DoubleBlockHalf.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.Direction; 4 | import com.zenith.mc.block.properties.api.StringRepresentable; 5 | 6 | public enum DoubleBlockHalf implements StringRepresentable { 7 | UPPER(Direction.DOWN), 8 | LOWER(Direction.UP); 9 | 10 | private final Direction directionToOther; 11 | 12 | private DoubleBlockHalf(final Direction directionToOther) { 13 | this.directionToOther = directionToOther; 14 | } 15 | 16 | public Direction getDirectionToOther() { 17 | return this.directionToOther; 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return this.getSerializedName(); 23 | } 24 | 25 | @Override 26 | public String getSerializedName() { 27 | return this == UPPER ? "upper" : "lower"; 28 | } 29 | 30 | public DoubleBlockHalf getOtherHalf() { 31 | return this == UPPER ? LOWER : UPPER; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/DripstoneThickness.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum DripstoneThickness implements StringRepresentable { 6 | TIP_MERGE("tip_merge"), 7 | TIP("tip"), 8 | FRUSTUM("frustum"), 9 | MIDDLE("middle"), 10 | BASE("base"); 11 | 12 | private final String name; 13 | 14 | private DripstoneThickness(final String name) { 15 | this.name = name; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return this.name; 21 | } 22 | 23 | @Override 24 | public String getSerializedName() { 25 | return this.name; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/Half.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum Half implements StringRepresentable { 6 | TOP("top"), 7 | BOTTOM("bottom"); 8 | 9 | private final String name; 10 | 11 | private Half(final String name) { 12 | this.name = name; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return this.name; 18 | } 19 | 20 | @Override 21 | public String getSerializedName() { 22 | return this.name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/PistonType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum PistonType implements StringRepresentable { 6 | DEFAULT("normal"), 7 | STICKY("sticky"); 8 | 9 | private final String name; 10 | 11 | private PistonType(final String name) { 12 | this.name = name; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return this.name; 18 | } 19 | 20 | @Override 21 | public String getSerializedName() { 22 | return this.name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/RedstoneSide.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum RedstoneSide implements StringRepresentable { 6 | UP("up"), 7 | SIDE("side"), 8 | NONE("none"); 9 | 10 | private final String name; 11 | 12 | private RedstoneSide(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return this.getSerializedName(); 19 | } 20 | 21 | @Override 22 | public String getSerializedName() { 23 | return this.name; 24 | } 25 | 26 | public boolean isConnected() { 27 | return this != NONE; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/SculkSensorPhase.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum SculkSensorPhase implements StringRepresentable { 6 | INACTIVE("inactive"), 7 | ACTIVE("active"), 8 | COOLDOWN("cooldown"); 9 | 10 | private final String name; 11 | 12 | private SculkSensorPhase(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return this.name; 19 | } 20 | 21 | @Override 22 | public String getSerializedName() { 23 | return this.name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/SlabType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum SlabType implements StringRepresentable { 6 | TOP("top"), 7 | BOTTOM("bottom"), 8 | DOUBLE("double"); 9 | 10 | private final String name; 11 | 12 | private SlabType(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return this.name; 19 | } 20 | 21 | @Override 22 | public String getSerializedName() { 23 | return this.name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/StairsShape.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum StairsShape implements StringRepresentable { 6 | STRAIGHT("straight"), 7 | INNER_LEFT("inner_left"), 8 | INNER_RIGHT("inner_right"), 9 | OUTER_LEFT("outer_left"), 10 | OUTER_RIGHT("outer_right"); 11 | 12 | private final String name; 13 | 14 | private StairsShape(final String name) { 15 | this.name = name; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return this.name; 21 | } 22 | 23 | @Override 24 | public String getSerializedName() { 25 | return this.name; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/StructureMode.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum StructureMode implements StringRepresentable { 6 | SAVE("save"), 7 | LOAD("load"), 8 | CORNER("corner"), 9 | DATA("data"); 10 | 11 | private final String name; 12 | private StructureMode(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String getSerializedName() { 18 | return this.name; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/Tilt.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum Tilt implements StringRepresentable { 6 | NONE("none", true), 7 | UNSTABLE("unstable", false), 8 | PARTIAL("partial", true), 9 | FULL("full", true); 10 | 11 | private final String name; 12 | private final boolean causesVibration; 13 | 14 | private Tilt(final String name, final boolean causesVibration) { 15 | this.name = name; 16 | this.causesVibration = causesVibration; 17 | } 18 | 19 | @Override 20 | public String getSerializedName() { 21 | return this.name; 22 | } 23 | 24 | public boolean causesVibration() { 25 | return this.causesVibration; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/TrialSpawnerState.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum TrialSpawnerState implements StringRepresentable { 6 | INACTIVE("inactive"), 7 | WAITING_FOR_PLAYERS("waiting_for_players"), 8 | ACTIVE("active"), 9 | WAITING_FOR_REWARD_EJECTION("waiting_for_reward_ejection"), 10 | EJECTING_REWARD("ejecting_reward"), 11 | COOLDOWN("cooldown"); 12 | 13 | private final String name; 14 | 15 | TrialSpawnerState(String name) { 16 | this.name = name; 17 | } 18 | 19 | @Override 20 | public String getSerializedName() { 21 | return name; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/VaultState.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum VaultState implements StringRepresentable { 6 | INACTIVE("inactive"), 7 | ACTIVE("active"), 8 | UNLOCKING("unlocking"), 9 | EJECTING("ejecting"); 10 | 11 | private final String stateName; 12 | 13 | VaultState(String stateName) { 14 | this.stateName = stateName; 15 | } 16 | 17 | @Override 18 | public String getSerializedName() { 19 | return stateName; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/WallSide.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties; 2 | 3 | import com.zenith.mc.block.properties.api.StringRepresentable; 4 | 5 | public enum WallSide implements StringRepresentable { 6 | NONE("none"), 7 | LOW("low"), 8 | TALL("tall"); 9 | 10 | private final String name; 11 | 12 | private WallSide(final String name) { 13 | this.name = name; 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return this.getSerializedName(); 19 | } 20 | 21 | @Override 22 | public String getSerializedName() { 23 | return this.name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/block/properties/api/StringRepresentable.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.block.properties.api; 2 | 3 | public interface StringRepresentable { 4 | String getSerializedName(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/chat_type/ChatTypeRegistry.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.chat_type; 2 | 3 | import com.zenith.mc.DynamicRegistry; 4 | 5 | public class ChatTypeRegistry { 6 | public static final DynamicRegistry REGISTRY = new DynamicRegistry<>(0); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/dimension/DimensionData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.dimension; 2 | 3 | import com.zenith.mc.RegistryData; 4 | 5 | public record DimensionData( 6 | int id, 7 | String name, 8 | int minY, 9 | int buildHeight, 10 | int height 11 | ) implements RegistryData { } 12 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/enchantment/EnchantmentData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.enchantment; 2 | 3 | import com.zenith.mc.RegistryData; 4 | 5 | public record EnchantmentData( 6 | int id, 7 | String name 8 | ) implements RegistryData { } 9 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/entity/EntityData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.entity; 2 | 3 | import com.zenith.mc.RegistryData; 4 | import org.geysermc.mcprotocollib.protocol.data.game.entity.type.EntityType; 5 | 6 | public record EntityData( 7 | int id, 8 | String name, 9 | float width, 10 | float height, 11 | boolean attackable, 12 | boolean pickable, 13 | boolean livingEntity, 14 | EntityType mcplType 15 | ) implements RegistryData { } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/food/FoodData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.food; 2 | 3 | import com.zenith.mc.RegistryData; 4 | 5 | public record FoodData( 6 | int id, 7 | String name, 8 | int stackSize, 9 | float foodPoints, 10 | float saturation, 11 | boolean canAlwaysEat, 12 | boolean isSafeFood 13 | ) implements RegistryData { } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/item/ItemData.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.item; 2 | 3 | import com.zenith.mc.RegistryData; 4 | import org.jspecify.annotations.Nullable; 5 | 6 | public record ItemData( 7 | int id, 8 | String name, 9 | int stackSize, 10 | @Nullable ToolTag toolTag 11 | ) implements RegistryData { 12 | public ItemData(int id, String name, int stackSize) { 13 | this(id, name, stackSize, null); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/item/ToolTag.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.item; 2 | 3 | public record ToolTag(ToolTier tier, ToolType type) { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/item/ToolTier.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.item; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum ToolTier { 7 | WOOD(2.0F), 8 | STONE(4.0F), 9 | IRON(6.0F), 10 | DIAMOND(8.0F), 11 | GOLD(12.0F), 12 | NETHERITE(9.0f); 13 | 14 | private final float speed; 15 | 16 | ToolTier(float speed) { 17 | this.speed = speed; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/mc/item/ToolType.java: -------------------------------------------------------------------------------- 1 | package com.zenith.mc.item; 2 | 3 | import com.zenith.mc.block.BlockTags; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | public enum ToolType { 8 | AXE(BlockTags.MINEABLE_WITH_AXE), 9 | HOE(BlockTags.MINEABLE_WITH_HOE), 10 | PICKAXE(BlockTags.MINEABLE_WITH_PICKAXE), 11 | SHOVEL(BlockTags.MINEABLE_WITH_SHOVEL), 12 | SWORD(BlockTags.SWORD_EFFICIENT); 13 | 14 | private final BlockTags blockTag; 15 | 16 | ToolType(BlockTags blockTag) { 17 | this.blockTag = blockTag; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/AwardStatsHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundAwardStatsPacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class AwardStatsHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(@NonNull ClientboundAwardStatsPacket packet, @NonNull ClientSession session) { 13 | CACHE.getStatsCache().getStatistics().putAll(packet.getStatistics()); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CCookieRequestHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundCookieRequestPacket; 6 | 7 | public class CCookieRequestHandler implements PacketHandler { 8 | @Override 9 | public ClientboundCookieRequestPacket apply(final ClientboundCookieRequestPacket packet, final ClientSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CCustomQueryHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundCustomQueryPacket; 6 | import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundCustomQueryAnswerPacket; 7 | 8 | public class CCustomQueryHandler implements PacketHandler { 9 | @Override 10 | public ClientboundCustomQueryPacket apply(final ClientboundCustomQueryPacket packet, final ClientSession session) { 11 | session.send(new ServerboundCustomQueryAnswerPacket(packet.getMessageId())); 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CDisconnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundDisconnectPacket; 6 | 7 | public class CDisconnectHandler implements PacketHandler { 8 | public static final CDisconnectHandler INSTANCE = new CDisconnectHandler(); 9 | @Override 10 | public ClientboundDisconnectPacket apply(final ClientboundDisconnectPacket packet, final ClientSession session) { 11 | session.disconnect(packet.getReason()); 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CLoginCompressionHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundLoginCompressionPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class CLoginCompressionHandler implements PacketHandler { 10 | @Override 11 | public ClientboundLoginCompressionPacket apply(final ClientboundLoginCompressionPacket packet, final ClientSession session) { 12 | session.setCompressionThreshold(packet.getThreshold(), CONFIG.client.compressionLevel, false); 13 | return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CRegistryDataHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class CRegistryDataHandler implements PacketHandler { 10 | @Override 11 | public ClientboundRegistryDataPacket apply(final ClientboundRegistryDataPacket packet, final ClientSession session) { 12 | CACHE.getRegistriesCache().initialize(packet.getRegistry(), packet.getEntries()); 13 | return packet; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CStatusResponseHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundStatusResponsePacket; 6 | import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundPingRequestPacket; 7 | 8 | public class CStatusResponseHandler implements PacketHandler { 9 | @Override 10 | public ClientboundStatusResponsePacket apply(final ClientboundStatusResponsePacket packet, final ClientSession session) { 11 | session.send(new ServerboundPingRequestPacket(System.currentTimeMillis())); 12 | return null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CStoreCookieHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundStoreCookiePacket; 6 | 7 | public class CStoreCookieHandler implements PacketHandler { 8 | @Override 9 | public ClientboundStoreCookiePacket apply(final ClientboundStoreCookiePacket packet, final ClientSession session) { 10 | // todo: store the cookie? 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/ChangeDifficultyHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundChangeDifficultyPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class ChangeDifficultyHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundChangeDifficultyPacket packet, final ClientSession session) { 12 | CACHE.getPlayerCache().setDifficulty(packet.getDifficulty()); 13 | CACHE.getPlayerCache().setDifficultyLocked(packet.isDifficultyLocked()); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/CommandsHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundCommandsPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class CommandsHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundCommandsPacket packet, final ClientSession session) { 12 | CACHE.getChatCache().setCommandNodes(packet.getNodes()); 13 | CACHE.getChatCache().setFirstCommandNodeIndex(packet.getFirstNodeIndex()); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/ExplodeHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.Proxy; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket; 7 | 8 | import static com.zenith.Globals.BOT; 9 | 10 | public class ExplodeHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(final ClientboundExplodePacket packet, final ClientSession session) { 13 | if (!Proxy.getInstance().hasActivePlayer()) 14 | BOT.handleExplosion(packet); 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/LoginDisconnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundLoginDisconnectPacket; 6 | 7 | public class LoginDisconnectHandler implements PacketHandler { 8 | @Override 9 | public ClientboundLoginDisconnectPacket apply(final ClientboundLoginDisconnectPacket packet, final ClientSession session) { 10 | session.disconnect(packet.getReason()); 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/MapDataHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundMapItemDataPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class MapDataHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(ClientboundMapItemDataPacket packet, ClientSession session) { 12 | CACHE.getMapDataCache().upsert(packet); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/PlayerCombatKillHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.event.client.ClientDeathEvent; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerCombatKillPacket; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | import static com.zenith.Globals.EVENT_BUS; 10 | 11 | public class PlayerCombatKillHandler implements ClientEventLoopPacketHandler { 12 | 13 | @Override 14 | public boolean applyAsync(ClientboundPlayerCombatKillPacket packet, ClientSession session) { 15 | if (packet.getPlayerId() == CACHE.getPlayerCache().getEntityId()) { 16 | EVENT_BUS.postAsync(new ClientDeathEvent()); 17 | } 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/SetExperienceHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundSetExperiencePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class SetExperienceHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(ClientboundSetExperiencePacket packet, ClientSession session) { 12 | CACHE.getPlayerCache().getThePlayer() 13 | .setTotalExperience(packet.getTotalExperience()) 14 | .setLevel(packet.getLevel()) 15 | .setExperience(packet.getExperience()); 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/SetTimeHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSetTimePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | import static com.zenith.Globals.TPS; 9 | 10 | public class SetTimeHandler implements ClientEventLoopPacketHandler { 11 | 12 | @Override 13 | public boolean applyAsync(ClientboundSetTimePacket packet, ClientSession session) { 14 | CACHE.getChunkCache().updateWorldTime(packet); 15 | TPS.handleTimeUpdate(); 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/SoundHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.event.module.SplashSoundEffectEvent; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSoundPacket; 7 | 8 | import static com.zenith.Globals.EVENT_BUS; 9 | import static org.geysermc.mcprotocollib.protocol.data.game.level.sound.BuiltinSound.ENTITY_FISHING_BOBBER_SPLASH; 10 | 11 | public class SoundHandler implements ClientEventLoopPacketHandler { 12 | @Override 13 | public boolean applyAsync(ClientboundSoundPacket packet, ClientSession session) { 14 | if (packet.getSound() == ENTITY_FISHING_BOBBER_SPLASH) EVENT_BUS.postAsync(new SplashSoundEffectEvent(packet)); 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/UpdateEnabledFeaturesHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundUpdateEnabledFeaturesPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class UpdateEnabledFeaturesHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundUpdateEnabledFeaturesPacket packet, final ClientSession session) { 12 | CACHE.getConfigurationCache().setEnabledFeatures(packet.getFeatures()); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/UpdateTagsHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class UpdateTagsHandler implements PacketHandler { 10 | public static final UpdateTagsHandler INSTANCE = new UpdateTagsHandler(); 11 | @Override 12 | public ClientboundUpdateTagsPacket apply(final ClientboundUpdateTagsPacket packet, final ClientSession session) { 13 | CACHE.getConfigurationCache().setTags(packet.getTags()); 14 | return packet; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/entity/MoveVehicleHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.entity; 2 | 3 | import com.zenith.feature.spectator.SpectatorSync; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class MoveVehicleHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(final ClientboundMoveVehiclePacket packet, final ClientSession session) { 13 | CACHE.getPlayerCache().setX(packet.getX()); 14 | CACHE.getPlayerCache().setY(packet.getY()); 15 | CACHE.getPlayerCache().setZ(packet.getZ()); 16 | SpectatorSync.syncPlayerPositionWithSpectators(); 17 | return true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/entity/RotateHeadHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.entity; 2 | 3 | import com.zenith.cache.data.entity.Entity; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundRotateHeadPacket; 7 | import org.jspecify.annotations.NonNull; 8 | 9 | import static com.zenith.Globals.CACHE; 10 | 11 | public class RotateHeadHandler implements ClientEventLoopPacketHandler { 12 | @Override 13 | public boolean applyAsync(@NonNull ClientboundRotateHeadPacket packet, @NonNull ClientSession session) { 14 | Entity entity = CACHE.getEntityCache().get(packet.getEntityId()); 15 | if (entity != null) { 16 | entity.setHeadYaw(packet.getHeadYaw()); 17 | } 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/inventory/ContainerCloseHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.inventory; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerClosePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | import static com.zenith.feature.spectator.SpectatorSync.syncPlayerEquipmentWithSpectatorsFromCache; 9 | 10 | public class ContainerCloseHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(final ClientboundContainerClosePacket packet, final ClientSession session) { 13 | CACHE.getPlayerCache().closeContainer(packet.getContainerId()); 14 | syncPlayerEquipmentWithSpectatorsFromCache(); 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/inventory/ContainerOpenScreenHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.inventory; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundOpenScreenPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class ContainerOpenScreenHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundOpenScreenPacket packet, final ClientSession session) { 12 | CACHE.getPlayerCache().openContainer(packet.getContainerId(), packet.getType(), packet.getTitle()); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/inventory/SyncRecipesHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.inventory; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundUpdateRecipesPacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class SyncRecipesHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(@NonNull ClientboundUpdateRecipesPacket packet, @NonNull ClientSession session) { 13 | CACHE.getRecipeCache().setRecipeRegistry(packet); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/inventory/UnlockRecipeHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.inventory; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundRecipePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class UnlockRecipeHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundRecipePacket packet, final ClientSession session) { 12 | CACHE.getRecipeCache().updateUnlockedRecipes(packet); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/BlockUpdateHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundBlockUpdatePacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class BlockUpdateHandler implements ClientEventLoopPacketHandler { 11 | 12 | @Override 13 | public boolean applyAsync(@NonNull ClientboundBlockUpdatePacket packet, @NonNull ClientSession session) { 14 | return CACHE.getChunkCache().updateBlock(packet); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/ChunkBatchFinishedHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.Proxy; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.PacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundChunkBatchFinishedPacket; 7 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundChunkBatchReceivedPacket; 8 | 9 | public class ChunkBatchFinishedHandler implements PacketHandler { 10 | @Override 11 | public ClientboundChunkBatchFinishedPacket apply(final ClientboundChunkBatchFinishedPacket packet, final ClientSession session) { 12 | if (!Proxy.getInstance().hasActivePlayer()) { 13 | session.sendAsync(new ServerboundChunkBatchReceivedPacket(64)); // max allowed by server 14 | } 15 | return packet; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/ChunksBiomesHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundChunksBiomesPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class ChunksBiomesHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundChunksBiomesPacket packet, final ClientSession session) { 12 | return CACHE.getChunkCache().handleChunkBiomes(packet); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/ForgetLevelChunkHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.feature.spectator.SpectatorSync; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundForgetLevelChunkPacket; 7 | import org.jspecify.annotations.NonNull; 8 | 9 | import static com.zenith.Globals.CACHE; 10 | 11 | public class ForgetLevelChunkHandler implements ClientEventLoopPacketHandler { 12 | @Override 13 | public boolean applyAsync(@NonNull ClientboundForgetLevelChunkPacket packet, @NonNull ClientSession session) { 14 | CACHE.getChunkCache().remove(packet.getX(), packet.getZ()); 15 | SpectatorSync.checkSpectatorPositionOutOfRender(packet.getX(), packet.getZ()); 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/LevelChunkWithLightHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class LevelChunkWithLightHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(@NonNull ClientboundLevelChunkWithLightPacket packet, @NonNull ClientSession session) { 13 | CACHE.getChunkCache().add(packet); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/LightUpdateHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class LightUpdateHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundLightUpdatePacket packet, final ClientSession session) { 12 | return CACHE.getChunkCache().handleLightUpdate(packet); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/SectionBlocksUpdateHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class SectionBlocksUpdateHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(@NonNull ClientboundSectionBlocksUpdatePacket packet, @NonNull ClientSession session) { 13 | return CACHE.getChunkCache().multiBlockUpdate(packet); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/SetChunkCacheCenterHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheCenterPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class SetChunkCacheCenterHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundSetChunkCacheCenterPacket packet, final ClientSession session) { 12 | CACHE.getChunkCache().setCenterX(packet.getChunkX()); 13 | CACHE.getChunkCache().setCenterZ(packet.getChunkZ()); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/SetChunkCacheRadiusHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSetChunkCacheRadiusPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class SetChunkCacheRadiusHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundSetChunkCacheRadiusPacket packet, final ClientSession session) { 12 | CACHE.getChunkCache().setServerViewDistance(packet.getViewDistance()); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/level/SetSimulationDistanceHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.level; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSetSimulationDistancePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class SetSimulationDistanceHandler implements ClientEventLoopPacketHandler { 10 | @Override 11 | public boolean applyAsync(final ClientboundSetSimulationDistancePacket packet, final ClientSession session) { 12 | CACHE.getChunkCache().setServerSimulationDistance(packet.getSimulationDistance()); 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/scoreboard/SetDisplayObjectiveHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.scoreboard; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.scoreboard.ClientboundSetDisplayObjectivePacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class SetDisplayObjectiveHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(@NonNull ClientboundSetDisplayObjectivePacket packet, @NonNull ClientSession session) { 13 | CACHE.getScoreboardCache().setPositionObjective(packet.getPosition(), packet.getName()); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/incoming/spawn/SpawnPositionHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.incoming.spawn; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import com.zenith.util.math.MutableVec3i; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundSetDefaultSpawnPositionPacket; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class SpawnPositionHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(ClientboundSetDefaultSpawnPositionPacket packet, ClientSession session) { 13 | CACHE.getPlayerCache().setSpawnPosition(new MutableVec3i(packet.getX(), packet.getY(), packet.getZ())); 14 | return true; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/outgoing/OutgoingContainerClickHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.outgoing; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | 9 | public class OutgoingContainerClickHandler implements PacketHandler { 10 | @Override 11 | public ServerboundContainerClickPacket apply(final ServerboundContainerClickPacket packet, final ClientSession session) { 12 | CACHE.getPlayerCache().getActionId().set(packet.getStateId()); 13 | return packet; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingContainerClickHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | import static com.zenith.feature.spectator.SpectatorSync.syncPlayerEquipmentWithSpectatorsFromCache; 9 | 10 | public class PostOutgoingContainerClickHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(final ServerboundContainerClickPacket packet, final ClientSession session) { 13 | CACHE.getPlayerCache().getInventoryCache().handleContainerClick(packet); 14 | syncPlayerEquipmentWithSpectatorsFromCache(); 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingContainerCloseHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket; 6 | 7 | import static com.zenith.Globals.CACHE; 8 | import static com.zenith.feature.spectator.SpectatorSync.syncPlayerEquipmentWithSpectatorsFromCache; 9 | 10 | public class PostOutgoingContainerCloseHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(final ServerboundContainerClosePacket packet, final ClientSession session) { 13 | CACHE.getPlayerCache().closeContainer(packet.getContainerId()); 14 | syncPlayerEquipmentWithSpectatorsFromCache(); 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingFinishConfigurationHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.PostOutgoingPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.data.ProtocolState; 6 | import org.geysermc.mcprotocollib.protocol.packet.configuration.serverbound.ServerboundFinishConfigurationPacket; 7 | 8 | public class PostOutgoingFinishConfigurationHandler implements PostOutgoingPacketHandler { 9 | @Override 10 | public void accept(final ServerboundFinishConfigurationPacket packet, final ClientSession session) { 11 | session.getPacketProtocol().setOutboundState(ProtocolState.GAME); // CONFIGURATION -> GAME 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingPlayerPositionHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.feature.spectator.SpectatorSync; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class PostOutgoingPlayerPositionHandler implements ClientEventLoopPacketHandler { 11 | 12 | @Override 13 | public boolean applyAsync(ServerboundMovePlayerPosPacket packet, ClientSession session) { 14 | CACHE.getPlayerCache() 15 | .setX(packet.getX()) 16 | .setY(packet.getY()) 17 | .setZ(packet.getZ()); 18 | SpectatorSync.syncPlayerPositionWithSpectators(); 19 | return true; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingPlayerRotationHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.feature.spectator.SpectatorSync; 4 | import com.zenith.network.client.ClientSession; 5 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerRotPacket; 7 | 8 | import static com.zenith.Globals.CACHE; 9 | 10 | public class PostOutgoingPlayerRotationHandler implements ClientEventLoopPacketHandler { 11 | @Override 12 | public boolean applyAsync(ServerboundMovePlayerRotPacket packet, ClientSession session) { 13 | CACHE.getPlayerCache() 14 | .setYaw(packet.getYaw()) 15 | .setPitch(packet.getPitch()); 16 | SpectatorSync.syncPlayerPositionWithSpectators(); 17 | return true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingPlayerStatusOnlyHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.network.client.ClientSession; 4 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerStatusOnlyPacket; 6 | 7 | public class PostOutgoingPlayerStatusOnlyHandler implements ClientEventLoopPacketHandler { 8 | @Override 9 | public boolean applyAsync(final ServerboundMovePlayerStatusOnlyPacket packet, final ClientSession session) { 10 | // todo: cache onground 11 | return true; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/client/handler/postoutgoing/PostOutgoingSwingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.client.handler.postoutgoing; 2 | 3 | import com.zenith.event.module.ClientSwingEvent; 4 | import com.zenith.feature.spectator.SpectatorSync; 5 | import com.zenith.network.client.ClientSession; 6 | import com.zenith.network.codec.ClientEventLoopPacketHandler; 7 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundSwingPacket; 8 | 9 | import static com.zenith.Globals.EVENT_BUS; 10 | 11 | public class PostOutgoingSwingHandler implements ClientEventLoopPacketHandler { 12 | @Override 13 | public boolean applyAsync(final ServerboundSwingPacket packet, final ClientSession session) { 14 | SpectatorSync.sendSwing(); 15 | EVENT_BUS.postAsync(ClientSwingEvent.INSTANCE); 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/codec/PacketHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.codec; 2 | 3 | import org.geysermc.mcprotocollib.network.Session; 4 | import org.geysermc.mcprotocollib.network.packet.Packet; 5 | 6 | @FunctionalInterface 7 | public interface PacketHandler

{ 8 | P apply(P packet, S session); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/codec/PostOutgoingPacketHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.codec; 2 | 3 | import org.geysermc.mcprotocollib.network.Session; 4 | import org.geysermc.mcprotocollib.network.packet.Packet; 5 | 6 | @FunctionalInterface 7 | public interface PostOutgoingPacketHandler

extends PacketHandler { 8 | @Override 9 | default P apply(P packet, S session) { 10 | accept(packet, session); 11 | return packet; 12 | } 13 | 14 | void accept(P packet, S session); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/player/incoming/CommandSuggestionHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.player.incoming; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket; 6 | 7 | import static com.zenith.Globals.CONFIG; 8 | 9 | public class CommandSuggestionHandler implements PacketHandler { 10 | @Override 11 | public ServerboundCommandSuggestionPacket apply(final ServerboundCommandSuggestionPacket packet, final ServerSession session) { 12 | if (CONFIG.inGameCommands.enable 13 | && CONFIG.inGameCommands.slashCommands 14 | && CONFIG.inGameCommands.slashCommandsReplacesServerCommands) return null; 15 | return packet; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/incoming/ConfigurationAckHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.incoming; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.data.ProtocolState; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundConfigurationAcknowledgedPacket; 7 | 8 | public class ConfigurationAckHandler implements PacketHandler { 9 | @Override 10 | public ServerboundConfigurationAcknowledgedPacket apply(final ServerboundConfigurationAcknowledgedPacket packet, final ServerSession session) { 11 | session.switchInboundState(ProtocolState.CONFIGURATION); 12 | return packet; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/incoming/KeepAliveHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.incoming; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.serverbound.ServerboundKeepAlivePacket; 6 | 7 | public class KeepAliveHandler implements PacketHandler { 8 | public static final KeepAliveHandler INSTANCE = new KeepAliveHandler(); 9 | @Override 10 | public ServerboundKeepAlivePacket apply(final ServerboundKeepAlivePacket packet, final ServerSession session) { 11 | if (packet.getPingId() == session.getLastKeepAliveId()) { 12 | session.setPing(System.currentTimeMillis() - session.getLastKeepAliveTime()); 13 | } 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/incoming/PingRequestHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.incoming; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundPongResponsePacket; 6 | import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundPingRequestPacket; 7 | 8 | public class PingRequestHandler implements PacketHandler { 9 | public static final PingRequestHandler INSTANCE = new PingRequestHandler(); 10 | @Override 11 | public ServerboundPingRequestPacket apply(final ServerboundPingRequestPacket packet, final ServerSession session) { 12 | session.send(new ClientboundPongResponsePacket(packet.getPingTime())); 13 | return null; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/incoming/PongHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.incoming; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.serverbound.ServerboundPongPacket; 6 | import org.jspecify.annotations.NonNull; 7 | 8 | public class PongHandler implements PacketHandler { 9 | @Override 10 | public ServerboundPongPacket apply(@NonNull ServerboundPongPacket packet, @NonNull ServerSession session) { 11 | if (packet.getId() == session.getLastPingId()) { 12 | session.setPing(System.currentTimeMillis() - session.getLastPingTime()); 13 | } 14 | return packet; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/outgoing/KeepAliveOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundKeepAlivePacket; 6 | 7 | public class KeepAliveOutgoingHandler implements PacketHandler { 8 | public static final KeepAliveOutgoingHandler INSTANCE = new KeepAliveOutgoingHandler(); 9 | @Override 10 | public ClientboundKeepAlivePacket apply(final ClientboundKeepAlivePacket packet, final ServerSession session) { 11 | session.setLastKeepAliveId(packet.getPingId()); 12 | session.setLastKeepAliveTime(System.currentTimeMillis()); 13 | return packet; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/postoutgoing/ClientFinishConfigurationPostOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.postoutgoing; 2 | 3 | import com.zenith.network.codec.PostOutgoingPacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.data.ProtocolState; 6 | import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundFinishConfigurationPacket; 7 | 8 | public class ClientFinishConfigurationPostOutgoingHandler implements PostOutgoingPacketHandler { 9 | @Override 10 | public void accept(final ClientboundFinishConfigurationPacket packet, final ServerSession session) { 11 | session.getPacketProtocol().setOutboundState(ProtocolState.GAME); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/postoutgoing/ClientStartConfigurationPostOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.postoutgoing; 2 | 3 | import com.zenith.network.codec.PostOutgoingPacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.data.ProtocolState; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundStartConfigurationPacket; 7 | 8 | public class ClientStartConfigurationPostOutgoingHandler implements PostOutgoingPacketHandler { 9 | @Override 10 | public void accept(final ClientboundStartConfigurationPacket packet, final ServerSession session) { 11 | session.getPacketProtocol().setOutboundState(ProtocolState.CONFIGURATION); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/postoutgoing/PingPostOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.postoutgoing; 2 | 3 | import com.zenith.network.codec.PostOutgoingPacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundPingPacket; 6 | 7 | public class PingPostOutgoingHandler implements PostOutgoingPacketHandler { 8 | @Override 9 | public void accept(final ClientboundPingPacket packet, final ServerSession session) { 10 | session.setLastPingId(packet.getId()); 11 | session.setLastPingTime(System.currentTimeMillis()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/shared/postoutgoing/TransferPostOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.shared.postoutgoing; 2 | 3 | import com.zenith.network.codec.PostOutgoingPacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import net.kyori.adventure.text.Component; 6 | import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundTransferPacket; 7 | 8 | public class TransferPostOutgoingHandler implements PostOutgoingPacketHandler { 9 | @Override 10 | public void accept(final ClientboundTransferPacket packet, final ServerSession session) { 11 | session.disconnect(Component.text("Transferring to " + packet.getHost() + ":" + packet.getPort())); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/ContainerCloseSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerClosePacket; 6 | 7 | public class ContainerCloseSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundContainerClosePacket apply(ClientboundContainerClosePacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/ContainerSetContentSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket; 6 | 7 | public class ContainerSetContentSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundContainerSetContentPacket apply(ClientboundContainerSetContentPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/ContainerSetDataSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket; 6 | 7 | public class ContainerSetDataSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundContainerSetDataPacket apply(ClientboundContainerSetDataPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/ContainerSetSlotSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket; 6 | 7 | public class ContainerSetSlotSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundContainerSetSlotPacket apply(ClientboundContainerSetSlotPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/GameEventSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.data.game.level.notify.GameEvent; 6 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundGameEventPacket; 7 | 8 | public class GameEventSpectatorOutgoingHandler implements PacketHandler { 9 | @Override 10 | public ClientboundGameEventPacket apply(final ClientboundGameEventPacket packet, final ServerSession session) { 11 | if (packet.getNotification() == GameEvent.CHANGE_GAMEMODE) { 12 | return null; 13 | } 14 | return packet; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/HorseScreenOpenSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket; 6 | 7 | public class HorseScreenOpenSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundHorseScreenOpenPacket apply(ClientboundHorseScreenOpenPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/MoveVehicleSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.ClientboundMoveVehiclePacket; 6 | 7 | public class MoveVehicleSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundMoveVehiclePacket apply(ClientboundMoveVehiclePacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/OpenBookSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundOpenBookPacket; 6 | 7 | public class OpenBookSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundOpenBookPacket apply(ClientboundOpenBookPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/OpenScreenSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundOpenScreenPacket; 6 | 7 | public class OpenScreenSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundOpenScreenPacket apply(ClientboundOpenScreenPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/OpenSignEditorSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.level.ClientboundOpenSignEditorPacket; 6 | 7 | public class OpenSignEditorSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundOpenSignEditorPacket apply(final ClientboundOpenSignEditorPacket packet, final ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/PlaceGhostRecipeSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.inventory.ClientboundPlaceGhostRecipePacket; 6 | 7 | public class PlaceGhostRecipeSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundPlaceGhostRecipePacket apply(ClientboundPlaceGhostRecipePacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/PlayerPositionSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket; 6 | 7 | public class PlayerPositionSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundPlayerPositionPacket apply(ClientboundPlayerPositionPacket packet, ServerSession session) { 10 | if (session.isAllowSpectatorServerPlayerPosRotate()) { 11 | return packet; 12 | } else { 13 | return null; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/SetCarriedItemSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundSetCarriedItemPacket; 6 | 7 | public class SetCarriedItemSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundSetCarriedItemPacket apply(ClientboundSetCarriedItemPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/SetExperienceSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundSetExperiencePacket; 6 | 7 | public class SetExperienceSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundSetExperiencePacket apply(ClientboundSetExperiencePacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/network/server/handler/spectator/outgoing/SetHealthSpectatorOutgoingHandler.java: -------------------------------------------------------------------------------- 1 | package com.zenith.network.server.handler.spectator.outgoing; 2 | 3 | import com.zenith.network.codec.PacketHandler; 4 | import com.zenith.network.server.ServerSession; 5 | import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.entity.player.ClientboundSetHealthPacket; 6 | 7 | public class SetHealthSpectatorOutgoingHandler implements PacketHandler { 8 | @Override 9 | public ClientboundSetHealthPacket apply(ClientboundSetHealthPacket packet, ServerSession session) { 10 | return null; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/plugin/api/Plugin.java: -------------------------------------------------------------------------------- 1 | package com.zenith.plugin.api; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.TYPE) 10 | public @interface Plugin { 11 | String id(); 12 | String version() default ""; 13 | String description() default ""; 14 | String url() default ""; 15 | String[] authors() default ""; 16 | String[] mcVersions() default "1.21.0"; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/plugin/api/PluginInfo.java: -------------------------------------------------------------------------------- 1 | package com.zenith.plugin.api; 2 | 3 | import org.jspecify.annotations.NullMarked; 4 | 5 | import java.util.List; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * Data from each plugin's {@link Plugin} annotation. 10 | */ 11 | @NullMarked 12 | public record PluginInfo( 13 | String entrypoint, 14 | String id, 15 | Version version, 16 | String description, 17 | String url, 18 | List authors, 19 | List mcVersions 20 | ) { 21 | public static final Pattern ID_PATTERN = Pattern.compile("[a-z][a-z0-9-_]{0,63}"); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/plugin/api/PluginInstance.java: -------------------------------------------------------------------------------- 1 | package com.zenith.plugin.api; 2 | 3 | import lombok.Data; 4 | 5 | import java.net.URLClassLoader; 6 | import java.nio.file.Path; 7 | 8 | @Data 9 | public class PluginInstance { 10 | private final String id; 11 | private final Path jarPath; 12 | private final PluginInfo pluginInfo; 13 | private final URLClassLoader classLoader; 14 | // null before loading 15 | private ZenithProxyPlugin pluginInstance; 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/plugin/api/ZenithProxyPlugin.java: -------------------------------------------------------------------------------- 1 | package com.zenith.plugin.api; 2 | 3 | public interface ZenithProxyPlugin { 4 | /** 5 | * Called immediately when the plugin class is loaded. 6 | * 7 | * Initialize configurations, modules, and commands here. 8 | */ 9 | void onLoad(PluginAPI pluginAPI); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/terminal/TerminalCommandCompleter.java: -------------------------------------------------------------------------------- 1 | package com.zenith.terminal; 2 | 3 | import org.jline.reader.Candidate; 4 | import org.jline.reader.Completer; 5 | import org.jline.reader.LineReader; 6 | import org.jline.reader.ParsedLine; 7 | 8 | import java.util.List; 9 | 10 | import static com.zenith.Globals.COMMAND; 11 | 12 | public class TerminalCommandCompleter implements Completer { 13 | @Override 14 | public void complete(final LineReader lineReader, final ParsedLine parsedLine, final List list) { 15 | final String line = parsedLine.line(); 16 | COMMAND.getCommandCompletions(line).stream() 17 | .map(Candidate::new) 18 | .forEach(list::add); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/terminal/logback/AnsiStripConverter.java: -------------------------------------------------------------------------------- 1 | package com.zenith.terminal.logback; 2 | 3 | import ch.qos.logback.classic.pattern.MessageConverter; 4 | import ch.qos.logback.classic.spi.ILoggingEvent; 5 | 6 | import java.util.regex.Pattern; 7 | 8 | public class AnsiStripConverter extends MessageConverter { 9 | final private Pattern ANSI_PATTERN = Pattern.compile("\\e\\[[\\d;]*[^\\d;]"); 10 | 11 | @Override 12 | public String convert(ILoggingEvent event) { 13 | final String formattedMessage = event.getFormattedMessage(); 14 | try { 15 | return ANSI_PATTERN.matcher(formattedMessage).replaceAll(""); 16 | } catch (final Exception e) { 17 | // fall through 18 | } 19 | return formattedMessage; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/terminal/logback/AnsiStripEncoder.java: -------------------------------------------------------------------------------- 1 | package com.zenith.terminal.logback; 2 | 3 | import ch.qos.logback.classic.encoder.PatternLayoutEncoder; 4 | import ch.qos.logback.core.CoreConstants; 5 | 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | import static java.util.Objects.isNull; 10 | 11 | public class AnsiStripEncoder extends PatternLayoutEncoder { 12 | @Override 13 | public void start() { 14 | Map patternRuleRegistry = (Map) context.getObject(CoreConstants.PATTERN_RULE_REGISTRY); 15 | if (isNull(patternRuleRegistry)) { 16 | patternRuleRegistry = new ConcurrentHashMap<>(); 17 | } 18 | patternRuleRegistry.put("stripAnsi", AnsiStripConverter.class.getName()); 19 | context.putObject(CoreConstants.PATTERN_RULE_REGISTRY, patternRuleRegistry); 20 | super.start(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/terminal/logback/PrintOnlyErrorLogbackStatusListener.java: -------------------------------------------------------------------------------- 1 | package com.zenith.terminal.logback; 2 | 3 | import ch.qos.logback.core.status.OnConsoleStatusListener; 4 | import ch.qos.logback.core.status.Status; 5 | 6 | import java.util.List; 7 | 8 | public class PrintOnlyErrorLogbackStatusListener extends OnConsoleStatusListener { 9 | 10 | private static final int LOG_LEVEL = Status.ERROR; 11 | 12 | @Override 13 | public void addStatusEvent(Status status) { 14 | if (status.getLevel() == LOG_LEVEL) { 15 | super.addStatusEvent(status); 16 | } 17 | } 18 | 19 | @Override 20 | public void start() { 21 | final List statuses = context.getStatusManager().getCopyOfStatusList(); 22 | for (Status status : statuses) { 23 | if (status.getLevel() == LOG_LEVEL) { 24 | super.start(); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/terminal/logback/StartupSizeAndTimeBasedTriggeringPolicy.java: -------------------------------------------------------------------------------- 1 | package com.zenith.terminal.logback; 2 | 3 | import ch.qos.logback.core.joran.spi.NoAutoStart; 4 | import ch.qos.logback.core.rolling.SizeAndTimeBasedFileNamingAndTriggeringPolicy; 5 | 6 | import java.io.File; 7 | 8 | @NoAutoStart 9 | public class StartupSizeAndTimeBasedTriggeringPolicy extends SizeAndTimeBasedFileNamingAndTriggeringPolicy { 10 | private boolean started = false; 11 | 12 | @Override 13 | public boolean isTriggeringEvent(File activeFile, E event) { 14 | if (!started) { 15 | atomicNextCheck.set(0L); 16 | return started = true; 17 | } 18 | 19 | return super.isTriggeringEvent(activeFile, event); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/ChatUtil.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util; 2 | 3 | 4 | public class ChatUtil { 5 | 6 | public static String sanitizeChatMessage(final String input) { 7 | StringBuilder stringbuilder = new StringBuilder(); 8 | for (char c0 : input.toCharArray()) { 9 | if (isAllowedChatCharacter(c0)) { 10 | stringbuilder.append(c0); 11 | } 12 | } 13 | return stringbuilder.toString(); 14 | } 15 | 16 | public static boolean isAllowedChatCharacter(char c0) { 17 | return c0 != 167 && c0 >= 32 && c0 != 127; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/Color.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util; 2 | 3 | public record Color(int r, int g, int b) { 4 | public static final Color BLACK = new Color(0, 0, 0); 5 | public int getRGB() { 6 | return ((255 & 0xFF) << 24) | 7 | ((r & 0xFF) << 16) | 8 | ((g & 0xFF) << 8) | 9 | ((b & 0xFF) << 0); 10 | } 11 | 12 | public static Color fromInt(int rgb) { 13 | return new Color( 14 | (rgb >> 16) & 0xFF, 15 | (rgb >> 8) & 0xFF, 16 | (rgb >> 0) & 0xFF 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/DisconnectMessages.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util; 2 | 3 | public final class DisconnectMessages { 4 | private DisconnectMessages() {} 5 | 6 | public static final String SERVER_RESTARTING = "Server restarting"; 7 | public static final String MAX_PT_DISCONNECT = "Max Playtime Disconnect"; 8 | public static final String SYSTEM_DISCONNECT = "System Disconnect"; 9 | public static final String MANUAL_DISCONNECT = "Manual Disconnect"; 10 | public static final String LOGIN_FAILED = "Login Failed"; 11 | public static final String AUTH_REQUIRED = "Cannot join online mode server with offline auth"; 12 | public static final String SERVER_CLOSING_MESSAGE = "Server closed."; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/MentionUtil.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util; 2 | 3 | public final class MentionUtil { 4 | public static final String EVERYONE = "@everyone"; 5 | public static final String HERE = "@here"; 6 | 7 | private MentionUtil() { 8 | } 9 | 10 | public static String forChannel(String id) { 11 | return "<#" + id + ">"; 12 | } 13 | 14 | public static String forRole(String id) { 15 | return "<@&" + id + ">"; 16 | } 17 | 18 | public static String forUser(String id) { 19 | return "<@" + id + ">"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/config/ConfigNullable.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.config; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Indicates that a config field can be null 10 | * 11 | * If this annotation is not present, the ConfigVerifier will fail if the field is null 12 | */ 13 | @Target(ElementType.FIELD) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface ConfigNullable { } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/config/LaunchConfig.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.config; 2 | 3 | import org.jspecify.annotations.Nullable; 4 | 5 | public class LaunchConfig { 6 | public boolean auto_update = true; 7 | public boolean auto_update_launcher = true; 8 | public String release_channel = "java.1.21.0"; 9 | public @Nullable String getMcVersion() { 10 | try { 11 | return release_channel.substring(release_channel.indexOf('.') + 1); 12 | } catch (final Exception e) { 13 | return null; 14 | } 15 | } 16 | public String version = "0.0.0"; 17 | public String local_version = "0.0.0"; 18 | public String repo_owner = "rfresh2"; 19 | public String repo_name = "ZenithProxy"; 20 | public @ConfigNullable @Nullable String custom_jvm_args = null; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/math/MutableVec3i.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.math; 2 | 3 | import lombok.*; 4 | import org.cloudburstmc.math.vector.Vector3i; 5 | 6 | @Getter 7 | @Setter 8 | @ToString 9 | @EqualsAndHashCode 10 | @AllArgsConstructor 11 | public class MutableVec3i { 12 | private int x; 13 | private int y; 14 | private int z; 15 | 16 | public static MutableVec3i from(Vector3i vector3i) { 17 | return new MutableVec3i(vector3i.getX(), vector3i.getY(), vector3i.getZ()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/struct/Maps.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.struct; 2 | 3 | import lombok.experimental.UtilityClass; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | @UtilityClass 9 | public final class Maps { 10 | public static final float FAST_LOAD_FACTOR = 0.5f; 11 | 12 | public static Map of(K k1, V v1) { 13 | final Map map = new HashMap<>(); 14 | map.put(k1, v1); 15 | return map; 16 | } 17 | 18 | public static Map of(K k1, V v1, K k2, V v2) { 19 | final Map map = new HashMap<>(); 20 | map.put(k1, v1); 21 | map.put(k2, v2); 22 | return map; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/struct/Pair.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.struct; 2 | 3 | public record Pair(L left, R right) { 4 | public static Pair of(final L left, final R right) { 5 | return new Pair<>(left, right); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/struct/SortedFastArrayList.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.struct; 2 | 3 | import org.jspecify.annotations.NonNull; 4 | 5 | import java.lang.reflect.Array; 6 | import java.util.Arrays; 7 | import java.util.Comparator; 8 | 9 | public class SortedFastArrayList extends FastArrayList { 10 | private final Comparator comparator; 11 | public SortedFastArrayList(@NonNull final Class clazz, Comparator comparator) { 12 | super(clazz); 13 | this.comparator = comparator; 14 | } 15 | 16 | @Override 17 | public synchronized void add(@NonNull T element) { 18 | T[] newArray = (T[]) Array.newInstance(clazz, this.array.length + 1); 19 | System.arraycopy(this.array, 0, newArray, 0, this.array.length); 20 | newArray[this.array.length] = element; 21 | Arrays.sort(newArray, comparator); 22 | this.array = newArray; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/timer/SyncedTickTimer.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.timer; 2 | 3 | public class SyncedTickTimer implements Timer { 4 | private long time = 0; 5 | 6 | SyncedTickTimer() {} 7 | 8 | public void reset() { 9 | this.time = TickTimerManager.INSTANCE.getTickTime(); 10 | } 11 | 12 | public void skip() { 13 | this.time = 0L; 14 | } 15 | 16 | public boolean tick(final long delay) { 17 | return tick(delay, true); 18 | } 19 | 20 | public boolean tick(final long delay, final boolean resetIfTick) { 21 | if (TickTimerManager.INSTANCE.getTickTime() - this.time > delay) { 22 | if (resetIfTick) this.time = TickTimerManager.INSTANCE.getTickTime(); 23 | return true; 24 | } else { 25 | return false; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/timer/TickTimerManager.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.timer; 2 | 3 | import com.zenith.event.client.ClientTickEvent; 4 | import lombok.Getter; 5 | 6 | import static com.github.rfresh2.EventConsumer.of; 7 | import static com.zenith.Globals.EVENT_BUS; 8 | 9 | public final class TickTimerManager { 10 | public static final TickTimerManager INSTANCE = new TickTimerManager(); 11 | 12 | @Getter 13 | private volatile long tickTime = 0; 14 | 15 | private TickTimerManager() { 16 | EVENT_BUS.subscribe( 17 | this, 18 | of(ClientTickEvent.class, 100_000_000, this::onClientTick) 19 | ); 20 | } 21 | 22 | private void onClientTick(ClientTickEvent event) { 23 | tickTime++; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/timer/Timer.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.timer; 2 | 3 | public interface Timer { 4 | // reset the last timer tick time to the current time 5 | void reset(); 6 | // skip to a state where the next timer tick will always return true 7 | void skip(); 8 | // returns true if the delay has been reached. resets the last tick timer 9 | boolean tick(long delay); 10 | // returns true if the delay has been reached. resets the last tick timer if resetIfTick is true 11 | boolean tick(long delay, boolean resetIfTick); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/util/timer/Timers.java: -------------------------------------------------------------------------------- 1 | package com.zenith.util.timer; 2 | 3 | public final class Timers { 4 | private Timers() {} 5 | 6 | // Synchronized to the zenith client tick event 7 | // Therefore, if the zenith client is not connected, no ticks will occur 8 | public static SyncedTickTimer tickTimer() { 9 | return new SyncedTickTimer(); 10 | } 11 | 12 | public static StandardTimer unsyncedTickTimer() { 13 | return new StandardTimer(50L); 14 | } 15 | 16 | public static StandardTimer timer() { 17 | return new StandardTimer(); 18 | } 19 | 20 | public static StandardTimer timer(long delay) { 21 | return new StandardTimer(delay); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/via/ProtocolVersionDetector.java: -------------------------------------------------------------------------------- 1 | package com.zenith.via; 2 | 3 | import com.zenith.feature.queue.mcping.MCPing; 4 | import lombok.experimental.UtilityClass; 5 | 6 | @UtilityClass 7 | public class ProtocolVersionDetector { 8 | public int getProtocolVersion(final String hostname, final int port) { 9 | try { 10 | return MCPing.INSTANCE.getProtocolVersion(hostname, port, 3000, true); 11 | } catch (final Exception e) { 12 | throw new RuntimeException(e); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/via/ZenithClientChannelInitializer.java: -------------------------------------------------------------------------------- 1 | package com.zenith.via; 2 | 3 | import io.netty.channel.Channel; 4 | import org.geysermc.mcprotocollib.network.tcp.TcpClientChannelInitializer; 5 | import org.geysermc.mcprotocollib.network.tcp.TcpClientSession; 6 | 7 | import static com.zenith.Globals.VIA_INITIALIZER; 8 | 9 | public class ZenithClientChannelInitializer extends TcpClientChannelInitializer { 10 | public static final Factory FACTORY = ZenithClientChannelInitializer::new; 11 | private final TcpClientSession client; 12 | 13 | public ZenithClientChannelInitializer(final TcpClientSession client, final boolean isTransferring) { 14 | super(client, isTransferring); 15 | this.client = client; 16 | } 17 | 18 | @Override 19 | protected void initChannel(final Channel channel) throws Exception { 20 | super.initChannel(channel); 21 | VIA_INITIALIZER.clientViaChannelInitializer(channel); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/via/ZenithServerChannelInitializer.java: -------------------------------------------------------------------------------- 1 | package com.zenith.via; 2 | 3 | import io.netty.channel.Channel; 4 | import org.geysermc.mcprotocollib.network.tcp.TcpServer; 5 | import org.geysermc.mcprotocollib.network.tcp.TcpServerChannelInitializer; 6 | 7 | import static com.zenith.Globals.VIA_INITIALIZER; 8 | 9 | public class ZenithServerChannelInitializer extends TcpServerChannelInitializer { 10 | public static final Factory FACTORY = ZenithServerChannelInitializer::new; 11 | 12 | public ZenithServerChannelInitializer(final TcpServer server) { 13 | super(server); 14 | } 15 | 16 | @Override 17 | protected void initChannel(final Channel channel) throws Exception { 18 | super.initChannel(channel); 19 | VIA_INITIALIZER.serverViaChannelInitializer(channel); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/zenith/via/ZenithViaConfig.java: -------------------------------------------------------------------------------- 1 | package com.zenith.via; 2 | 3 | import com.viaversion.vialoader.impl.viaversion.VLViaConfig; 4 | 5 | import java.io.File; 6 | import java.util.logging.LogManager; 7 | 8 | public class ZenithViaConfig extends VLViaConfig { 9 | public ZenithViaConfig(final File configFile) { 10 | super(configFile, LogManager.getLogManager().getLogger("ViaVersion")); 11 | } 12 | 13 | @Override 14 | public int getMaxPPS() { 15 | return -1; 16 | } 17 | 18 | @Override 19 | public int getTrackingPeriod() { 20 | return -1; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/gradle/incremental.annotation.processors: -------------------------------------------------------------------------------- 1 | com.zenith.plugin.api.PluginAnnotationProcessor,isolating 2 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/native-image/agent-access-filter.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": [ 3 | {"excludeClasses": "discord4j.**"}, 4 | {"excludeClasses": "io.netty.**"} 5 | ], 6 | "regexRules": [] 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/native-image/predefined-classes-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type":"agent-extracted", 4 | "classes":[ 5 | ] 6 | } 7 | ] 8 | 9 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/native-image/proxy-config.json: -------------------------------------------------------------------------------- 1 | [{"interfaces":["java.sql.Connection"]},{"interfaces":["sun.misc.SignalHandler"]}] 2 | -------------------------------------------------------------------------------- /src/main/resources/death_message_mobs.schema: -------------------------------------------------------------------------------- 1 | zombie pigman 2 | zombie pigmen 3 | creeper 4 | wither 5 | zombie 6 | slime 7 | slime cube 8 | magma cube 9 | zombies 10 | skeletons 11 | skeleton 12 | spider 13 | skeletal warrior 14 | wither skeletal warrior 15 | wither skeletons 16 | wither skeleton 17 | endermite 18 | enderman 19 | wolf 20 | witch 21 | zombie villager 22 | ghast 23 | husk 24 | ender dragon 25 | blaze 26 | elder guardian 27 | polar bear 28 | guardian 29 | silverfish 30 | vindicator 31 | vex 32 | shulker 33 | iron golem 34 | strays 35 | stray 36 | llama 37 | wolves 38 | piglin 39 | piglin brute 40 | warden 41 | bee 42 | bees 43 | evoker 44 | frog 45 | phantom 46 | goat 47 | hoglin 48 | pillagers 49 | pillager 50 | ravager 51 | drowned 52 | zombified piglin 53 | dolphin 54 | panda 55 | trader llama 56 | pufferfish 57 | -------------------------------------------------------------------------------- /src/main/resources/mcdata/mapColorIdToColor.json: -------------------------------------------------------------------------------- 1 | {"0":0,"1":8368696,"2":16247203,"3":13092807,"4":16711680,"5":10526975,"6":10987431,"7":31744,"8":16777215,"9":10791096,"10":9923917,"11":7368816,"12":4210943,"13":9402184,"14":16776437,"15":14188339,"16":11685080,"17":6724056,"18":15066419,"19":8375321,"20":15892389,"21":5000268,"22":10066329,"23":5013401,"24":8339378,"25":3361970,"26":6704179,"27":6717235,"28":10040115,"29":1644825,"30":16445005,"31":6085589,"32":4882687,"33":55610,"34":8476209,"35":7340544,"36":13742497,"37":10441252,"38":9787244,"39":7367818,"40":12223780,"41":6780213,"42":10505550,"43":3746083,"44":8874850,"45":5725276,"46":8014168,"47":4996700,"48":4993571,"49":5001770,"50":9321518,"51":2430480,"52":12398641,"53":9715553,"54":6035741,"55":1474182,"56":3837580,"57":5647422,"58":1356933,"59":6579300,"60":14200723,"61":8365974,"62":0,"63":0} -------------------------------------------------------------------------------- /src/main/resources/servericon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rfresh2/ZenithProxy/8beb2522b7468c251bd5f40744c0f0428ce72a34/src/main/resources/servericon.png -------------------------------------------------------------------------------- /src/test/java/com/zenith/PingTest.java: -------------------------------------------------------------------------------- 1 | package com.zenith; 2 | 3 | import com.zenith.via.ProtocolVersionDetector; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | 7 | public class PingTest { 8 | 9 | // @Test 10 | public void constPing() { 11 | // testing ping srv dns resolver 12 | assertEquals(ProtocolVersionDetector.getProtocolVersion("constantiam.net", 25565), 762); 13 | } 14 | 15 | // @Test 16 | public void nineb9tPing() { 17 | // testing ping srv dns resolver 18 | assertEquals(ProtocolVersionDetector.getProtocolVersion("9b9t.com", 25565), 757); 19 | } 20 | 21 | // @Test 22 | public void twob2tPing() { 23 | // testing ping srv dns resolver 24 | assertEquals(ProtocolVersionDetector.getProtocolVersion("2b2t.org", 25565), 765); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/com/zenith/ReplayRecordingReaderTest.java: -------------------------------------------------------------------------------- 1 | package com.zenith; 2 | 3 | import com.zenith.util.ReplayReader; 4 | 5 | import java.io.File; 6 | import java.nio.file.Path; 7 | 8 | public class ReplayRecordingReaderTest { 9 | 10 | // @Test 11 | public void readTestRecording() { 12 | File replayFile = Path.of("run", "replays", "reader-test.mcpr").toFile(); 13 | File outputFile = replayFile.getParentFile().toPath().resolve("replay.log").toFile(); 14 | final ReplayReader replayReader = new ReplayReader(replayFile, outputFile); 15 | replayReader.read(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/java/com/zenith/feature/api/PriobanApiTest.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api; 2 | 3 | import com.zenith.feature.api.prioban.PriobanApi; 4 | import org.junit.jupiter.api.Assertions; 5 | 6 | import java.util.Optional; 7 | 8 | public class PriobanApiTest { 9 | 10 | // @Test 11 | public void notBannedCheck() { 12 | Optional b = PriobanApi.INSTANCE.checkPrioBan("rfresh2"); 13 | Assertions.assertTrue(b.isPresent()); 14 | Assertions.assertFalse(b.get()); 15 | } 16 | 17 | // @Test 18 | public void bannedCheck() { 19 | Optional b = PriobanApi.INSTANCE.checkPrioBan("jared2013"); 20 | Assertions.assertTrue(b.isPresent()); 21 | Assertions.assertTrue(b.get()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/java/com/zenith/feature/api/VcApiTests.java: -------------------------------------------------------------------------------- 1 | package com.zenith.feature.api; 2 | 3 | import com.zenith.feature.api.vcapi.VcApi; 4 | import com.zenith.feature.api.vcapi.model.PlaytimeResponse; 5 | import com.zenith.feature.api.vcapi.model.SeenResponse; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertNotNull; 8 | import static org.junit.jupiter.api.Assertions.assertTrue; 9 | 10 | public class VcApiTests { 11 | 12 | final VcApi api = new VcApi(); 13 | 14 | 15 | // @Test 16 | public void seen() { 17 | SeenResponse seenResponse = api.getSeen("rfresh2").get(); 18 | assertNotNull(seenResponse); 19 | System.out.println(seenResponse); 20 | } 21 | 22 | // @Test 23 | public void playtime() { 24 | PlaytimeResponse playtime = api.getPlaytime("rfresh2").get(); 25 | assertNotNull(playtime); 26 | assertTrue(playtime.playtimeSeconds() > 0); 27 | System.out.println(playtime); 28 | } 29 | } 30 | --------------------------------------------------------------------------------