From af9c270a50d4f69b1f674ffea48b3358e0858a3e Mon Sep 17 00:00:00 2001 From: bundabrg Date: Fri, 10 Jul 2020 17:28:20 +0800 Subject: [PATCH] Clean up Triggers --- .../bungeecord/GeyserBungeePlugin.java | 2 +- .../platform/sponge/GeyserSpongePlugin.java | 2 +- .../standalone/GeyserStandaloneBootstrap.java | 2 +- .../velocity/GeyserVelocityPlugin.java | 2 +- .../geysermc/connector/GeyserConnector.java | 5 +- .../event/events/BuildBedrockStateEvent.java | 41 ----------- .../event/events/BuildBlockStateMapEvent.java | 41 ----------- .../events/{ => geyser}/GeyserStartEvent.java | 4 +- .../events/{ => geyser}/GeyserStopEvent.java | 4 +- .../{ => geyser}/LoadBedrockSkinEvent.java | 3 +- .../{ => geyser}/ResourceReadEvent.java | 3 +- .../BedrockCodecRegistryEvent.java | 3 +- .../{ => network}/BedrockPongEvent.java | 3 +- .../DownstreamPacketReceiveEvent.java | 3 +- .../DownstreamPacketSendEvent.java | 3 +- .../UpstreamPacketReceiveEvent.java | 3 +- .../{ => packet}/UpstreamPacketSendEvent.java | 3 +- .../{ => plugin}/PluginDisableEvent.java | 3 +- .../{ => plugin}/PluginEnableEvent.java | 3 +- .../{ => plugin}/PluginMessageEvent.java | 3 +- .../BlockEntityRegistryEvent.java | 3 +- .../BlockTranslatorRegistryEvent.java} | 24 ++++++- .../InventoryTranslatorRegistryEvent.java | 3 +- .../ItemRemapperRegistryEvent.java | 3 +- .../PacketTranslatorRegistryEvent.java | 3 +- .../SoundHandlerRegistryEvent.java | 3 +- .../network/ConnectorServerEventHandler.java | 2 +- .../network/UpstreamPacketHandler.java | 2 +- .../network/session/GeyserSession.java | 6 +- .../translators/PacketTranslatorRegistry.java | 2 +- .../inventory/InventoryTranslator.java | 2 +- .../translators/item/ItemTranslator.java | 2 +- .../java/JavaPluginMessageTranslator.java | 2 +- .../sound/SoundHandlerRegistry.java | 2 +- .../world/block/BlockTranslator.java | 70 ++++++++++--------- .../connector/plugin/GeyserPlugin.java | 6 +- .../connector/plugin/PluginManager.java | 1 - .../geysermc/connector/utils/FileUtils.java | 2 +- .../geysermc/connector/utils/SkinUtils.java | 2 +- connector/src/main/resources/languages | 2 +- 40 files changed, 118 insertions(+), 160 deletions(-) delete mode 100644 connector/src/main/java/org/geysermc/connector/event/events/BuildBedrockStateEvent.java delete mode 100644 connector/src/main/java/org/geysermc/connector/event/events/BuildBlockStateMapEvent.java rename connector/src/main/java/org/geysermc/connector/event/events/{ => geyser}/GeyserStartEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => geyser}/GeyserStopEvent.java (92%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => geyser}/LoadBedrockSkinEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => geyser}/ResourceReadEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => network}/BedrockCodecRegistryEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => network}/BedrockPongEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => packet}/DownstreamPacketReceiveEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => packet}/DownstreamPacketSendEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => packet}/UpstreamPacketReceiveEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => packet}/UpstreamPacketSendEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => plugin}/PluginDisableEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => plugin}/PluginEnableEvent.java (92%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => plugin}/PluginMessageEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => registry}/BlockEntityRegistryEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{RuntimeBlockStateReadEvent.java => registry/BlockTranslatorRegistryEvent.java} (60%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => registry}/InventoryTranslatorRegistryEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => registry}/ItemRemapperRegistryEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => registry}/PacketTranslatorRegistryEvent.java (93%) rename connector/src/main/java/org/geysermc/connector/event/events/{ => registry}/SoundHandlerRegistryEvent.java (93%) diff --git a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java index a3e7d169b5e..311fa5935da 100644 --- a/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java +++ b/bootstrap/bungeecord/src/main/java/org/geysermc/platform/bungeecord/GeyserBungeePlugin.java @@ -36,7 +36,7 @@ import org.geysermc.connector.command.CommandManager; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.event.events.GeyserStartEvent; +import org.geysermc.connector.event.events.geyser.GeyserStartEvent; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.utils.FileUtils; diff --git a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java index 107d9439289..07c256c55ba 100644 --- a/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java +++ b/bootstrap/sponge/src/main/java/org/geysermc/platform/sponge/GeyserSpongePlugin.java @@ -35,7 +35,7 @@ import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.command.CommandManager; import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.event.events.GeyserStartEvent; +import org.geysermc.connector.event.events.geyser.GeyserStartEvent; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.utils.FileUtils; diff --git a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java index ac7bbfa29c3..8996128cf2c 100644 --- a/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java +++ b/bootstrap/standalone/src/main/java/org/geysermc/platform/standalone/GeyserStandaloneBootstrap.java @@ -37,7 +37,7 @@ import org.geysermc.connector.command.CommandManager; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.event.events.GeyserStartEvent; +import org.geysermc.connector.event.events.geyser.GeyserStartEvent; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.utils.FileUtils; diff --git a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java index efc69ce8bd1..220d8fca613 100644 --- a/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java +++ b/bootstrap/velocity/src/main/java/org/geysermc/platform/velocity/GeyserVelocityPlugin.java @@ -40,7 +40,7 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.bootstrap.GeyserBootstrap; import org.geysermc.connector.dump.BootstrapDumpInfo; -import org.geysermc.connector.event.events.GeyserStartEvent; +import org.geysermc.connector.event.events.geyser.GeyserStartEvent; import org.geysermc.connector.ping.GeyserLegacyPingPassthrough; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.utils.FileUtils; diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index b13e5593b79..8ead035ca10 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -38,7 +38,7 @@ import org.geysermc.connector.command.CommandManager; import org.geysermc.connector.event.EventManager; import org.geysermc.connector.configuration.GeyserConfiguration; -import org.geysermc.connector.event.events.BedrockCodecRegistryEvent; +import org.geysermc.connector.event.events.network.BedrockCodecRegistryEvent; import org.geysermc.connector.metrics.Metrics; import org.geysermc.connector.network.ConnectorServerEventHandler; import org.geysermc.connector.network.remote.RemoteServer; @@ -56,8 +56,7 @@ import org.geysermc.connector.network.translators.world.block.BlockTranslator; import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator; import org.geysermc.connector.plugin.PluginManager; -import org.geysermc.connector.event.events.GeyserStopEvent; -import org.geysermc.connector.event.events.GeyserStartEvent; +import org.geysermc.connector.event.events.geyser.GeyserStopEvent; import org.geysermc.connector.utils.DimensionUtils; import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.LocaleUtils; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/BuildBedrockStateEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/BuildBedrockStateEvent.java deleted file mode 100644 index e43238751d3..00000000000 --- a/connector/src/main/java/org/geysermc/connector/event/events/BuildBedrockStateEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019-2020 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/Geyser - * - */ - -package org.geysermc.connector.event.events; - -import com.fasterxml.jackson.databind.JsonNode; -import com.nukkitx.nbt.NbtMap; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode(callSuper = true) -@Data -@AllArgsConstructor -public class BuildBedrockStateEvent extends GeyserEvent { - JsonNode blockNode; - NbtMap blockState; -} diff --git a/connector/src/main/java/org/geysermc/connector/event/events/BuildBlockStateMapEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/BuildBlockStateMapEvent.java deleted file mode 100644 index fe9b59f5593..00000000000 --- a/connector/src/main/java/org/geysermc/connector/event/events/BuildBlockStateMapEvent.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2019-2020 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/Geyser - * - */ - -package org.geysermc.connector.event.events; - -import com.nukkitx.nbt.NbtMap; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Map; - -@EqualsAndHashCode(callSuper = true) -@Data -@AllArgsConstructor -public class BuildBlockStateMapEvent extends CancellableGeyserEvent { - Map blockStateMap; -} diff --git a/connector/src/main/java/org/geysermc/connector/event/events/GeyserStartEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/geyser/GeyserStartEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/GeyserStartEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/geyser/GeyserStartEvent.java index 7c6a93c690f..5bb27f211c5 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/GeyserStartEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/geyser/GeyserStartEvent.java @@ -24,7 +24,9 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.geyser; + +import org.geysermc.connector.event.events.GeyserEvent; /** * EnableEvent is triggered for each plugin when enabling it diff --git a/connector/src/main/java/org/geysermc/connector/event/events/GeyserStopEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/geyser/GeyserStopEvent.java similarity index 92% rename from connector/src/main/java/org/geysermc/connector/event/events/GeyserStopEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/geyser/GeyserStopEvent.java index 2f3d3be5c6d..a72f06c6ae7 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/GeyserStopEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/geyser/GeyserStopEvent.java @@ -24,7 +24,9 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.geyser; + +import org.geysermc.connector.event.events.GeyserEvent; /** * DisableEvent is triggered for each plugin when disabling it diff --git a/connector/src/main/java/org/geysermc/connector/event/events/LoadBedrockSkinEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/geyser/LoadBedrockSkinEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/LoadBedrockSkinEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/geyser/LoadBedrockSkinEvent.java index 104f9eac4c8..0de88a38b02 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/LoadBedrockSkinEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/geyser/LoadBedrockSkinEvent.java @@ -24,12 +24,13 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.geyser; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import org.geysermc.connector.entity.PlayerEntity; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.network.session.auth.BedrockClientData; @EqualsAndHashCode(callSuper = true) diff --git a/connector/src/main/java/org/geysermc/connector/event/events/ResourceReadEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/geyser/ResourceReadEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/ResourceReadEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/geyser/ResourceReadEvent.java index 9d765d66e1f..85089157a36 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/ResourceReadEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/geyser/ResourceReadEvent.java @@ -24,11 +24,12 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.geyser; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; import java.io.InputStream; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/BedrockCodecRegistryEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/network/BedrockCodecRegistryEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/BedrockCodecRegistryEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/network/BedrockCodecRegistryEvent.java index ebd3224dcf3..2e8582d3724 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/BedrockCodecRegistryEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/network/BedrockCodecRegistryEvent.java @@ -24,12 +24,13 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.network; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; @EqualsAndHashCode(callSuper = true) @AllArgsConstructor diff --git a/connector/src/main/java/org/geysermc/connector/event/events/BedrockPongEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/network/BedrockPongEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/BedrockPongEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/network/BedrockPongEvent.java index 49f6c8d0aee..4ddc7f9d2a9 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/BedrockPongEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/network/BedrockPongEvent.java @@ -24,12 +24,13 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.network; import com.nukkitx.protocol.bedrock.BedrockPong; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; import java.net.InetSocketAddress; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/DownstreamPacketReceiveEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/packet/DownstreamPacketReceiveEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/DownstreamPacketReceiveEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/packet/DownstreamPacketReceiveEvent.java index 97bd9df1fe8..683ba6a6ff3 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/DownstreamPacketReceiveEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/packet/DownstreamPacketReceiveEvent.java @@ -24,7 +24,7 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.packet; import com.github.steveice10.packetlib.packet.Packet; import lombok.AllArgsConstructor; @@ -32,6 +32,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.network.session.GeyserSession; /** diff --git a/connector/src/main/java/org/geysermc/connector/event/events/DownstreamPacketSendEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/packet/DownstreamPacketSendEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/DownstreamPacketSendEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/packet/DownstreamPacketSendEvent.java index dbd7fdfdd9f..c85ce075659 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/DownstreamPacketSendEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/packet/DownstreamPacketSendEvent.java @@ -24,7 +24,7 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.packet; import com.github.steveice10.packetlib.packet.Packet; import lombok.AllArgsConstructor; @@ -32,6 +32,7 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.network.session.GeyserSession; /** diff --git a/connector/src/main/java/org/geysermc/connector/event/events/UpstreamPacketReceiveEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/packet/UpstreamPacketReceiveEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/UpstreamPacketReceiveEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/packet/UpstreamPacketReceiveEvent.java index aca180ffb34..b837cbe86af 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/UpstreamPacketReceiveEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/packet/UpstreamPacketReceiveEvent.java @@ -24,12 +24,13 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.packet; import com.nukkitx.protocol.bedrock.BedrockPacket; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.network.session.GeyserSession; /** diff --git a/connector/src/main/java/org/geysermc/connector/event/events/UpstreamPacketSendEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/packet/UpstreamPacketSendEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/UpstreamPacketSendEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/packet/UpstreamPacketSendEvent.java index 1dd37f75bfb..4702d489fa4 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/UpstreamPacketSendEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/packet/UpstreamPacketSendEvent.java @@ -24,12 +24,13 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.packet; import com.nukkitx.protocol.bedrock.BedrockPacket; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.network.session.GeyserSession; /** diff --git a/connector/src/main/java/org/geysermc/connector/event/events/PluginDisableEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginDisableEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/PluginDisableEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginDisableEvent.java index 4ad9cb826da..bec1bd29b5e 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/PluginDisableEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginDisableEvent.java @@ -24,11 +24,12 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.plugin; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; import org.geysermc.connector.plugin.GeyserPlugin; @EqualsAndHashCode(callSuper = true) diff --git a/connector/src/main/java/org/geysermc/connector/event/events/PluginEnableEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginEnableEvent.java similarity index 92% rename from connector/src/main/java/org/geysermc/connector/event/events/PluginEnableEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginEnableEvent.java index 08867217fc1..ac2c3375ab2 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/PluginEnableEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginEnableEvent.java @@ -24,11 +24,12 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.plugin; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.plugin.GeyserPlugin; @EqualsAndHashCode(callSuper = true) diff --git a/connector/src/main/java/org/geysermc/connector/event/events/PluginMessageEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginMessageEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/PluginMessageEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginMessageEvent.java index 744459c0413..10c60501a7e 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/PluginMessageEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/plugin/PluginMessageEvent.java @@ -24,11 +24,12 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.plugin; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.CancellableGeyserEvent; import org.geysermc.connector.network.session.GeyserSession; @EqualsAndHashCode(callSuper = true) diff --git a/connector/src/main/java/org/geysermc/connector/event/events/BlockEntityRegistryEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/registry/BlockEntityRegistryEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/BlockEntityRegistryEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/registry/BlockEntityRegistryEvent.java index 440779a4cd3..f5d5c5d5284 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/BlockEntityRegistryEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/registry/BlockEntityRegistryEvent.java @@ -24,13 +24,14 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.registry; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; +import org.geysermc.connector.event.events.GeyserEvent; import java.util.Set; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/RuntimeBlockStateReadEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/registry/BlockTranslatorRegistryEvent.java similarity index 60% rename from connector/src/main/java/org/geysermc/connector/event/events/RuntimeBlockStateReadEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/registry/BlockTranslatorRegistryEvent.java index 06a974557c3..d454f0ed6c8 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/RuntimeBlockStateReadEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/registry/BlockTranslatorRegistryEvent.java @@ -24,17 +24,35 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.registry; +import com.google.common.collect.BiMap; import com.nukkitx.nbt.NbtList; import com.nukkitx.nbt.NbtMap; +import it.unimi.dsi.fastutil.ints.Int2BooleanMap; +import it.unimi.dsi.fastutil.ints.Int2DoubleMap; +import it.unimi.dsi.fastutil.ints.Int2IntMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.IntSet; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; @EqualsAndHashCode(callSuper = true) @AllArgsConstructor @Data -public class RuntimeBlockStateReadEvent extends GeyserEvent { - private NbtList blockStates; +public class BlockTranslatorRegistryEvent extends GeyserEvent { + NbtList blocks; + Int2IntMap javaToBedrockBlockMap; + BiMap javaIdBlockMap; + IntSet waterlogged; + Object2IntMap itemFrames; + Int2ObjectMap javaIdToBlockEntityMap; + Int2DoubleMap javaRuntimeIdToHardness; + Int2BooleanMap javaRuntimeIdToCanHarvestWithHand; + Int2ObjectMap javaRuntimeIdToToolType; + IntSet javaRuntimeWoolIds; } diff --git a/connector/src/main/java/org/geysermc/connector/event/events/InventoryTranslatorRegistryEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/registry/InventoryTranslatorRegistryEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/InventoryTranslatorRegistryEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/registry/InventoryTranslatorRegistryEvent.java index cc34e14a13c..8e43ce74d6c 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/InventoryTranslatorRegistryEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/registry/InventoryTranslatorRegistryEvent.java @@ -24,12 +24,13 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.registry; import com.github.steveice10.mc.protocol.data.game.window.WindowType; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; import org.geysermc.connector.network.translators.inventory.InventoryTranslator; import java.util.Map; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/ItemRemapperRegistryEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/registry/ItemRemapperRegistryEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/ItemRemapperRegistryEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/registry/ItemRemapperRegistryEvent.java index 45a8adacd45..cc44758cc78 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/ItemRemapperRegistryEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/registry/ItemRemapperRegistryEvent.java @@ -24,13 +24,14 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.registry; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; +import org.geysermc.connector.event.events.GeyserEvent; import java.util.Set; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/PacketTranslatorRegistryEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/registry/PacketTranslatorRegistryEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/PacketTranslatorRegistryEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/registry/PacketTranslatorRegistryEvent.java index e3c47c1dd39..bcbb6d8873b 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/PacketTranslatorRegistryEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/registry/PacketTranslatorRegistryEvent.java @@ -24,11 +24,12 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.registry; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; +import org.geysermc.connector.event.events.GeyserEvent; import java.util.Set; diff --git a/connector/src/main/java/org/geysermc/connector/event/events/SoundHandlerRegistryEvent.java b/connector/src/main/java/org/geysermc/connector/event/events/registry/SoundHandlerRegistryEvent.java similarity index 93% rename from connector/src/main/java/org/geysermc/connector/event/events/SoundHandlerRegistryEvent.java rename to connector/src/main/java/org/geysermc/connector/event/events/registry/SoundHandlerRegistryEvent.java index 95d16c92ed7..6bda7fc9471 100644 --- a/connector/src/main/java/org/geysermc/connector/event/events/SoundHandlerRegistryEvent.java +++ b/connector/src/main/java/org/geysermc/connector/event/events/registry/SoundHandlerRegistryEvent.java @@ -24,13 +24,14 @@ * */ -package org.geysermc.connector.event.events; +package org.geysermc.connector.event.events.registry; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.ToString; +import org.geysermc.connector.event.events.GeyserEvent; import java.util.Set; diff --git a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java index 30faf732f49..9f97b40c965 100644 --- a/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/ConnectorServerEventHandler.java @@ -35,7 +35,7 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.BedrockPongEvent; +import org.geysermc.connector.event.events.network.BedrockPongEvent; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.ping.IGeyserPingPassthrough; import org.geysermc.connector.utils.MessageUtils; diff --git a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java index d03082efd31..c01288c9ad0 100644 --- a/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java +++ b/connector/src/main/java/org/geysermc/connector/network/UpstreamPacketHandler.java @@ -30,7 +30,7 @@ import org.geysermc.connector.common.AuthType; import org.geysermc.connector.configuration.GeyserConfiguration; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.event.events.UpstreamPacketReceiveEvent; +import org.geysermc.connector.event.events.packet.UpstreamPacketReceiveEvent; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslatorRegistry; import org.geysermc.connector.utils.LoginEncryptionUtils; diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 4a49f0de445..a3e9fc2fabd 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -61,9 +61,9 @@ import org.geysermc.connector.common.AuthType; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.PlayerEntity; -import org.geysermc.connector.event.events.DownstreamPacketReceiveEvent; -import org.geysermc.connector.event.events.DownstreamPacketSendEvent; -import org.geysermc.connector.event.events.UpstreamPacketSendEvent; +import org.geysermc.connector.event.events.packet.DownstreamPacketReceiveEvent; +import org.geysermc.connector.event.events.packet.DownstreamPacketSendEvent; +import org.geysermc.connector.event.events.packet.UpstreamPacketSendEvent; import org.geysermc.connector.inventory.PlayerInventory; import org.geysermc.connector.network.remote.RemoteServer; import org.geysermc.connector.network.session.auth.AuthData; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java index 9c85982a636..0e1ca598a38 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/PacketTranslatorRegistry.java @@ -33,7 +33,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.PacketTranslatorRegistryEvent; +import org.geysermc.connector.event.events.registry.PacketTranslatorRegistryEvent; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.utils.LanguageUtils; import org.reflections.Reflections; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java index 39f8b15c9fb..4cdd8b2c745 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/inventory/InventoryTranslator.java @@ -30,7 +30,7 @@ import com.nukkitx.protocol.bedrock.data.inventory.InventoryActionData; import lombok.AllArgsConstructor; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.InventoryTranslatorRegistryEvent; +import org.geysermc.connector.event.events.registry.InventoryTranslatorRegistryEvent; import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.inventory.updater.ContainerInventoryUpdater; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java index 969235801b6..51124423996 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java @@ -41,7 +41,7 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.ItemRemapperRegistryEvent; +import org.geysermc.connector.event.events.registry.ItemRemapperRegistryEvent; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.ItemRemapper; import org.geysermc.connector.utils.LanguageUtils; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java index a19099eb3d6..51747e91b9d 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaPluginMessageTranslator.java @@ -26,7 +26,7 @@ package org.geysermc.connector.network.translators.java; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.event.events.PluginMessageEvent; +import org.geysermc.connector.event.events.plugin.PluginMessageEvent; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.translators.PacketTranslator; import org.geysermc.connector.network.translators.Translator; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandlerRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandlerRegistry.java index b018bdcb0d8..bac50cc7f4c 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandlerRegistry.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/sound/SoundHandlerRegistry.java @@ -27,7 +27,7 @@ package org.geysermc.connector.network.translators.sound; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.SoundHandlerRegistryEvent; +import org.geysermc.connector.event.events.registry.SoundHandlerRegistryEvent; import org.reflections.Reflections; import java.util.HashMap; diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockTranslator.java index 8add4610a09..37740d24dcb 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/world/block/BlockTranslator.java @@ -39,10 +39,8 @@ import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.BlockEntityRegistryEvent; -import org.geysermc.connector.event.events.BuildBedrockStateEvent; -import org.geysermc.connector.event.events.BuildBlockStateMapEvent; -import org.geysermc.connector.event.events.RuntimeBlockStateReadEvent; +import org.geysermc.connector.event.events.registry.BlockEntityRegistryEvent; +import org.geysermc.connector.event.events.registry.BlockTranslatorRegistryEvent; import org.geysermc.connector.network.translators.world.block.entity.BlockEntity; import org.geysermc.connector.utils.FileUtils; import org.reflections.Reflections; @@ -82,29 +80,25 @@ public class BlockTranslator { private static final int BLOCK_STATE_VERSION = 17825806; static { + /* Load block palette */ + InputStream stream = FileUtils.getResource("bedrock/runtime_block_states.dat"); + + NbtList blocksTag; + try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)) { + blocksTag = (NbtList) nbtInputStream.readTag(); + } catch (Exception e) { + throw new AssertionError("Unable to get blocks from runtime block states", e); + } + Map blockStateMap = new HashMap<>(); - EventManager.getInstance().triggerEvent(new BuildBlockStateMapEvent(blockStateMap)) - .onNotCancelled(result -> { - /* Load block palette */ - InputStream stream = FileUtils.getResource("bedrock/runtime_block_states.dat"); - - NbtList blocksTag; - try (NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream)) { - blocksTag = EventManager.getInstance().triggerEvent(new RuntimeBlockStateReadEvent( - (NbtList) nbtInputStream.readTag())).getEvent().getBlockStates(); - } catch (Exception e) { - throw new AssertionError("Unable to get blocks from runtime block states", e); - } - - for (NbtMap tag : blocksTag) { - if (blockStateMap.putIfAbsent(tag.getCompound("block"), tag) != null) { - throw new AssertionError("Duplicate block states in Bedrock palette"); - } - } - }); - - InputStream stream = FileUtils.getResource("mappings/blocks.json"); + for (NbtMap tag : blocksTag) { + if (blockStateMap.putIfAbsent(tag.getCompound("block"), tag) != null) { + throw new AssertionError("Duplicate block states in Bedrock palette"); + } + } + + stream = FileUtils.getResource("mappings/blocks.json"); JsonNode blocks; try { blocks = GeyserConnector.JSON_MAPPER.readTree(stream); @@ -114,10 +108,10 @@ public class BlockTranslator { Object2IntMap addedStatesMap = new Object2IntOpenHashMap<>(); addedStatesMap.defaultReturnValue(-1); List paletteList = new ArrayList<>(); - - BlockEntityRegistryEvent blockEntityEvent = EventManager.getInstance().triggerEvent(new BlockEntityRegistryEvent( + + Set> blockEntityClasses = EventManager.getInstance().triggerEvent(new BlockEntityRegistryEvent( new Reflections("org.geysermc.connector.network.translators.world.block.entity").getTypesAnnotatedWith(BlockEntity.class)) - ).getEvent(); + ).getEvent().getRegisteredTranslators(); int waterRuntimeId = -1; int javaRuntimeId = -1; @@ -163,7 +157,7 @@ public class BlockTranslator { // Used for adding all "special" Java block states to block state map String identifier; String bedrock_identifer = entry.getValue().get("bedrock_identifier").asText(); - for (Class clazz : blockEntityEvent.getRegisteredTranslators()) { + for (Class clazz : blockEntityClasses) { identifier = clazz.getAnnotation(BlockEntity.class).regex(); // Endswith, or else the block bedrock gets picked up for bed if (bedrock_identifer.endsWith(identifier) && !identifier.equals("")) { @@ -260,7 +254,20 @@ public class BlockTranslator { } BLOCKS = new NbtList<>(NbtType.COMPOUND, paletteList); - System.err.println(BLOCKS); + + EventManager.getInstance().triggerEvent( + new BlockTranslatorRegistryEvent( + BLOCKS, + JAVA_TO_BEDROCK_BLOCK_MAP, + JAVA_ID_BLOCK_MAP, + WATERLOGGED, + ITEM_FRAMES, + JAVA_ID_TO_BLOCK_ENTITY_MAP, + JAVA_RUNTIME_ID_TO_HARDNESS, + JAVA_RUNTIME_ID_TO_CAN_HARVEST_WITH_HAND, + JAVA_RUNTIME_ID_TO_TOOL_TYPE, + JAVA_RUNTIME_WOOL_IDS + )); } private BlockTranslator() { @@ -297,8 +304,7 @@ private static NbtMap buildBedrockState(JsonNode node) { } } tagBuilder.put("states", statesBuilder.build()); - - return EventManager.getInstance().triggerEvent(new BuildBedrockStateEvent(node, tagBuilder.build())).getEvent().getBlockState(); + return tagBuilder.build(); } public static int getBedrockBlockId(int state) { diff --git a/connector/src/main/java/org/geysermc/connector/plugin/GeyserPlugin.java b/connector/src/main/java/org/geysermc/connector/plugin/GeyserPlugin.java index dcfe2df9b59..f35495ec163 100644 --- a/connector/src/main/java/org/geysermc/connector/plugin/GeyserPlugin.java +++ b/connector/src/main/java/org/geysermc/connector/plugin/GeyserPlugin.java @@ -31,8 +31,8 @@ import org.geysermc.connector.event.EventManager; import org.geysermc.connector.event.annotations.Event; import org.geysermc.connector.event.events.GeyserEvent; -import org.geysermc.connector.event.events.PluginDisableEvent; -import org.geysermc.connector.event.events.PluginEnableEvent; +import org.geysermc.connector.event.events.plugin.PluginDisableEvent; +import org.geysermc.connector.event.events.plugin.PluginEnableEvent; import org.geysermc.connector.event.handlers.EventHandler; import org.geysermc.connector.plugin.handlers.PluginLambdaEventHandler; import org.geysermc.connector.plugin.handlers.PluginMethodEventHandler; @@ -47,8 +47,6 @@ import java.util.ArrayList; import java.util.List; -import static jdk.xml.internal.SecuritySupport.getClassLoader; - /** * All GeyserPlugins extend from this */ diff --git a/connector/src/main/java/org/geysermc/connector/plugin/PluginManager.java b/connector/src/main/java/org/geysermc/connector/plugin/PluginManager.java index ae4308c9fa1..3d4f202c91f 100644 --- a/connector/src/main/java/org/geysermc/connector/plugin/PluginManager.java +++ b/connector/src/main/java/org/geysermc/connector/plugin/PluginManager.java @@ -29,7 +29,6 @@ import lombok.Getter; import lombok.ToString; import org.geysermc.connector.GeyserConnector; -import org.geysermc.connector.event.events.PluginEnableEvent; import java.io.File; import java.io.FileNotFoundException; diff --git a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java index 85110fd4c44..d7bff8e0cec 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/FileUtils.java @@ -29,7 +29,7 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.ResourceReadEvent; +import org.geysermc.connector.event.events.geyser.ResourceReadEvent; import java.io.File; import java.io.FileOutputStream; diff --git a/connector/src/main/java/org/geysermc/connector/utils/SkinUtils.java b/connector/src/main/java/org/geysermc/connector/utils/SkinUtils.java index 2fc38a91b78..cac1a0fb45c 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/SkinUtils.java +++ b/connector/src/main/java/org/geysermc/connector/utils/SkinUtils.java @@ -37,7 +37,7 @@ import org.geysermc.connector.GeyserConnector; import org.geysermc.connector.entity.PlayerEntity; import org.geysermc.connector.event.EventManager; -import org.geysermc.connector.event.events.LoadBedrockSkinEvent; +import org.geysermc.connector.event.events.geyser.LoadBedrockSkinEvent; import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.auth.BedrockClientData; diff --git a/connector/src/main/resources/languages b/connector/src/main/resources/languages index fc8f930a238..08be7fdd7bd 160000 --- a/connector/src/main/resources/languages +++ b/connector/src/main/resources/languages @@ -1 +1 @@ -Subproject commit fc8f930a238a375c7e3be6e5c7ea1720b61d0cca +Subproject commit 08be7fdd7bd3c1ade46fa8968c04d3d67bb0d378