From 8ee737feddfc2866f20824bcdb20c6cf4a66b3b4 Mon Sep 17 00:00:00 2001 From: Ammo Date: Thu, 24 Jul 2025 19:46:37 +0200 Subject: [PATCH] chore: Remove dead code and add todos at places where things have to be fixed --- build.gradle.kts | 7 - buildSrc/build.gradle.kts | 10 - .../main/kotlin/core-convention.gradle.kts | 5 - .../main/kotlin/dokka-convention.gradle.kts | 31 --- gradle/libs.versions.toml | 7 - .../cloud/api/common/SurfCloudApplication.kt | 1 - .../slne/surf/cloud/api/common/TestPacket.kt | 32 --- .../network/codec/StringIdDispatchCodec.kt | 6 +- .../common/netty/packet/packet-extension.kt | 2 +- .../api/common/player/playtime/Playtime.kt | 6 +- .../cloud/api/common/server/UserListImpl.kt | 6 +- .../cloud/api/common/util/codec/codec-util.kt | 4 +- .../cloud/api/common/util/fast-util-util.kt | 187 -------------- .../util/queue/FastFairPriorityQueue.kt | 2 +- .../common/util/spring/JoinResourceLoader.kt | 4 +- .../ssl/SelfSignedCertificateGenerator.kt | 177 -------------- .../slne/surf/cloud/api/common/util/util.kt | 2 + .../surf-cloud-api-server/build.gradle.kts | 7 +- .../packet/NettyPacketServerExtensions.kt | 1 - .../library/impl/MavenLibraryResolver.kt | 24 +- surf-cloud-bukkit/build.gradle.kts | 2 - .../dev/slne/surf/cloud/bukkit/PaperMain.kt | 9 - .../bukkit/command/network/GListCommand.kt | 2 +- .../cloud/bukkit/listener/ListenerManager.kt | 4 +- .../SurfFatalErrorExceptionListener.kt | 22 -- .../listener/player/ConnectionListener.kt | 5 +- .../listener/player/PlayerAfkListener.kt | 2 +- .../player/SilentDisconnectListener.kt | 3 +- .../punish/mute/AbstractMuteListener.kt | 2 - .../BukkitSpecificPacketListenerExtension.kt | 4 +- .../sync/ClientInformationUpdaterSyncer.kt | 4 +- .../placeholder/CloudPlaceholderExpansion.kt | 2 +- .../player/BukkitClientCloudPlayerImpl.kt | 9 +- .../player/BukkitCloudPlayerManagerImpl.kt | 3 +- .../processor/BukkitListenerProcessor.kt | 8 +- .../client/netty/ClientNettyClientImpl.kt | 8 +- .../network/ClientCommonPacketListenerImpl.kt | 13 +- .../ClientPreRunningPacketListenerImpl.kt | 7 +- .../ClientRunningPacketListenerImpl.kt | 8 +- .../ClientSynchronizingPacketListenerImpl.kt | 15 +- ...PlatformSpecificPacketListenerExtension.kt | 4 +- .../client/player/ClientCloudPlayerImpl.kt | 34 ++- .../CommonClientCloudPlayerManagerImpl.kt | 2 +- .../client/player/OfflineCloudPlayerImpl.kt | 6 +- .../client/player/PunishmentManagerImpl.kt | 16 +- .../client/server/ClientCloudServerImpl.kt | 2 +- .../server/ClientCloudServerManagerImpl.kt | 4 +- .../server/ClientProxyCloudServerImpl.kt | 2 +- .../core/client/sync/SyncRegistryImpl.kt | 7 +- .../cloud/core/common/coroutines/scopes.kt | 5 +- .../core/common/data/PersistentDataImpl.kt | 2 +- .../CloudEventListenerBeanPostProcessor.kt | 6 +- .../common/netty/CommonNettyClientImpl.kt | 9 +- .../common/netty/network/ConnectionImpl.kt | 39 ++- .../common/netty/network/EncryptionManager.kt | 3 - .../network/RespondingPacketSendHandler.kt | 4 +- .../netty/network/TickablePacketListener.kt | 4 +- .../netty/network/Varint21FrameDecoder.kt | 21 +- .../netty/network/protocol/BundlePacket.kt | 5 +- .../netty/network/protocol/BundlerInfo.kt | 2 +- .../network/protocol/ProtocolInfoBuilder.kt | 2 +- .../common/ClientCommonPacketListener.kt | 8 +- .../protocol/common/KeepAliveHandler.kt | 6 +- .../common/ServerCommonPacketListener.kt | 3 + .../{ => bidirectional}/KeepAlivePacket.kt | 2 +- .../ClientboundBundleDelimiterPacket.kt | 2 +- .../ClientboundBundlePacket.kt | 2 +- .../ClientboundPongResponsePacket.kt | 2 +- .../ClientboundSetVelocitySecretPacket.kt | 4 +- .../ServerboundBundleDelimiterPacket.kt | 2 +- .../ServerboundBundlePacket.kt | 2 +- .../ServerboundPingRequestPacket.kt | 2 +- .../protocol/handshake/HandshakeProtocols.kt | 1 + .../ServerHandshakePacketListener.kt | 3 +- .../ServerboundHandshakePacket.kt | 3 +- .../ClientInitializePacketListener.kt | 3 +- .../initialize/InitializeProtocols.kt | 2 + .../ServerInitializePacketListener.kt | 3 +- .../ClientboundInitializeIdResponsePacket.kt | 2 +- .../ServerboundInitializeRequestIdPacket.kt | 2 +- .../ClientPreRunningPacketListener.kt | 2 + .../prerunning/PreRunningProtocols.kt | 13 +- .../ServerPreRunningPacketListener.kt | 3 + .../ClientboundPreRunningFinishedPacket.kt | 2 +- ...ClientboundProceedToSynchronizingPacket.kt | 4 +- ...ServerboundPreRunningAcknowledgedPacket.kt | 2 +- ...roceedToSynchronizingAcknowledgedPacket.kt | 2 +- .../ServerboundRequestContinuation.kt | 4 +- .../running/RunningClientPacketListener.kt | 4 +- .../protocol/running/RunningProtocols.kt | 10 +- .../running/RunningServerPacketListener.kt | 13 + .../ServerboundRequestPlayerDataPacket.kt | 220 ----------------- .../DisconnectPlayerPacket.kt | 2 +- .../LuckpermsMetaDataResponsePacket.kt | 2 +- .../PlayerConnectToServerPacket.kt | 5 +- .../PlayerDisconnectFromServerPacket.kt | 9 +- .../RequestLuckpermsMetaDataPacket.kt | 2 +- .../RequestOfflineDisplayNamePacket.kt | 5 +- .../RequestPlayerPermissionPacket.kt | 2 +- .../ResponseDisplayNamePacketRequestPacket.kt | 9 +- .../SilentDisconnectPlayerPacket.kt | 2 +- .../{ => bidirectional}/SyncSetDeltaPacket.kt | 2 +- .../SyncValueChangePacket.kt | 2 +- .../TeleportPlayerPacket.kt | 2 +- .../TeleportPlayerResultPacket.kt | 7 +- .../TeleportPlayerToPlayerPacket.kt | 2 +- .../UpdateAFKStatePacket.kt | 2 +- .../ClientboundAddPlayerToServerPacket.kt | 2 +- .../ClientboundBatchUpdateServer.kt | 2 +- .../ClientboundClearResourcePacksPacket.kt | 9 +- .../ClientboundClearTitlePacket.kt | 7 +- ...lientboundConnectPlayerToServerResponse.kt | 2 +- .../ClientboundDisconnectPacket.kt | 2 +- .../ClientboundHideBossBarPacket.kt | 15 +- ...ntboundIsServerManagedByThisProxyPacket.kt | 3 +- .../ClientboundOpenBookPacket.kt | 7 +- .../ClientboundPingPacket.kt | 6 +- .../ClientboundPlaySoundPacket.kt | 5 +- ...ndPlayerPersistentDataContainerResponse.kt | 2 +- ...tboundRegisterCloudServersToProxyPacket.kt | 2 +- .../ClientboundRegisterServerPacket.kt | 2 +- ...ClientboundRemovePlayerFromServerPacket.kt | 2 +- .../ClientboundRemoveResourcePacksPacket.kt | 9 +- .../ClientboundRequestDisplayNamePacket.kt | 11 +- .../ClientboundResetTitlePacket.kt | 7 +- .../ClientboundRunPrePlayerJoinTasksPacket.kt | 5 +- .../ClientboundSendActionBarPacket.kt | 7 +- .../ClientboundSendMessagePacket.kt | 2 +- ...oundSendPlayerListHeaderAndFooterPacket.kt | 2 +- .../ClientboundSendResourcePacksPacket.kt | 9 +- .../ClientboundSendTitlePartPacket.kt | 13 +- .../ClientboundShowBossBarPacket.kt | 7 +- .../ClientboundShowTitlePacket.kt | 5 +- .../ClientboundStopSoundPacket.kt | 7 +- .../ClientboundTransferPlayerPacket.kt | 4 +- ...oundTriggerPunishmentCreatedEventPacket.kt | 2 +- ...boundTriggerPunishmentUpdateEventPacket.kt | 4 +- .../ClientboundTriggerShutdownPacket.kt | 4 +- .../ClientboundUnregisterServerPacket.kt | 9 +- ...lientboundUpdateServerInformationPacket.kt | 14 +- .../ServerboundAttachIpAddressToBanPacket.kt | 5 +- .../ServerboundAttachNotePunishment.kt | 8 +- .../ServerboundBroadcastPacket.kt | 2 +- .../ServerboundClearResourcePacksPacket.kt | 9 +- .../ServerboundClearTitlePacket.kt | 7 +- .../ServerboundClientInformationPacket.kt | 2 +- .../ServerboundConnectPlayerToServerPacket.kt | 3 +- ...eateOfflineCloudPlayerIfNotExistsPacket.kt | 10 +- .../ServerboundCreatePunishmentPackets.kt | 2 +- ...ServerboundFetchIpAddressesForBanPacket.kt | 2 +- ...rverboundFetchNotesFromPunishmentPacket.kt | 8 +- .../ServerboundFetchPunishmentPackets.kt | 2 +- .../ServerboundGeneratePunishmentIdPacket.kt | 4 +- ...entLoginValidationPunishmentCachePacket.kt | 2 +- .../ServerboundHideBossBarPacket.kt | 15 +- ...boundIsServerManagedByThisProxyResponse.kt | 7 +- .../ServerboundOpenBookPacket.kt | 7 +- .../ServerboundPlaySoundPacket.kt | 14 +- ...ayerPersistentDataContainerUpdatePacket.kt | 2 +- .../ServerboundPongPacket.kt | 2 +- .../ServerboundPullPlayersToGroupPacket.kt | 2 +- .../ServerboundQueuePlayerToGroupPacket.kt | 3 +- .../ServerboundRemoveResourcePacksPacket.kt | 9 +- .../ServerboundRequestDisplayNamePacket.kt | 11 +- .../ServerboundRequestPlayerDataPacket.kt | 230 ++++++++++++++++++ ...undRequestPlayerPersistentDataContainer.kt | 3 +- .../ServerboundResetTitlePacket.kt | 7 +- .../ServerboundSendActionBarPacket.kt | 7 +- .../ServerboundSendMessagePacket.kt | 2 +- ...oundSendPlayerListHeaderAndFooterPacket.kt | 2 +- .../ServerboundSendResourcePacksPacket.kt | 9 +- .../ServerboundSendTitlePartPacket.kt | 13 +- .../ServerboundShowBossBarPacket.kt | 7 +- .../ServerboundShowTitlePacket.kt | 5 +- .../ServerboundShutdownServerPacket.kt | 2 +- .../ServerboundStopSoundPacket.kt | 7 +- ...ServerboundTransferPlayerPacketResponse.kt | 2 +- .../ClientSynchronizingPacketListener.kt | 11 +- .../ServerSynchronizingPacketListener.kt | 8 +- .../synchronizing/SynchronizingProtocols.kt | 22 +- .../FinishSynchronizingPacket.kt | 7 +- .../StartSynchronizingPacket.kt | 2 +- .../ClientboundBatchSyncSetPacket.kt | 4 +- .../ClientboundBatchSyncValuePacket.kt | 2 +- .../ClientboundSynchronizeFinishPacket.kt | 2 +- ...oundSynchronizeFinishAcknowledgedPacket.kt | 2 +- .../listener/NettyListenerRegistry.kt | 38 +-- .../permission/CommonCloudPermissions.kt | 2 +- .../common/player/CloudPlayerManagerImpl.kt | 129 ---------- .../common/player/name/NameHistoryImpl.kt | 2 +- .../common/player/playtime/PlaytimeImpl.kt | 13 +- .../PersistentPlayerDataContainerViewImpl.kt | 2 +- .../ppdc/PersistentPlayerDataTypeRegistry.kt | 6 +- .../CloudPlayerPunishmentManagerBridgeImpl.kt | 2 +- .../CloudPlayerPunishmentManagerImpl.kt | 9 +- .../punishment/type/PunishmentBanImpl.kt | 6 +- .../punishment/type/PunishmentKickImpl.kt | 2 +- .../punishment/type/PunishmentMuteImpl.kt | 2 +- .../punishment/type/PunishmentWarnImpl.kt | 2 +- ...rePlayerJoinTaskAutoRegistrationHandler.kt | 2 +- .../task/CloudBeforeStartTaskHandler.kt | 4 +- .../common/processors/NettyPacketProcessor.kt | 26 +- .../core/common/server/AbstractCloudServer.kt | 6 +- .../common/server/AbstractProxyCloudServer.kt | 2 +- .../common/server/CommonCloudServerImpl.kt | 4 +- .../server/CommonCloudServerManagerImpl.kt | 8 +- .../cloud/core/common/sound/CommonSounds.kt | 2 +- .../spring/config/CaffeineCacheConfig.kt | 14 +- .../spring/config/SurfCloudCommonConfig.kt | 3 - .../common/sync/CommonSyncRegistryImpl.kt | 2 +- .../cloud/core/common/sync/SyncSetImpl.kt | 4 +- .../core/common/util/encryption/Crypt.kt | 10 - .../launcher/StandaloneUrlClassLoader.java | 78 ------ surf-cloud-standalone/build.gradle.kts | 1 - ...AdditionalSpringStandaloneConfiguration.kt | 1 - .../cloud/standalone/commands/DebugCommand.kt | 26 -- .../standalone/commands/LifecycleCommand.kt | 17 -- .../standalone/commands/__CommandScan.kt | 12 - .../commands/execution/tasks/BuildContexts.kt | 4 +- .../standalone/commands/impl/TestCommand.kt | 20 +- .../console/BrigadierCompletionMatcher.kt | 4 +- .../console/BrigadierConsoleParser.kt | 2 +- .../netty/server/NettyServerImpl.kt | 2 +- .../netty/server/ProxySecretHolder.kt | 2 +- .../connection/ServerConnectionListener.kt | 4 +- .../network/ServerCommonPacketListenerImpl.kt | 11 +- .../server/network/ServerEncryptionManager.kt | 19 -- .../ServerHandshakePacketListenerImpl.kt | 9 +- .../ServerInitializePacketListenerImpl.kt | 4 +- .../network/ServerLoginPacketListenerImpl.kt | 4 - .../ServerPreRunningPacketListenerImpl.kt | 7 +- .../ServerRunningPacketListenerImpl.kt | 9 +- .../ServerSynchronizingPacketListenerImpl.kt | 14 +- .../network/config/FinishSynchronizeTask.kt | 2 +- .../config/SynchronizeRegistriesTask.kt | 4 +- .../player/CloudPlayerPlaytimeManager.kt | 2 +- .../player/OfflineCloudPlayerImpl.kt | 2 +- .../player/StandaloneCloudPlayerImpl.kt | 10 +- .../StandaloneCloudPlayerManagerImpl.kt | 7 +- .../player/db/exposed/CloudPlayerService.kt | 2 +- .../player/name/name-history-extension.kt | 2 +- .../punishment/PunishmentManagerImpl.kt | 6 +- .../coroutine/impl/CoroutineManagerImpl.kt | 4 +- .../entrypoint/LaunchEntryPointHandler.kt | 13 +- .../ByteCodeModifyingURLClassloader.kt | 4 +- .../group/LockingClassLoaderGroup.kt | 2 +- .../dependency/PluginMetaDependencyTree.kt | 2 +- .../entrypoint/strategy/LoadOrderTree.kt | 2 +- .../strategy/PluginLoadingStrategy.kt | 4 +- .../strategy/TopographicGraphSorter.kt | 6 +- .../loader/StandaloneClasspathBuilder.kt | 2 +- .../loader/library/StandaloneLibraryStore.kt | 4 +- .../StandalonePluginInstanceManager.kt | 4 +- .../serializer/EnumValueSerializer.kt | 10 +- .../plugin/spring/config/DatabaseConfig.kt | 11 +- .../PluginLoadTimeWeavingConfiguration.kt | 1 - .../server/CommonStandaloneServerImpl.kt | 37 +-- .../server/StandaloneCloudServerImpl.kt | 6 +- .../StandaloneCloudServerManagerImpl.kt | 12 +- .../server/StandaloneProxyCloudServerImpl.kt | 2 +- .../standalone/server/queue/GroupQueueImpl.kt | 2 +- .../server/queue/QueueManagerImpl.kt | 2 - .../server/queue/ServerQueueImpl.kt | 2 +- .../server/queue/SingleServerQueue.kt | 101 -------- .../cloud/standalone/sync/SyncRegistryImpl.kt | 4 +- .../temp/NettyServerProxiedPacketHandler.kt | 19 -- .../temp/SurfNettyServerPacketHandler.kt | 119 --------- .../cloud/standalone/test/TestEntityTest.kt | 26 -- .../standalone/test/TestPacketListener.kt | 18 -- .../surf/cloud/standalone/test/TestPdc.kt | 50 ---- .../build.gradle.kts | 1 - .../standalone/test/TestStandaloneLoader.kt | 1 - surf-cloud-velocity/build.gradle.kts | 2 - .../slne/surf/cloud/velocity/VelocityMain.kt | 8 - .../velocity/listener/ListenerManager.kt | 4 +- .../listener/player/ConnectionListener.kt | 4 +- ...VelocitySpecificPacketListenerExtension.kt | 9 +- .../player/VelocityClientCloudPlayerImpl.kt | 7 +- .../player/VelocityCloudPlayerManagerImpl.kt | 2 +- .../processor/VelocityListenerProcessor.kt | 3 +- 280 files changed, 1003 insertions(+), 1999 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/dokka-convention.gradle.kts delete mode 100644 surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/TestPacket.kt delete mode 100644 surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/fast-util-util.kt delete mode 100644 surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/ssl/SelfSignedCertificateGenerator.kt delete mode 100644 surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/exception/SurfFatalErrorExceptionListener.kt rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => bidirectional}/KeepAlivePacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => clientbound}/ClientboundBundleDelimiterPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => clientbound}/ClientboundBundlePacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => clientbound}/ClientboundPongResponsePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => clientbound}/ClientboundSetVelocitySecretPacket.kt (83%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => serverbound}/ServerboundBundleDelimiterPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => serverbound}/ServerboundBundlePacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/{ => serverbound}/ServerboundPingRequestPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/{ => serverbound}/ServerboundHandshakePacket.kt (94%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/{ => clientbound}/ClientboundInitializeIdResponsePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/{ => serverbound}/ServerboundInitializeRequestIdPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/{ => clientbound}/ClientboundPreRunningFinishedPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/{ => clientbound}/ClientboundProceedToSynchronizingPacket.kt (88%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/{ => serverbound}/ServerboundPreRunningAcknowledgedPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/{ => serverbound}/ServerboundProceedToSynchronizingAcknowledgedPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/{ => serverbound}/ServerboundRequestContinuation.kt (89%) delete mode 100644 surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerDataPacket.kt rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/DisconnectPlayerPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/LuckpermsMetaDataResponsePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/PlayerConnectToServerPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/PlayerDisconnectFromServerPacket.kt (83%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/RequestLuckpermsMetaDataPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/RequestOfflineDisplayNamePacket.kt (86%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/RequestPlayerPermissionPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/ResponseDisplayNamePacketRequestPacket.kt (81%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/SilentDisconnectPlayerPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/SyncSetDeltaPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/SyncValueChangePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/TeleportPlayerPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/TeleportPlayerResultPacket.kt (82%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/TeleportPlayerToPlayerPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => bidirectional}/UpdateAFKStatePacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundAddPlayerToServerPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundBatchUpdateServer.kt (99%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundClearResourcePacksPacket.kt (78%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundClearTitlePacket.kt (81%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundConnectPlayerToServerResponse.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundDisconnectPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundHideBossBarPacket.kt (73%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundIsServerManagedByThisProxyPacket.kt (89%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundOpenBookPacket.kt (85%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundPingPacket.kt (92%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundPlaySoundPacket.kt (95%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundPlayerPersistentDataContainerResponse.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundRegisterCloudServersToProxyPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundRegisterServerPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundRemovePlayerFromServerPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundRemoveResourcePacksPacket.kt (82%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundRequestDisplayNamePacket.kt (67%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundResetTitlePacket.kt (81%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundRunPrePlayerJoinTasksPacket.kt (93%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundSendActionBarPacket.kt (84%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundSendMessagePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundSendPlayerListHeaderAndFooterPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundSendResourcePacksPacket.kt (84%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundSendTitlePartPacket.kt (86%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundShowBossBarPacket.kt (85%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundShowTitlePacket.kt (89%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundStopSoundPacket.kt (86%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundTransferPlayerPacket.kt (90%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundTriggerPunishmentCreatedEventPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundTriggerPunishmentUpdateEventPacket.kt (95%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundTriggerShutdownPacket.kt (87%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundUnregisterServerPacket.kt (78%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => clientbound}/ClientboundUpdateServerInformationPacket.kt (65%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundAttachIpAddressToBanPacket.kt (87%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundAttachNotePunishment.kt (82%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundBroadcastPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundClearResourcePacksPacket.kt (78%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundClearTitlePacket.kt (81%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundClientInformationPacket.kt (99%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundConnectPlayerToServerPacket.kt (84%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt (71%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundCreatePunishmentPackets.kt (99%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundFetchIpAddressesForBanPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundFetchNotesFromPunishmentPacket.kt (82%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundFetchPunishmentPackets.kt (99%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundGeneratePunishmentIdPacket.kt (83%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundHideBossBarPacket.kt (73%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundIsServerManagedByThisProxyResponse.kt (88%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundOpenBookPacket.kt (85%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundPlaySoundPacket.kt (89%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundPlayerPersistentDataContainerUpdatePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundPongPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundPullPlayersToGroupPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundQueuePlayerToGroupPacket.kt (83%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundRemoveResourcePacksPacket.kt (82%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundRequestDisplayNamePacket.kt (67%) create mode 100644 surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerDataPacket.kt rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundRequestPlayerPersistentDataContainer.kt (88%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundResetTitlePacket.kt (81%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundSendActionBarPacket.kt (84%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundSendMessagePacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundSendPlayerListHeaderAndFooterPacket.kt (98%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundSendResourcePacksPacket.kt (84%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundSendTitlePartPacket.kt (86%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundShowBossBarPacket.kt (85%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundShowTitlePacket.kt (89%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundShutdownServerPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundStopSoundPacket.kt (86%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/{ => serverbound}/ServerboundTransferPlayerPacketResponse.kt (99%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/{ => bidirectional}/FinishSynchronizingPacket.kt (77%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/{ => bidirectional}/StartSynchronizingPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/{ => clientbound}/ClientboundBatchSyncSetPacket.kt (97%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/{ => clientbound}/ClientboundBatchSyncValuePacket.kt (99%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/{ => clientbound}/ClientboundSynchronizeFinishPacket.kt (96%) rename surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/{ => serverbound}/ServerboundSynchronizeFinishAcknowledgedPacket.kt (96%) delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/DebugCommand.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/LifecycleCommand.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/__CommandScan.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/SingleServerQueue.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/NettyServerProxiedPacketHandler.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/SurfNettyServerPacketHandler.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestEntityTest.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPacketListener.kt delete mode 100644 surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPdc.kt diff --git a/build.gradle.kts b/build.gradle.kts index 122d94f8..9cb5a607 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,6 @@ buildscript { plugins { id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.17.0" -// id("io.freefair.aspectj.post-compile-weaving") version "8.13.1" java } @@ -30,17 +29,11 @@ allprojects { } apply(plugin = "java") -// apply(plugin = "io.freefair.aspectj.post-compile-weaving") dependencies { -// implementation(platform("org.springframework.boot:spring-boot-dependencies:3.4.4")) -// implementation(platform("io.ktor:ktor-bom:3.0.3")) -// implementation(platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:2025.4.10")) - implementation(platform(project(":surf-cloud-bom"))) compileOnly("org.springframework.boot:spring-boot-configuration-processor:3.5.3") - // "kapt"("org.springframework.boot:spring-boot-configuration-processor:3.4.3") testImplementation(kotlin("test")) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 61240d4b..a145c349 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -8,15 +8,5 @@ repositories { } dependencies { -// val kotlinVersion = "2.1.0" -// val dokkaVersion = "2.0.0-Beta" - implementation("org.springframework.boot:org.springframework.boot.gradle.plugin:3.5.3") -// implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") -// implementation("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion") -// implementation("org.jetbrains.kotlin:kotlin-lombok:$kotlinVersion") -// implementation("org.jetbrains.kotlin:kotlin-noarg:$kotlinVersion") -// implementation("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion") -// implementation("org.hibernate.build:gradle-maven-publish-auth:3.0.4") -// compileOnly("com.gradleup.shadow:shadow-gradle-plugin:8.3.5") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/core-convention.gradle.kts b/buildSrc/src/main/kotlin/core-convention.gradle.kts index 0991ba67..d83577a4 100644 --- a/buildSrc/src/main/kotlin/core-convention.gradle.kts +++ b/buildSrc/src/main/kotlin/core-convention.gradle.kts @@ -1,12 +1,9 @@ @file:Suppress("UnstableApiUsage") - plugins { java } - - repositories { mavenCentral() } @@ -16,7 +13,5 @@ dependencies { implementation(platform("io.ktor:ktor-bom:3.2.1")) implementation(platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:2025.7.8")) - compileOnly("org.springframework.boot:spring-boot-configuration-processor:3.5.3") -// "kapt"("org.springframework.boot:spring-boot-configuration-processor:3.4.3") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts deleted file mode 100644 index 31d9e537..00000000 --- a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Common conventions for generating documentation with Dokka. - */ - -//plugins { -// id("org.jetbrains.dokka") -//} - -//dokka { -// dokkaSourceSets.configureEach { -// sourceLink { -// // Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration -//// remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example") -// localDirectory.set(rootDir) -// } -// } -//} - -//dokka { -// -// pluginsConfiguration.html { -// footerMessage = "Copyright © SLNE Development 2024-${Year.now().value}" -// -// customStyleSheets.from(file("logo-styles.css")) -// customAssets.from(file("surf-cloud-logo.png")) -// } -// -// dokkaPublications.html { -// outputDirectory.set(layout.buildDirectory.dir("dokkaDir")) -// } -//} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 99fc10a7..e08906f9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,6 @@ aide-reflection = "1.3" netty = "4.2.2.Final" netty-tcnative = "2.0.72.Final" datafixerupper = "8.0.16" -#byte-buddy = "1.15.10" exposed = "0.61.0" maven-impl = "4.0.0-rc-2" maven-resolver = "2.0.5" @@ -12,16 +11,11 @@ jline = "3.30.4" brigadier = "1.3.10" terminalconsoleappender = "1.3.0" bson-kotlinx = "5.4.0" -aspectjweaver = "1.9.22.1" zstd-jni = "1.5.7-4" luckperms-api = "5.4" reactive-streams = "1.0.4" -ehcache = "3.10.8" kotlin-byte-buf-serializer = "1.0.0" voicechat-api = "2.5.27" -discord-webhooks = "1.0" -konf = "1.1.2" - [libraries] velocity-native = { module = "com.velocitypowered:velocity-native", version.ref = "velocity-version" } @@ -71,7 +65,6 @@ flyway-mysql = { module = "org.flywaydb:flyway-mysql" } spring-instrument = { module = "org.springframework:spring-instrument" } kotlin-byte-buf-serializer = { module = "dev.slne.surf:kotlin-byte-buf-serializer", version.ref = "kotlin-byte-buf-serializer" } voicechat-api = { module = "de.maxhenkel.voicechat:voicechat-api", version.ref = "voicechat-api" } -discord-webhooks = { module = "com.github.BinaryWriter:discord-webhooks", version.ref = "discord-webhooks" } [plugins] spring-boot = { id = "org.springframework.boot" } diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/SurfCloudApplication.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/SurfCloudApplication.kt index 35d75791..45038fb3 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/SurfCloudApplication.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/SurfCloudApplication.kt @@ -24,7 +24,6 @@ import java.lang.annotation.Inherited @Retention(AnnotationRetention.RUNTIME) @EnableScheduling @EnableAsync(mode = AdviceMode.ASPECTJ) -//@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) @EntityScan @EnableCaching(mode = AdviceMode.ASPECTJ) @AutoConfigurationPackage diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/TestPacket.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/TestPacket.kt deleted file mode 100644 index 57291899..00000000 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/TestPacket.kt +++ /dev/null @@ -1,32 +0,0 @@ -package dev.slne.surf.cloud.api.common - -import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket -import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow -import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -import kotlinx.serialization.Serializable - -@Serializable -@SurfNettyPacket("cloud:serverbound:test", PacketFlow.SERVERBOUND) -data class TestPacket( - val data: String, - val number: Int, - val boolean: Boolean, - val list: List, - val map: Map, - val nullable: String?, - val nullableList: List?, - val nullableMap: Map?, -) : NettyPacket() { - companion object { - fun random() = TestPacket( - data = "test", - number = 42, - boolean = true, - list = listOf("one", "two", "three"), - map = mapOf("key1" to "value1", "key2" to "value2"), - nullable = null, - nullableList = null, - nullableMap = null - ) - } -} \ No newline at end of file diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/network/codec/StringIdDispatchCodec.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/network/codec/StringIdDispatchCodec.kt index 31562398..ef1dbbd3 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/network/codec/StringIdDispatchCodec.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/network/codec/StringIdDispatchCodec.kt @@ -4,9 +4,9 @@ package dev.slne.surf.cloud.api.common.netty.network.codec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.readUtf import dev.slne.surf.cloud.api.common.netty.protocol.buffer.writeUtf -import dev.slne.surf.cloud.api.common.util.freeze -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.freeze +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import io.netty.buffer.ByteBuf import io.netty.handler.codec.DecoderException import io.netty.handler.codec.EncoderException diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/packet/packet-extension.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/packet/packet-extension.kt index c0a74980..4148ee6f 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/packet/packet-extension.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/netty/packet/packet-extension.kt @@ -6,7 +6,7 @@ import dev.slne.surf.cloud.api.common.netty.network.codec.StreamCodec import dev.slne.surf.cloud.api.common.netty.network.codec.StreamDecoder import dev.slne.surf.cloud.api.common.netty.network.codec.StreamMemberEncoder import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import io.netty.buffer.ByteBuf import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.serializer diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/player/playtime/Playtime.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/player/playtime/Playtime.kt index c0596c0c..a0f7c1dd 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/player/playtime/Playtime.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/player/playtime/Playtime.kt @@ -176,7 +176,11 @@ interface Playtime { * @param since Optional start time to filter playtime. * @return An [ObjectList] of pairs, each containing a category name and its corresponding playtime duration. */ - fun topCategories(limit: Int = 5, since: ZonedDateTime? = null): ObjectList> + fun topCategories( + limit: Int = 5, + since: ZonedDateTime? = null + ): ObjectList> fun writeToByteBuf(buf: ByteBuf) + fun mutableObjectSetOf(): ObjectSet } \ No newline at end of file diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/server/UserListImpl.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/server/UserListImpl.kt index 3dd5bf13..d95361c0 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/server/UserListImpl.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/server/UserListImpl.kt @@ -5,9 +5,9 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.api.common.player.CloudPlayer import dev.slne.surf.cloud.api.common.player.CloudPlayerManager import dev.slne.surf.cloud.api.common.util.annotation.InternalApi -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf -import dev.slne.surf.cloud.api.common.util.synchronize -import dev.slne.surf.cloud.api.common.util.toObjectSet +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf +import dev.slne.surf.surfapi.core.api.util.synchronize +import dev.slne.surf.surfapi.core.api.util.toObjectSet import it.unimi.dsi.fastutil.objects.ObjectSet import java.util.* diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/codec/codec-util.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/codec/codec-util.kt index 8c474cb1..1925b253 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/codec/codec-util.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/codec/codec-util.kt @@ -9,9 +9,9 @@ import com.mojang.serialization.codecs.RecordCodecBuilder import dev.slne.surf.cloud.api.common.netty.network.codec.streamCodec import dev.slne.surf.cloud.api.common.netty.network.codec.streamCodecUnitSimple import dev.slne.surf.cloud.api.common.netty.protocol.buffer.* -import dev.slne.surf.cloud.api.common.util.objectListOf import dev.slne.surf.cloud.api.common.util.toIntArray import dev.slne.surf.cloud.api.common.util.toUuid +import dev.slne.surf.surfapi.core.api.util.objectListOf import io.netty.buffer.ByteBuf import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet import net.kyori.adventure.bossbar.BossBar @@ -382,7 +382,7 @@ object ExtraCodecs { // endregion // region nbt val COMPOUND_TAG_CODEC = streamCodec({ buf, tag -> - ByteArrayOutputStream().use {out -> + ByteArrayOutputStream().use { out -> BinaryTagIO.writer().write(tag, out, BinaryTagIO.Compression.GZIP) buf.writeByteArray(out.toByteArray()) } diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/fast-util-util.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/fast-util-util.kt deleted file mode 100644 index 8d58aa5e..00000000 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/fast-util-util.kt +++ /dev/null @@ -1,187 +0,0 @@ -package dev.slne.surf.cloud.api.common.util - -import it.unimi.dsi.fastutil.ints.Int2ObjectMap -import it.unimi.dsi.fastutil.ints.Int2ObjectMaps -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap -import it.unimi.dsi.fastutil.ints.IntOpenHashSet -import it.unimi.dsi.fastutil.ints.IntSet -import it.unimi.dsi.fastutil.ints.IntSets -import it.unimi.dsi.fastutil.longs.* -import it.unimi.dsi.fastutil.objects.* -import org.jetbrains.annotations.Unmodifiable -import org.jetbrains.annotations.UnmodifiableView - -// region ObjectSet -fun mutableObjectSetOf(vararg elements: T) = ObjectOpenHashSet(elements) -fun mutableObjectSetOf() = ObjectOpenHashSet() -fun mutableObjectSetOf(capacity: Int) = ObjectOpenHashSet(capacity) -fun mutableObjectSetOf(iterable: Iterable) = when (iterable) { - is Collection -> ObjectOpenHashSet(iterable) - else -> ObjectOpenHashSet(iterable.iterator()) -} - -fun objectSetOf(vararg elements: T): ObjectSet = when (elements.size) { - 0 -> emptyObjectSet() - 1 -> ObjectSets.singleton(elements[0]) - else -> mutableObjectSetOf(*elements).freeze() -} - -fun objectSetOf(collection: Iterable) = mutableObjectSetOf(collection).freeze() -fun objectSetOf() = emptyObjectSet() -fun emptyObjectSet(): @Unmodifiable ObjectSet = ObjectSets.emptySet() -fun ObjectSet.synchronize(): ObjectSet = ObjectSets.synchronize(this) -fun ObjectSet.freeze(): @UnmodifiableView ObjectSet = - this as? ObjectSets.UnmodifiableSet ?: ObjectSets.unmodifiable(this) - -fun Sequence.toMutableObjectSet() = ObjectOpenHashSet(iterator()) -fun Sequence.toObjectSet() = toMutableObjectSet().freeze() -fun Array.toObjectSet() = objectSetOf(*this) -fun Iterable.toObjectSet() = (this as? ObjectSet)?.freeze() ?: objectSetOf(this) - -// endregion -// region ObjectList -fun mutableObjectListOf(vararg elements: T) = ObjectArrayList().apply { addAll(elements) } -fun mutableObjectListOf() = ObjectArrayList() -fun mutableObjectListOf(capacity: Int) = ObjectArrayList(capacity) -fun objectListOf(vararg elements: T) = mutableObjectListOf(*elements).freeze() -fun objectListOf() = emptyObjectList() -fun emptyObjectList(): @Unmodifiable ObjectList = ObjectLists.emptyList() -fun ObjectArrayList.synchronize(): ObjectList = ObjectLists.synchronize(this) -fun ObjectArrayList.freeze(): @UnmodifiableView ObjectList = - ObjectLists.unmodifiable(this) - -fun Sequence.toMutableObjectList() = ObjectArrayList().apply { addAll(toList()) } -fun Sequence.toObjectList() = toMutableObjectList().freeze() -fun Collection.toObjectList() = this as? ObjectList ?: ObjectArrayList(this).freeze() -fun Iterable.toObjectList() = - this as? ObjectList ?: ObjectArrayList(iterator()).freeze() -// endregion - -// region ObjectMap -// region Object2ObjectMap -fun mutableObject2ObjectMapOf(vararg pairs: Pair) = - Object2ObjectOpenHashMap(pairs.size).apply { putAll(pairs) } - -fun mutableObject2ObjectMapOf() = Object2ObjectOpenHashMap() -fun mutableObject2ObjectMapOf(capacity: Int) = Object2ObjectOpenHashMap(capacity) -fun object2ObjectMapOf(vararg pairs: Pair) = mutableObject2ObjectMapOf(*pairs).freeze() -fun object2ObjectMapOf() = emptyObject2ObjectMap() -fun emptyObject2ObjectMap(): @Unmodifiable Object2ObjectMap = - Object2ObjectMaps.emptyMap() - -fun Object2ObjectOpenHashMap.synchronize(): Object2ObjectMap = - Object2ObjectMaps.synchronize(this) - -fun Object2ObjectMap.freeze(): @UnmodifiableView Object2ObjectMap = - Object2ObjectMaps.unmodifiable(this) - -fun mutableObject2MultiObjectsMapOf(vararg pairs: Pair>) = - Object2ObjectOpenHashMap>(pairs.size).apply { putAll(pairs) } - -fun mutableObject2MultiObjectsMapOf() = Object2ObjectOpenHashMap>() -fun object2MultiObjectsMapOf(vararg pairs: Pair>) = - mutableObject2MultiObjectsMapOf(*pairs).freeze() - -fun object2MultiObjectsMapOf() = emptyObject2MultiObjectsMap() -fun emptyObject2MultiObjectsMap(): @Unmodifiable Object2MultiObjectsMap = - Object2ObjectMaps.emptyMap() -typealias Object2MultiObjectsMap = Object2ObjectMap> - -fun Object2MultiObjectsMap.add(key: K, value: V) { - val set = get(key) ?: mutableObjectSetOf().also { put(key, it) } - set.add(value) -} - -// endregion -// endregion -// region LongMap -// region Long2LongMap -fun mutableLong2LongMapOf(vararg pairs: Pair) = - Long2LongOpenHashMap(pairs.size).apply { putAll(pairs) } - -fun mutableLong2LongMapOf() = Long2LongOpenHashMap() -fun long2LongMapOf(vararg pairs: Pair) = mutableLong2LongMapOf(*pairs).freeze() -fun long2LongMapOf() = emptyLong2LongMap() -fun emptyLong2LongMap(): @Unmodifiable Long2LongMap = Long2LongMaps.EMPTY_MAP -fun Long2LongOpenHashMap.synchronize(): Long2LongMap = Long2LongMaps.synchronize(this) -fun Long2LongOpenHashMap.freeze(): @UnmodifiableView Long2LongMap = Long2LongMaps.unmodifiable(this) - -// endregion -// region Long2ObjectMap -fun mutableLong2ObjectMapOf(vararg pairs: Pair) = - Long2ObjectOpenHashMap(pairs.size).apply { putAll(pairs) } - -fun mutableLong2ObjectMapOf() = Long2ObjectOpenHashMap() -fun long2ObjectMapOf(vararg pairs: Pair) = mutableLong2ObjectMapOf(*pairs).freeze() -fun long2ObjectMapOf() = emptyLong2ObjectMap() -fun emptyLong2ObjectMap(): @Unmodifiable Long2ObjectMap = Long2ObjectMaps.emptyMap() -fun Long2ObjectOpenHashMap.synchronize(): Long2ObjectMap = - Long2ObjectMaps.synchronize(this) - -fun Long2ObjectOpenHashMap.freeze(): @UnmodifiableView Long2ObjectMap = - Long2ObjectMaps.unmodifiable(this) - -// endregion -// region LongSet -fun mutableLongSetOf(vararg elements: Long) = LongOpenHashSet(elements) -fun mutableLongSetOf() = LongOpenHashSet() -fun longSetOf(vararg elements: Long) = mutableLongSetOf(*elements).freeze() -fun longSetOf() = emptyLongSet() -fun emptyLongSet(): @Unmodifiable LongSet = LongSets.EMPTY_SET -fun LongSet.synchronize(): LongSet = LongSets.synchronize(this) -fun LongSet.freeze(): @UnmodifiableView LongSet = LongSets.unmodifiable(this) -fun Sequence.toMutableLongSet() = LongOpenHashSet(toList()) -fun Sequence.toLongSet() = toMutableLongSet().freeze() -// endregion - -// region IntSet -fun mutableIntSetOf(vararg elements: Int) = IntOpenHashSet(elements) -fun mutableIntSetOf() = IntOpenHashSet() -fun intSetOf(vararg elements: Int) = mutableIntSetOf(*elements).freeze() -fun intSetOf() = emptyIntSet() -fun emptyIntSet(): @Unmodifiable IntSet = IntSets.EMPTY_SET -fun IntSet.synchronize(): IntSet = IntSets.synchronize(this) -fun IntSet.freeze(): @UnmodifiableView IntSet = IntSets.unmodifiable(this) -fun Sequence.toMutableIntSet() = IntOpenHashSet(toList()) -fun Sequence.toIntSet() = toMutableIntSet().freeze() -// endregion -// region IntMap -// region Int2ObjectMap -fun mutableInt2ObjectMapOf(vararg pairs: Pair) = - Int2ObjectOpenHashMap(pairs.size).apply { putAll(pairs) } - -fun mutableInt2ObjectMapOf() = Int2ObjectOpenHashMap() -fun int2ObjectMapOf(vararg pairs: Pair) = mutableInt2ObjectMapOf(*pairs).freeze() -fun int2ObjectMapOf() = emptyInt2ObjectMap() -fun emptyInt2ObjectMap(): @Unmodifiable Int2ObjectMap = Int2ObjectMaps.emptyMap() -fun Int2ObjectOpenHashMap.synchronize(): Int2ObjectMap = Int2ObjectMaps.synchronize(this) -fun Int2ObjectOpenHashMap.freeze(): @UnmodifiableView Int2ObjectMap = - Int2ObjectMaps.unmodifiable(this) - -// endregion -// region Object2IntMap -fun mutableObject2IntMapOf(vararg pairs: Pair) = - Object2IntOpenHashMap(pairs.size).apply { putAll(pairs) } - -fun mutableObject2IntMapOf() = Object2IntOpenHashMap() -fun object2IntMapOf(vararg pairs: Pair) = mutableObject2IntMapOf(*pairs).freeze() -fun object2IntMapOf() = emptyObject2IntMap() -fun emptyObject2IntMap(): @Unmodifiable Object2IntMap = Object2IntMaps.emptyMap() -fun Object2IntOpenHashMap.synchronize(): Object2IntMap = Object2IntMaps.synchronize(this) -fun Object2IntOpenHashMap.freeze(): @UnmodifiableView Object2IntMap = - Object2IntMaps.unmodifiable(this) -// endregion -// region Object2BooleanMap -fun mutableObject2BooleanMapOf(vararg pairs: Pair) = - Object2BooleanOpenHashMap(pairs.size).apply { putAll(pairs) } - -fun mutableObject2BooleanMapOf() = Object2BooleanOpenHashMap() -fun object2BooleanMapOf(vararg pairs: Pair) = mutableObject2BooleanMapOf(*pairs).freeze() -fun object2BooleanMapOf() = emptyObject2BooleanMap() -fun emptyObject2BooleanMap(): @Unmodifiable Object2BooleanMap = Object2BooleanMaps.emptyMap() -fun Object2BooleanOpenHashMap.synchronize(): Object2BooleanMap = - Object2BooleanMaps.synchronize(this) - -fun Object2BooleanOpenHashMap.freeze(): @UnmodifiableView Object2BooleanMap = - Object2BooleanMaps.unmodifiable(this) -// endregion \ No newline at end of file diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/queue/FastFairPriorityQueue.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/queue/FastFairPriorityQueue.kt index 00b74aa5..574201de 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/queue/FastFairPriorityQueue.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/queue/FastFairPriorityQueue.kt @@ -1,6 +1,6 @@ package dev.slne.surf.cloud.api.common.util.queue -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import it.unimi.dsi.fastutil.objects.* import java.io.Serial import java.util.* diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/spring/JoinResourceLoader.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/spring/JoinResourceLoader.kt index acaa9fc8..ea4ec214 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/spring/JoinResourceLoader.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/spring/JoinResourceLoader.kt @@ -1,13 +1,13 @@ package dev.slne.surf.cloud.api.common.util.spring -import dev.slne.surf.cloud.api.common.util.emptyObjectList +import dev.slne.surf.surfapi.core.api.util.emptyObjectList import org.springframework.core.io.Resource import org.springframework.core.io.ResourceLoader open class JoinResourceLoader( private val mainLoader: ResourceLoader, private val joinLoader: List = emptyObjectList() -): ResourceLoader { +) : ResourceLoader { override fun getResource(location: String): Resource { val resource = mainLoader.getResource(location) if (resource.exists()) return resource diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/ssl/SelfSignedCertificateGenerator.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/ssl/SelfSignedCertificateGenerator.kt deleted file mode 100644 index 48461805..00000000 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/ssl/SelfSignedCertificateGenerator.kt +++ /dev/null @@ -1,177 +0,0 @@ -//package dev.slne.surf.cloud.api.common.util.ssl -// -//import io.netty.buffer.Unpooled -//import io.netty.handler.codec.base64.Base64 -//import io.netty.util.CharsetUtil -//import io.netty.util.internal.PlatformDependent -//import org.bouncycastle.asn1.x500.X500Name -//import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter -//import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder -//import org.bouncycastle.jce.provider.BouncyCastleProvider -//import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder -//import java.io.File -//import java.io.FileOutputStream -//import java.math.BigInteger -//import java.security.KeyPair -//import java.security.KeyPairGenerator -//import java.security.PrivateKey -//import java.security.SecureRandom -//import java.security.cert.CertificateFactory -//import java.security.cert.X509Certificate -//import java.util.* -// -///** -// * Copied from [io.netty.handler.ssl.util.SelfSignedCertificate] because classloader issues -// * -// * @see io.netty.handler.ssl.util.SelfSignedCertificate -// * @author Netty -// */ -//class SelfSignedCertificateGenerator( -// fqdn: String, -// random: SecureRandom = dev.slne.surf.surfapi.core.api.util.random, -// bits: Int = 2048, -// notBefore: Date = Date(), -// notAfter: Date = Date(notBefore.time + 365L * 24 * 60 * 60 * 1000), -// algorithm: String = "RSA" -//) { -// val certificate: File -// val privateKey: File -// val key: PrivateKey -// val cert: X509Certificate -// -// -// init { -// require(algorithm == "RSA" || algorithm == "EC") { "algorithm: $algorithm (expected: RSA or EC)" } -// -// val keyGen = KeyPairGenerator.getInstance(algorithm) -// keyGen.initialize(bits, random) -// val keypair = keyGen.generateKeyPair() -// -// val paths = BouncyCastleSelfSignedCertGenerator.generate( -// fqdn, -// keypair, -// random, -// notBefore, -// notAfter, -// algorithm -// ) -// -// certificate = File(paths.first) -// privateKey = File(paths.second) -// key = keypair.private -// -// val certificateInput = certificate.inputStream() -// try { -// cert = CertificateFactory.getInstance("X509").generateCertificate(certificateInput) as X509Certificate -// } finally { -// certificateInput.close() -// } -// } -// -// fun delete() { -// certificate.delete() -// privateKey.delete() -// } -//} -// -//internal fun newSelfSignedCertificate( -// fqdn: String, -// key: PrivateKey, -// cert: X509Certificate -//): Pair { -// var fqdn = fqdn -// -// // Encode the private key into a file. -// var wrappedBuf = Unpooled.wrappedBuffer(key.encoded) -// var encodedBuf = Base64.encode(wrappedBuf, true) -// val keyText = buildString { -// append("-----BEGIN PRIVATE KEY-----\n") -// append(encodedBuf.toString(CharsetUtil.US_ASCII)) -// append("\n-----END PRIVATE KEY-----\n") -// } -// -// encodedBuf.release() -// wrappedBuf.release() -// -// // Change all asterisk to 'x' for file name safety. -// fqdn = fqdn.replace(Regex("[^\\w.-]"), "x") -// -// val keyFile = PlatformDependent.createTempFile("keyutil_${fqdn}_", ".key", null) -// keyFile.deleteOnExit() -// -// var keyOut: FileOutputStream? = keyFile.outputStream() -// try { -// keyOut!!.write(keyText.toByteArray(CharsetUtil.US_ASCII)) -// keyOut.close() -// keyOut = null -// } finally { -// if (keyOut != null) { -// keyOut.close() -// keyFile.delete() -// } -// } -// -// wrappedBuf = Unpooled.wrappedBuffer(cert.encoded) -// encodedBuf = Base64.encode(wrappedBuf, true) -// val certText = buildString { -// // Encode the certificate into a CRT file. -// append("-----BEGIN CERTIFICATE-----\n") -// append(encodedBuf.toString(CharsetUtil.US_ASCII)) -// append("\n-----END CERTIFICATE-----\n") -// } -// encodedBuf.release() -// wrappedBuf.release() -// -// val certFile = PlatformDependent.createTempFile("keyutil_${fqdn}_", ".crt", null) -// certFile.deleteOnExit() -// -// var certOut: FileOutputStream? = certFile.outputStream() -// try { -// certOut!!.write(certText.toByteArray(CharsetUtil.US_ASCII)) -// certOut.close() -// certOut = null -// } finally { -// if (certOut != null) { -// certOut.close() -// certFile.delete() -// keyFile.delete() -// } -// } -// -// return certFile.path to keyFile.path -//} -// -//internal object BouncyCastleSelfSignedCertGenerator { -// private val provider = BouncyCastleProvider() -// -// fun generate( -// fqdn: String, -// keyPair: KeyPair, -// random: SecureRandom, -// notBefore: Date, -// notAfter: Date, -// algorithm: String -// ): Pair { -// val key = keyPair.private -// -// // Prepare the information required for generating an X.509 certificate. -// val owner = X500Name("CN=$fqdn") -// val builder = JcaX509v3CertificateBuilder( -// owner, -// BigInteger(64, random), -// notBefore, -// notAfter, -// owner, -// keyPair.public -// ) -// -// val signer = JcaContentSignerBuilder( -// if (algorithm.equals("EC", true)) "SHA256withECDSA" else "SHA256WithRSAEncryption" -// ).build(key) -// val certHolder = builder.build(signer) -// val cert = JcaX509CertificateConverter().setProvider(provider).getCertificate(certHolder) -// cert.verify(keyPair.public) -// -// return newSelfSignedCertificate(fqdn, key, cert) -// } -//} \ No newline at end of file diff --git a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/util.kt b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/util.kt index 30cb96d1..2bebe916 100644 --- a/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/util.kt +++ b/surf-cloud-api/surf-cloud-api-common/src/main/kotlin/dev/slne/surf/cloud/api/common/util/util.kt @@ -1,6 +1,8 @@ package dev.slne.surf.cloud.api.common.util import com.sksamuel.aedile.core.Cache +import dev.slne.surf.surfapi.core.api.util.mutableObject2IntMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import it.unimi.dsi.fastutil.objects.ObjectList import kotlinx.coroutines.Deferred import kotlinx.coroutines.async diff --git a/surf-cloud-api/surf-cloud-api-server/build.gradle.kts b/surf-cloud-api/surf-cloud-api-server/build.gradle.kts index 39abe196..389b228e 100644 --- a/surf-cloud-api/surf-cloud-api-server/build.gradle.kts +++ b/surf-cloud-api/surf-cloud-api-server/build.gradle.kts @@ -1,4 +1,5 @@ import dev.slne.surf.surfapi.gradle.util.slneReleases +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { `exclude-kotlin` @@ -15,7 +16,6 @@ dependencies { api(libs.bundles.ktor.api.server) api(libs.bson.kotlinx) api(libs.spring.boot.starter.actuator) -// api(libs.discord.webhooks) { isTransitive = true } } kotlin { @@ -28,4 +28,9 @@ publishing { repositories { slneReleases() } +} + +val compileKotlin: KotlinCompile by tasks +compileKotlin.compilerOptions { + freeCompilerArgs.set(listOf("-Xwhen-guards")) } \ No newline at end of file diff --git a/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/netty/packet/NettyPacketServerExtensions.kt b/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/netty/packet/NettyPacketServerExtensions.kt index 01c4d25a..02677c06 100644 --- a/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/netty/packet/NettyPacketServerExtensions.kt +++ b/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/netty/packet/NettyPacketServerExtensions.kt @@ -3,7 +3,6 @@ package dev.slne.surf.cloud.api.server.netty.packet import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.server.server.ServerCloudServerManager - fun NettyPacket.broadcast() { ServerCloudServerManager.broadcast(this) } \ No newline at end of file diff --git a/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/plugin/loader/library/impl/MavenLibraryResolver.kt b/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/plugin/loader/library/impl/MavenLibraryResolver.kt index 8c194e4a..d9c91b1f 100644 --- a/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/plugin/loader/library/impl/MavenLibraryResolver.kt +++ b/surf-cloud-api/surf-cloud-api-server/src/main/kotlin/dev/slne/surf/cloud/api/server/plugin/loader/library/impl/MavenLibraryResolver.kt @@ -3,10 +3,10 @@ package dev.slne.surf.cloud.api.server.plugin.loader.library.impl import dev.slne.surf.cloud.api.common.util.annotation.InternalApi -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.server.plugin.loader.library.ClassPathLibrary import dev.slne.surf.cloud.api.server.plugin.loader.library.LibraryLoadingException import dev.slne.surf.cloud.api.server.plugin.loader.library.LibraryStore +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import org.apache.maven.repository.internal.MavenRepositorySystemUtils import org.eclipse.aether.RepositorySystem import org.eclipse.aether.artifact.DefaultArtifact @@ -25,28 +25,6 @@ class MavenLibraryResolver : ClassPathLibrary { private val log = dev.slne.surf.surfapi.core.api.util.logger() private val repository: RepositorySystem = RepositorySystemSupplier().get() -// private val session = repository.createSessionBuilder().apply { -// setSystemProperties(System.getProperties()) -// setChecksumPolicy(RepositoryPolicy.CHECKSUM_POLICY_FAIL) -// withLocalRepositories(LocalRepository("libraries")) -// setTransferListener(object : AbstractTransferListener() { -// override fun transferInitiated(event: TransferEvent) { -// log.atInfo() -// .log( -// "Downloading %s", -// event.resource.repositoryUrl + event.resource.resourceName -// ) -// } -// -// override fun transferFailed(event: TransferEvent) { -// log.atSevere().log( -// "Failed to download %s from %s", -// event.resource.resourceName, -// event.resource.repositoryUrl -// ) -// } -// }) -// }.build() private val session = MavenRepositorySystemUtils.newSession().apply { setSystemProperties(System.getProperties()) diff --git a/surf-cloud-bukkit/build.gradle.kts b/surf-cloud-bukkit/build.gradle.kts index 48300af1..ed3db16f 100644 --- a/surf-cloud-bukkit/build.gradle.kts +++ b/surf-cloud-bukkit/build.gradle.kts @@ -31,8 +31,6 @@ dependencies { api(project(":surf-cloud-api:surf-cloud-api-client:surf-cloud-api-client-paper")) compileOnly(libs.voicechat.api) - -// api("org.springframework.boot:spring-boot-starter-data-jpa") } configurations { diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/PaperMain.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/PaperMain.kt index e54cc118..166ed884 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/PaperMain.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/PaperMain.kt @@ -4,8 +4,6 @@ import com.github.shynixn.mccoroutine.folia.SuspendingJavaPlugin import com.github.shynixn.mccoroutine.folia.launch import dev.jorel.commandapi.CommandAPIBukkit import dev.jorel.commandapi.kotlindsl.* -import dev.slne.surf.cloud.api.client.netty.packet.fireAndForget -import dev.slne.surf.cloud.api.common.TestPacket import dev.slne.surf.cloud.api.common.player.teleport.TeleportCause import dev.slne.surf.cloud.api.common.player.teleport.fineLocation import dev.slne.surf.cloud.api.common.player.toCloudPlayer @@ -111,13 +109,6 @@ class PaperMain : SuspendingJavaPlugin() { } } } - - commandAPICommand("send-test-packet") { - anyExecutor { sender, args -> - TestPacket.random().fireAndForget() - sender.sendPlainMessage("Test packet sent") - } - } } @OptIn(ExperimentalContracts::class) diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/command/network/GListCommand.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/command/network/GListCommand.kt index ce0b5996..32f87e49 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/command/network/GListCommand.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/command/network/GListCommand.kt @@ -12,12 +12,12 @@ import dev.slne.surf.cloud.api.common.server.CloudServer import dev.slne.surf.cloud.api.common.server.CloudServerManager import dev.slne.surf.cloud.api.common.server.UserList import dev.slne.surf.cloud.api.common.util.mapAsync -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf import dev.slne.surf.cloud.bukkit.permission.CloudPermissionRegistry import dev.slne.surf.cloud.bukkit.plugin import dev.slne.surf.surfapi.core.api.messages.Colors import dev.slne.surf.surfapi.core.api.messages.adventure.sendText import dev.slne.surf.surfapi.core.api.messages.joinToComponent +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import it.unimi.dsi.fastutil.objects.Object2ObjectMap import kotlinx.coroutines.awaitAll import net.kyori.adventure.text.Component diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/ListenerManager.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/ListenerManager.kt index 0424878d..cca75305 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/ListenerManager.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/ListenerManager.kt @@ -1,7 +1,6 @@ package dev.slne.surf.cloud.bukkit.listener import dev.slne.surf.cloud.api.common.util.TimeLogger -import dev.slne.surf.cloud.bukkit.listener.exception.SurfFatalErrorExceptionListener import dev.slne.surf.cloud.bukkit.listener.player.ConnectionListener import dev.slne.surf.cloud.bukkit.listener.player.SilentDisconnectListener import dev.slne.surf.cloud.bukkit.plugin @@ -16,7 +15,7 @@ import org.springframework.stereotype.Component @OptIn(NmsUseWithCaution::class) @Component @Order(CloudLifecycleAware.MISC_PRIORITY) -class ListenerManager: CloudLifecycleAware { +class ListenerManager : CloudLifecycleAware { override suspend fun onEnable(timeLogger: TimeLogger) { timeLogger.measureStep("Registering listeners") { @@ -32,7 +31,6 @@ class ListenerManager: CloudLifecycleAware { fun registerListeners() { ConnectionListener.register() - SurfFatalErrorExceptionListener.register() nmsBridge.registerClientboundPacketListener(SilentDisconnectListener) } diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/exception/SurfFatalErrorExceptionListener.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/exception/SurfFatalErrorExceptionListener.kt deleted file mode 100644 index 5b343d11..00000000 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/exception/SurfFatalErrorExceptionListener.kt +++ /dev/null @@ -1,22 +0,0 @@ -package dev.slne.surf.cloud.bukkit.listener.exception - -import com.destroystokyo.paper.event.server.ServerExceptionEvent -import dev.slne.surf.cloud.api.common.exceptions.FatalSurfError -import dev.slne.surf.cloud.core.common.handleEventuallyFatalError -import org.bukkit.Bukkit -import org.bukkit.event.EventHandler -import org.bukkit.event.Listener - -object SurfFatalErrorExceptionListener : Listener { -// private val handler = { _: FatalSurfError -> Bukkit.shutdown() } - -// @EventHandler -// fun onServerException(event: ServerExceptionEvent) { -// val e = event.exception -// if (e.handle()) return -// if (e.cause?.handle() == true) return -// } -// -// private fun Throwable.handle() = handleEventuallyFatalError(false, false, handler) - -} \ No newline at end of file diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/ConnectionListener.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/ConnectionListener.kt index 00568985..760b9aa4 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/ConnectionListener.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/ConnectionListener.kt @@ -5,8 +5,8 @@ import dev.slne.surf.cloud.api.client.netty.packet.fireAndForget import dev.slne.surf.cloud.api.common.player.task.PrePlayerJoinTask import dev.slne.surf.cloud.core.common.data.CloudPersistentData import dev.slne.surf.cloud.core.common.messages.MessageManager -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.PlayerConnectToServerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.PlayerDisconnectFromServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.PlayerConnectToServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.PlayerDisconnectFromServerPacket import kotlinx.coroutines.runBlocking import org.bukkit.event.EventHandler import org.bukkit.event.EventPriority @@ -24,7 +24,6 @@ object ConnectionListener : Listener { return } - /** * We are in an async event wich uses a cached thread pool, * so we can use runBlocking here without blocking the main thread diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/PlayerAfkListener.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/PlayerAfkListener.kt index 23b17c12..48c9954f 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/PlayerAfkListener.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/PlayerAfkListener.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.bukkit.listener.player import dev.slne.surf.cloud.api.client.netty.packet.fireAndForget -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.UpdateAFKStatePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.UpdateAFKStatePacket import dev.slne.surf.surfapi.core.api.util.mutableObject2BooleanMapOf import dev.slne.surf.surfapi.core.api.util.mutableObject2LongMapOf import org.bukkit.event.EventHandler diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/SilentDisconnectListener.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/SilentDisconnectListener.kt index 11d4e9d5..633e3f1b 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/SilentDisconnectListener.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/player/SilentDisconnectListener.kt @@ -1,11 +1,10 @@ package dev.slne.surf.cloud.bukkit.listener.player -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf -import dev.slne.surf.cloud.bukkit.player.BukkitClientCloudPlayerImpl import dev.slne.surf.surfapi.bukkit.api.nms.NmsUseWithCaution import dev.slne.surf.surfapi.bukkit.api.nms.listener.NmsClientboundPacketListener import dev.slne.surf.surfapi.bukkit.api.nms.listener.packets.clientbound.DisconnectPacket import dev.slne.surf.surfapi.bukkit.api.packet.listener.listener.PacketListenerResult +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf import org.bukkit.entity.Player import java.util.* diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/punish/mute/AbstractMuteListener.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/punish/mute/AbstractMuteListener.kt index b0f2456e..68e7c55c 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/punish/mute/AbstractMuteListener.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/listener/punish/mute/AbstractMuteListener.kt @@ -19,7 +19,6 @@ abstract class AbstractMuteListener { } } - protected fun processMute(playerUuid: UUID): Boolean { val player = playerUuid.toOfflineCloudPlayer() val longestActiveMute = player.punishmentManager.longestActiveMute() ?: return false @@ -28,7 +27,6 @@ abstract class AbstractMuteListener { return true } - protected fun isMuted(playerUuid: UUID): Boolean { return CloudPlayerManager.getPlayer(playerUuid)?.punishmentManager?.isMuted == true } diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/network/BukkitSpecificPacketListenerExtension.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/network/BukkitSpecificPacketListenerExtension.kt index 4be719c6..a9e322bb 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/network/BukkitSpecificPacketListenerExtension.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/network/BukkitSpecificPacketListenerExtension.kt @@ -13,8 +13,8 @@ import dev.slne.surf.cloud.bukkit.plugin import dev.slne.surf.cloud.core.client.netty.network.PlatformSpecificPacketListenerExtension import dev.slne.surf.cloud.core.client.server.ClientCloudServerImpl import dev.slne.surf.cloud.core.common.coroutines.CommonObservableScope -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RegistrationInfo -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundTransferPlayerPacketResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.RegistrationInfo +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse import dev.slne.surf.surfapi.bukkit.api.extensions.server import dev.slne.surf.surfapi.bukkit.api.nms.NmsUseWithCaution import dev.slne.surf.surfapi.bukkit.api.nms.bridges.nmsCommonBridge diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/sync/ClientInformationUpdaterSyncer.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/sync/ClientInformationUpdaterSyncer.kt index 792bbc8f..654ee6cb 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/sync/ClientInformationUpdaterSyncer.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/netty/sync/ClientInformationUpdaterSyncer.kt @@ -6,8 +6,8 @@ import dev.slne.surf.cloud.api.common.server.state.ServerState import dev.slne.surf.cloud.api.common.util.TimeLogger import dev.slne.surf.cloud.api.common.util.observer.ObservableField import dev.slne.surf.cloud.bukkit.util.ObservableFieldByEvent -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientInformation -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundClientInformationPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ClientInformation +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundClientInformationPacket import dev.slne.surf.cloud.core.common.spring.CloudLifecycleAware import org.bukkit.Bukkit import org.springframework.core.annotation.Order diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/placeholder/CloudPlaceholderExpansion.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/placeholder/CloudPlaceholderExpansion.kt index 7ecdd711..6f6de776 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/placeholder/CloudPlaceholderExpansion.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/placeholder/CloudPlaceholderExpansion.kt @@ -1,11 +1,11 @@ package dev.slne.surf.cloud.bukkit.placeholder import dev.slne.surf.cloud.api.common.util.TimeLogger -import dev.slne.surf.cloud.api.common.util.objectListOf import dev.slne.surf.cloud.bukkit.placeholder.afk.CloudAfkPlaceholder import dev.slne.surf.cloud.core.common.spring.CloudLifecycleAware import dev.slne.surf.surfapi.bukkit.api.hook.papi.expansion.PapiExpansion import dev.slne.surf.surfapi.bukkit.api.hook.papi.papiHook +import dev.slne.surf.surfapi.core.api.util.objectListOf import org.springframework.core.annotation.Order import org.springframework.stereotype.Component diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitClientCloudPlayerImpl.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitClientCloudPlayerImpl.kt index ae986873..ef605a64 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitClientCloudPlayerImpl.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitClientCloudPlayerImpl.kt @@ -10,8 +10,8 @@ import dev.slne.surf.cloud.api.common.player.teleport.TeleportLocation import dev.slne.surf.cloud.bukkit.listener.player.SilentDisconnectListener import dev.slne.surf.cloud.bukkit.plugin import dev.slne.surf.cloud.core.client.player.ClientCloudPlayerImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.DisconnectPlayerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SilentDisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SilentDisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.DisconnectPlayerPacket import kotlinx.coroutines.future.await import net.kyori.adventure.text.Component import org.bukkit.Bukkit @@ -19,8 +19,9 @@ import org.bukkit.conversations.* import org.bukkit.entity.Player import java.util.* -class BukkitClientCloudPlayerImpl(uuid: UUID, name: String) : ClientCloudPlayerImpl(uuid, - name +class BukkitClientCloudPlayerImpl(uuid: UUID, name: String) : ClientCloudPlayerImpl( + uuid, + name // TODO: Fix createIfNotExists ) { public override val audience: Player? get() = Bukkit.getPlayer(uuid) override val platformClass: Class = Player::class.java diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitCloudPlayerManagerImpl.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitCloudPlayerManagerImpl.kt index ec979170..f623f677 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitCloudPlayerManagerImpl.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/player/BukkitCloudPlayerManagerImpl.kt @@ -11,7 +11,8 @@ import java.net.Inet4Address import java.util.* @AutoService(CloudPlayerManager::class) -class BukkitCloudPlayerManagerImpl : CommonClientCloudPlayerManagerImpl() { +class BukkitCloudPlayerManagerImpl :// TODO: Fix createIfNotExists + CommonClientCloudPlayerManagerImpl() { init { checkInstantiationByServiceLoader() } diff --git a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/processor/BukkitListenerProcessor.kt b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/processor/BukkitListenerProcessor.kt index dd5e23bb..8af49349 100644 --- a/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/processor/BukkitListenerProcessor.kt +++ b/surf-cloud-bukkit/src/main/kotlin/dev/slne/surf/cloud/bukkit/processor/BukkitListenerProcessor.kt @@ -1,12 +1,8 @@ package dev.slne.surf.cloud.bukkit.processor -import dev.slne.surf.cloud.api.common.util.TimeLogger -import dev.slne.surf.cloud.api.common.util.isAnnotated -import dev.slne.surf.cloud.api.common.util.isCandidateFor -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf -import dev.slne.surf.cloud.api.common.util.selectFunctions -import dev.slne.surf.cloud.api.common.util.ultimateTargetClass +import dev.slne.surf.cloud.api.common.util.* import dev.slne.surf.cloud.core.common.spring.CloudLifecycleAware +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import org.bukkit.Bukkit import org.bukkit.event.Event import org.bukkit.event.EventException diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/ClientNettyClientImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/ClientNettyClientImpl.kt index f8e49531..2e926d7d 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/ClientNettyClientImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/ClientNettyClientImpl.kt @@ -21,13 +21,13 @@ import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectReason import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails import dev.slne.surf.cloud.core.common.netty.network.EncryptionManager -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ServerboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundlePacket import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ClientInitializePacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ClientboundInitializeIdResponsePacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ServerboundInitializeRequestIdPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.clientbound.ClientboundInitializeIdResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.serverbound.ServerboundInitializeRequestIdPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.login.LoginProtocols import dev.slne.surf.cloud.core.common.netty.network.protocol.login.ServerboundLoginStartPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundBroadcastPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundBroadcastPacket import dev.slne.surf.cloud.core.common.util.InetSocketAddress import dev.slne.surf.cloud.core.common.util.ServerAddress import dev.slne.surf.surfapi.core.api.util.logger diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientCommonPacketListenerImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientCommonPacketListenerImpl.kt index 0af253ae..98a8a33b 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientCommonPacketListenerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientCommonPacketListenerImpl.kt @@ -1,9 +1,7 @@ package dev.slne.surf.cloud.core.client.netty.network -import dev.slne.surf.cloud.api.common.exceptions.ExitCodes import dev.slne.surf.cloud.api.common.netty.network.protocol.respond import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -import dev.slne.surf.cloud.core.client.netty.NettyCommonClientManager import dev.slne.surf.cloud.core.common.coroutines.ConnectionManagementScope import dev.slne.surf.cloud.core.common.netty.NettyManager import dev.slne.surf.cloud.core.common.netty.network.CommonTickablePacketListener @@ -11,16 +9,15 @@ import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectReason import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientCommonPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundBundlePacket import dev.slne.surf.cloud.core.common.netty.network.protocol.common.KeepAliveHandler -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.KeepAlivePacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundDisconnectPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundPingPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundPongPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundDisconnectPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundPingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundPongPacket import dev.slne.surf.cloud.core.common.util.bean import dev.slne.surf.surfapi.core.api.util.logger import kotlinx.coroutines.launch -import kotlin.system.exitProcess abstract class ClientCommonPacketListenerImpl( val connection: ConnectionImpl, diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientPreRunningPacketListenerImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientPreRunningPacketListenerImpl.kt index 103449f7..1e81fc18 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientPreRunningPacketListenerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientPreRunningPacketListenerImpl.kt @@ -5,7 +5,12 @@ import dev.slne.surf.cloud.core.client.netty.ClientNettyClientImpl import dev.slne.surf.cloud.core.client.netty.network.AbstractStatusUpdater.State import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails -import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.ClientPreRunningPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundPreRunningFinishedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundProceedToSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundPreRunningAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundProceedToSynchronizingAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundRequestContinuation import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.SynchronizingProtocols import kotlinx.coroutines.CompletableDeferred diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientRunningPacketListenerImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientRunningPacketListenerImpl.kt index bfeb770b..fc8a5215 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientRunningPacketListenerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientRunningPacketListenerImpl.kt @@ -19,8 +19,12 @@ import dev.slne.surf.cloud.core.client.util.getOrLoadUser import dev.slne.surf.cloud.core.client.util.luckperms import dev.slne.surf.cloud.core.common.coroutines.PacketHandlerScope import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundSetVelocitySecretPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RunningClientPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundIsServerManagedByThisProxyResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse import dev.slne.surf.cloud.core.common.netty.registry.listener.NettyListenerRegistry import dev.slne.surf.cloud.core.common.player.playerManagerImpl import dev.slne.surf.cloud.core.common.player.task.PrePlayerJoinTaskManager diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientSynchronizingPacketListenerImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientSynchronizingPacketListenerImpl.kt index 4bec557b..6d461363 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientSynchronizingPacketListenerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/ClientSynchronizingPacketListenerImpl.kt @@ -11,12 +11,17 @@ import dev.slne.surf.cloud.core.client.sync.SyncRegistryImpl import dev.slne.surf.cloud.core.common.coroutines.BeforeStartTaskScope import dev.slne.surf.cloud.core.common.coroutines.PacketHandlerScope import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundSetVelocitySecretPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundBatchUpdateServer +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RunningProtocols -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncSetDeltaPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncValueChangePacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundBatchUpdateServer +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ClientSynchronizingPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncSetPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncValuePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundSynchronizeFinishPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.serverbound.ServerboundSynchronizeFinishAcknowledgedPacket import dev.slne.surf.cloud.core.common.netty.registry.listener.NettyListenerRegistry import dev.slne.surf.cloud.core.common.plugin.task.CloudSynchronizeTaskManager import dev.slne.surf.surfapi.core.api.util.logger diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/PlatformSpecificPacketListenerExtension.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/PlatformSpecificPacketListenerExtension.kt index f0b399dc..96605f48 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/PlatformSpecificPacketListenerExtension.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/netty/network/PlatformSpecificPacketListenerExtension.kt @@ -4,8 +4,8 @@ import dev.slne.surf.cloud.api.common.player.teleport.TeleportCause import dev.slne.surf.cloud.api.common.player.teleport.TeleportFlag import dev.slne.surf.cloud.api.common.player.teleport.TeleportLocation import dev.slne.surf.cloud.core.client.server.ClientCloudServerImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RegistrationInfo -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundTransferPlayerPacketResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.RegistrationInfo +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse import net.kyori.adventure.text.Component import java.net.InetSocketAddress import java.util.* diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/ClientCloudPlayerImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/ClientCloudPlayerImpl.kt index 08d9c41b..927ae6d6 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/ClientCloudPlayerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/ClientCloudPlayerImpl.kt @@ -18,9 +18,35 @@ import dev.slne.surf.cloud.api.common.util.getValue import dev.slne.surf.cloud.api.common.util.setValue import dev.slne.surf.cloud.core.client.server.serverManagerImpl import dev.slne.surf.cloud.core.client.util.luckperms -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundRequestPlayerDataPacket.DataRequestType -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundRequestPlayerDataResponse.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestLuckpermsMetaDataPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestPlayerPermissionPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.TeleportPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.TeleportPlayerToPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerDataPacket.DataRequestType +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerDataResponse.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundClearResourcePacksPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundClearTitlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundConnectPlayerToServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundCreateOfflineCloudPlayerIfNotExistsPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundHideBossBarPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundOpenBookPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundPlaySoundPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundPlayerPersistentDataContainerUpdatePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundQueuePlayerToGroupPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRemoveResourcePacksPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestDisplayNamePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerDataPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerDataResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerPersistentDataContainer +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundResetTitlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundSendActionBarPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundSendMessagePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundSendPlayerListHeaderAndFooterPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundSendResourcePacksPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundSendTitlePartPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundShowBossBarPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundShowTitlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundStopSoundPacket import dev.slne.surf.cloud.core.common.player.CommonCloudPlayerImpl import dev.slne.surf.cloud.core.common.player.ppdc.PersistentPlayerDataContainerImpl import dev.slne.surf.cloud.core.common.util.hasPermissionPlattform @@ -47,7 +73,7 @@ import java.util.* import java.util.concurrent.atomic.AtomicBoolean import kotlin.time.Duration import kotlin.time.Duration.Companion.days -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundRequestPlayerDataResponse.NameHistory as NameHistoryResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerDataResponse.NameHistory as NameHistoryResponse abstract class ClientCloudPlayerImpl( uuid: UUID, diff --git a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/CommonClientCloudPlayerManagerImpl.kt b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/CommonClientCloudPlayerManagerImpl.kt index 6e9dac69..045bd968 100644 --- a/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/CommonClientCloudPlayerManagerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-client/src/main/kotlin/dev/slne/surf/cloud/core/client/player/CommonClientCloudPlayerManagerImpl.kt @@ -44,7 +44,7 @@ abstract class CommonClientCloudPlayerManagerImpl(packet.setId) ?: error("SyncSet with id '${packet.setId}' is not registered") + getSet(packet.setId) + ?: error("SyncSet with id '${packet.setId}' is not registered") val lastChangeId = lastChangeIds.getLong(packet.setId) if (packet.changeId <= lastChangeId) { log.atInfo() diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/coroutines/scopes.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/coroutines/scopes.kt index ef4e2e65..e023e11f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/coroutines/scopes.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/coroutines/scopes.kt @@ -1,9 +1,9 @@ package dev.slne.surf.cloud.core.common.coroutines -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.common.util.threadFactory import dev.slne.surf.cloud.core.common.coroutines.BeforeStartTaskScope.unnamedTask import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import kotlinx.coroutines.* import java.util.concurrent.Executors import kotlin.coroutines.CoroutineContext @@ -166,7 +166,7 @@ object BeforeStartTaskScope : BaseScope( dispatcher = Dispatchers.IO, name = "before-start-task", coroutineExceptionHandler = CoroutineExceptionHandler { context, throwable -> - val task= context[TaskName] ?: unnamedTask + val task = context[TaskName] ?: unnamedTask log.atWarning() .withCause(throwable) .log("Unhandled exception in before start task: $task") @@ -180,6 +180,7 @@ object BeforeStartTaskScope : BaseScope( val order: Int ) : CoroutineContext.Element { companion object Key : CoroutineContext.Key + override val key: CoroutineContext.Key<*> = Key override fun toString(): String { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/data/PersistentDataImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/data/PersistentDataImpl.kt index 3bfbc689..51fd5356 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/data/PersistentDataImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/data/PersistentDataImpl.kt @@ -14,7 +14,7 @@ import kotlin.io.path.div import kotlin.io.path.notExists -object PersistentDataImpl { +object PersistentDataImpl { // TODO: 24.07.2025 15:35 Think about moving this to a database? Like why is this stored in a file that is not usable accross multiple standalones private val file by lazy { (coreCloudInstance.dataFolder / "storage" / "data.dat").apply { if (notExists()) { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/event/CloudEventListenerBeanPostProcessor.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/event/CloudEventListenerBeanPostProcessor.kt index 8d1f0679..664ec2bc 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/event/CloudEventListenerBeanPostProcessor.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/event/CloudEventListenerBeanPostProcessor.kt @@ -1,7 +1,11 @@ package dev.slne.surf.cloud.core.common.event import dev.slne.surf.cloud.api.common.event.CloudEventHandler -import dev.slne.surf.cloud.api.common.util.* +import dev.slne.surf.cloud.api.common.util.isAnnotated +import dev.slne.surf.cloud.api.common.util.isCandidateFor +import dev.slne.surf.cloud.api.common.util.selectFunctions +import dev.slne.surf.cloud.api.common.util.ultimateTargetClass +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import org.springframework.beans.factory.config.BeanDefinition import org.springframework.beans.factory.config.BeanPostProcessor import org.springframework.context.SmartLifecycle diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/CommonNettyClientImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/CommonNettyClientImpl.kt index 1d82b5d9..4ffad28d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/CommonNettyClientImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/CommonNettyClientImpl.kt @@ -4,9 +4,9 @@ import dev.slne.surf.cloud.api.common.netty.NettyClient import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.synchronize import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.synchronize import kotlinx.coroutines.CompletableDeferred import java.net.InetSocketAddress import kotlin.time.Duration @@ -73,7 +73,10 @@ abstract class CommonNettyClientImpl( } } - override suspend fun

fireAndAwait(packet: RespondingNettyPacket

, timeout: Duration): P? { + override suspend fun

fireAndAwait( + packet: RespondingNettyPacket

, + timeout: Duration + ): P? { return packet.fireAndAwait(connection, timeout) } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/ConnectionImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/ConnectionImpl.kt index b9b937a2..9297f634 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/ConnectionImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/ConnectionImpl.kt @@ -13,16 +13,43 @@ import dev.slne.surf.cloud.api.common.util.threadFactory import dev.slne.surf.cloud.core.common.config.cloudConfig import dev.slne.surf.cloud.core.common.coroutines.ConnectionManagementScope import dev.slne.surf.cloud.core.common.coroutines.PacketHandlerScope -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientCommonPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ServerCommonPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundPongResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundPingRequestPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ClientIntent import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.HandshakeProtocols import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ServerHandshakePacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ServerboundHandshakePacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.serverbound.ServerboundHandshakePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ClientInitializePacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.InitializeProtocols +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ServerInitializePacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.clientbound.ClientboundInitializeIdResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.serverbound.ServerboundInitializeRequestIdPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.login.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.ClientPreRunningPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.ServerPreRunningPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundPreRunningFinishedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundProceedToSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundPreRunningAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundProceedToSynchronizingAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundRequestContinuation +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RunningClientPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RunningServerPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ClientSynchronizingPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ServerSynchronizingPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncSetPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncValuePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundSynchronizeFinishPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.serverbound.ServerboundSynchronizeFinishAcknowledgedPacket import dev.slne.surf.surfapi.core.api.util.logger import io.netty.bootstrap.Bootstrap import io.netty.channel.* diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/EncryptionManager.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/EncryptionManager.kt index ce7a699f..9ae91b70 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/EncryptionManager.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/EncryptionManager.kt @@ -28,9 +28,6 @@ abstract class EncryptionManager { val missingFiles = files.filter { !it.exists() }.toMutableList() while (missingFiles.isNotEmpty()) { -// log.atInfo() -// .log("Waiting for missing files: ${missingFiles.joinToString { it.path }}") - println("[INFO] ${this::class.simpleName}: Waiting for missing files: ${missingFiles.joinToString { it.path }}") delay(5.seconds) diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/RespondingPacketSendHandler.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/RespondingPacketSendHandler.kt index 45464596..e5abada4 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/RespondingPacketSendHandler.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/RespondingPacketSendHandler.kt @@ -3,10 +3,10 @@ package dev.slne.surf.cloud.core.common.netty.network import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf import dev.slne.surf.cloud.api.common.util.netty.UnifiedReadOnlyChannelHandler -import dev.slne.surf.cloud.api.common.util.synchronize import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.synchronize import io.netty.channel.ChannelHandlerContext import io.netty.channel.ChannelPromise import kotlinx.coroutines.CompletableDeferred diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/TickablePacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/TickablePacketListener.kt index 4ab646e1..61a7ea29 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/TickablePacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/TickablePacketListener.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.core.common.netty.network -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf -import dev.slne.surf.cloud.api.common.util.synchronize +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.synchronize import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/Varint21FrameDecoder.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/Varint21FrameDecoder.kt index b79da58e..419e1a53 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/Varint21FrameDecoder.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/Varint21FrameDecoder.kt @@ -45,21 +45,6 @@ class Varint21FrameDecoder : ByteToMessageDecoder() { out.add(byteBuf.readRetainedSlice(length)) } } - - -// byteBuf.markReaderIndex() -// helperBuf.clear() -// -// if (!copyVarint(byteBuf, helperBuf)) { -// byteBuf.resetReaderIndex() -// } else { -// val value = VarInt.readVarInt(helperBuf) -// if (byteBuf.readableBytes() < value) { -// byteBuf.resetReaderIndex() -// } else { -// out.add(byteBuf.readBytes(value)) -// } -// } } companion object { @@ -91,8 +76,10 @@ class Varint21FrameDecoder : ByteToMessageDecoder() { var preservedBytes = wholeOrMore and (atStop xor (atStop - 1)) // merge together using this trick: https://github.com/netty/netty/pull/14050#discussion_r1597896639 - preservedBytes = (preservedBytes and 0x007F007F) or ((preservedBytes and 0x00007F00) shr 1) - preservedBytes = (preservedBytes and 0x00003FFF) or ((preservedBytes and 0x3FFF0000.toInt()) shr 2) + preservedBytes = + (preservedBytes and 0x007F007F) or ((preservedBytes and 0x00007F00) shr 1) + preservedBytes = + (preservedBytes and 0x00003FFF) or ((preservedBytes and 0x3FFF0000.toInt()) shr 2) return preservedBytes } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlePacket.kt index 032f2968..bb385ec5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlePacket.kt @@ -1,9 +1,10 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -import dev.slne.surf.cloud.api.common.util.toObjectSet +import dev.slne.surf.surfapi.core.api.util.toObjectSet -abstract class BundlePacket protected constructor(val subPackets: Iterable): NettyPacket() { +abstract class BundlePacket protected constructor(val subPackets: Iterable) : + NettyPacket() { init { val supportedProtocols = protocols.toObjectSet() for (packet in subPackets) { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlerInfo.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlerInfo.kt index e08a8722..fd77d4d5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlerInfo.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/BundlerInfo.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf interface BundlerInfo { companion object { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/ProtocolInfoBuilder.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/ProtocolInfoBuilder.kt index 3b6b9a83..e03a3e3f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/ProtocolInfoBuilder.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/ProtocolInfoBuilder.kt @@ -7,11 +7,11 @@ import dev.slne.surf.cloud.api.common.netty.network.codec.StreamCodec import dev.slne.surf.cloud.api.common.netty.network.codec.streamCodecUnitSimple import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf import dev.slne.surf.cloud.core.common.netty.network.ClientboundPacketListener import dev.slne.surf.cloud.core.common.netty.network.PacketListener import dev.slne.surf.cloud.core.common.netty.network.ProtocolInfo import dev.slne.surf.cloud.core.common.netty.network.ServerboundPacketListener +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf import io.netty.buffer.ByteBuf import java.util.function.Consumer import java.util.function.Function diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientCommonPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientCommonPacketListener.kt index 63db155e..38a23d7a 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientCommonPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientCommonPacketListener.kt @@ -1,10 +1,12 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.common import dev.slne.surf.cloud.core.common.netty.network.ClientboundPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundDisconnectPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundPingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundDisconnectPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundPingPacket -interface ClientCommonPacketListener: ClientboundPacketListener { +interface ClientCommonPacketListener : ClientboundPacketListener { fun handleBundlePacket(packet: ClientboundBundlePacket) diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAliveHandler.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAliveHandler.kt index ecf1b2a6..1c5e77fd 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAliveHandler.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAliveHandler.kt @@ -3,6 +3,7 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.common import dev.slne.surf.cloud.api.common.netty.network.protocol.await import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectReason +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch import kotlin.time.Duration @@ -28,7 +29,10 @@ class KeepAliveHandler( val elapsedTime = currentTime - keepAliveTime if (KEEP_ALIVE_TIME.isExpired(elapsedTime)) { - if (keepAlivePending && !isDisconnectProcessed() && KEEP_ALIVE_LIMIT.isExpired(elapsedTime)) { + if (keepAlivePending && !isDisconnectProcessed() && KEEP_ALIVE_LIMIT.isExpired( + elapsedTime + ) + ) { disconnect(DisconnectReason.TIMEOUT) } else if (checkIfClosed(currentTime)) { keepAlivePending = true diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerCommonPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerCommonPacketListener.kt index 8d2fe3db..5be9951b 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerCommonPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerCommonPacketListener.kt @@ -1,6 +1,9 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.common import dev.slne.surf.cloud.core.common.netty.network.ServerboundPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundPingRequestPacket interface ServerCommonPacketListener : ServerboundPacketListener { fun handleBundlePacket(packet: ServerboundBundlePacket) diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAlivePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/bidirectional/KeepAlivePacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAlivePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/bidirectional/KeepAlivePacket.kt index b792e40f..e9e530e7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/KeepAlivePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/bidirectional/KeepAlivePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundBundleDelimiterPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundBundleDelimiterPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundBundleDelimiterPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundBundleDelimiterPacket.kt index 650a422e..f2101271 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundBundleDelimiterPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundBundleDelimiterPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundBundlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundBundlePacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundBundlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundBundlePacket.kt index ba9e58d4..92e65fb0 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundBundlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundBundlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundPongResponsePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundPongResponsePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundPongResponsePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundPongResponsePacket.kt index 87ee9655..b4f517f4 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundPongResponsePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundPongResponsePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundSetVelocitySecretPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundSetVelocitySecretPacket.kt similarity index 83% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundSetVelocitySecretPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundSetVelocitySecretPacket.kt index 364f5abd..43b64a15 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ClientboundSetVelocitySecretPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/clientbound/ClientboundSetVelocitySecretPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow @@ -7,7 +7,7 @@ import kotlinx.serialization.Serializable @SurfNettyPacket("cloud:clientbound:set_velocity_secret", PacketFlow.CLIENTBOUND) @Serializable -class ClientboundSetVelocitySecretPacket(val secret: ByteArray): NettyPacket() { +class ClientboundSetVelocitySecretPacket(val secret: ByteArray) : NettyPacket() { override fun toString(): String { return "ClientboundSetVelocitySecretPacket(secret=***)" } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundBundleDelimiterPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundBundleDelimiterPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundBundleDelimiterPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundBundleDelimiterPacket.kt index b0f49ae2..91783721 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundBundleDelimiterPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundBundleDelimiterPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundBundlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundBundlePacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundBundlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundBundlePacket.kt index 2e78d710..a6446a71 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundBundlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundBundlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundPingRequestPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundPingRequestPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundPingRequestPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundPingRequestPacket.kt index 00cf404c..26973463 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/ServerboundPingRequestPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/common/serverbound/ServerboundPingRequestPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.common +package dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/HandshakeProtocols.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/HandshakeProtocols.kt index 2108db88..b1597ad9 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/HandshakeProtocols.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/HandshakeProtocols.kt @@ -3,6 +3,7 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.handshake import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.core.common.netty.network.protocol.ProtocolInfoBuilder +import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.serverbound.ServerboundHandshakePacket object HandshakeProtocols { val SERVERBOUND_TEMPLATE = diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerHandshakePacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerHandshakePacketListener.kt index a63b5df7..53a21642 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerHandshakePacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerHandshakePacketListener.kt @@ -2,8 +2,9 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.handshake import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.core.common.netty.network.ServerboundPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.serverbound.ServerboundHandshakePacket -interface ServerHandshakePacketListener: ServerboundPacketListener { +interface ServerHandshakePacketListener : ServerboundPacketListener { override val protocol get() = ConnectionProtocol.HANDSHAKING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerboundHandshakePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/serverbound/ServerboundHandshakePacket.kt similarity index 94% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerboundHandshakePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/serverbound/ServerboundHandshakePacket.kt index fe02e45b..17d13395 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/ServerboundHandshakePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/handshake/serverbound/ServerboundHandshakePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.handshake +package dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -7,6 +7,7 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ClientIntent const val PROTOCOL_VERSION = 1 diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientInitializePacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientInitializePacketListener.kt index 643bd25e..461adade 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientInitializePacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientInitializePacketListener.kt @@ -2,8 +2,9 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.core.common.netty.network.ClientboundPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.clientbound.ClientboundInitializeIdResponsePacket -interface ClientInitializePacketListener: ClientboundPacketListener { +interface ClientInitializePacketListener : ClientboundPacketListener { override val protocol: ConnectionProtocol get() = ConnectionProtocol.INITIALIZE diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/InitializeProtocols.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/InitializeProtocols.kt index fd3e42c5..de399b73 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/InitializeProtocols.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/InitializeProtocols.kt @@ -2,6 +2,8 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.core.common.netty.network.protocol.ProtocolInfoBuilder +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.clientbound.ClientboundInitializeIdResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.serverbound.ServerboundInitializeRequestIdPacket import io.netty.buffer.ByteBuf object InitializeProtocols { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerInitializePacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerInitializePacketListener.kt index 29cdf557..576f29e8 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerInitializePacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerInitializePacketListener.kt @@ -2,8 +2,9 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.core.common.netty.network.ServerboundPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.serverbound.ServerboundInitializeRequestIdPacket -interface ServerInitializePacketListener: ServerboundPacketListener { +interface ServerInitializePacketListener : ServerboundPacketListener { override val protocol: ConnectionProtocol get() = ConnectionProtocol.INITIALIZE diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientboundInitializeIdResponsePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/clientbound/ClientboundInitializeIdResponsePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientboundInitializeIdResponsePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/clientbound/ClientboundInitializeIdResponsePacket.kt index 46255646..fcbf9579 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ClientboundInitializeIdResponsePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/clientbound/ClientboundInitializeIdResponsePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize +package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerboundInitializeRequestIdPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/serverbound/ServerboundInitializeRequestIdPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerboundInitializeRequestIdPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/serverbound/ServerboundInitializeRequestIdPacket.kt index e96007c8..de76079d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/ServerboundInitializeRequestIdPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/initialize/serverbound/ServerboundInitializeRequestIdPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize +package dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientPreRunningPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientPreRunningPacketListener.kt index 9f538752..3ddca872 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientPreRunningPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientPreRunningPacketListener.kt @@ -2,6 +2,8 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientCommonPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundPreRunningFinishedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundProceedToSynchronizingPacket interface ClientPreRunningPacketListener : ClientCommonPacketListener { override val protocol get() = ConnectionProtocol.PRE_RUNNING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/PreRunningProtocols.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/PreRunningProtocols.kt index b59469fd..26e6034f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/PreRunningProtocols.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/PreRunningProtocols.kt @@ -5,7 +5,18 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.long.LongResponse import dev.slne.surf.cloud.api.common.netty.packet.createCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.core.common.netty.network.protocol.ProtocolInfoBuilder -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundleDelimiterPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundPongResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundleDelimiterPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundPingRequestPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundPreRunningFinishedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundProceedToSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundPreRunningAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundProceedToSynchronizingAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundRequestContinuation object PreRunningProtocols { val CLIENTBOUND_TEMPLATE = diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerPreRunningPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerPreRunningPacketListener.kt index 75a3fcb8..a8db0ad9 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerPreRunningPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerPreRunningPacketListener.kt @@ -2,6 +2,9 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ServerCommonPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundPreRunningAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundProceedToSynchronizingAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundRequestContinuation interface ServerPreRunningPacketListener : ServerCommonPacketListener { override val protocol get() = ConnectionProtocol.PRE_RUNNING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientboundPreRunningFinishedPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/clientbound/ClientboundPreRunningFinishedPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientboundPreRunningFinishedPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/clientbound/ClientboundPreRunningFinishedPacket.kt index 18b97d26..10f499e8 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientboundPreRunningFinishedPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/clientbound/ClientboundPreRunningFinishedPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning +package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientboundProceedToSynchronizingPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/clientbound/ClientboundProceedToSynchronizingPacket.kt similarity index 88% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientboundProceedToSynchronizingPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/clientbound/ClientboundProceedToSynchronizingPacket.kt index 3edae1b3..58ea2299 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ClientboundProceedToSynchronizingPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/clientbound/ClientboundProceedToSynchronizingPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning +package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -12,7 +12,7 @@ import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket PacketFlow.CLIENTBOUND, ConnectionProtocol.PRE_RUNNING ) -object ClientboundProceedToSynchronizingPacket: NettyPacket() { +object ClientboundProceedToSynchronizingPacket : NettyPacket() { val STREAM_CODEC = streamCodecUnitSimple(this) override val terminal = true } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundPreRunningAcknowledgedPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundPreRunningAcknowledgedPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundPreRunningAcknowledgedPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundPreRunningAcknowledgedPacket.kt index 15165dd5..4986e891 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundPreRunningAcknowledgedPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundPreRunningAcknowledgedPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning +package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundProceedToSynchronizingAcknowledgedPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundProceedToSynchronizingAcknowledgedPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundProceedToSynchronizingAcknowledgedPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundProceedToSynchronizingAcknowledgedPacket.kt index 91acbcdc..859546b6 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundProceedToSynchronizingAcknowledgedPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundProceedToSynchronizingAcknowledgedPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning +package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundRequestContinuation.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundRequestContinuation.kt similarity index 89% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundRequestContinuation.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundRequestContinuation.kt index 611d82f5..8a11301c 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/ServerboundRequestContinuation.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/prerunning/serverbound/ServerboundRequestContinuation.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning +package dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -12,6 +12,6 @@ import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket PacketFlow.SERVERBOUND, ConnectionProtocol.PRE_RUNNING ) -object ServerboundRequestContinuation: NettyPacket() { +object ServerboundRequestContinuation : NettyPacket() { val STREAM_CODEC = streamCodecUnitSimple(this) } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningClientPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningClientPacketListener.kt index 3011b165..0b2187c6 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningClientPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningClientPacketListener.kt @@ -3,7 +3,9 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.running import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientCommonPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.* interface RunningClientPacketListener : ClientCommonPacketListener { override val protocol get() = ConnectionProtocol.RUNNING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningProtocols.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningProtocols.kt index 63dbadc8..08bbc6e7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningProtocols.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningProtocols.kt @@ -4,7 +4,15 @@ import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.packet.createCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.core.common.netty.network.protocol.ProtocolInfoBuilder -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundleDelimiterPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundPongResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundPingRequestPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.* object RunningProtocols { val CLIENTBOUND_TEMPLATE = diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningServerPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningServerPacketListener.kt index edfa0f4a..7f0429e5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningServerPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RunningServerPacketListener.kt @@ -4,6 +4,19 @@ import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.core.common.netty.network.TickablePacketListener import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ServerCommonPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.DisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.PlayerConnectToServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.PlayerDisconnectFromServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestLuckpermsMetaDataPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestOfflineDisplayNamePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestPlayerPermissionPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SilentDisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.TeleportPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.TeleportPlayerToPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.UpdateAFKStatePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.* interface RunningServerPacketListener : ServerCommonPacketListener, TickablePacketListener { override val protocol get() = ConnectionProtocol.RUNNING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerDataPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerDataPacket.kt deleted file mode 100644 index 19cafe9e..00000000 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerDataPacket.kt +++ /dev/null @@ -1,220 +0,0 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running - -import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket -import dev.slne.surf.cloud.api.common.netty.network.codec.StreamDecoder -import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow -import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket -import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket -import dev.slne.surf.cloud.api.common.netty.packet.packetCodec -import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf -import dev.slne.surf.cloud.api.common.netty.protocol.buffer.readEnum -import dev.slne.surf.cloud.api.common.player.OfflineCloudPlayer -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundRequestPlayerDataPacket.DataRequestType -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundRequestPlayerDataResponse.* -import dev.slne.surf.cloud.core.common.player.playtime.PlaytimeImpl -import net.kyori.adventure.text.Component -import java.net.Inet4Address -import java.time.ZonedDateTime -import java.util.* -import kotlin.time.Duration -import dev.slne.surf.cloud.api.common.player.name.NameHistory as ApiNameHistory -import dev.slne.surf.cloud.api.common.player.playtime.Playtime as ApiPlaytime - -@SurfNettyPacket("cloud:request:player_data", PacketFlow.SERVERBOUND) -class ServerboundRequestPlayerDataPacket(val uuid: UUID, val type: DataRequestType) : - RespondingNettyPacket() { - - companion object { - val STREAM_CODEC = - packetCodec( - ServerboundRequestPlayerDataPacket::write, - ::ServerboundRequestPlayerDataPacket - ) - } - - private constructor(buf: SurfByteBuf) : this( - buf.readUuid(), - buf.readEnum() - ) - - private fun write(buf: SurfByteBuf) { - buf.writeUuid(uuid) - buf.writeEnum(type) - } - - enum class DataRequestType(val reader: StreamDecoder) { - LATEST_IP_ADDRESS(::IpAddress) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return IpAddress(player.latestIpAddress()) - } - }, - LAST_SERVER(::LastServer) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return LastServer(player.lastServerRaw()) - } - }, - LAST_SEEN(::LastSeen) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return LastSeen(player.lastSeen()) - } - }, - FIRST_SEEN(::FirstSeen) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return FirstSeen(player.firstSeen()) - } - }, - DISPLAY_NAME(::DisplayName) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return DisplayName(player.displayName()) - } - }, - NAME(::Name) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return Name(player.name()) - } - }, - NAME_HISTORY(::NameHistory) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return NameHistory(player.nameHistory()) - } - }, - PLAYTIME(::Playtime) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - return Playtime(player.playtime()) - } - }, - IS_AFK(::IsAFK) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - val player= player.player ?: error("Player is not online") - return IsAFK(player.isAfk()) - } - }, - PLAYTIME_SESSION(::PlaytimeSession) { - override suspend fun readData(player: OfflineCloudPlayer): DataResponse { - val player= player.player ?: error("Player is not online") - return PlaytimeSession(player.currentSessionDuration()) - } - }; - - abstract suspend fun readData(player: OfflineCloudPlayer): DataResponse - } -} - -@SurfNettyPacket("cloud:response:player_data", PacketFlow.CLIENTBOUND) -class ServerboundRequestPlayerDataResponse(val data: DataResponse) : ResponseNettyPacket() { - companion object { - val STREAM_CODEC = - packetCodec( - ServerboundRequestPlayerDataResponse::write, - ::ServerboundRequestPlayerDataResponse - ) - } - - private constructor(buf: SurfByteBuf) : this( - buf.readEnum().reader.decode(buf) - ) - - abstract class DataResponse(val type: DataRequestType) { - abstract fun write(buf: SurfByteBuf) - } - - private fun write(buf: SurfByteBuf) { - buf.writeEnum(data.type) - data.write(buf) - } - - - class IpAddress(val ip: Inet4Address?) : DataResponse(DataRequestType.LATEST_IP_ADDRESS) { - constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readInet4Address() }) - - override fun write(buf: SurfByteBuf) { - buf.writeNullable(ip) { buf, ip -> buf.writeInet4Address(ip) } - } - } - - class LastServer(val server: String?) : DataResponse(DataRequestType.LAST_SERVER) { - constructor(buf: SurfByteBuf) : this(buf.readNullableString()) - - override fun write(buf: SurfByteBuf) { - buf.writeNullable(server) - } - } - - class LastSeen(val lastSeen: ZonedDateTime?) : DataResponse(DataRequestType.LAST_SEEN) { - constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readZonedDateTime() }) - - override fun write(buf: SurfByteBuf) { - buf.writeNullable(lastSeen) { buf, dateTime -> buf.writeZonedDateTime(dateTime) } - } - } - - class FirstSeen(val firstSeen: ZonedDateTime?) : DataResponse(DataRequestType.FIRST_SEEN) { - constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readZonedDateTime() }) - - override fun write(buf: SurfByteBuf) { - buf.writeNullable(firstSeen) { buf, dateTime -> buf.writeZonedDateTime(dateTime) } - } - } - - class DisplayName(val displayName: Component?) : DataResponse(DataRequestType.DISPLAY_NAME) { - constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readComponent() }) - - override fun write(buf: SurfByteBuf) { - buf.writeNullable(displayName) { buf, name -> buf.writeComponent(name) } - } - } - - class Name(val name: String?) : DataResponse(DataRequestType.NAME) { - constructor(buf: SurfByteBuf) : this(buf.readNullableString()) - - override fun write(buf: SurfByteBuf) { - buf.writeNullable(name) - } - } - - class NameHistory(val history: ApiNameHistory) : DataResponse(DataRequestType.NAME_HISTORY) { - constructor(buf: SurfByteBuf) : this(ApiNameHistory.readFromByteBuf(buf)) - - override fun write(buf: SurfByteBuf) { - history.writeToByteBuf(buf) - } - } - - class Playtime(val playtime: ApiPlaytime) : DataResponse(DataRequestType.PLAYTIME) { - constructor(buf: SurfByteBuf) : this(PlaytimeImpl.readFromByteBuf(buf)) - - override fun write(buf: SurfByteBuf) { - playtime.writeToByteBuf(buf) - } - } - - class IsAFK(val isAfk: Boolean) : DataResponse(DataRequestType.IS_AFK) { - constructor(buf: SurfByteBuf) : this(buf.readBoolean()) - - override fun write(buf: SurfByteBuf) { - buf.writeBoolean(isAfk) - } - } - - class PlaytimeSession(val playtime: Duration) : DataResponse(DataRequestType.PLAYTIME_SESSION) { - constructor(buf: SurfByteBuf) : this(buf.readDuration()) - - override fun write(buf: SurfByteBuf) { - buf.writeDuration(playtime) - } - } -} - -inline fun DataResponse.getGenericValue(): T = when (this) { - is IpAddress -> check(T::class == Inet4Address::class) { "Expected Inet4Address" }.let { ip as T } - is LastServer -> check(T::class == String::class) { "Expected String" }.let { server as T } - is LastSeen -> check(T::class == ZonedDateTime::class) { "Expected ZonedDateTime" }.let { lastSeen as T } - is FirstSeen -> check(T::class == ZonedDateTime::class) { "Expected ZonedDateTime" }.let { firstSeen as T } - is DisplayName -> check(T::class == Component::class) { "Expected Component" }.let { displayName as T } - is Name -> check(T::class == String::class) { "Expected String" }.let { name as T } - is NameHistory -> check(T::class == ApiNameHistory::class) { "Expected ApiNameHistory" }.let { history as T } - is Playtime -> check(T::class == ApiPlaytime::class) { "Expected ApiPlaytime" }.let { playtime as T } - is IsAFK -> check(T::class == Boolean::class) { "Expected Boolean" }.let { isAfk as T } - is PlaytimeSession -> check(T::class == Duration::class) { "Expected Duration" }.let { playtime as T } - else -> error("Unknown DataResponse type: ${this::class.simpleName}") -} \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/DisconnectPlayerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/DisconnectPlayerPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/DisconnectPlayerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/DisconnectPlayerPacket.kt index 85e89bee..c27b67ff 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/DisconnectPlayerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/DisconnectPlayerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/LuckpermsMetaDataResponsePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/LuckpermsMetaDataResponsePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/LuckpermsMetaDataResponsePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/LuckpermsMetaDataResponsePacket.kt index 63bdf96e..05291f79 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/LuckpermsMetaDataResponsePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/LuckpermsMetaDataResponsePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/PlayerConnectToServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/PlayerConnectToServerPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/PlayerConnectToServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/PlayerConnectToServerPacket.kt index 1ad7bf09..cd67f5e0 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/PlayerConnectToServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/PlayerConnectToServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -44,4 +44,5 @@ data class PlayerConnectedToServerPacket( @SurfNettyPacket("cloud:response:connect_to_server", PacketFlow.BIDIRECTIONAL) @Serializable -class PlayerConnectToServerResponsePacket(val result: PrePlayerJoinTask.Result) : ResponseNettyPacket() \ No newline at end of file +class PlayerConnectToServerResponsePacket(val result: PrePlayerJoinTask.Result) : + ResponseNettyPacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/PlayerDisconnectFromServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/PlayerDisconnectFromServerPacket.kt similarity index 83% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/PlayerDisconnectFromServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/PlayerDisconnectFromServerPacket.kt index d9c6f0af..7c4cafd1 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/PlayerDisconnectFromServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/PlayerDisconnectFromServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -6,13 +6,14 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf -import java.util.UUID +import java.util.* @SurfNettyPacket(DefaultIds.PLAYER_DISCONNECT_FROM_SERVER_PACKET, PacketFlow.BIDIRECTIONAL) -class PlayerDisconnectFromServerPacket: NettyPacket { +class PlayerDisconnectFromServerPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(PlayerDisconnectFromServerPacket::write, ::PlayerDisconnectFromServerPacket) + val STREAM_CODEC = + packetCodec(PlayerDisconnectFromServerPacket::write, ::PlayerDisconnectFromServerPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestLuckpermsMetaDataPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestLuckpermsMetaDataPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestLuckpermsMetaDataPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestLuckpermsMetaDataPacket.kt index 0a51c0c4..7a201986 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestLuckpermsMetaDataPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestLuckpermsMetaDataPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestOfflineDisplayNamePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestOfflineDisplayNamePacket.kt similarity index 86% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestOfflineDisplayNamePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestOfflineDisplayNamePacket.kt index 1bb3434d..c3eb8ccd 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestOfflineDisplayNamePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestOfflineDisplayNamePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -15,7 +15,8 @@ class RequestOfflineDisplayNamePacket(val uuid: UUID) : private constructor(buf: SurfByteBuf) : this(buf.readUuid()) companion object { - val STREAM_CODEC = packetCodec(RequestOfflineDisplayNamePacket::write, ::RequestOfflineDisplayNamePacket) + val STREAM_CODEC = + packetCodec(RequestOfflineDisplayNamePacket::write, ::RequestOfflineDisplayNamePacket) } private fun write(buf: SurfByteBuf) { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestPlayerPermissionPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestPlayerPermissionPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestPlayerPermissionPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestPlayerPermissionPacket.kt index 62262298..89037411 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/RequestPlayerPermissionPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/RequestPlayerPermissionPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ResponseDisplayNamePacketRequestPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/ResponseDisplayNamePacketRequestPacket.kt similarity index 81% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ResponseDisplayNamePacketRequestPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/ResponseDisplayNamePacketRequestPacket.kt index c6876067..7e3d0682 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ResponseDisplayNamePacketRequestPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/ResponseDisplayNamePacketRequestPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -10,10 +10,13 @@ import net.kyori.adventure.text.Component import java.util.UUID @SurfNettyPacket(DefaultIds.RESPONSE_DISPLAY_NAME_PACKET_REQUEST_PACKET, PacketFlow.BIDIRECTIONAL) -class ResponseDisplayNamePacketRequestPacket: ResponseNettyPacket { +class ResponseDisplayNamePacketRequestPacket : ResponseNettyPacket { companion object { - val STREAM_CODEC = packetCodec(ResponseDisplayNamePacketRequestPacket::write, ::ResponseDisplayNamePacketRequestPacket) + val STREAM_CODEC = packetCodec( + ResponseDisplayNamePacketRequestPacket::write, + ::ResponseDisplayNamePacketRequestPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SilentDisconnectPlayerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SilentDisconnectPlayerPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SilentDisconnectPlayerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SilentDisconnectPlayerPacket.kt index 87b7f04f..6a81872e 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SilentDisconnectPlayerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SilentDisconnectPlayerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SyncSetDeltaPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SyncSetDeltaPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SyncSetDeltaPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SyncSetDeltaPacket.kt index 02e6889c..89f847d2 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SyncSetDeltaPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SyncSetDeltaPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SyncValueChangePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SyncValueChangePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SyncValueChangePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SyncValueChangePacket.kt index 1981781a..5a76da55 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/SyncValueChangePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/SyncValueChangePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerPacket.kt index 70b1e0d3..61f5ce43 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerResultPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerResultPacket.kt similarity index 82% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerResultPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerResultPacket.kt index 89e11ad2..de2d01cc 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerResultPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerResultPacket.kt @@ -1,16 +1,11 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow -import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf -import net.kyori.adventure.text.Component -import okhttp3.Response -import java.util.* @SurfNettyPacket(DefaultIds.BIDIRECTIONAL_TELEPORT_PLAYER_RESULT, PacketFlow.BIDIRECTIONAL) class TeleportPlayerResultPacket : ResponseNettyPacket { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerToPlayerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerToPlayerPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerToPlayerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerToPlayerPacket.kt index dc075825..f2773ea5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/TeleportPlayerToPlayerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/TeleportPlayerToPlayerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/UpdateAFKStatePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/UpdateAFKStatePacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/UpdateAFKStatePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/UpdateAFKStatePacket.kt index 868c359e..5f68a780 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/UpdateAFKStatePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/bidirectional/UpdateAFKStatePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundAddPlayerToServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundAddPlayerToServerPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundAddPlayerToServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundAddPlayerToServerPacket.kt index 723a8d65..7d2faad8 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundAddPlayerToServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundAddPlayerToServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundBatchUpdateServer.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundBatchUpdateServer.kt similarity index 99% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundBatchUpdateServer.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundBatchUpdateServer.kt index 793c849a..487c35df 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundBatchUpdateServer.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundBatchUpdateServer.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundClearResourcePacksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundClearResourcePacksPacket.kt similarity index 78% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundClearResourcePacksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundClearResourcePacksPacket.kt index b8719ce3..08f893e0 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundClearResourcePacksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundClearResourcePacksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,13 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_CLEAR_RESOURCE_PACKS_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundClearResourcePacksPacket: NettyPacket { +class ClientboundClearResourcePacksPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundClearResourcePacksPacket::write, ::ClientboundClearResourcePacksPacket) + val STREAM_CODEC = packetCodec( + ClientboundClearResourcePacksPacket::write, + ::ClientboundClearResourcePacksPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundClearTitlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundClearTitlePacket.kt similarity index 81% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundClearTitlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundClearTitlePacket.kt index df0d82cd..2909b71f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundClearTitlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundClearTitlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,11 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_CLEAR_TITLE_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundClearTitlePacket: NettyPacket { +class ClientboundClearTitlePacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundClearTitlePacket::write, ::ClientboundClearTitlePacket) + val STREAM_CODEC = + packetCodec(ClientboundClearTitlePacket::write, ::ClientboundClearTitlePacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundConnectPlayerToServerResponse.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundConnectPlayerToServerResponse.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundConnectPlayerToServerResponse.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundConnectPlayerToServerResponse.kt index 6006f374..9db55dd9 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundConnectPlayerToServerResponse.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundConnectPlayerToServerResponse.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundDisconnectPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundDisconnectPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundDisconnectPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundDisconnectPacket.kt index 6b847d67..0bd0f1df 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundDisconnectPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundDisconnectPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundHideBossBarPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundHideBossBarPacket.kt similarity index 73% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundHideBossBarPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundHideBossBarPacket.kt index 666b821d..d24acbad 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundHideBossBarPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundHideBossBarPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,26 +11,27 @@ import net.kyori.adventure.bossbar.BossBar import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_HIDE_BOSS_BAR_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundHideBossBarPacket : NettyPacket{ +class ClientboundHideBossBarPacket : NettyPacket { - companion object{ - val STREAM_CODEC = packetCodec(ClientboundHideBossBarPacket::write, ::ClientboundHideBossBarPacket) + companion object { + val STREAM_CODEC = + packetCodec(ClientboundHideBossBarPacket::write, ::ClientboundHideBossBarPacket) } val uuid: UUID val bossBar: BossBar - constructor(uuid: UUID, bossBar: BossBar){ + constructor(uuid: UUID, bossBar: BossBar) { this.uuid = uuid this.bossBar = bossBar } - private constructor(buf: SurfByteBuf){ + private constructor(buf: SurfByteBuf) { this.uuid = buf.readUuid() this.bossBar = ExtraCodecs.STREAM_BOSSBAR_CODEC.decode(buf) } - private fun write(buf: SurfByteBuf){ + private fun write(buf: SurfByteBuf) { buf.writeUuid(uuid) ExtraCodecs.STREAM_BOSSBAR_CODEC.encode(buf, bossBar) } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundIsServerManagedByThisProxyPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundIsServerManagedByThisProxyPacket.kt similarity index 89% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundIsServerManagedByThisProxyPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundIsServerManagedByThisProxyPacket.kt index 9d988612..56e16597 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundIsServerManagedByThisProxyPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundIsServerManagedByThisProxyPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -6,6 +6,7 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundIsServerManagedByThisProxyResponse import java.net.InetSocketAddress @SurfNettyPacket( diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundOpenBookPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundOpenBookPacket.kt similarity index 85% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundOpenBookPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundOpenBookPacket.kt index 8d6b555a..3387e087 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundOpenBookPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundOpenBookPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,11 @@ import net.kyori.adventure.inventory.Book import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_OPEN_BOOK_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundOpenBookPacket: NettyPacket { +class ClientboundOpenBookPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundOpenBookPacket::write, ::ClientboundOpenBookPacket) + val STREAM_CODEC = + packetCodec(ClientboundOpenBookPacket::write, ::ClientboundOpenBookPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPingPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPingPacket.kt similarity index 92% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPingPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPingPacket.kt index 4c550d2b..cabbd3c7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPingPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPingPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -13,9 +13,9 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf * packet with the same id. */ @SurfNettyPacket(DefaultIds.CLIENTBOUND_PING_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundPingPacket: NettyPacket { +class ClientboundPingPacket : NettyPacket { - companion object{ + companion object { @JvmStatic val STREAM_CODEC = packetCodec(ClientboundPingPacket::write, ::ClientboundPingPacket) } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPlaySoundPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPlaySoundPacket.kt similarity index 95% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPlaySoundPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPlaySoundPacket.kt index 551bf38c..30f0d1e5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPlaySoundPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPlaySoundPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -14,7 +14,8 @@ import java.util.* class ClientboundPlaySoundPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundPlaySoundPacket::write, ::ClientboundPlaySoundPacket) + val STREAM_CODEC = + packetCodec(ClientboundPlaySoundPacket::write, ::ClientboundPlaySoundPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPlayerPersistentDataContainerResponse.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPlayerPersistentDataContainerResponse.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPlayerPersistentDataContainerResponse.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPlayerPersistentDataContainerResponse.kt index 3821cdf6..2f0b8f2f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundPlayerPersistentDataContainerResponse.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundPlayerPersistentDataContainerResponse.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRegisterCloudServersToProxyPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRegisterCloudServersToProxyPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRegisterCloudServersToProxyPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRegisterCloudServersToProxyPacket.kt index 02c703b2..a3af3682 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRegisterCloudServersToProxyPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRegisterCloudServersToProxyPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRegisterServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRegisterServerPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRegisterServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRegisterServerPacket.kt index f3ccbb4b..901afbca 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRegisterServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRegisterServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRemovePlayerFromServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRemovePlayerFromServerPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRemovePlayerFromServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRemovePlayerFromServerPacket.kt index f2fa6689..4f60f758 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRemovePlayerFromServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRemovePlayerFromServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRemoveResourcePacksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRemoveResourcePacksPacket.kt similarity index 82% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRemoveResourcePacksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRemoveResourcePacksPacket.kt index 2487826a..992f9279 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRemoveResourcePacksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRemoveResourcePacksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,13 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_REMOVE_RESOURCE_PACKS_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundRemoveResourcePacksPacket: NettyPacket { +class ClientboundRemoveResourcePacksPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundRemoveResourcePacksPacket::write, ::ClientboundRemoveResourcePacksPacket) + val STREAM_CODEC = packetCodec( + ClientboundRemoveResourcePacksPacket::write, + ::ClientboundRemoveResourcePacksPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRequestDisplayNamePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRequestDisplayNamePacket.kt similarity index 67% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRequestDisplayNamePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRequestDisplayNamePacket.kt index e7e38ce8..18c1362d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRequestDisplayNamePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRequestDisplayNamePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -6,13 +6,18 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.ResponseDisplayNamePacketRequestPacket import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_REQUEST_DISPLAY_NAME_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundRequestDisplayNamePacket: RespondingNettyPacket { +class ClientboundRequestDisplayNamePacket : + RespondingNettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundRequestDisplayNamePacket::write, ::ClientboundRequestDisplayNamePacket) + val STREAM_CODEC = packetCodec( + ClientboundRequestDisplayNamePacket::write, + ::ClientboundRequestDisplayNamePacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundResetTitlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundResetTitlePacket.kt similarity index 81% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundResetTitlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundResetTitlePacket.kt index 0f8b079c..dc0d5b2a 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundResetTitlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundResetTitlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,11 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_RESET_TITLE_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundResetTitlePacket: NettyPacket { +class ClientboundResetTitlePacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundResetTitlePacket::write, ::ClientboundResetTitlePacket) + val STREAM_CODEC = + packetCodec(ClientboundResetTitlePacket::write, ::ClientboundResetTitlePacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRunPrePlayerJoinTasksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRunPrePlayerJoinTasksPacket.kt similarity index 93% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRunPrePlayerJoinTasksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRunPrePlayerJoinTasksPacket.kt index ded22a3a..19e7a5bc 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundRunPrePlayerJoinTasksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundRunPrePlayerJoinTasksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow @@ -16,4 +16,5 @@ class ClientboundRunPrePlayerJoinTasksPacket(val uuid: @Contextual UUID) : @SurfNettyPacket("cloud:response:run_pre_player_join_tasks", PacketFlow.SERVERBOUND) @Serializable -class RunPrePlayerJoinTasksResultPacket(val result: PrePlayerJoinTask.Result) : ResponseNettyPacket() \ No newline at end of file +class RunPrePlayerJoinTasksResultPacket(val result: PrePlayerJoinTask.Result) : + ResponseNettyPacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendActionBarPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendActionBarPacket.kt similarity index 84% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendActionBarPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendActionBarPacket.kt index 83af8bdc..93344375 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendActionBarPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendActionBarPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -10,9 +10,10 @@ import net.kyori.adventure.text.Component import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_ACTION_BAR_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundSendActionBarPacket: NettyPacket { +class ClientboundSendActionBarPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundSendActionBarPacket::write, ::ClientboundSendActionBarPacket) + val STREAM_CODEC = + packetCodec(ClientboundSendActionBarPacket::write, ::ClientboundSendActionBarPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendMessagePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendMessagePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendMessagePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendMessagePacket.kt index a53d10cc..513e40eb 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendMessagePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendMessagePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendPlayerListHeaderAndFooterPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendPlayerListHeaderAndFooterPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendPlayerListHeaderAndFooterPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendPlayerListHeaderAndFooterPacket.kt index 2122e3da..4476fd12 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendPlayerListHeaderAndFooterPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendPlayerListHeaderAndFooterPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendResourcePacksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendResourcePacksPacket.kt similarity index 84% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendResourcePacksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendResourcePacksPacket.kt index e13e2a4a..8fcf7348 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendResourcePacksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendResourcePacksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,13 @@ import net.kyori.adventure.resource.ResourcePackRequest import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_SEND_RESOURCE_PACKS_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundSendResourcePacksPacket: NettyPacket { +class ClientboundSendResourcePacksPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundSendResourcePacksPacket::write, ::ClientboundSendResourcePacksPacket) + val STREAM_CODEC = packetCodec( + ClientboundSendResourcePacksPacket::write, + ::ClientboundSendResourcePacksPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendTitlePartPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendTitlePartPacket.kt similarity index 86% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendTitlePartPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendTitlePartPacket.kt index 89f785c7..6ad4dd63 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundSendTitlePartPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundSendTitlePartPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -13,10 +13,11 @@ import net.kyori.adventure.title.TitlePart import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_TITLE_PART_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundSendTitlePartPacket: NettyPacket { +class ClientboundSendTitlePartPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundSendTitlePartPacket::write, ::ClientboundSendTitlePartPacket) + val STREAM_CODEC = + packetCodec(ClientboundSendTitlePartPacket::write, ::ClientboundSendTitlePartPacket) } val uuid: UUID @@ -44,7 +45,11 @@ class ClientboundSendTitlePartPacket: NettyPacket { ExtraCodecs.STREAM_TITLE_PART_CODEC.encode(buf, titlePart) when (titlePart) { TitlePart.TITLE, TitlePart.SUBTITLE -> buf.writeComponent(value as Component) - TitlePart.TIMES -> ExtraCodecs.TITLE_TIMES_STREAM_CODEC.encode(buf, value as Title.Times) + TitlePart.TIMES -> ExtraCodecs.TITLE_TIMES_STREAM_CODEC.encode( + buf, + value as Title.Times + ) + else -> error("Unknown title part: $titlePart") } } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundShowBossBarPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundShowBossBarPacket.kt similarity index 85% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundShowBossBarPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundShowBossBarPacket.kt index dc5a2c47..907fdaf7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundShowBossBarPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundShowBossBarPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,11 @@ import net.kyori.adventure.bossbar.BossBar import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_SHOW_BOSS_BAR_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundShowBossBarPacket : NettyPacket{ +class ClientboundShowBossBarPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundShowBossBarPacket::write, ::ClientboundShowBossBarPacket) + val STREAM_CODEC = + packetCodec(ClientboundShowBossBarPacket::write, ::ClientboundShowBossBarPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundShowTitlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundShowTitlePacket.kt similarity index 89% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundShowTitlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundShowTitlePacket.kt index 6306ec4f..93d0a8d5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundShowTitlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundShowTitlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -14,7 +14,8 @@ import java.util.* class ClientboundShowTitlePacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundShowTitlePacket::write, ::ClientboundShowTitlePacket) + val STREAM_CODEC = + packetCodec(ClientboundShowTitlePacket::write, ::ClientboundShowTitlePacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundStopSoundPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundStopSoundPacket.kt similarity index 86% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundStopSoundPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundStopSoundPacket.kt index d5d9b084..e4ea1e82 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundStopSoundPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundStopSoundPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,11 @@ import net.kyori.adventure.sound.SoundStop import java.util.UUID @SurfNettyPacket(DefaultIds.CLIENTBOUND_STOP_SOUND_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundStopSoundPacket: NettyPacket { +class ClientboundStopSoundPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundStopSoundPacket::write, ::ClientboundStopSoundPacket) + val STREAM_CODEC = + packetCodec(ClientboundStopSoundPacket::write, ::ClientboundStopSoundPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTransferPlayerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTransferPlayerPacket.kt similarity index 90% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTransferPlayerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTransferPlayerPacket.kt index 14b8c863..530ebc14 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTransferPlayerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTransferPlayerPacket.kt @@ -1,12 +1,12 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket -import dev.slne.surf.cloud.api.common.meta.SurfNettyPacketHandler import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse import java.net.InetSocketAddress import java.util.* diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerPunishmentCreatedEventPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerPunishmentCreatedEventPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerPunishmentCreatedEventPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerPunishmentCreatedEventPacket.kt index a1dd00ec..65065d1d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerPunishmentCreatedEventPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerPunishmentCreatedEventPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerPunishmentUpdateEventPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerPunishmentUpdateEventPacket.kt similarity index 95% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerPunishmentUpdateEventPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerPunishmentUpdateEventPacket.kt index 1e3c05ed..60a6348e 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerPunishmentUpdateEventPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerPunishmentUpdateEventPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.event.offlineplayer.punishment.CloudPlayerPunishmentUpdatedEvent import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -12,4 +12,4 @@ import kotlinx.serialization.Serializable data class ClientboundTriggerPunishmentUpdateEventPacket( val updatedPunishment: AbstractPunishment, val operation: CloudPlayerPunishmentUpdatedEvent.Operation -): NettyPacket() \ No newline at end of file +) : NettyPacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerShutdownPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerShutdownPacket.kt similarity index 87% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerShutdownPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerShutdownPacket.kt index 9aca43e1..4757cc80 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundTriggerShutdownPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundTriggerShutdownPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -10,6 +10,6 @@ import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket DefaultIds.CLIENTBOUND_SHUTDOWN_PACKET, PacketFlow.CLIENTBOUND ) -object ClientboundTriggerShutdownPacket: NettyPacket() { +object ClientboundTriggerShutdownPacket : NettyPacket() { val STREAM_CODEC = streamCodecUnitSimple(this) } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundUnregisterServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundUnregisterServerPacket.kt similarity index 78% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundUnregisterServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundUnregisterServerPacket.kt index 883e07f2..23ffa430 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundUnregisterServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundUnregisterServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -8,10 +8,13 @@ import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf @SurfNettyPacket(DefaultIds.CLIENTBOUND_UNREGISTER_SERVER_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundUnregisterServerPacket: NettyPacket { +class ClientboundUnregisterServerPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundUnregisterServerPacket::write, ::ClientboundUnregisterServerPacket) + val STREAM_CODEC = packetCodec( + ClientboundUnregisterServerPacket::write, + ::ClientboundUnregisterServerPacket + ) } val serverId: Long diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundUpdateServerInformationPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundUpdateServerInformationPacket.kt similarity index 65% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundUpdateServerInformationPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundUpdateServerInformationPacket.kt index 2e8abebf..338c20e5 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ClientboundUpdateServerInformationPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/clientbound/ClientboundUpdateServerInformationPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -6,12 +6,16 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ClientInformation @SurfNettyPacket(DefaultIds.CLIENTBOUND_UPDATE_SERVER_INFORMATION_PACKET, PacketFlow.CLIENTBOUND) -class ClientboundUpdateServerInformationPacket: NettyPacket { +class ClientboundUpdateServerInformationPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ClientboundUpdateServerInformationPacket::write, ::ClientboundUpdateServerInformationPacket) + val STREAM_CODEC = packetCodec( + ClientboundUpdateServerInformationPacket::write, + ::ClientboundUpdateServerInformationPacket + ) } val serverId: Long @@ -24,11 +28,11 @@ class ClientboundUpdateServerInformationPacket: NettyPacket { private constructor(buf: SurfByteBuf) { serverId = buf.readVarLong() - information = ClientInformation.STREAM_CODEC.decode(buf) + information = ClientInformation.Companion.STREAM_CODEC.decode(buf) } private fun write(buf: SurfByteBuf) { buf.writeVarLong(serverId) - ClientInformation.STREAM_CODEC.encode(buf, information) + ClientInformation.Companion.STREAM_CODEC.encode(buf, information) } } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundAttachIpAddressToBanPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundAttachIpAddressToBanPacket.kt similarity index 87% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundAttachIpAddressToBanPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundAttachIpAddressToBanPacket.kt index 8e716bba..776bbd80 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundAttachIpAddressToBanPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundAttachIpAddressToBanPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow @@ -7,4 +7,5 @@ import kotlinx.serialization.Serializable @Serializable @SurfNettyPacket("cloud:serverbound:attach_ip_address_to_ban", PacketFlow.SERVERBOUND) -data class ServerboundAttachIpAddressToBanPacket(val banId: Long, val rawIp: String): BooleanResponsePacket() \ No newline at end of file +data class ServerboundAttachIpAddressToBanPacket(val banId: Long, val rawIp: String) : + BooleanResponsePacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundAttachNotePunishment.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundAttachNotePunishment.kt similarity index 82% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundAttachNotePunishment.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundAttachNotePunishment.kt index 7a235a93..8399c088 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundAttachNotePunishment.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundAttachNotePunishment.kt @@ -1,11 +1,10 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket import dev.slne.surf.cloud.api.common.player.punishment.type.PunishmentType -import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote.PunishmentNoteImpl import kotlinx.serialization.Serializable @@ -15,8 +14,9 @@ data class ServerboundAttachNoteToPunishmentPacket( val punishmentId: Long, val note: String, val punishType: PunishmentType -): RespondingNettyPacket() +) : RespondingNettyPacket() @Serializable @SurfNettyPacket("cloud:clientbound:attached_note_punishment", PacketFlow.CLIENTBOUND) -class ClientboundAttachedNoteToPunishmentResponse(val note: PunishmentNoteImpl): ResponseNettyPacket() \ No newline at end of file +class ClientboundAttachedNoteToPunishmentResponse(val note: PunishmentNoteImpl) : + ResponseNettyPacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundBroadcastPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundBroadcastPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundBroadcastPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundBroadcastPacket.kt index e5b00118..f84ab4b7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundBroadcastPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundBroadcastPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClearResourcePacksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClearResourcePacksPacket.kt similarity index 78% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClearResourcePacksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClearResourcePacksPacket.kt index ce3a026b..1598e32c 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClearResourcePacksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClearResourcePacksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,13 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_CLEAR_RESOURCE_PACKS_PACKET, PacketFlow.SERVERBOUND) -class ServerboundClearResourcePacksPacket: NettyPacket { +class ServerboundClearResourcePacksPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundClearResourcePacksPacket::write, ::ServerboundClearResourcePacksPacket) + val STREAM_CODEC = packetCodec( + ServerboundClearResourcePacksPacket::write, + ::ServerboundClearResourcePacksPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClearTitlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClearTitlePacket.kt similarity index 81% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClearTitlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClearTitlePacket.kt index ecef3559..13902eda 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClearTitlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClearTitlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,11 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_CLEAR_TITLE_PACKET, PacketFlow.SERVERBOUND) -class ServerboundClearTitlePacket: NettyPacket { +class ServerboundClearTitlePacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundClearTitlePacket::write, ::ServerboundClearTitlePacket) + val STREAM_CODEC = + packetCodec(ServerboundClearTitlePacket::write, ::ServerboundClearTitlePacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClientInformationPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClientInformationPacket.kt similarity index 99% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClientInformationPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClientInformationPacket.kt index 213538e4..0fe63ee7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundClientInformationPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundClientInformationPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundConnectPlayerToServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundConnectPlayerToServerPacket.kt similarity index 84% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundConnectPlayerToServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundConnectPlayerToServerPacket.kt index 10bf56c1..bbfd801f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundConnectPlayerToServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundConnectPlayerToServerPacket.kt @@ -1,9 +1,10 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundConnectPlayerToServerResponse import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable import java.util.* diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt similarity index 71% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt index cfdf024b..b90f6456 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundCreateOfflineCloudPlayerIfNotExistsPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow @@ -7,6 +7,10 @@ import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable import java.util.* -@SurfNettyPacket("cloud:clientbound:create_offline_cloud_player_if_not_exists", PacketFlow.SERVERBOUND) +@SurfNettyPacket( + "cloud:clientbound:create_offline_cloud_player_if_not_exists", + PacketFlow.SERVERBOUND +) @Serializable -class ServerboundCreateOfflineCloudPlayerIfNotExistsPacket(val uuid: @Contextual UUID): NettyPacket() \ No newline at end of file +class ServerboundCreateOfflineCloudPlayerIfNotExistsPacket(val uuid: @Contextual UUID) : + NettyPacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundCreatePunishmentPackets.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundCreatePunishmentPackets.kt similarity index 99% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundCreatePunishmentPackets.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundCreatePunishmentPackets.kt index d8b97125..b070c59e 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundCreatePunishmentPackets.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundCreatePunishmentPackets.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchIpAddressesForBanPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchIpAddressesForBanPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchIpAddressesForBanPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchIpAddressesForBanPacket.kt index 6c4359c6..b7d2082c 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchIpAddressesForBanPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchIpAddressesForBanPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchNotesFromPunishmentPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchNotesFromPunishmentPacket.kt similarity index 82% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchNotesFromPunishmentPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchNotesFromPunishmentPacket.kt index ff7e1453..74c7d304 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchNotesFromPunishmentPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchNotesFromPunishmentPacket.kt @@ -1,11 +1,10 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket import dev.slne.surf.cloud.api.common.player.punishment.type.PunishmentType -import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote.PunishmentNoteImpl import kotlinx.serialization.Serializable @@ -14,8 +13,9 @@ import kotlinx.serialization.Serializable data class ServerboundFetchNotesFromPunishmentPacket( val punishmentId: Long, val punishType: PunishmentType -): RespondingNettyPacket() +) : RespondingNettyPacket() @Serializable @SurfNettyPacket("cloud:clientbound:fetch_notes_from_punishment_response", PacketFlow.CLIENTBOUND) -data class ClientboundFetchNotesFromPunishmentResponse(val notes: List): ResponseNettyPacket() \ No newline at end of file +data class ClientboundFetchNotesFromPunishmentResponse(val notes: List) : + ResponseNettyPacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchPunishmentPackets.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchPunishmentPackets.kt similarity index 99% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchPunishmentPackets.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchPunishmentPackets.kt index aaf151f2..9b4c9976 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundFetchPunishmentPackets.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundFetchPunishmentPackets.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundGeneratePunishmentIdPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundGeneratePunishmentIdPacket.kt similarity index 83% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundGeneratePunishmentIdPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundGeneratePunishmentIdPacket.kt index d05ba6b1..782fa59a 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundGeneratePunishmentIdPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundGeneratePunishmentIdPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow @@ -7,4 +7,4 @@ import kotlinx.serialization.Serializable @Serializable @SurfNettyPacket("cloud:serverbound:generate_punishment_id", PacketFlow.SERVERBOUND) -class ServerboundGeneratePunishmentIdPacket: StringResponsePacket() \ No newline at end of file +class ServerboundGeneratePunishmentIdPacket : StringResponsePacket() \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt index e34d99ce..fd7430e2 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundGetCurrentLoginValidationPunishmentCachePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundHideBossBarPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundHideBossBarPacket.kt similarity index 73% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundHideBossBarPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundHideBossBarPacket.kt index b5632340..23a96e31 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundHideBossBarPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundHideBossBarPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,26 +11,27 @@ import net.kyori.adventure.bossbar.BossBar import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_HIDE_BOSS_BAR_PACKET, PacketFlow.SERVERBOUND) -class ServerboundHideBossBarPacket : NettyPacket{ +class ServerboundHideBossBarPacket : NettyPacket { - companion object{ - val STREAM_CODEC = packetCodec(ServerboundHideBossBarPacket::write, ::ServerboundHideBossBarPacket) + companion object { + val STREAM_CODEC = + packetCodec(ServerboundHideBossBarPacket::write, ::ServerboundHideBossBarPacket) } val uuid: UUID val bossBar: BossBar - constructor(uuid: UUID, bossBar: BossBar){ + constructor(uuid: UUID, bossBar: BossBar) { this.uuid = uuid this.bossBar = bossBar } - private constructor(buf: SurfByteBuf){ + private constructor(buf: SurfByteBuf) { this.uuid = buf.readUuid() this.bossBar = ExtraCodecs.STREAM_BOSSBAR_CODEC.decode(buf) } - private fun write(buf: SurfByteBuf){ + private fun write(buf: SurfByteBuf) { buf.writeUuid(uuid) ExtraCodecs.STREAM_BOSSBAR_CODEC.encode(buf, bossBar) } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundIsServerManagedByThisProxyResponse.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundIsServerManagedByThisProxyResponse.kt similarity index 88% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundIsServerManagedByThisProxyResponse.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundIsServerManagedByThisProxyResponse.kt index f6634fd5..d1e5f342 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundIsServerManagedByThisProxyResponse.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundIsServerManagedByThisProxyResponse.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -7,7 +7,10 @@ import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf -@SurfNettyPacket(DefaultIds.CLIENTBOUND_IS_SERVER_MANAGED_BY_THIS_PROXY_RESPONSE, PacketFlow.SERVERBOUND) +@SurfNettyPacket( + DefaultIds.CLIENTBOUND_IS_SERVER_MANAGED_BY_THIS_PROXY_RESPONSE, + PacketFlow.SERVERBOUND +) class ServerboundIsServerManagedByThisProxyResponse : ResponseNettyPacket { companion object { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundOpenBookPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundOpenBookPacket.kt similarity index 85% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundOpenBookPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundOpenBookPacket.kt index 1c6243f0..242a36e9 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundOpenBookPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundOpenBookPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,11 @@ import net.kyori.adventure.inventory.Book import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_OPEN_BOOK_PACKET, PacketFlow.SERVERBOUND) -class ServerboundOpenBookPacket: NettyPacket { +class ServerboundOpenBookPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundOpenBookPacket::write, ::ServerboundOpenBookPacket) + val STREAM_CODEC = + packetCodec(ServerboundOpenBookPacket::write, ::ServerboundOpenBookPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPlaySoundPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPlaySoundPacket.kt similarity index 89% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPlaySoundPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPlaySoundPacket.kt index 530af91d..71d572c4 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPlaySoundPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPlaySoundPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -14,7 +14,8 @@ import java.util.UUID class ServerboundPlaySoundPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundPlaySoundPacket::write, ::ServerboundPlaySoundPacket) + val STREAM_CODEC = + packetCodec(ServerboundPlaySoundPacket::write, ::ServerboundPlaySoundPacket) } val uuid: UUID @@ -47,7 +48,14 @@ class ServerboundPlaySoundPacket : NettyPacket { this.permission = permission } - constructor(uuid: UUID, sound: Sound, x: Double, y: Double, z: Double, permission: String? = null) { + constructor( + uuid: UUID, + sound: Sound, + x: Double, + y: Double, + z: Double, + permission: String? = null + ) { this.uuid = uuid this.sound = sound this.emitter = null diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPlayerPersistentDataContainerUpdatePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPlayerPersistentDataContainerUpdatePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPlayerPersistentDataContainerUpdatePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPlayerPersistentDataContainerUpdatePacket.kt index a4c384c4..7d6d3cf7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPlayerPersistentDataContainerUpdatePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPlayerPersistentDataContainerUpdatePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPongPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPongPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPongPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPongPacket.kt index a0d4d09d..fe6acbdf 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPongPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPongPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPullPlayersToGroupPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPullPlayersToGroupPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPullPlayersToGroupPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPullPlayersToGroupPacket.kt index a5fe588f..4efbf08a 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundPullPlayersToGroupPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundPullPlayersToGroupPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundQueuePlayerToGroupPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundQueuePlayerToGroupPacket.kt similarity index 83% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundQueuePlayerToGroupPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundQueuePlayerToGroupPacket.kt index e1a330b7..009d83ab 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundQueuePlayerToGroupPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundQueuePlayerToGroupPacket.kt @@ -1,9 +1,10 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundConnectPlayerToServerResponse import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable import java.util.* diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRemoveResourcePacksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRemoveResourcePacksPacket.kt similarity index 82% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRemoveResourcePacksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRemoveResourcePacksPacket.kt index e40efc05..0c5323f7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRemoveResourcePacksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRemoveResourcePacksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,13 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_REMOVE_RESOURCE_PACKS_PACKET, PacketFlow.SERVERBOUND) -class ServerboundRemoveResourcePacksPacket: NettyPacket { +class ServerboundRemoveResourcePacksPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundRemoveResourcePacksPacket::write, ::ServerboundRemoveResourcePacksPacket) + val STREAM_CODEC = packetCodec( + ServerboundRemoveResourcePacksPacket::write, + ::ServerboundRemoveResourcePacksPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestDisplayNamePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestDisplayNamePacket.kt similarity index 67% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestDisplayNamePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestDisplayNamePacket.kt index d8568f0b..a4597d31 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestDisplayNamePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestDisplayNamePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -6,13 +6,18 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.ResponseDisplayNamePacketRequestPacket import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_REQUEST_DISPLAY_NAME_PACKET, PacketFlow.SERVERBOUND) -class ServerboundRequestDisplayNamePacket: RespondingNettyPacket { +class ServerboundRequestDisplayNamePacket : + RespondingNettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundRequestDisplayNamePacket::write, ::ServerboundRequestDisplayNamePacket) + val STREAM_CODEC = packetCodec( + ServerboundRequestDisplayNamePacket::write, + ::ServerboundRequestDisplayNamePacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerDataPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerDataPacket.kt new file mode 100644 index 00000000..c868a3ac --- /dev/null +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerDataPacket.kt @@ -0,0 +1,230 @@ +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound + +import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket +import dev.slne.surf.cloud.api.common.netty.network.codec.StreamDecoder +import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow +import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket +import dev.slne.surf.cloud.api.common.netty.packet.ResponseNettyPacket +import dev.slne.surf.cloud.api.common.netty.packet.packetCodec +import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.api.common.netty.protocol.buffer.readEnum +import dev.slne.surf.cloud.api.common.player.OfflineCloudPlayer +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundRequestPlayerDataResponse.* +import dev.slne.surf.cloud.core.common.player.playtime.PlaytimeImpl +import net.kyori.adventure.text.Component +import java.net.Inet4Address +import java.time.ZonedDateTime +import java.util.* +import kotlin.time.Duration +import dev.slne.surf.cloud.api.common.player.name.NameHistory as ApiNameHistory +import dev.slne.surf.cloud.api.common.player.playtime.Playtime as ApiPlaytime + +@SurfNettyPacket("cloud:request:player_data", PacketFlow.SERVERBOUND) +class ServerboundRequestPlayerDataPacket(val uuid: UUID, val type: DataRequestType) : + RespondingNettyPacket() { + + companion object { + val STREAM_CODEC = + packetCodec( + ServerboundRequestPlayerDataPacket::write, + ::ServerboundRequestPlayerDataPacket + ) + } + + private constructor(buf: SurfByteBuf) : this( + buf.readUuid(), + buf.readEnum() + ) + + private fun write(buf: SurfByteBuf) { + buf.writeUuid(uuid) + buf.writeEnum(type) + } + + enum class DataRequestType(val reader: StreamDecoder) { + LATEST_IP_ADDRESS(ServerboundRequestPlayerDataResponse::IpAddress) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.IpAddress(player.latestIpAddress()) + } + }, + LAST_SERVER(ServerboundRequestPlayerDataResponse::LastServer) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.LastServer(player.lastServerRaw()) + } + }, + LAST_SEEN(ServerboundRequestPlayerDataResponse::LastSeen) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.LastSeen(player.lastSeen()) + } + }, + FIRST_SEEN(ServerboundRequestPlayerDataResponse::FirstSeen) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.FirstSeen(player.firstSeen()) + } + }, + DISPLAY_NAME(ServerboundRequestPlayerDataResponse::DisplayName) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.DisplayName(player.displayName()) + } + }, + NAME(ServerboundRequestPlayerDataResponse::Name) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.Name(player.name()) + } + }, + NAME_HISTORY(ServerboundRequestPlayerDataResponse::NameHistory) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.NameHistory(player.nameHistory()) + } + }, + PLAYTIME(ServerboundRequestPlayerDataResponse::Playtime) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + return ServerboundRequestPlayerDataResponse.Playtime(player.playtime()) + } + }, + IS_AFK(ServerboundRequestPlayerDataResponse::IsAFK) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + val player = player.player ?: error("Player is not online") + return ServerboundRequestPlayerDataResponse.IsAFK(player.isAfk()) + } + }, + PLAYTIME_SESSION(ServerboundRequestPlayerDataResponse::PlaytimeSession) { + override suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse { + val player = player.player ?: error("Player is not online") + return ServerboundRequestPlayerDataResponse.PlaytimeSession(player.currentSessionDuration()) + } + }; + + abstract suspend fun readData(player: OfflineCloudPlayer): ServerboundRequestPlayerDataResponse.DataResponse + } +} + +@SurfNettyPacket("cloud:response:player_data", PacketFlow.CLIENTBOUND) +class ServerboundRequestPlayerDataResponse(val data: DataResponse) : ResponseNettyPacket() { + companion object { + val STREAM_CODEC = + packetCodec( + ServerboundRequestPlayerDataResponse::write, + ::ServerboundRequestPlayerDataResponse + ) + } + + private constructor(buf: SurfByteBuf) : this( + buf.readEnum().reader.decode(buf) + ) + + abstract class DataResponse(val type: ServerboundRequestPlayerDataPacket.DataRequestType) { + abstract fun write(buf: SurfByteBuf) + } + + private fun write(buf: SurfByteBuf) { + buf.writeEnum(data.type) + data.write(buf) + } + + + class IpAddress(val ip: Inet4Address?) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.LATEST_IP_ADDRESS) { + constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readInet4Address() }) + + override fun write(buf: SurfByteBuf) { + buf.writeNullable(ip) { buf, ip -> buf.writeInet4Address(ip) } + } + } + + class LastServer(val server: String?) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.LAST_SERVER) { + constructor(buf: SurfByteBuf) : this(buf.readNullableString()) + + override fun write(buf: SurfByteBuf) { + buf.writeNullable(server) + } + } + + class LastSeen(val lastSeen: ZonedDateTime?) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.LAST_SEEN) { + constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readZonedDateTime() }) + + override fun write(buf: SurfByteBuf) { + buf.writeNullable(lastSeen) { buf, dateTime -> buf.writeZonedDateTime(dateTime) } + } + } + + class FirstSeen(val firstSeen: ZonedDateTime?) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.FIRST_SEEN) { + constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readZonedDateTime() }) + + override fun write(buf: SurfByteBuf) { + buf.writeNullable(firstSeen) { buf, dateTime -> buf.writeZonedDateTime(dateTime) } + } + } + + class DisplayName(val displayName: Component?) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.DISPLAY_NAME) { + constructor(buf: SurfByteBuf) : this(buf.readNullable { it.readComponent() }) + + override fun write(buf: SurfByteBuf) { + buf.writeNullable(displayName) { buf, name -> buf.writeComponent(name) } + } + } + + class Name(val name: String?) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.NAME) { + constructor(buf: SurfByteBuf) : this(buf.readNullableString()) + + override fun write(buf: SurfByteBuf) { + buf.writeNullable(name) + } + } + + class NameHistory(val history: ApiNameHistory) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.NAME_HISTORY) { + constructor(buf: SurfByteBuf) : this(ApiNameHistory.readFromByteBuf(buf)) + + override fun write(buf: SurfByteBuf) { + history.writeToByteBuf(buf) + } + } + + class Playtime(val playtime: ApiPlaytime) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.PLAYTIME) { + constructor(buf: SurfByteBuf) : this(PlaytimeImpl.readFromByteBuf(buf)) + + override fun write(buf: SurfByteBuf) { + playtime.writeToByteBuf(buf) + } + } + + class IsAFK(val isAfk: Boolean) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.IS_AFK) { + constructor(buf: SurfByteBuf) : this(buf.readBoolean()) + + override fun write(buf: SurfByteBuf) { + buf.writeBoolean(isAfk) + } + } + + class PlaytimeSession(val playtime: Duration) : + DataResponse(ServerboundRequestPlayerDataPacket.DataRequestType.PLAYTIME_SESSION) { + constructor(buf: SurfByteBuf) : this(buf.readDuration()) + + override fun write(buf: SurfByteBuf) { + buf.writeDuration(playtime) + } + } +} + +inline fun ServerboundRequestPlayerDataResponse.DataResponse.getGenericValue(): T = + when (this) { + is ServerboundRequestPlayerDataResponse.IpAddress -> check(T::class == Inet4Address::class) { "Expected Inet4Address" }.let { ip as T } + is ServerboundRequestPlayerDataResponse.LastServer -> check(T::class == String::class) { "Expected String" }.let { server as T } + is ServerboundRequestPlayerDataResponse.LastSeen -> check(T::class == ZonedDateTime::class) { "Expected ZonedDateTime" }.let { lastSeen as T } + is ServerboundRequestPlayerDataResponse.FirstSeen -> check(T::class == ZonedDateTime::class) { "Expected ZonedDateTime" }.let { firstSeen as T } + is ServerboundRequestPlayerDataResponse.DisplayName -> check(T::class == Component::class) { "Expected Component" }.let { displayName as T } + is ServerboundRequestPlayerDataResponse.Name -> check(T::class == String::class) { "Expected String" }.let { name as T } + is ServerboundRequestPlayerDataResponse.NameHistory -> check(T::class == ApiNameHistory::class) { "Expected ApiNameHistory" }.let { history as T } + is ServerboundRequestPlayerDataResponse.Playtime -> check(T::class == ApiPlaytime::class) { "Expected ApiPlaytime" }.let { playtime as T } + is ServerboundRequestPlayerDataResponse.IsAFK -> check(T::class == Boolean::class) { "Expected Boolean" }.let { isAfk as T } + is ServerboundRequestPlayerDataResponse.PlaytimeSession -> check(T::class == Duration::class) { "Expected Duration" }.let { playtime as T } + else -> error("Unknown DataResponse type: ${this::class.simpleName}") + } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerPersistentDataContainer.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerPersistentDataContainer.kt similarity index 88% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerPersistentDataContainer.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerPersistentDataContainer.kt index 7ffe1084..7f15a39d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundRequestPlayerPersistentDataContainer.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundRequestPlayerPersistentDataContainer.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -6,6 +6,7 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.RespondingNettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundPlayerPersistentDataContainerResponse import java.util.UUID @SurfNettyPacket( diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundResetTitlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundResetTitlePacket.kt similarity index 81% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundResetTitlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundResetTitlePacket.kt index 88df9c82..7bd36f9a 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundResetTitlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundResetTitlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -9,10 +9,11 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_RESET_TITLE_PACKET, PacketFlow.SERVERBOUND) -class ServerboundResetTitlePacket: NettyPacket { +class ServerboundResetTitlePacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundResetTitlePacket::write, ::ServerboundResetTitlePacket) + val STREAM_CODEC = + packetCodec(ServerboundResetTitlePacket::write, ::ServerboundResetTitlePacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendActionBarPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendActionBarPacket.kt similarity index 84% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendActionBarPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendActionBarPacket.kt index 138df7be..7864b56c 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendActionBarPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendActionBarPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -10,9 +10,10 @@ import net.kyori.adventure.text.Component import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_SEND_ACTION_BAR_PACKET, PacketFlow.SERVERBOUND) -class ServerboundSendActionBarPacket: NettyPacket { +class ServerboundSendActionBarPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundSendActionBarPacket::write, ::ServerboundSendActionBarPacket) + val STREAM_CODEC = + packetCodec(ServerboundSendActionBarPacket::write, ::ServerboundSendActionBarPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendMessagePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendMessagePacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendMessagePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendMessagePacket.kt index 329df386..c75b79ca 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendMessagePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendMessagePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendPlayerListHeaderAndFooterPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendPlayerListHeaderAndFooterPacket.kt similarity index 98% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendPlayerListHeaderAndFooterPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendPlayerListHeaderAndFooterPacket.kt index 2aee5f37..a1fa2732 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendPlayerListHeaderAndFooterPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendPlayerListHeaderAndFooterPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendResourcePacksPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendResourcePacksPacket.kt similarity index 84% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendResourcePacksPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendResourcePacksPacket.kt index f23ce14e..2151cb95 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendResourcePacksPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendResourcePacksPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,13 @@ import net.kyori.adventure.resource.ResourcePackRequest import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_SEND_RESOURCE_PACKS_PACKET, PacketFlow.SERVERBOUND) -class ServerboundSendResourcePacksPacket: NettyPacket { +class ServerboundSendResourcePacksPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundSendResourcePacksPacket::write, ::ServerboundSendResourcePacksPacket) + val STREAM_CODEC = packetCodec( + ServerboundSendResourcePacksPacket::write, + ::ServerboundSendResourcePacksPacket + ) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendTitlePartPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendTitlePartPacket.kt similarity index 86% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendTitlePartPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendTitlePartPacket.kt index e9116055..520551c9 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundSendTitlePartPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundSendTitlePartPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -13,10 +13,11 @@ import net.kyori.adventure.title.TitlePart import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_SEND_TITLE_PART_PACKET, PacketFlow.SERVERBOUND) -class ServerboundSendTitlePartPacket: NettyPacket { +class ServerboundSendTitlePartPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundSendTitlePartPacket::write, ::ServerboundSendTitlePartPacket) + val STREAM_CODEC = + packetCodec(ServerboundSendTitlePartPacket::write, ::ServerboundSendTitlePartPacket) } val uuid: UUID @@ -44,7 +45,11 @@ class ServerboundSendTitlePartPacket: NettyPacket { ExtraCodecs.STREAM_TITLE_PART_CODEC.encode(buf, titlePart) when (titlePart) { TitlePart.TITLE, TitlePart.SUBTITLE -> buf.writeComponent(value as Component) - TitlePart.TIMES -> ExtraCodecs.TITLE_TIMES_STREAM_CODEC.encode(buf, value as Title.Times) + TitlePart.TIMES -> ExtraCodecs.TITLE_TIMES_STREAM_CODEC.encode( + buf, + value as Title.Times + ) + else -> error("Unknown title part: $titlePart") } } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShowBossBarPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShowBossBarPacket.kt similarity index 85% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShowBossBarPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShowBossBarPacket.kt index 671d6ce4..b1ba7aea 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShowBossBarPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShowBossBarPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,11 @@ import net.kyori.adventure.bossbar.BossBar import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_SHOW_BOSS_BAR_PACKET, PacketFlow.SERVERBOUND) -class ServerboundShowBossBarPacket : NettyPacket{ +class ServerboundShowBossBarPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundShowBossBarPacket::write, ::ServerboundShowBossBarPacket) + val STREAM_CODEC = + packetCodec(ServerboundShowBossBarPacket::write, ::ServerboundShowBossBarPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShowTitlePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShowTitlePacket.kt similarity index 89% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShowTitlePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShowTitlePacket.kt index 76a785b5..edca78dc 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShowTitlePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShowTitlePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -14,7 +14,8 @@ import java.util.* class ServerboundShowTitlePacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundShowTitlePacket::write, ::ServerboundShowTitlePacket) + val STREAM_CODEC = + packetCodec(ServerboundShowTitlePacket::write, ::ServerboundShowTitlePacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShutdownServerPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShutdownServerPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShutdownServerPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShutdownServerPacket.kt index 0a386857..8b9c6a9d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundShutdownServerPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundShutdownServerPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundStopSoundPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundStopSoundPacket.kt similarity index 86% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundStopSoundPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundStopSoundPacket.kt index f607cd4b..6ada03b7 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundStopSoundPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundStopSoundPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket @@ -11,10 +11,11 @@ import net.kyori.adventure.sound.SoundStop import java.util.UUID @SurfNettyPacket(DefaultIds.SERVERBOUND_STOP_SOUND_PACKET, PacketFlow.SERVERBOUND) -class ServerboundStopSoundPacket: NettyPacket { +class ServerboundStopSoundPacket : NettyPacket { companion object { - val STREAM_CODEC = packetCodec(ServerboundStopSoundPacket::write, ::ServerboundStopSoundPacket) + val STREAM_CODEC = + packetCodec(ServerboundStopSoundPacket::write, ::ServerboundStopSoundPacket) } val uuid: UUID diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundTransferPlayerPacketResponse.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundTransferPlayerPacketResponse.kt similarity index 99% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundTransferPlayerPacketResponse.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundTransferPlayerPacketResponse.kt index 2ec23332..d80a981d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/ServerboundTransferPlayerPacketResponse.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/running/serverbound/ServerboundTransferPlayerPacketResponse.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.running +package dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound import dev.slne.surf.cloud.api.common.meta.DefaultIds import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientSynchronizingPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientSynchronizingPacketListener.kt index e9640263..679fcf1f 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientSynchronizingPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientSynchronizingPacketListener.kt @@ -3,10 +3,13 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientCommonPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundSetVelocitySecretPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundBatchUpdateServer -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncSetDeltaPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundBatchUpdateServer +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncSetPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncValuePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundSynchronizeFinishPacket interface ClientSynchronizingPacketListener : ClientCommonPacketListener { override val protocol get() = ConnectionProtocol.SYNCHRONIZING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerSynchronizingPacketListener.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerSynchronizingPacketListener.kt index abf1e9ce..2e5b1dbe 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerSynchronizingPacketListener.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerSynchronizingPacketListener.kt @@ -3,9 +3,11 @@ package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ServerCommonPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundCreateOfflineCloudPlayerIfNotExistsPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncSetDeltaPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundCreateOfflineCloudPlayerIfNotExistsPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.serverbound.ServerboundSynchronizeFinishAcknowledgedPacket interface ServerSynchronizingPacketListener : ServerCommonPacketListener { override val protocol get() = ConnectionProtocol.SYNCHRONIZING diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/SynchronizingProtocols.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/SynchronizingProtocols.kt index a07a999d..2852cb21 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/SynchronizingProtocols.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/SynchronizingProtocols.kt @@ -4,11 +4,23 @@ import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.packet.createCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.core.common.netty.network.protocol.ProtocolInfoBuilder -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundBatchUpdateServer -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundCreateOfflineCloudPlayerIfNotExistsPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncSetDeltaPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundleDelimiterPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundPongResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundleDelimiterPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundPingRequestPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundBatchUpdateServer +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundCreateOfflineCloudPlayerIfNotExistsPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncSetPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncValuePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundSynchronizeFinishPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.serverbound.ServerboundSynchronizeFinishAcknowledgedPacket object SynchronizingProtocols { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/FinishSynchronizingPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/bidirectional/FinishSynchronizingPacket.kt similarity index 77% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/FinishSynchronizingPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/bidirectional/FinishSynchronizingPacket.kt index a18bd624..65f9bff6 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/FinishSynchronizingPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/bidirectional/FinishSynchronizingPacket.kt @@ -1,15 +1,16 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing +package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional +import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol import dev.slne.surf.cloud.api.common.netty.network.codec.streamCodecUnitSimple import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket -@dev.slne.surf.cloud.api.common.meta.SurfNettyPacket( +@SurfNettyPacket( "cloud:bidirectional:finish_synchronize", PacketFlow.BIDIRECTIONAL, ConnectionProtocol.SYNCHRONIZING ) -object FinishSynchronizingPacket: NettyPacket() { +object FinishSynchronizingPacket : NettyPacket() { val STREAM_CODEC = streamCodecUnitSimple(FinishSynchronizingPacket) } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/StartSynchronizingPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/bidirectional/StartSynchronizingPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/StartSynchronizingPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/bidirectional/StartSynchronizingPacket.kt index d9d7fa28..0bfc0dfc 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/StartSynchronizingPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/bidirectional/StartSynchronizingPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing +package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundBatchSyncSetPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundBatchSyncSetPacket.kt similarity index 97% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundBatchSyncSetPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundBatchSyncSetPacket.kt index fde12c6c..1b830159 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundBatchSyncSetPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundBatchSyncSetPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing +package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol @@ -6,10 +6,10 @@ import dev.slne.surf.cloud.api.common.netty.network.protocol.PacketFlow import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.packetCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf -import dev.slne.surf.cloud.api.common.util.objectListOf import dev.slne.surf.cloud.core.common.sync.CommonSyncRegistryImpl import dev.slne.surf.cloud.core.common.sync.SyncSetImpl import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.objectListOf @SurfNettyPacket( "cloud:batch_sync_set", diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundBatchSyncValuePacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundBatchSyncValuePacket.kt similarity index 99% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundBatchSyncValuePacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundBatchSyncValuePacket.kt index f0de96c4..ac7d0bad 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundBatchSyncValuePacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundBatchSyncValuePacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing +package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundSynchronizeFinishPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundSynchronizeFinishPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundSynchronizeFinishPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundSynchronizeFinishPacket.kt index 4897e7fd..5416022c 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ClientboundSynchronizeFinishPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/clientbound/ClientboundSynchronizeFinishPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing +package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerboundSynchronizeFinishAcknowledgedPacket.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/serverbound/ServerboundSynchronizeFinishAcknowledgedPacket.kt similarity index 96% rename from surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerboundSynchronizeFinishAcknowledgedPacket.kt rename to surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/serverbound/ServerboundSynchronizeFinishAcknowledgedPacket.kt index 167a3b0b..ea0f0cc6 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/ServerboundSynchronizeFinishAcknowledgedPacket.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/network/protocol/synchronizing/serverbound/ServerboundSynchronizeFinishAcknowledgedPacket.kt @@ -1,4 +1,4 @@ -package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing +package dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.serverbound import dev.slne.surf.cloud.api.common.meta.SurfNettyPacket import dev.slne.surf.cloud.api.common.netty.network.ConnectionProtocol diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/registry/listener/NettyListenerRegistry.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/registry/listener/NettyListenerRegistry.kt index 96bc360e..f53c381c 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/registry/listener/NettyListenerRegistry.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/netty/registry/listener/NettyListenerRegistry.kt @@ -4,7 +4,7 @@ import dev.slne.surf.cloud.api.common.netty.exception.SurfNettyListenerRegistrat import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.netty.packet.NettyPacketInfo import dev.slne.surf.cloud.api.common.util.isSuspending -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import it.unimi.dsi.fastutil.objects.Object2ObjectFunction import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet import it.unimi.dsi.fastutil.objects.ObjectSet @@ -77,42 +77,6 @@ object NettyListenerRegistry { isSuspending ) ) - -// for (i in params.indices) { -// val param = params[i] -// if (NettyPacket::class.java.isAssignableFrom(param)) { -// if (packetClass != null) { -// throw SurfNettyListenerRegistrationException("Listener method must have only one parameter of type NettyPacket") -// } -// -// packetClass = param as Class> -// packetClassIndex = i -// } else if (NettyPacketInfo::class.java.isAssignableFrom(param)) { -// if (packetInfoIndex != -1) { -// throw SurfNettyListenerRegistrationException("Listener method must have only one parameter of type NettyPacketInfo") -// } -// -// packetInfoIndex = i -// } else { -// throw SurfNettyListenerRegistrationException("Listener method must have one or two parameters of type NettyPacket and optional NettyPacketInfo") -// } -// } -// -// if (packetClass == null) { -// throw SurfNettyListenerRegistrationException("Listener method must have one parameter of type NettyPacket") -// } -// -// if (!Modifier.isPublic(listenerMethod.modifiers)) { -// throw SurfNettyListenerRegistrationException("Listener method must be public") -// } -// -// listeners.computeIfAbsent(packetClass, -// Object2ObjectFunction { -// ObjectOpenHashSet( -// 1 -// ) -// }) -// .add(RegisteredListener(bean, listenerMethod, packetClassIndex, packetInfoIndex)) } fun hasListeners(packetClass: Class) = listeners.containsKey(packetClass) diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/permission/CommonCloudPermissions.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/permission/CommonCloudPermissions.kt index f82b5a5e..3ffff7f2 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/permission/CommonCloudPermissions.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/permission/CommonCloudPermissions.kt @@ -1,6 +1,6 @@ package dev.slne.surf.cloud.core.common.permission -object CommonCloudPermissions { +object CommonCloudPermissions { // TODO: Auto register to luckperms? const val PREFIX = "surfcloud" private const val ANNOUNCE_PREFIX = "$PREFIX.announce" private const val QUEUE_PREFIX = "$PREFIX.queue" diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/CloudPlayerManagerImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/CloudPlayerManagerImpl.kt index 0ff2153d..330a7e27 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/CloudPlayerManagerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/CloudPlayerManagerImpl.kt @@ -26,11 +26,6 @@ abstract class CloudPlayerManagerImpl

: CloudPlayerMa protected val playerCache = Caffeine.newBuilder() .asCache() -// protected val players = mutableObject2ObjectMapOf().synchronize() -// protected val creatingPlayers = -// mutableObject2ObjectMapOf>().synchronize() -// protected val createMutex = Mutex() - override fun getPlayer(uuid: UUID?): P? { return uuid?.let { playerCache.getOrNull(it) } } @@ -106,132 +101,8 @@ abstract class CloudPlayerManagerImpl

: CloudPlayerMa } catch (e: PreJoinDenied) { e.result } - - -// val (player, preJoinResult, created) = getOrCreatePlayerAtomically( -// uuid, -// name, -// proxy, -// ip, -// serverUid, -// runPreJoinTasks -// ) -// -// if (player == null) { -// return preJoinResult -// } -// -// if (!created) { -// if (proxy) { -// updateProxyServer(player, serverUid) -// } else { -// updateServer(player, serverUid) -// } -// onServerConnect(uuid, player, serverUid) -// } -// -// return PrePlayerJoinTask.Result.ALLOWED - - -// val player = players[uuid] -// val creatingPlayer = creatingPlayers[uuid] -// -// if (player == null && creatingPlayer == null) { -// val creatingPlayerDeferred = CompletableDeferred() -// creatingPlayers[uuid] = creatingPlayerDeferred -// -// createPlayer(uuid, name, proxy, ip, serverUid).also { -// if (runPreJoinTasks) { -// val preJoinResult = preJoin(it) -// if (preJoinResult !is PrePlayerJoinTask.Result.ALLOWED) { -// creatingPlayerDeferred.complete(null) -// return preJoinResult -// } -// } -// -// onNetworkConnect(uuid, it) -// onServerConnect(uuid, it, serverUid) -// addPlayer(it) -// } -// } else { -// coroutineScope { -// if (proxy) { -// if (player != null) { -// updateProxyServer(player, serverUid) -// } else { -// launch { -// creatingPlayer?.await()?.let { newPlayer -> -// updateProxyServer(newPlayer, serverUid) -// } -// } -// } -// } else { -// if (player != null) { -// updateServer(player, serverUid) -// } else { -// launch { -// creatingPlayer?.await()?.let { newPlayer -> -// updateServer(newPlayer, serverUid) -// } -// } -// } -// } -// -// if (player != null) { -// onServerConnect(uuid, player, serverUid) -// } else { -// launch { -// creatingPlayer?.await()?.let { newPlayer -> -// onServerConnect(uuid, newPlayer, serverUid) -// } -// } -// } -// } -// } -// -// return PrePlayerJoinTask.Result.ALLOWED } -// private suspend fun getOrCreatePlayerAtomically( -// uuid: UUID, -// name: String, -// proxy: Boolean, -// ip: Inet4Address, -// serverUid: Long, -// runPreJoinTasks: Boolean -// ): Triple { -// players[uuid]?.let { return Triple(it, PrePlayerJoinTask.Result.ALLOWED, false) } -// -// var needsCreation = false -// val creatingPlayer = createMutex.withLock { -// creatingPlayers.computeIfAbsent(uuid) { -// needsCreation = true -// CompletableDeferred() -// } -// } -// -// if (!creatingPlayer.isCompleted && needsCreation) { -// val newPlayer = createPlayer(uuid, name, proxy, ip, serverUid) -// -// if (runPreJoinTasks) { -// val preJoinResult = preJoin(newPlayer) -// if (preJoinResult !is PrePlayerJoinTask.Result.ALLOWED) { -// creatingPlayer.complete(null) -// return Triple(null, preJoinResult, true) -// } -// } -// -// addPlayer(newPlayer) -// creatingPlayers.remove(uuid) -// -// onNetworkConnect(uuid, newPlayer) -// onServerConnect(uuid, newPlayer, serverUid) -// creatingPlayer.complete(newPlayer) -// } -// -// return Triple(creatingPlayer.await(), PrePlayerJoinTask.Result.ALLOWED, true) -// } - protected open suspend fun preJoin(player: P): PrePlayerJoinTask.Result { return PrePlayerJoinTask.Result.ALLOWED } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/name/NameHistoryImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/name/NameHistoryImpl.kt index e373a86d..0c31c470 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/name/NameHistoryImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/name/NameHistoryImpl.kt @@ -6,7 +6,7 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.writeCollection import dev.slne.surf.cloud.api.common.player.name.NameEntry import dev.slne.surf.cloud.api.common.player.name.NameHistory import dev.slne.surf.cloud.api.common.player.name.NameHistoryFactory -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import io.netty.buffer.ByteBuf import it.unimi.dsi.fastutil.objects.ObjectList import it.unimi.dsi.fastutil.objects.ObjectLists diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/playtime/PlaytimeImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/playtime/PlaytimeImpl.kt index f8e4ae2a..421c5478 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/playtime/PlaytimeImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/playtime/PlaytimeImpl.kt @@ -2,7 +2,10 @@ package dev.slne.surf.cloud.core.common.player.playtime import dev.slne.surf.cloud.api.common.netty.protocol.buffer.* import dev.slne.surf.cloud.api.common.player.playtime.Playtime -import dev.slne.surf.cloud.api.common.util.* +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.objectListOf +import dev.slne.surf.surfapi.core.api.util.toObjectList import io.netty.buffer.ByteBuf import it.unimi.dsi.fastutil.objects.Object2ObjectMap import it.unimi.dsi.fastutil.objects.ObjectList @@ -14,7 +17,13 @@ import java.time.ZonedDateTime import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds -class PlaytimeImpl(private val entries: ObjectList) : Playtime { +class PlaytimeImpl(private val entries: ObjectList) : + Playtime { + + override fun mutableObjectSetOf(): ObjectSet { + TODO("Implement me") + } + override fun sumPlaytimes(since: ZonedDateTime?): Duration = entries .filter { since == null || it.createdAt.isAfter(since) } .sumOf { it.durationSeconds } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataContainerViewImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataContainerViewImpl.kt index ebecaccb..5d9578c4 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataContainerViewImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataContainerViewImpl.kt @@ -4,7 +4,7 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.api.common.player.ppdc.PersistentPlayerDataAdapterContext import dev.slne.surf.cloud.api.common.player.ppdc.PersistentPlayerDataContainerView import dev.slne.surf.cloud.api.common.player.ppdc.PersistentPlayerDataType -import dev.slne.surf.cloud.api.common.util.toObjectSet +import dev.slne.surf.surfapi.core.api.util.toObjectSet import it.unimi.dsi.fastutil.objects.ObjectSet import net.kyori.adventure.key.Key import net.kyori.adventure.nbt.BinaryTag diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataTypeRegistry.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataTypeRegistry.kt index 04b32122..8f634930 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataTypeRegistry.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/ppdc/PersistentPlayerDataTypeRegistry.kt @@ -4,9 +4,9 @@ import com.google.common.primitives.Primitives import dev.slne.surf.cloud.api.common.player.ppdc.ListPersistentPlayerDataType import dev.slne.surf.cloud.api.common.player.ppdc.PersistentPlayerDataContainer import dev.slne.surf.cloud.api.common.player.ppdc.PersistentPlayerDataType -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf -import dev.slne.surf.cloud.api.common.util.synchronize +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.synchronize import net.kyori.adventure.nbt.* import kotlin.reflect.KClass import kotlin.reflect.cast diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerBridgeImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerBridgeImpl.kt index 1528c4e0..72a7bc6d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerBridgeImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerBridgeImpl.kt @@ -7,11 +7,11 @@ import dev.slne.surf.cloud.api.common.player.punishment.CloudPlayerPunishmentMan import dev.slne.surf.cloud.api.common.player.punishment.PunishmentLoginValidation import dev.slne.surf.cloud.api.common.player.punishment.type.ban.PunishmentBan import dev.slne.surf.cloud.api.common.player.task.PrePlayerJoinTask -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf import dev.slne.surf.cloud.core.common.messages.MessageManager import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.util.bean import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf import dev.slne.surf.surfapi.core.api.util.toObjectList import it.unimi.dsi.fastutil.objects.ObjectList import org.jetbrains.annotations.Unmodifiable diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerImpl.kt index cdb5c7f6..6fa6dc63 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/CloudPlayerPunishmentManagerImpl.kt @@ -9,20 +9,17 @@ import dev.slne.surf.cloud.api.common.player.punishment.type.ban.PunishmentBan import dev.slne.surf.cloud.api.common.player.punishment.type.kick.PunishmentKick import dev.slne.surf.cloud.api.common.player.punishment.type.mute.PunishmentMute import dev.slne.surf.cloud.api.common.player.punishment.type.warn.PunishmentWarn -import dev.slne.surf.cloud.api.common.util.emptyObjectList -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf -import dev.slne.surf.cloud.api.common.util.synchronize -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.player.punishment.type.PunishmentMuteImpl import dev.slne.surf.cloud.core.common.util.bean -import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.* import it.unimi.dsi.fastutil.objects.ObjectArrayList import it.unimi.dsi.fastutil.objects.ObjectList import org.jetbrains.annotations.Unmodifiable import java.util.* -class CloudPlayerPunishmentManagerImpl(private val playerUuid: UUID) : CloudPlayerPunishmentManager { +class CloudPlayerPunishmentManagerImpl(private val playerUuid: UUID) : + CloudPlayerPunishmentManager { companion object { private val log = logger() } diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentBanImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentBanImpl.kt index 2f068fcc..c1b33085 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentBanImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentBanImpl.kt @@ -4,10 +4,10 @@ import com.google.common.net.InetAddresses import dev.slne.surf.cloud.api.common.player.punishment.type.PunishmentAttachedIpAddress import dev.slne.surf.cloud.api.common.player.punishment.type.ban.PunishmentBan import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.core.common.messages.MessageManager import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.util.bean +import dev.slne.surf.surfapi.core.api.util.toObjectList import it.unimi.dsi.fastutil.objects.ObjectList import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable @@ -37,7 +37,7 @@ data class PunishmentBanImpl( override suspend fun attachIpAddress(rawIp: String): Boolean { require(InetAddresses.isInetAddress(rawIp)) { "Invalid IP address: $rawIp" } - return bean().attachIpAddressToBan(id, rawIp) + return bean().attachIpAddressToBan(id, rawIp) } override suspend fun fetchIpAddresses(): Set { @@ -49,7 +49,7 @@ data class PunishmentBanImpl( } override suspend fun addNote(note: String): PunishmentNote { - return bean().attachNoteToBan(id, note) + return bean().attachNoteToBan(id, note) } override suspend fun fetchNotes(): ObjectList { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentKickImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentKickImpl.kt index 48008886..af74dc84 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentKickImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentKickImpl.kt @@ -2,10 +2,10 @@ package dev.slne.surf.cloud.core.common.player.punishment.type import dev.slne.surf.cloud.api.common.player.punishment.type.kick.PunishmentKick import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.core.common.messages.MessageManager import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.util.bean +import dev.slne.surf.surfapi.core.api.util.toObjectList import it.unimi.dsi.fastutil.objects.ObjectList import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentMuteImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentMuteImpl.kt index 1105c05b..0009e262 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentMuteImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentMuteImpl.kt @@ -2,10 +2,10 @@ package dev.slne.surf.cloud.core.common.player.punishment.type import dev.slne.surf.cloud.api.common.player.punishment.type.mute.PunishmentMute import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.core.common.messages.MessageManager import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.util.bean +import dev.slne.surf.surfapi.core.api.util.toObjectList import it.unimi.dsi.fastutil.objects.ObjectList import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentWarnImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentWarnImpl.kt index d9247f1d..fe7abd4d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentWarnImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/punishment/type/PunishmentWarnImpl.kt @@ -2,10 +2,10 @@ package dev.slne.surf.cloud.core.common.player.punishment.type import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote import dev.slne.surf.cloud.api.common.player.punishment.type.warn.PunishmentWarn -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.core.common.messages.MessageManager import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.util.bean +import dev.slne.surf.surfapi.core.api.util.toObjectList import it.unimi.dsi.fastutil.objects.ObjectList import kotlinx.serialization.Contextual import kotlinx.serialization.Serializable diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/task/PrePlayerJoinTaskAutoRegistrationHandler.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/task/PrePlayerJoinTaskAutoRegistrationHandler.kt index 67054d50..59916450 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/task/PrePlayerJoinTaskAutoRegistrationHandler.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/player/task/PrePlayerJoinTaskAutoRegistrationHandler.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.core.common.player.task import dev.slne.surf.cloud.api.common.player.task.PrePlayerJoinTask -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf import org.springframework.beans.factory.config.BeanPostProcessor import org.springframework.context.SmartLifecycle import org.springframework.stereotype.Component diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/plugin/task/CloudBeforeStartTaskHandler.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/plugin/task/CloudBeforeStartTaskHandler.kt index fd2d714e..a7b2399d 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/plugin/task/CloudBeforeStartTaskHandler.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/plugin/task/CloudBeforeStartTaskHandler.kt @@ -1,13 +1,13 @@ package dev.slne.surf.cloud.core.common.plugin.task import dev.slne.surf.cloud.api.common.plugin.spring.task.CloudInitialSynchronizeTask -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf import org.springframework.beans.factory.config.BeanPostProcessor import org.springframework.context.SmartLifecycle import org.springframework.stereotype.Component @Component -class CloudBeforeStartTaskHandler: BeanPostProcessor, SmartLifecycle { +class CloudBeforeStartTaskHandler : BeanPostProcessor, SmartLifecycle { private val watched = mutableObjectSetOf() private var running = false diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/processors/NettyPacketProcessor.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/processors/NettyPacketProcessor.kt index f0ad4807..3b2f9d43 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/processors/NettyPacketProcessor.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/processors/NettyPacketProcessor.kt @@ -34,9 +34,6 @@ class NettyPacketProcessor : ApplicationContextInitializer() if (codec == null) { @@ -169,22 +169,4 @@ class NettyPacketProcessor : ApplicationContextInitializer { -//// val candidates1 = context.beanDefinitionNames -//// .mapNotNull { context.getType(it)?.`package`?.name } -//// .distinct() -// -// val candidates2 = -// findMainClass(context)?.getAnnotation(SurfCloudApplication::class.java)?.basePackages -// ?: emptyArray() -// -// return (candidates2).asSequence().distinct().filter { it.contains("org.springframework") } -// } -// -// private fun findMainClass(context: ConfigurableApplicationContext): Class<*>? { -// return context.getBeansWithAnnotation(SurfCloudApplication::class.java).values -// .map { it::class.java } -// .firstOrNull() -// } } \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractCloudServer.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractCloudServer.kt index 10aea562..5df1c2c4 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractCloudServer.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractCloudServer.kt @@ -4,10 +4,10 @@ import dev.slne.surf.cloud.api.common.player.CloudPlayer import dev.slne.surf.cloud.api.common.player.ConnectionResultEnum import dev.slne.surf.cloud.api.common.server.CloudServer import dev.slne.surf.cloud.api.common.server.UserListImpl -import dev.slne.surf.cloud.api.common.util.emptyObjectList import dev.slne.surf.cloud.api.common.util.mapAsync -import dev.slne.surf.cloud.api.common.util.objectListOf -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientInformation +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ClientInformation +import dev.slne.surf.surfapi.core.api.util.emptyObjectList +import dev.slne.surf.surfapi.core.api.util.objectListOf import it.unimi.dsi.fastutil.objects.ObjectList import kotlinx.coroutines.awaitAll import java.net.InetSocketAddress diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractProxyCloudServer.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractProxyCloudServer.kt index ee7d9aa1..b367a0f6 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractProxyCloudServer.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/AbstractProxyCloudServer.kt @@ -2,7 +2,7 @@ package dev.slne.surf.cloud.core.common.server import dev.slne.surf.cloud.api.common.server.ProxyCloudServer import dev.slne.surf.cloud.api.common.server.UserListImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientInformation +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ClientInformation import java.net.InetSocketAddress abstract class AbstractProxyCloudServer( diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerImpl.kt index b568d153..c5f20937 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerImpl.kt @@ -6,10 +6,10 @@ import dev.slne.surf.cloud.api.common.server.BatchTransferResult import dev.slne.surf.cloud.api.common.server.CloudServer import dev.slne.surf.cloud.api.common.server.CommonCloudServer import dev.slne.surf.cloud.api.common.server.UserListImpl -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf import dev.slne.surf.cloud.core.common.coroutines.PlayerBatchTransferScope -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientInformation +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ClientInformation import dev.slne.surf.cloud.core.common.sound.CommonSounds +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import kotlinx.coroutines.Deferred import kotlinx.coroutines.async import kotlinx.coroutines.delay diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerManagerImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerManagerImpl.kt index be3b72ec..78f3fc82 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerManagerImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/server/CommonCloudServerManagerImpl.kt @@ -6,10 +6,10 @@ import dev.slne.surf.cloud.api.common.server.CloudServerManager import dev.slne.surf.cloud.api.common.server.CommonCloudServer import dev.slne.surf.cloud.api.common.server.ProxyCloudServer import dev.slne.surf.cloud.api.common.util.annotation.InternalApi -import dev.slne.surf.cloud.api.common.util.freeze -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf -import dev.slne.surf.cloud.api.common.util.toObjectSet +import dev.slne.surf.surfapi.core.api.util.freeze +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf +import dev.slne.surf.surfapi.core.api.util.toObjectSet import it.unimi.dsi.fastutil.objects.ObjectCollection import it.unimi.dsi.fastutil.objects.ObjectList import net.kyori.adventure.text.Component diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sound/CommonSounds.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sound/CommonSounds.kt index c5b1ad94..04119d05 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sound/CommonSounds.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sound/CommonSounds.kt @@ -1,8 +1,8 @@ package dev.slne.surf.cloud.core.common.sound -import dev.slne.surf.cloud.api.common.util.objectListOf import dev.slne.surf.surfapi.core.api.generated.SoundKeys import dev.slne.surf.surfapi.core.api.messages.adventure.Sound +import dev.slne.surf.surfapi.core.api.util.objectListOf import net.kyori.adventure.sound.Sound.Source object CommonSounds { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/CaffeineCacheConfig.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/CaffeineCacheConfig.kt index 92c1f77d..e9c6b5fe 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/CaffeineCacheConfig.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/CaffeineCacheConfig.kt @@ -1,20 +1,8 @@ package dev.slne.surf.cloud.core.common.spring.config -import com.github.benmanes.caffeine.cache.Caffeine -import com.sksamuel.aedile.core.expireAfterAccess import org.springframework.cache.annotation.EnableCaching -import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import kotlin.time.Duration.Companion.minutes @Configuration @EnableCaching -class CaffeineCacheConfig { - -// @Bean -// fun caffeineConfig(): Caffeine { -// return Caffeine.newBuilder() -// .expireAfterAccess(10.minutes) -// .maximumSize(1000) -// } -} \ No newline at end of file +class CaffeineCacheConfig \ No newline at end of file diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/SurfCloudCommonConfig.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/SurfCloudCommonConfig.kt index 26b98949..f4a87a6b 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/SurfCloudCommonConfig.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/spring/config/SurfCloudCommonConfig.kt @@ -1,6 +1,5 @@ package dev.slne.surf.cloud.core.common.spring.config -import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.DeserializationFeature import com.fasterxml.jackson.databind.MapperFeature import com.fasterxml.jackson.databind.Module @@ -19,8 +18,6 @@ class SurfCloudCommonConfig { .configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false) .configure(SerializationFeature.WRITE_DATES_WITH_ZONE_ID, true) .configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true) -// .configure(JsonParser.Feature.USE_FAST_DOUBLE_PARSER, true) -// .configure(JsonParser.Feature.USE_FAST_BIG_NUMBER_PARSER, true) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .addModules(modules.orderedStream().toList()) .defaultTimeZone(TimeZone.getDefault()) diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/CommonSyncRegistryImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/CommonSyncRegistryImpl.kt index 337fc5f5..bef90150 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/CommonSyncRegistryImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/CommonSyncRegistryImpl.kt @@ -5,7 +5,7 @@ import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.api.common.sync.SyncRegistry import dev.slne.surf.cloud.api.common.sync.SyncSet import dev.slne.surf.cloud.api.common.sync.SyncValue -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import javax.annotation.OverridingMethodsMustInvokeSuper abstract class CommonSyncRegistryImpl : SyncRegistry { diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/SyncSetImpl.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/SyncSetImpl.kt index 35fd11e8..743265e1 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/SyncSetImpl.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/SyncSetImpl.kt @@ -4,9 +4,9 @@ import dev.slne.surf.cloud.api.common.netty.network.codec.StreamCodec import dev.slne.surf.cloud.api.common.netty.protocol.buffer.SurfByteBuf import dev.slne.surf.cloud.api.common.sync.SyncSet import dev.slne.surf.cloud.api.common.sync.SyncSetListener -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf -import dev.slne.surf.cloud.api.common.util.toObjectSet import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf +import dev.slne.surf.surfapi.core.api.util.toObjectSet import it.unimi.dsi.fastutil.objects.ObjectIterator import it.unimi.dsi.fastutil.objects.ObjectSet import java.util.concurrent.ConcurrentHashMap diff --git a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/util/encryption/Crypt.kt b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/util/encryption/Crypt.kt index 9985c20b..a36bb4d3 100644 --- a/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/util/encryption/Crypt.kt +++ b/surf-cloud-core/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/util/encryption/Crypt.kt @@ -35,14 +35,6 @@ object Crypt { Base64.getMimeEncoder(76, MIME_LINE_SEPARATOR.toByteArray(Charsets.UTF_8)) fun writeCertificate(file: File, certificate: X509Certificate) { -// file.writeText( -// """ -// $CERTIFICATE_HEADER -// ${mimeEncoder.encodeToString(certificate.encoded)} -// $CERTIFICATE_FOOTER -// """.trimIndent() -// ) - file.writeText(buildString { append(CERTIFICATE_HEADER) append(MIME_LINE_SEPARATOR) @@ -147,8 +139,6 @@ object Crypt { keyFactory.generatePublic(encodedKeySpec) } - // } - fun decryptByteToSecretKey(privateKey: PrivateKey, encryptedSecretKey: ByteArray): SecretKey = safeCrypto { val bs = decryptUsingKey(privateKey, encryptedSecretKey) diff --git a/surf-cloud-standalone-launcher/src/main/java/dev/slne/surf/cloud/launcher/StandaloneUrlClassLoader.java b/surf-cloud-standalone-launcher/src/main/java/dev/slne/surf/cloud/launcher/StandaloneUrlClassLoader.java index a2ef911b..40e64cec 100644 --- a/surf-cloud-standalone-launcher/src/main/java/dev/slne/surf/cloud/launcher/StandaloneUrlClassLoader.java +++ b/surf-cloud-standalone-launcher/src/main/java/dev/slne/surf/cloud/launcher/StandaloneUrlClassLoader.java @@ -36,84 +36,6 @@ protected Class findClass(String name) throws ClassNotFoundException { return super.findClass(name); } - // public void addTransformer(ClassFileTransformer transformer) { -// this.transformers.add(transformer); -// } -// -// public ClassLoader getThrowawayClassLoader() { -// return new StandaloneUrlClassLoader(getURLs(), getParent()); -// } - -// @Override -// public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { -// if (isExcludedFromTransformation(name)) { -// return super.loadClass(name, resolve); -// } -// -// Class c = findLoadedClass(name); -// if (c == null) { -// try { -// c = super.loadClass(name, false); -// } catch (ClassNotFoundException ex) { -// c = findClass(name); -// } -// } -// -// if (resolve) { -// resolveClass(c); -// } -// -// return c; -// } - -// @Override -// protected Class findClass(String name) throws ClassNotFoundException { -// String resourceName = name.replace('.', '/').concat(".class"); -// -// URL resource = getResource(resourceName); -// if (resource == null) { -// throw new ClassNotFoundException("Resource not found: " + resourceName); -// } -// -// byte[] classBytes; -// try (InputStream is = resource.openStream()) { -// classBytes = is.readAllBytes(); -// } catch (IOException ex) { -// throw new ClassNotFoundException("Could not read class:" + name, ex); -// } -// -// byte[] transformedBytes = transformClassBytes(name, classBytes); -// -//// CodeSource codeSource = new CodeSource(resource, (java.security.cert.Certificate[]) null); -//// ProtectionDomain pd = new ProtectionDomain(codeSource, null); -// -// return defineClass(name, transformedBytes, 0, transformedBytes.length); -// } - -// private byte[] transformClassBytes(String className, byte[] originalBytes) -// throws ClassNotFoundException { -// byte[] current = originalBytes; -// for (ClassFileTransformer transformer : transformers) { -// try { -// byte[] transformed = transformer.transform( -// this, -// className, -// null, -// null, -// current -// ); -// if (transformed != null) { -// current = transformed; -// } -// } catch (IllegalClassFormatException e) { -// throw new ClassNotFoundException( -// "Error while transforming class " + className, e -// ); -// } -// } -// return current; -// } - private boolean isExcludedFromTransformation(String className) { return className.startsWith("java.") || className.startsWith("javax.") diff --git a/surf-cloud-standalone/build.gradle.kts b/surf-cloud-standalone/build.gradle.kts index 4676fba3..7f71d02b 100644 --- a/surf-cloud-standalone/build.gradle.kts +++ b/surf-cloud-standalone/build.gradle.kts @@ -31,7 +31,6 @@ dependencies { } } -// implementation(fileTree("libs/**/*.jar")) // Include all JARs in libs directory implementation(fileTree("libs") { include("*.jar") }) diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/__AdditionalSpringStandaloneConfiguration.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/__AdditionalSpringStandaloneConfiguration.kt index 563237d0..8cbdc82c 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/__AdditionalSpringStandaloneConfiguration.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/__AdditionalSpringStandaloneConfiguration.kt @@ -14,5 +14,4 @@ import org.springframework.context.annotation.Import @AdditionalStandaloneConfiguration @ImportAutoConfiguration(ExposedAutoConfiguration::class) @Import(TransactionConfiguration::class) -//@EnableAspectJAutoProxy(proxyTargetClass = true) internal class __AdditionalSpringStandaloneConfiguration diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/DebugCommand.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/DebugCommand.kt deleted file mode 100644 index dc48dc21..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/DebugCommand.kt +++ /dev/null @@ -1,26 +0,0 @@ -//package dev.slne.surf.cloud.standalone.commands -// -//import dev.slne.surf.cloud.api.util.buildAnsiString -//import dev.slne.surf.cloud.core.util.bean -//import dev.slne.surf.cloud.standalone.independentCloudInstance -//import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl -//import org.springframework.boot.ansi.AnsiColor -//import org.springframework.shell.command.CommandContext -//import org.springframework.shell.command.annotation.Command -// -//@Command(command = ["debug"], description = "Debug command") -//class DebugCommand { -// -// @Command(command = ["listClients"], description = "List connected clients") -// fun listConnectedClients(context: CommandContext) { -// with(context.terminal.writer()) { -// val server = bean() -// val clients = server.connection.clientTracker.clients -// -// println(buildAnsiString(AnsiColor.GREEN, "Connected clients:")) -// clients.forEach { client -> -// println("- ${client.serverGuid} (${client.channel.remoteAddress()})") -// } -// } -// } -//} \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/LifecycleCommand.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/LifecycleCommand.kt deleted file mode 100644 index 328f8b91..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/LifecycleCommand.kt +++ /dev/null @@ -1,17 +0,0 @@ -//package dev.slne.surf.cloud.standalone.commands -// -//import dev.slne.surf.cloud.api.exceptions.ExitCodes -//import org.springframework.shell.command.CommandContext -//import org.springframework.shell.command.annotation.Command -//import kotlin.system.exitProcess -// -// -//@Command(group = "lifecycle") -//class LifecycleCommand { -// -// @Command(command = ["stop"], description = "Stops the server") -// fun stop(context: CommandContext) { -// context.terminal.writer().println("Stopping server...") -// exitProcess(ExitCodes.NORMAL) -// } -//} diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/__CommandScan.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/__CommandScan.kt deleted file mode 100644 index 7ea9f08a..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/__CommandScan.kt +++ /dev/null @@ -1,12 +0,0 @@ -//package dev.slne.surf.cloud.standalone.commands -// -//import org.springframework.shell.command.annotation.EnableCommand -//import org.springframework.stereotype.Component -// -//@Suppress("ClassName") -//@EnableCommand( -// LifecycleCommand::class, -// DebugCommand::class -//) -//@Component -//class __CommandScan diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/execution/tasks/BuildContexts.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/execution/tasks/BuildContexts.kt index 93f2579a..aa4a625c 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/execution/tasks/BuildContexts.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/execution/tasks/BuildContexts.kt @@ -4,11 +4,11 @@ import com.mojang.brigadier.LiteralMessage import com.mojang.brigadier.context.ContextChain import com.mojang.brigadier.exceptions.CommandSyntaxException import com.mojang.brigadier.exceptions.DynamicCommandExceptionType -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf -import dev.slne.surf.cloud.api.common.util.objectListOf import dev.slne.surf.cloud.api.server.command.CommandResultCallback import dev.slne.surf.cloud.api.server.command.ExecutionCommandSource import dev.slne.surf.cloud.standalone.commands.execution.* +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.objectListOf open class BuildContexts>( private val commandInput: String, diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/impl/TestCommand.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/impl/TestCommand.kt index e77f8ffc..e6e007a3 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/impl/TestCommand.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/commands/impl/TestCommand.kt @@ -2,24 +2,16 @@ package dev.slne.surf.cloud.standalone.commands.impl import com.mojang.brigadier.CommandDispatcher import com.mojang.brigadier.builder.LiteralArgumentBuilder -import com.mojang.brigadier.tree.LiteralCommandNode import dev.slne.surf.cloud.api.server.command.CommandSource import dev.slne.surf.cloud.api.server.command.ConsoleCommand -import dev.slne.surf.cloud.api.server.command.literal object TestCommand : ConsoleCommand { fun register(dispatcher: CommandDispatcher) { -// dispatcher.register(literal("test") { -// executes { context -> -// context.source.sendSuccess("This is a test command") -// 1 -// } -// }) - - dispatcher.register(LiteralArgumentBuilder.literal("test") - .executes { context -> - context.source.sendSuccess("This is a test command") - 1 - }) + dispatcher.register( + LiteralArgumentBuilder.literal("test") + .executes { context -> + context.source.sendSuccess("This is a test command") + 1 + }) } } \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierCompletionMatcher.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierCompletionMatcher.kt index 66d90fa5..1a4fbf5b 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierCompletionMatcher.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierCompletionMatcher.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.standalone.console -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.toObjectList +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.toObjectList import it.unimi.dsi.fastutil.objects.ObjectList import org.jline.reader.Candidate import org.jline.reader.CompletingParsedLine diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierConsoleParser.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierConsoleParser.kt index 12261bfa..ca541361 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierConsoleParser.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/console/BrigadierConsoleParser.kt @@ -2,10 +2,10 @@ package dev.slne.surf.cloud.standalone.console import com.mojang.brigadier.StringReader import com.mojang.brigadier.context.CommandContextBuilder -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.server.command.CommandSource import dev.slne.surf.cloud.api.server.command.util.contains import dev.slne.surf.cloud.standalone.commands.CommandManagerImpl +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import org.jline.reader.ParsedLine import org.jline.reader.Parser diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/NettyServerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/NettyServerImpl.kt index 5887adbe..5492187b 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/NettyServerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/NettyServerImpl.kt @@ -1,7 +1,6 @@ package dev.slne.surf.cloud.standalone.netty.server import com.github.benmanes.caffeine.cache.Caffeine -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.core.common.config.cloudConfig import dev.slne.surf.cloud.core.common.netty.network.DisconnectReason import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails @@ -12,6 +11,7 @@ import dev.slne.surf.cloud.standalone.server.serverManagerImpl import dev.slne.surf.cloud.standalone.spark.provider.CloudTickHook import dev.slne.surf.cloud.standalone.spark.provider.CloudTickReporter import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.toObjectList import io.netty.channel.epoll.Epoll import io.netty.channel.unix.DomainSocketAddress import kotlinx.coroutines.Dispatchers diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/ProxySecretHolder.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/ProxySecretHolder.kt index e10baf6f..fd2c0a62 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/ProxySecretHolder.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/ProxySecretHolder.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.standalone.netty.server import dev.slne.surf.cloud.api.server.netty.packet.broadcast -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket import dev.slne.surf.cloud.standalone.config.ProxyConfig.SecretConfig.SecretType import dev.slne.surf.cloud.standalone.config.standaloneConfig import org.apache.commons.lang3.RandomStringUtils diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/connection/ServerConnectionListener.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/connection/ServerConnectionListener.kt index 3dd7cdc8..3f776387 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/connection/ServerConnectionListener.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/connection/ServerConnectionListener.kt @@ -9,8 +9,8 @@ import dev.slne.surf.cloud.api.common.util.threadFactory import dev.slne.surf.cloud.core.common.config.cloudConfig import dev.slne.surf.cloud.core.common.coroutines.ConnectionManagementScope import dev.slne.surf.cloud.core.common.netty.network.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundBundlePacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundDisconnectPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundDisconnectPacket import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl import dev.slne.surf.cloud.standalone.netty.server.network.ServerHandshakePacketListenerImpl import dev.slne.surf.surfapi.core.api.util.logger diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerCommonPacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerCommonPacketListenerImpl.kt index c26387be..30bfbeb7 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerCommonPacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerCommonPacketListenerImpl.kt @@ -7,10 +7,15 @@ import dev.slne.surf.cloud.core.common.netty.network.CommonTickablePacketListene import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectReason import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.KeepAliveHandler import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ServerCommonPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundDisconnectPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundBroadcastPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.bidirectional.KeepAlivePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundPongResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundBundlePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.serverbound.ServerboundPingRequestPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundDisconnectPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundBroadcastPacket import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl import dev.slne.surf.cloud.standalone.netty.server.ServerClientImpl import dev.slne.surf.surfapi.core.api.util.logger diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerEncryptionManager.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerEncryptionManager.kt index 6c38378b..f902aa48 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerEncryptionManager.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerEncryptionManager.kt @@ -17,7 +17,6 @@ class ServerEncryptionManager : EncryptionManager() { override fun setupEncryption(ch: Channel) { ch.pipeline().addFirst( -// HandlerNames.SPLITTER, HandlerNames.SSL_HANDLER, buildSslContext().newHandler(ch.alloc()) ) @@ -34,22 +33,4 @@ class ServerEncryptionManager : EncryptionManager() { .clientAuth(ClientAuth.REQUIRE) .build() } - -// private fun buildTrustManager(): TrustManagerFactory { -// val keyStore = KeyStore.getInstance(KeyStore.getDefaultType()).apply { load(null, null) } -// -// clientCertificatesFolder.toFile().listFiles { file -> file.extension == "crt" } -// ?.forEachIndexed { index, certFile -> -// certFile.inputStream().use { inputStream -> -// val certificate = -// CertificateFactory.getInstance("X.509").generateCertificate(inputStream) -// keyStore.setCertificateEntry("client-cert-$index", certificate) -// } -// } -// -// val trustManagerFactory = -// TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()) -// trustManagerFactory.init(keyStore) -// return trustManagerFactory -// } } \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerHandshakePacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerHandshakePacketListenerImpl.kt index f7378d87..26806c93 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerHandshakePacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerHandshakePacketListenerImpl.kt @@ -4,16 +4,19 @@ import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectReason import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ClientIntent -import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.PROTOCOL_VERSION import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ServerHandshakePacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.ServerboundHandshakePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.serverbound.PROTOCOL_VERSION +import dev.slne.surf.cloud.core.common.netty.network.protocol.handshake.serverbound.ServerboundHandshakePacket import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.InitializeProtocols import dev.slne.surf.cloud.core.common.netty.network.protocol.login.ClientboundLoginDisconnectPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.login.LoginProtocols import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl import java.net.InetSocketAddress -class ServerHandshakePacketListenerImpl(val server: NettyServerImpl, val connection: ConnectionImpl) : +class ServerHandshakePacketListenerImpl( + val server: NettyServerImpl, + val connection: ConnectionImpl +) : ServerHandshakePacketListener { override suspend fun handleHandshake(packet: ServerboundHandshakePacket) { connection.hostname = "${packet.hostName}:${packet.port}" diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerInitializePacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerInitializePacketListenerImpl.kt index 84ed8fe5..0f67d4e9 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerInitializePacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerInitializePacketListenerImpl.kt @@ -2,9 +2,9 @@ package dev.slne.surf.cloud.standalone.netty.server.network import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl import dev.slne.surf.cloud.core.common.netty.network.DisconnectionDetails -import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ClientboundInitializeIdResponsePacket import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ServerInitializePacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.ServerboundInitializeRequestIdPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.clientbound.ClientboundInitializeIdResponsePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.initialize.serverbound.ServerboundInitializeRequestIdPacket import dev.slne.surf.cloud.standalone.persistent.StandalonePersistentData class ServerInitializePacketListenerImpl(val connection: ConnectionImpl) : diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerLoginPacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerLoginPacketListenerImpl.kt index d7b4237b..fc2484d5 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerLoginPacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerLoginPacketListenerImpl.kt @@ -49,10 +49,6 @@ class ServerLoginPacketListenerImpl(val server: NettyServerImpl, val connection: private fun startClientVerification() { state = State.VERIFYING - -// if (proxy && standaloneConfig.useSingleProxySetup && ProxyServerAutoregistration.hasProxy) { -// disconnect(DisconnectReason.PROXY_ALREADY_CONNECTED) -// } } private fun verifyLoginAndFinishConnectionSetup() { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerPreRunningPacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerPreRunningPacketListenerImpl.kt index 05f7702f..4200d3bf 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerPreRunningPacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerPreRunningPacketListenerImpl.kt @@ -1,7 +1,12 @@ package dev.slne.surf.cloud.standalone.netty.server.network import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.ServerPreRunningPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundPreRunningFinishedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.clientbound.ClientboundProceedToSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundPreRunningAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundProceedToSynchronizingAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.prerunning.serverbound.ServerboundRequestContinuation import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.SynchronizingProtocols import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl import dev.slne.surf.cloud.standalone.netty.server.ServerClientImpl diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerRunningPacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerRunningPacketListenerImpl.kt index ad738e15..b3aee5f8 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerRunningPacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerRunningPacketListenerImpl.kt @@ -9,12 +9,16 @@ import dev.slne.surf.cloud.api.common.player.ConnectionResultEnum import dev.slne.surf.cloud.api.common.player.punishment.type.PunishmentType import dev.slne.surf.cloud.api.common.server.CloudServer import dev.slne.surf.cloud.api.common.server.CloudServerManager -import dev.slne.surf.cloud.api.common.util.mutableIntSetOf import dev.slne.surf.cloud.core.common.coroutines.PacketHandlerScope import dev.slne.surf.cloud.core.common.coroutines.PunishmentHandlerScope import dev.slne.surf.cloud.core.common.coroutines.QueueConnectionScope import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RunningServerPacketListener +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundConnectPlayerToServerResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundPlayerPersistentDataContainerResponse +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundUpdateServerInformationPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.* import dev.slne.surf.cloud.core.common.netty.registry.listener.NettyListenerRegistry import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.player.playerManagerImpl @@ -27,6 +31,7 @@ import dev.slne.surf.cloud.standalone.server.StandaloneProxyCloudServerImpl import dev.slne.surf.cloud.standalone.server.serverManagerImpl import dev.slne.surf.cloud.standalone.sync.SyncRegistryImpl import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableIntSetOf import dev.slne.surf.surfapi.core.api.util.random import kotlinx.coroutines.launch import kotlinx.coroutines.withContext diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerSynchronizingPacketListenerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerSynchronizingPacketListenerImpl.kt index f4095791..c985af24 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerSynchronizingPacketListenerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/ServerSynchronizingPacketListenerImpl.kt @@ -7,12 +7,16 @@ import dev.slne.surf.cloud.api.common.player.CloudPlayerManager import dev.slne.surf.cloud.core.common.coroutines.BeforeStartTaskScope import dev.slne.surf.cloud.core.common.coroutines.PacketHandlerScope import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.common.ClientboundSetVelocitySecretPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ClientboundSynchronizeFinishPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.common.clientbound.ClientboundSetVelocitySecretPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RunningProtocols +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundBatchUpdateServer +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundCreateOfflineCloudPlayerIfNotExistsPacket import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ServerSynchronizingPacketListener -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ServerboundSynchronizeFinishAcknowledgedPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundSynchronizeFinishPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.serverbound.ServerboundSynchronizeFinishAcknowledgedPacket import dev.slne.surf.cloud.core.common.netty.registry.listener.NettyListenerRegistry import dev.slne.surf.cloud.core.common.plugin.task.CloudSynchronizeTaskManager import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/FinishSynchronizeTask.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/FinishSynchronizeTask.kt index 1f9b374a..415d5fec 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/FinishSynchronizeTask.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/FinishSynchronizeTask.kt @@ -2,7 +2,7 @@ package dev.slne.surf.cloud.standalone.netty.server.network.config import dev.slne.surf.cloud.api.common.netty.NettyClient import dev.slne.surf.cloud.api.common.plugin.spring.task.CloudInitialSynchronizeTask -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.FinishSynchronizingPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.bidirectional.FinishSynchronizingPacket object FinishSynchronizeTask : CloudInitialSynchronizeTask { override suspend fun execute(client: NettyClient) { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/SynchronizeRegistriesTask.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/SynchronizeRegistriesTask.kt index d4e725ab..4491e139 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/SynchronizeRegistriesTask.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/network/config/SynchronizeRegistriesTask.kt @@ -2,8 +2,8 @@ package dev.slne.surf.cloud.standalone.netty.server.network.config import dev.slne.surf.cloud.api.common.netty.NettyClient import dev.slne.surf.cloud.api.common.plugin.spring.task.CloudInitialSynchronizeTask -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ClientboundBatchSyncSetPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.ClientboundBatchSyncValuePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncSetPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.synchronizing.clientbound.ClientboundBatchSyncValuePacket import dev.slne.surf.cloud.standalone.sync.SyncRegistryImpl object SynchronizeRegistriesTask : CloudInitialSynchronizeTask { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/CloudPlayerPlaytimeManager.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/CloudPlayerPlaytimeManager.kt index 745c4d3b..fa4fa78e 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/CloudPlayerPlaytimeManager.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/CloudPlayerPlaytimeManager.kt @@ -4,10 +4,10 @@ import com.github.benmanes.caffeine.cache.Caffeine import com.sksamuel.aedile.core.expireAfterAccess import dev.slne.surf.cloud.api.common.event.CloudEventHandler import dev.slne.surf.cloud.api.common.event.player.connection.CloudPlayerDisconnectFromNetworkEvent -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.core.common.coroutines.PlayerPlaytimeScope import dev.slne.surf.cloud.standalone.player.db.exposed.CloudPlayerService import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import org.springframework.beans.factory.DisposableBean diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/OfflineCloudPlayerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/OfflineCloudPlayerImpl.kt index 832e0a21..fbeab691 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/OfflineCloudPlayerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/OfflineCloudPlayerImpl.kt @@ -49,7 +49,7 @@ class OfflineCloudPlayerImpl(uuid: UUID) : CommonOfflineCloudPlayerImpl(uuid) { override suspend fun playtime(): Playtime { return player?.playtime() ?: service.loadPlaytimeEntries(uuid) - .let { if (it.isEmpty()) PlaytimeImpl.EMPTY else PlaytimeImpl(it) } + .let { if (it.isEmpty()) PlaytimeImpl.EMPTY else PlaytimeImpl(it) } // FIXME: 24.07.2025 19:34 implement missing code } override suspend fun displayName(): Component { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerImpl.kt index a33d51a0..a13874cf 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerImpl.kt @@ -14,7 +14,15 @@ import dev.slne.surf.cloud.api.common.player.teleport.TeleportLocation import dev.slne.surf.cloud.api.common.server.CloudServer import dev.slne.surf.cloud.api.server.server.ServerCommonCloudServer import dev.slne.surf.cloud.core.common.netty.network.protocol.running.* -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundTransferPlayerPacketResponse.Status +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.DisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestLuckpermsMetaDataPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestPlayerPermissionPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SilentDisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.TeleportPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.TeleportPlayerToPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.UpdateAFKStatePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.* +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse.Status import dev.slne.surf.cloud.core.common.player.CommonCloudPlayerImpl import dev.slne.surf.cloud.core.common.player.playtime.PlaytimeEntry import dev.slne.surf.cloud.core.common.player.playtime.PlaytimeImpl diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerManagerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerManagerImpl.kt index a059dd47..91e151ac 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerManagerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/StandaloneCloudPlayerManagerImpl.kt @@ -10,7 +10,7 @@ import dev.slne.surf.cloud.api.server.export.PlayerDataExportEmpty import dev.slne.surf.cloud.core.common.coroutines.PlayerDataSaveScope import dev.slne.surf.cloud.core.common.coroutines.PlayerDatabaseScope import dev.slne.surf.cloud.core.common.messages.MessageManager -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundRunPrePlayerJoinTasksPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundRunPrePlayerJoinTasksPacket import dev.slne.surf.cloud.core.common.player.CloudPlayerManagerImpl import dev.slne.surf.cloud.core.common.player.playerManagerImpl import dev.slne.surf.cloud.core.common.player.task.PrePlayerJoinTaskManager @@ -37,11 +37,6 @@ class StandaloneCloudPlayerManagerImpl : CloudPlayerManagerImpl) = NameHistoryImpl(entries.mapTo(mutableObjectListOf()) { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/punishment/PunishmentManagerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/punishment/PunishmentManagerImpl.kt index b2c22ceb..c20f197e 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/punishment/PunishmentManagerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/punishment/PunishmentManagerImpl.kt @@ -8,12 +8,11 @@ import dev.slne.surf.cloud.api.common.player.OfflineCloudPlayer import dev.slne.surf.cloud.api.common.player.punishment.type.PunishmentAttachedIpAddress.PunishmentAttachedIpAddressImpl import dev.slne.surf.cloud.api.common.player.punishment.type.note.PunishmentNote.PunishmentNoteImpl import dev.slne.surf.cloud.api.common.player.task.PrePlayerJoinTask -import dev.slne.surf.cloud.api.common.util.toObjectList import dev.slne.surf.cloud.api.server.exposed.table.AuditableLongEntityClass import dev.slne.surf.cloud.api.server.netty.packet.broadcast import dev.slne.surf.cloud.core.common.coroutines.PunishmentHandlerScope -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundTriggerPunishmentCreatedEventPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundTriggerPunishmentUpdateEventPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundTriggerPunishmentCreatedEventPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundTriggerPunishmentUpdateEventPacket import dev.slne.surf.cloud.core.common.player.PunishmentCacheImpl import dev.slne.surf.cloud.core.common.player.PunishmentManager import dev.slne.surf.cloud.core.common.player.punishment.type.* @@ -21,6 +20,7 @@ import dev.slne.surf.cloud.standalone.player.db.exposed.punishment.entity.* import dev.slne.surf.cloud.standalone.player.db.exposed.punishment.table.* import dev.slne.surf.surfapi.core.api.util.logger import dev.slne.surf.surfapi.core.api.util.random +import dev.slne.surf.surfapi.core.api.util.toObjectList import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/coroutine/impl/CoroutineManagerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/coroutine/impl/CoroutineManagerImpl.kt index edb8d92b..1bda45db 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/coroutine/impl/CoroutineManagerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/coroutine/impl/CoroutineManagerImpl.kt @@ -1,11 +1,11 @@ package dev.slne.surf.cloud.standalone.plugin.coroutine.impl import com.google.auto.service.AutoService -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.synchronize import dev.slne.surf.cloud.api.server.plugin.StandalonePlugin import dev.slne.surf.cloud.api.server.plugin.coroutine.CoroutineManager import dev.slne.surf.cloud.api.server.plugin.coroutine.CoroutineSession +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.synchronize @AutoService(CoroutineManager::class) class CoroutineManagerImpl : CoroutineManager { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/LaunchEntryPointHandler.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/LaunchEntryPointHandler.kt index f7146009..b73581b5 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/LaunchEntryPointHandler.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/LaunchEntryPointHandler.kt @@ -1,19 +1,20 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint -import dev.slne.surf.cloud.api.common.util.mutableObject2BooleanMapOf -import dev.slne.surf.cloud.api.common.util.object2ObjectMapOf import dev.slne.surf.cloud.standalone.plugin.provider.PluginProvider import dev.slne.surf.cloud.standalone.plugin.storage.BootstrapSpringProviderStorage import dev.slne.surf.cloud.standalone.plugin.storage.ProviderStorage import dev.slne.surf.cloud.standalone.plugin.storage.ServerSpringPluginProviderStorage +import dev.slne.surf.surfapi.core.api.util.mutableObject2BooleanMapOf +import dev.slne.surf.surfapi.core.api.util.object2ObjectMapOf import it.unimi.dsi.fastutil.objects.Object2ObjectMap object LaunchEntryPointHandler : EntrypointHandler { - val storage: Object2ObjectMap, ProviderStorage<*>> = object2ObjectMapOf, ProviderStorage<*>>( - Entrypoint.SPRING_PLUGIN_BOOTSTRAPPER to BootstrapSpringProviderStorage(), - Entrypoint.SPRING_PLUGIN to ServerSpringPluginProviderStorage() - ) + val storage: Object2ObjectMap, ProviderStorage<*>> = + object2ObjectMapOf, ProviderStorage<*>>( + Entrypoint.SPRING_PLUGIN_BOOTSTRAPPER to BootstrapSpringProviderStorage(), + Entrypoint.SPRING_PLUGIN to ServerSpringPluginProviderStorage() + ) private val enteredMap = mutableObject2BooleanMapOf>().apply { defaultReturnValue(false) } diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/ByteCodeModifyingURLClassloader.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/ByteCodeModifyingURLClassloader.kt index 51c5672e..8b00fcd2 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/ByteCodeModifyingURLClassloader.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/ByteCodeModifyingURLClassloader.kt @@ -1,7 +1,7 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint.classloader -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.synchronize +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.synchronize import java.io.IOException import java.io.UncheckedIOException import java.net.JarURLConnection diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.kt index 43d8e0c8..8b76a27a 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/classloader/group/LockingClassLoaderGroup.kt @@ -1,8 +1,8 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint.classloader.group -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf import dev.slne.surf.cloud.api.server.plugin.provider.classloader.SpringPluginClassloader import dev.slne.surf.cloud.api.server.plugin.provider.classloader.SpringPluginClassloaderGroup +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf import java.util.concurrent.atomic.AtomicInteger import java.util.concurrent.locks.ReentrantReadWriteLock diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/dependency/PluginMetaDependencyTree.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/dependency/PluginMetaDependencyTree.kt index c0785a74..80449df5 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/dependency/PluginMetaDependencyTree.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/dependency/PluginMetaDependencyTree.kt @@ -5,10 +5,10 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint.dependency import com.google.common.graph.GraphBuilder import com.google.common.graph.Graphs import com.google.common.graph.MutableGraph -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf import dev.slne.surf.cloud.api.server.plugin.configuration.PluginMeta import dev.slne.surf.cloud.api.server.plugin.dependency.DependencyContext import dev.slne.surf.cloud.standalone.plugin.provider.PluginProvider +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf abstract class PluginMetaDependencyTree( protected val graph: MutableGraph = GraphBuilder.directed().build() diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/LoadOrderTree.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/LoadOrderTree.kt index b5e660a2..28f648e7 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/LoadOrderTree.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/LoadOrderTree.kt @@ -3,11 +3,11 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint.strategy import com.google.common.graph.MutableGraph -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf import dev.slne.surf.cloud.api.server.plugin.configuration.PluginMeta import dev.slne.surf.cloud.standalone.plugin.provider.PluginProvider import dev.slne.surf.cloud.standalone.plugin.provider.configuration.StandalonePluginMeta import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf class LoadOrderTree( private val providerMap: Map>, diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/PluginLoadingStrategy.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/PluginLoadingStrategy.kt index d3176fd0..7630116e 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/PluginLoadingStrategy.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/PluginLoadingStrategy.kt @@ -4,12 +4,12 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint.strategy import com.google.common.collect.Maps import com.google.common.graph.GraphBuilder -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.standalone.plugin.entrypoint.dependency.PluginMetaDependencyTree import dev.slne.surf.cloud.standalone.plugin.exception.UnknownDependencyException import dev.slne.surf.cloud.standalone.plugin.provider.PluginProvider import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import it.unimi.dsi.fastutil.objects.ObjectList class PluginLoadingStrategy(private val configuration: ProviderConfiguration) : diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/TopographicGraphSorter.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/TopographicGraphSorter.kt index b60fcabd..02fd54a3 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/TopographicGraphSorter.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/entrypoint/strategy/TopographicGraphSorter.kt @@ -3,8 +3,8 @@ package dev.slne.surf.cloud.standalone.plugin.entrypoint.strategy import com.google.common.graph.Graph -import dev.slne.surf.cloud.api.common.util.mutableObject2IntMapOf -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf +import dev.slne.surf.surfapi.core.api.util.mutableObject2IntMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import it.unimi.dsi.fastutil.objects.ObjectList fun Graph.topologicalSort(): ObjectList { @@ -47,4 +47,4 @@ fun Graph.topologicalSort(): ObjectList { return sorted } -class GraphCycleException(): RuntimeException() \ No newline at end of file +class GraphCycleException() : RuntimeException() \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/StandaloneClasspathBuilder.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/StandaloneClasspathBuilder.kt index 8fc25214..3f07e1cf 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/StandaloneClasspathBuilder.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/StandaloneClasspathBuilder.kt @@ -1,6 +1,5 @@ package dev.slne.surf.cloud.standalone.plugin.loader -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.server.plugin.bootstrap.StandalonePluginProviderContext import dev.slne.surf.cloud.api.server.plugin.loader.PluginClasspathBuilder import dev.slne.surf.cloud.api.server.plugin.loader.library.ClassPathLibrary @@ -8,6 +7,7 @@ import dev.slne.surf.cloud.standalone.plugin.entrypoint.classloader.ByteCodeModi import dev.slne.surf.cloud.standalone.plugin.entrypoint.classloader.SpringPluginClassloaderImpl import dev.slne.surf.cloud.standalone.plugin.loader.library.StandaloneLibraryStore import dev.slne.surf.cloud.standalone.plugin.provider.configuration.StandalonePluginMeta +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import it.unimi.dsi.fastutil.objects.ObjectList import java.io.IOException import java.net.URL diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/library/StandaloneLibraryStore.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/library/StandaloneLibraryStore.kt index 601f2129..4983ea9c 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/library/StandaloneLibraryStore.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/loader/library/StandaloneLibraryStore.kt @@ -1,10 +1,10 @@ package dev.slne.surf.cloud.standalone.plugin.loader.library -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.server.plugin.loader.library.LibraryStore +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import java.nio.file.Path -class StandaloneLibraryStore: LibraryStore { +class StandaloneLibraryStore : LibraryStore { val paths = mutableObjectListOf() override fun addLibrary(library: Path) { diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/manager/StandalonePluginInstanceManager.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/manager/StandalonePluginInstanceManager.kt index 1d2576ff..d876f406 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/manager/StandalonePluginInstanceManager.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/manager/StandalonePluginInstanceManager.kt @@ -1,7 +1,5 @@ package dev.slne.surf.cloud.standalone.plugin.manager -import dev.slne.surf.cloud.api.common.util.mutableObject2ObjectMapOf -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.server.plugin.PluginManager import dev.slne.surf.cloud.api.server.plugin.StandalonePlugin import dev.slne.surf.cloud.api.server.plugin.configuration.PluginMeta @@ -14,6 +12,8 @@ import dev.slne.surf.cloud.standalone.plugin.entrypoint.strategy.PluginGraphCycl import dev.slne.surf.cloud.standalone.plugin.exception.InvalidPluginException import dev.slne.surf.cloud.standalone.plugin.provider.source.FileProviderSource import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObject2ObjectMapOf +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import java.io.IOException import java.nio.file.Path diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/provider/configuration/serializer/EnumValueSerializer.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/provider/configuration/serializer/EnumValueSerializer.kt index f3c124c9..70ebfae3 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/provider/configuration/serializer/EnumValueSerializer.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/provider/configuration/serializer/EnumValueSerializer.kt @@ -14,16 +14,18 @@ class EnumValueSerializer : ScalarSerializer>(object : TypeToken override fun deserialize(type: Type, obj: Any): Enum<*>? { val enumConstant = obj.toString() val typeClass = GenericTypeReflector.erase(type).asSubclass(Enum::class.java) - var ret = EnumLookup.lookupEnum(typeClass, enumConstant) + val ret = EnumLookup.lookupEnum(typeClass, enumConstant) ?: EnumLookup.lookupEnum(typeClass, enumConstant.replace('-', '_')) if (ret == null) { val longer = typeClass.enumConstants.size > 10 val optionSample = typeClass.enumConstants.take(10).map { it.name } log.atSevere() - .log("Failed to deserialize enum value '$enumConstant' for type $typeClass. " + - "Available options: ${optionSample.joinToString()}" + - if (longer) "..." else "") + .log( + "Failed to deserialize enum value '$enumConstant' for type $typeClass. " + + "Available options: ${optionSample.joinToString()}" + + if (longer) "..." else "" + ) } return ret diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/DatabaseConfig.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/DatabaseConfig.kt index 4b1d1b13..a1da839e 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/DatabaseConfig.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/DatabaseConfig.kt @@ -46,12 +46,5 @@ class DatabaseConfigConfiguration { } -fun createDatabaseConfig(dataDir: Path): DatabaseConfig { -// val config = dataDir / "database.yaml" -// if (config.notExists()) { -// config.createParentDirectories() -// config.createFile() -// } - - return surfConfigApi.createSpongeYmlConfig(dataDir, "database.yaml") -} \ No newline at end of file +fun createDatabaseConfig(dataDir: Path) = + surfConfigApi.createSpongeYmlConfig(dataDir, "database.yaml") \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/PluginLoadTimeWeavingConfiguration.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/PluginLoadTimeWeavingConfiguration.kt index 4d0b7e5b..9de100bc 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/PluginLoadTimeWeavingConfiguration.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/plugin/spring/config/PluginLoadTimeWeavingConfiguration.kt @@ -4,6 +4,5 @@ import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Profile @Configuration(proxyBeanMethods = false) -//@EnableAspectJAutoProxy(proxyTargetClass = true) @Profile("plugin") class PluginLoadTimeWeavingConfiguration \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/CommonStandaloneServerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/CommonStandaloneServerImpl.kt index 42ab1437..e0c89c3e 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/CommonStandaloneServerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/CommonStandaloneServerImpl.kt @@ -3,8 +3,8 @@ package dev.slne.surf.cloud.standalone.server import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.server.UserListImpl import dev.slne.surf.cloud.api.server.server.ServerCommonCloudServer -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundAddPlayerToServerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundRemovePlayerFromServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundAddPlayerToServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundRemovePlayerFromServerPacket import dev.slne.surf.cloud.core.common.util.bean import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl import java.util.* @@ -32,35 +32,4 @@ class CommonStandaloneServerImpl : CommonStandaloneServer { server.connection.broadcast(packet) } } -} - -//abstract class CommonStandaloneServerImpl( -// uid: Long, -// group: String, -// name: String, -// users: UserListImpl, -// information: ClientInformation, -// override val connection: Connection, -//) : CommonCloudServerImpl(uid, group, name, users, information ), ServerCommonCloudServer { -// private val connectionThrottlerer = Mutex() -// -// fun addPlayer(player: CloudPlayer) { -// users.add(player) -// } -// -// fun removePlayer(player: CloudPlayer) { -// users.remove(player) -// } -// -// suspend fun connectPlayer(player: StandaloneCloudPlayerImpl): ConnectionResult { -// connectionThrottlerer.withLock { -// if (player.server == this || player.proxyServer == this) { -// return ConnectionResult.ALREADY_CONNECTED -// } -// -// if (emptySlots <= 0) { -// return ConnectionResult.SERVER_FULL -// } -// } -// } -//} \ No newline at end of file +} \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerImpl.kt index 1f43e346..56970d26 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerImpl.kt @@ -7,9 +7,9 @@ import dev.slne.surf.cloud.api.server.server.ServerCloudServer import dev.slne.surf.cloud.api.server.server.ServerCommonCloudServer import dev.slne.surf.cloud.core.common.coroutines.CloudServerCleanupScope import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundTransferPlayerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundTriggerShutdownPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundTransferPlayerPacketResponse.Status +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundTransferPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundTriggerShutdownPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse.Status import dev.slne.surf.cloud.core.common.server.AbstractCloudServer import dev.slne.surf.cloud.core.common.util.bean import dev.slne.surf.cloud.standalone.config.standaloneConfig diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerManagerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerManagerImpl.kt index 46d4fc07..171308a5 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerManagerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneCloudServerManagerImpl.kt @@ -7,15 +7,12 @@ import dev.slne.surf.cloud.api.common.player.CloudPlayer import dev.slne.surf.cloud.api.common.player.ConnectionResultEnum import dev.slne.surf.cloud.api.common.server.CloudServer import dev.slne.surf.cloud.api.common.server.CloudServerManager -import dev.slne.surf.cloud.api.common.util.emptyObjectList -import dev.slne.surf.cloud.api.common.util.freeze -import dev.slne.surf.cloud.api.common.util.mutableObjectListOf import dev.slne.surf.cloud.api.server.server.ServerCloudServerManager import dev.slne.surf.cloud.api.server.server.ServerCommonCloudServer import dev.slne.surf.cloud.api.server.server.ServerProxyCloudServer -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundRegisterServerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundUnregisterServerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RequestOfflineDisplayNamePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.RequestOfflineDisplayNamePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundRegisterServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundUnregisterServerPacket import dev.slne.surf.cloud.core.common.server.CommonCloudServerImpl import dev.slne.surf.cloud.core.common.server.CommonCloudServerManagerImpl import dev.slne.surf.cloud.core.common.util.bean @@ -23,7 +20,10 @@ import dev.slne.surf.cloud.standalone.config.standaloneConfig import dev.slne.surf.cloud.standalone.event.server.CloudServerRegisteredEvent import dev.slne.surf.cloud.standalone.netty.server.NettyServerImpl import dev.slne.surf.cloud.standalone.player.StandaloneCloudPlayerImpl +import dev.slne.surf.surfapi.core.api.util.emptyObjectList +import dev.slne.surf.surfapi.core.api.util.freeze import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectListOf import it.unimi.dsi.fastutil.objects.ObjectCollection import it.unimi.dsi.fastutil.objects.ObjectList import net.kyori.adventure.text.Component diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneProxyCloudServerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneProxyCloudServerImpl.kt index 8ab0f827..aed31629 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneProxyCloudServerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/StandaloneProxyCloudServerImpl.kt @@ -3,7 +3,7 @@ package dev.slne.surf.cloud.standalone.server import dev.slne.surf.cloud.api.server.server.ServerCommonCloudServer import dev.slne.surf.cloud.api.server.server.ServerProxyCloudServer import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ClientboundTriggerShutdownPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.ClientboundTriggerShutdownPacket import dev.slne.surf.cloud.core.common.server.AbstractProxyCloudServer import java.net.InetSocketAddress diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/GroupQueueImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/GroupQueueImpl.kt index 5b16b97e..f2b66edb 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/GroupQueueImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/GroupQueueImpl.kt @@ -220,6 +220,6 @@ class GroupQueueImpl( suspend fun entriesSnapshot() = lock.withLock { entries.snapshot() } override fun asComponent(): Component { - TODO("Not yet implemented") + TODO("Not yet implemented") // TODO: Implement this method to return a Component representation of the queue } } \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/QueueManagerImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/QueueManagerImpl.kt index 0bab22c6..669595f0 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/QueueManagerImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/QueueManagerImpl.kt @@ -69,7 +69,6 @@ class QueueManagerImpl( player.uuid, ConnectionResultEnum.QUEUE_SWAPPED(other.getQueueName(), target.name) ) -// player.sendMessage(MessageManager.Queue.getQueueSwap(other.getQueueName(), target.name)) } } @@ -117,7 +116,6 @@ class QueueManagerImpl( player.uuid, ConnectionResultEnum.QUEUE_SWAPPED(other.getQueueName(), target) ) -// player.sendMessage(MessageManager.Queue.getQueueSwap(other.getQueueName(), target.name)) } } diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/ServerQueueImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/ServerQueueImpl.kt index fc0a749e..06b6fd32 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/ServerQueueImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/ServerQueueImpl.kt @@ -59,6 +59,6 @@ class ServerQueueImpl( serverManagerImpl.retrieveServerById(serverUid)?.name ?: serverUid.toString() override fun asComponent(): Component { - TODO("Not yet implemented") + TODO("Not yet implemented") // TODO: Implement this method to return a Component representation of the queue } } \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/SingleServerQueue.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/SingleServerQueue.kt deleted file mode 100644 index feb024ae..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/server/queue/SingleServerQueue.kt +++ /dev/null @@ -1,101 +0,0 @@ -package dev.slne.surf.cloud.standalone.server.queue - -// -//class SingleServerQueue(private val server: StandaloneCloudServerImpl) { -// private val log = logger() -// private val queue = -// FairSuspendPriorityQueue { a, b -> -// val aPriority = a.getLuckpermsMetaData(QUEUE_PRIORITY_KEY)?.toIntOrNull() ?: -1 -// val bPriority = b.getLuckpermsMetaData(QUEUE_PRIORITY_KEY)?.toIntOrNull() ?: -1 -// bPriority.compareTo(aPriority) -// } -// -// private val mutex = Mutex() -// -// @Volatile -// private var processing = false -// -// val queueDisplay = ServerQueueDisplay(this) -// -// private suspend fun processQueue() = coroutineScope { -// if (processing) return@coroutineScope -// processing = true -// -// while (isActive) { -// val player = mutex.withLock { -// if (queue.isEmpty() || !server.hasEmptySlots()) return@coroutineScope -// queue.poll() -// } ?: break // No more players to process at the moment -// val rawResult = player.connectToServer(server) // suspend -// val (result, message) = rawResult -// -// runCatching { -// when (result) { -// // Re-add the player to the queue if the server is full -// SERVER_FULL -> mutex.withLock { queue.addFirst(player) } -// CATEGORY_FULL -> throw AssertionError("How did that happen? We are not using categories here.") -// SERVER_NOT_FOUND -> throw AssertionError("How did this pop up here? The server should exist.") -// SERVER_OFFLINE -> throw AssertionError("Some very weird stuff happened here. The server should be online.") -// ALREADY_CONNECTED -> log.atWarning() -// .log("Player %s is already connected to the server", player.uuid) -// -// CANNOT_SWITCH_PROXY -> throw AssertionError("It is not possible to change the proxy here.") -// OTHER_SERVER_CANNOT_ACCEPT_TRANSFER_PACKET, CANNOT_COMMUNICATE_WITH_PROXY, CANNOT_CONNECT_TO_PROXY -> -// throw AssertionError("Well this check should have been done before adding the player to the queue. Someone definitely messed up and it was not me.") -// -// CONNECTION_IN_PROGRESS -> Unit // Don't know what happened here, but good for us -// CONNECTION_CANCELLED, SERVER_DISCONNECTED -> { -// if (message != null) { -// player.sendMessage(message) -// } -// } -// -// SUCCESS -> player.connectionQueueCallback?.complete(rawResult) -// } -// }.onFailure { player.connectionQueueCallback?.completeExceptionally(it) } -// } -// -// processing = false -// } -// -// suspend fun addPlayerToQueue(player: StandaloneCloudPlayerImpl) { -// mutex.withLock { -// if (!queue.contains(player)) { -// queue.offer(player) -// } -// } -// -// QueueProcessingScope.launch { processQueue() } -// } -// -// /** -// * Called when a player leaves the network. -// * -// * @param player The player that left the network. -// */ -// suspend fun handlePlayerLeave(player: CloudPlayer) { -// if (player !is StandaloneCloudPlayerImpl) return -// -// mutex.withLock { queue.remove(player) } -// QueueProcessingScope.launch { processQueue() } -// } -// -// /** -// * Removes a player from the queue. -// * -// * @param player The player to remove from the queue. -// */ -// suspend fun removePlayerFromQueue(player: StandaloneCloudPlayerImpl) { -// mutex.withLock { queue.remove(player) } -// QueueProcessingScope.launch { processQueue() } -// } -// -// /** -// * Called when the server information is updated. E.g., the maximum player count changes. -// */ -// fun handleServerUpdate() { -// QueueProcessingScope.launch { processQueue() } -// } -// -// suspend fun snapshot() = mutex.withLock { queue.toObjectList() } -//} \ No newline at end of file diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/sync/SyncRegistryImpl.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/sync/SyncRegistryImpl.kt index 6ae332a3..62bc34fd 100644 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/sync/SyncRegistryImpl.kt +++ b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/sync/SyncRegistryImpl.kt @@ -4,8 +4,8 @@ import com.google.auto.service.AutoService import dev.slne.surf.cloud.api.common.netty.packet.NettyPacket import dev.slne.surf.cloud.api.common.sync.SyncRegistry import dev.slne.surf.cloud.core.common.netty.network.ConnectionImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncSetDeltaPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SyncValueChangePacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncSetDeltaPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SyncValueChangePacket import dev.slne.surf.cloud.core.common.sync.BasicSyncValue import dev.slne.surf.cloud.core.common.sync.CommonSyncRegistryImpl import dev.slne.surf.cloud.core.common.sync.SyncSetImpl diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/NettyServerProxiedPacketHandler.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/NettyServerProxiedPacketHandler.kt deleted file mode 100644 index d82a5745..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/NettyServerProxiedPacketHandler.kt +++ /dev/null @@ -1,19 +0,0 @@ -package dev.slne.surf.cloud.standalone.temp - -//@Component -//@Profile("server") -//class NettyServerProxiedPacketHandler : ChannelInitializerModifier { -// override fun modify(channel: Channel) { -// channel.pipeline().addBefore("packetHandler", "proxiedPacketHandler", Handler()) -// } -// -// private class Handler : ChannelDuplexHandler() { -// override fun channelRead(ctx: ChannelHandlerContext, msg: Any) { -// if (msg is ProxiedNettyPacket) { -// msg.target.sendPacket(msg) -// } else { -// super.channelRead(ctx, msg) -// } -// } -// } -//} diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/SurfNettyServerPacketHandler.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/SurfNettyServerPacketHandler.kt deleted file mode 100644 index 3253dd83..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/temp/SurfNettyServerPacketHandler.kt +++ /dev/null @@ -1,119 +0,0 @@ -package dev.slne.surf.cloud.standalone.temp - -// -//@Component -//@Profile("server") -//class SurfNettyServerPacketHandler(private val nettyServerImpl: NettyServerImpl) { -// @SurfNettyPacketHandler -// fun onCloudServerRegistration(packet: CloudRegisterServerPacket, info: NettyPacketInfo) { -// if (packet.type != CloudRegisterServerPacket.Type.FETCH_PRELOAD) { -// return -// } -// -// val data = packet.data -// -// val serverId = if (data.serverId == CloudPersistentData.SERVER_ID_NOT_SET) { -// random.nextLong(0xffffff) -// } else { -// data.serverId -// } -// -// val server = CloudServerImpl( -// port = data.port, -// host = data.host, -// category = data.category, -// serverGuid = serverId, -// state = ServerState.RESTARTING -// ) -// -// val clientSource = info.asClientSource() as NettyClientSourceImpl -// clientSource.cloudServer = server -// clientSource.broadcastServerInfo(CloudServerInfoAction.ADD_SERVER_INFO) -// -// val preload = CloudRegisterServerPacket( -// type = CloudRegisterServerPacket.Type.PRELOAD, -// data = CloudServerRegistrationData( -// serverId = server.serverGuid, -// category = server.category, -// port = server.port, -// host = server.host, -// ) -// ) -// -// clientSource.sendPacket(preload) -// } -// -// @SurfNettyPacketHandler -// fun onCloudServerInfo(packet: CloudServerInfoPacket, info: NettyPacketInfo) { -// handleServerInfo(packet.server, packet.action) -// broadcastPacket(info.asClientSource(), packet) -// } -// -// @SurfNettyPacketHandler -// fun onCloudServerInfoBatch(packet: CloudServerInfoBatchPacket, info: NettyPacketInfo) { -// for (server in packet.servers) { -// handleServerInfo(server, packet.action) -// } -// broadcastPacket(info.asClientSource(), packet) -// } -// -// @SurfNettyPacketHandler -// fun onClientQuit(packet: ClientQuitPacket?, info: NettyPacketInfo) { -// val client = info.asClientSource() as NettyClientSourceImpl -// val server = client.cloudServer ?: return -// -// server.state = ServerState.OFFLINE -// client.broadcastServerInfo(CloudServerInfoAction.REMOVE_SERVER_INFO) -// client.cloudServer = null -// } -// -// @SurfNettyPacketHandler -// fun onClientJoin(packet: ClientJoinNettyPacket?, info: NettyPacketInfo) { -// val server = nettyServerImpl.connection.clientTracker.clients.asSequence() -// .filter { it.hasServerGuid() } -// .mapNotNull { it.cloudServer } -// .toSet() -// -// when (server.size) { -// 0 -> { -// } -// -// 1 -> info.source.sendPacket( -// CloudServerInfoPacket( -// CloudServerInfoAction.ADD_SERVER_INFO, -// server.iterator().next() -// ) -// ) -// -// else -> info.source.sendPacket( -// -// CloudServerInfoBatchPacket( -// CloudServerInfoAction.ADD_SERVER_INFO, -// server -// ) -// ) -// } -// } -// -// private fun handleServerInfo(server: CloudServer, action: CloudServerInfoAction) { -// when (action) { -// CloudServerInfoAction.UPDATE_SERVER_INFO -> { -// val list = nettyServerImpl.connection.clientTracker -// val clientSource = -// list.findByServerGuid(server.serverGuid) as? NettyClientSourceImpl -// ?: error("Client not found") -// -// clientSource.updateServerInfo(server) -// } -// -// else -> { -// } -// } -// } -// -// private fun broadcastPacket(sender: NettyClientSource, packet: NettyPacket<*>) { -// nettyServerImpl.connection.clientTracker.clients -// .filter { it != sender } -// .forEach { it.sendPacket(packet) } -// } -//} diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestEntityTest.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestEntityTest.kt deleted file mode 100644 index 89b63294..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestEntityTest.kt +++ /dev/null @@ -1,26 +0,0 @@ -package dev.slne.surf.cloud.standalone.test - -import org.springframework.boot.CommandLineRunner -import org.springframework.stereotype.Component - -@Component -class TestEntityTest : CommandLineRunner { - @Throws(Exception::class) - override fun run(vararg args: String) { -// final TestEntity entity = new TestEntity(true, 25, 100.0, UUID.randomUUID(), "Test", false); -// final TestEntity entity2 = new TestEntity(true, 25, 100.0, UUID.randomUUID(), "Test", false); -// final TestEntity entity3 = new TestEntity(true, 25, 100.0, UUID.randomUUID(), "Test", false); -// -// TestEntity saved = testEntityRepository.save(entity); -// TestEntity saved2 = testEntityRepository.save(entity2); -// TestEntity saved3 = testEntityRepository.save(entity3); -// System.out.println("Entity saved: " + saved); -// -//// testEntityRepository.delete(saved); -//// -//// System.out.println("Entity deleted: " + saved); -// -// System.out.println("Entity count: " + testEntityRepository.count()); -// System.out.println("Entity exists: " + testEntityRepository.existsById(saved.getId())); - } -} diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPacketListener.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPacketListener.kt deleted file mode 100644 index 7f37020f..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPacketListener.kt +++ /dev/null @@ -1,18 +0,0 @@ -package dev.slne.surf.cloud.standalone.test - -import dev.slne.surf.cloud.api.common.TestPacket -import dev.slne.surf.cloud.api.common.meta.SurfNettyPacketHandler -import dev.slne.surf.surfapi.core.api.util.logger -import org.springframework.stereotype.Component - - -@Component -class TestPacketListener { - private val log = logger() - - @SurfNettyPacketHandler - fun onTestPacket(packet: TestPacket) { - log.atInfo() - .log("Received TestPacket: $packet") - } -} diff --git a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPdc.kt b/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPdc.kt deleted file mode 100644 index 00e65353..00000000 --- a/surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/test/TestPdc.kt +++ /dev/null @@ -1,50 +0,0 @@ -package dev.slne.surf.cloud.standalone.test - -import dev.slne.surf.cloud.api.common.event.player.connection.CloudPlayerConnectToNetworkEvent -import dev.slne.surf.cloud.standalone.player.StandaloneCloudPlayerImpl -import dev.slne.surf.surfapi.core.api.messages.Colors -import dev.slne.surf.surfapi.core.api.messages.adventure.buildText -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.logger.slf4j.ComponentLogger -import org.springframework.context.event.EventListener -import kotlin.time.Duration.Companion.seconds -import org.springframework.stereotype.Component as SpringComponent - -@SpringComponent -class TestPdc { -// private val logger = ComponentLogger.logger() -// -// @EventListener -// fun onCloudPlayerConnectToNetwork(event: CloudPlayerConnectToNetworkEvent) { -// val player = event.player as StandaloneCloudPlayerImpl -// logger.info( -//// Component.text( -//// "Player ${player.uuid} connected to the network", -//// Colors.SUCCESS -//// ) -// buildText { -// info("Player ") -// variableValue("${player.name} (${player.uuid})") -// info(" connected to the network") -// } -// ) -// -// player.sendMessage( -// Component.text( -// "Welcome to the network!", -// Colors.SUCCESS -// ) -// ) -// -// -//// GlobalScope.launch { -//// while (player.connected) { -//// delay(1.seconds) -//// logger.info("pdc: ${player.getPersistentData()}") -//// } -//// } -// } -} \ No newline at end of file diff --git a/surf-cloud-test-plugin/surf-cloud-test-standalone/build.gradle.kts b/surf-cloud-test-plugin/surf-cloud-test-standalone/build.gradle.kts index cc671d2d..f48462c4 100644 --- a/surf-cloud-test-plugin/surf-cloud-test-standalone/build.gradle.kts +++ b/surf-cloud-test-plugin/surf-cloud-test-standalone/build.gradle.kts @@ -5,6 +5,5 @@ plugins { dependencies { compileOnly(project(":surf-cloud-api:surf-cloud-api-server")) - // https://mvnrepository.com/artifact/commons-io/commons-io compileOnly("commons-io:commons-io:2.19.0") } \ No newline at end of file diff --git a/surf-cloud-test-plugin/surf-cloud-test-standalone/src/main/kotlin/dev/slne/surf/cloudtest/standalone/test/TestStandaloneLoader.kt b/surf-cloud-test-plugin/surf-cloud-test-standalone/src/main/kotlin/dev/slne/surf/cloudtest/standalone/test/TestStandaloneLoader.kt index cb1030a3..28deb831 100644 --- a/surf-cloud-test-plugin/surf-cloud-test-standalone/src/main/kotlin/dev/slne/surf/cloudtest/standalone/test/TestStandaloneLoader.kt +++ b/surf-cloud-test-plugin/surf-cloud-test-standalone/src/main/kotlin/dev/slne/surf/cloudtest/standalone/test/TestStandaloneLoader.kt @@ -13,7 +13,6 @@ class TestStandaloneLoader : StandalonePluginLoader { val resolver = MavenLibraryResolver() resolver.addMavenCentral() -// resolver.addDependency(Dependency(DefaultArtifact("space.kscience:kmath-core:0.4.1"), "compile")) resolver.addDependency("commons-io:commons-io:2.18.0") classpathBuilder.addLibrary(resolver) diff --git a/surf-cloud-velocity/build.gradle.kts b/surf-cloud-velocity/build.gradle.kts index b8f830cb..dfb4ad92 100644 --- a/surf-cloud-velocity/build.gradle.kts +++ b/surf-cloud-velocity/build.gradle.kts @@ -6,8 +6,6 @@ plugins { dependencies { api(project(":surf-cloud-core:surf-cloud-core-client")) api(project(":surf-cloud-api:surf-cloud-api-client:surf-cloud-api-client-velocity")) - -// api("org.springframework.boot:spring-boot-starter-data-jpa") } velocityPluginFile { diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/VelocityMain.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/VelocityMain.kt index c86d7ebb..5f4cb2b8 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/VelocityMain.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/VelocityMain.kt @@ -14,14 +14,6 @@ import dev.slne.surf.cloud.core.common.handleEventuallyFatalError import kotlinx.coroutines.runBlocking import java.nio.file.Path -//@Plugin( -// id = "surf-cloud-velocity", -// name = "Surf Cloud Velocity", -// version = "1.21.4-1.0.0-SNAPSHOT", -// description = "A cloud plugin for Velocity", -// authors = ["twisti"], -// dependencies = [Dependency("surf-api-velocity"), Dependency("luckperms")] -//) class VelocityMain @Inject constructor( val server: ProxyServer, val pluginManager: PluginManager, diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/ListenerManager.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/ListenerManager.kt index 0e4abc22..9ff87d85 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/ListenerManager.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/ListenerManager.kt @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component @Component @Order(CloudLifecycleAware.MISC_PRIORITY) -class ListenerManager: CloudLifecycleAware { +class ListenerManager : CloudLifecycleAware { override suspend fun onEnable(timeLogger: TimeLogger) { timeLogger.measureStep("Register Velocity listeners") { @@ -25,8 +25,6 @@ class ListenerManager: CloudLifecycleAware { } fun registerListeners() { -// register(ConnectionListener) - VelocityListenerProcessor.registerListeners() } diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/player/ConnectionListener.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/player/ConnectionListener.kt index f7d34b49..1a2c3136 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/player/ConnectionListener.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/player/ConnectionListener.kt @@ -13,8 +13,8 @@ import dev.slne.surf.cloud.api.common.player.task.PrePlayerJoinTask.Result import dev.slne.surf.cloud.api.common.server.CloudServerManager import dev.slne.surf.cloud.core.common.data.CloudPersistentData import dev.slne.surf.cloud.core.common.messages.MessageManager -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.PlayerConnectToServerPacket -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.PlayerDisconnectFromServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.PlayerConnectToServerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.PlayerDisconnectFromServerPacket import dev.slne.surf.cloud.velocity.proxy import org.springframework.stereotype.Component import java.net.Inet4Address diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/netty/network/VelocitySpecificPacketListenerExtension.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/netty/network/VelocitySpecificPacketListenerExtension.kt index 256ec4c7..0623a8e2 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/netty/network/VelocitySpecificPacketListenerExtension.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/netty/network/VelocitySpecificPacketListenerExtension.kt @@ -9,8 +9,8 @@ import dev.slne.surf.cloud.api.common.util.observer.observingFlow import dev.slne.surf.cloud.core.client.netty.network.PlatformSpecificPacketListenerExtension import dev.slne.surf.cloud.core.client.server.ClientCloudServerImpl import dev.slne.surf.cloud.core.common.coroutines.CommonObservableScope -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.RegistrationInfo -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.ServerboundTransferPlayerPacketResponse.Status +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.clientbound.RegistrationInfo +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.serverbound.ServerboundTransferPlayerPacketResponse.Status import dev.slne.surf.cloud.velocity.proxy import dev.slne.surf.cloud.velocity.reflection.VelocityConfigurationProxy import dev.slne.surf.surfapi.core.api.util.logger @@ -121,7 +121,10 @@ class VelocitySpecificPacketListenerExtension : PlatformSpecificPacketListenerEx observingFlow({ VelocityConfigurationProxy.instance.getForwardingSecret(proxy.configuration) }) .onEach { remote -> if (!remote.contentEquals(currentVelocitySecret)) { - VelocityConfigurationProxy.instance.setForwardingSecret(proxy.configuration, currentVelocitySecret) + VelocityConfigurationProxy.instance.setForwardingSecret( + proxy.configuration, + currentVelocitySecret + ) } } .launchIn(CommonObservableScope) diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityClientCloudPlayerImpl.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityClientCloudPlayerImpl.kt index b2dc9358..041f5dab 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityClientCloudPlayerImpl.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityClientCloudPlayerImpl.kt @@ -3,13 +3,14 @@ package dev.slne.surf.cloud.velocity.player import com.velocitypowered.api.proxy.Player import dev.slne.surf.cloud.api.client.netty.packet.fireAndForget import dev.slne.surf.cloud.core.client.player.ClientCloudPlayerImpl -import dev.slne.surf.cloud.core.common.netty.network.protocol.running.SilentDisconnectPlayerPacket +import dev.slne.surf.cloud.core.common.netty.network.protocol.running.bidirectional.SilentDisconnectPlayerPacket import dev.slne.surf.cloud.velocity.proxy import net.kyori.adventure.text.Component import java.util.* -class VelocityClientCloudPlayerImpl(uuid: UUID, name: String) : ClientCloudPlayerImpl(uuid, - name +class VelocityClientCloudPlayerImpl(uuid: UUID, name: String) : ClientCloudPlayerImpl( + uuid, + name // FIXME: 24.07.2025 19:40 implement missing code ) { override val platformClass = Player::class.java override val audience: Player? get() = proxy.getPlayer(uuid).orElse(null) diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityCloudPlayerManagerImpl.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityCloudPlayerManagerImpl.kt index f0becdef..8f57fd0a 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityCloudPlayerManagerImpl.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/VelocityCloudPlayerManagerImpl.kt @@ -11,7 +11,7 @@ import java.util.* @AutoService(CloudPlayerManager::class) class VelocityCloudPlayerManagerImpl : - CommonClientCloudPlayerManagerImpl() { + CommonClientCloudPlayerManagerImpl() { // FIXME: 24.07.2025 19:39 implement missing code init { checkInstantiationByServiceLoader() } diff --git a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/processor/VelocityListenerProcessor.kt b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/processor/VelocityListenerProcessor.kt index 2be1b22f..38c1678e 100644 --- a/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/processor/VelocityListenerProcessor.kt +++ b/surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/processor/VelocityListenerProcessor.kt @@ -3,11 +3,11 @@ package dev.slne.surf.cloud.velocity.processor import com.velocitypowered.api.event.Subscribe import dev.slne.surf.cloud.api.common.util.containsMethodWithAnnotation import dev.slne.surf.cloud.api.common.util.isCandidateFor -import dev.slne.surf.cloud.api.common.util.mutableObjectSetOf import dev.slne.surf.cloud.api.common.util.ultimateTargetClass import dev.slne.surf.cloud.velocity.VelocityMain import dev.slne.surf.cloud.velocity.plugin import dev.slne.surf.surfapi.core.api.util.logger +import dev.slne.surf.surfapi.core.api.util.mutableObjectSetOf import org.springframework.aop.framework.AopInfrastructureBean import org.springframework.beans.BeansException import org.springframework.beans.factory.BeanCreationException @@ -24,7 +24,6 @@ class VelocityListenerProcessor : BeanPostProcessor { val targetClass = bean.ultimateTargetClass() if (targetClass.isCandidateFor() && targetClass.containsMethodWithAnnotation()) { -// registerEventHandlers(beanName, bean) candidates.add(bean) }