From 8259cbe823e7ec68dbe8fa787992abf0e1308356 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Sun, 30 May 2021 22:07:17 -0400 Subject: [PATCH 1/3] Some boat fixes (#2243) - Fix getting kicked for flying when standing on a boat - Fix using a boat on land --- .../geysermc/connector/entity/BoatEntity.java | 16 ++++++++++++++-- .../connector/entity/type/EntityType.java | 2 +- .../BedrockMoveEntityAbsoluteTranslator.java | 5 ++--- .../java/world/JavaVehicleMoveTranslator.java | 3 +-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index d07ecc965..659722675 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; +import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; @@ -65,7 +66,19 @@ public class BoatEntity extends Entity { @Override public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { // We don't include the rotation (y) as it causes the boat to appear sideways - super.moveAbsolute(session, position.add(0d, this.entityType.getOffset(), 0d), Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90), isOnGround, teleported); + setPosition(position.add(0d, this.entityType.getOffset(), 0d)); + setRotation(Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90)); + setOnGround(isOnGround); + + MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); + moveEntityPacket.setRuntimeEntityId(geyserId); + // Minimal glitching when ServerVehicleMovePacket is sent + moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityType.PLAYER.getOffset() - this.entityType.getOffset()) : this.position); + moveEntityPacket.setRotation(getBedrockRotation()); + moveEntityPacket.setOnGround(isOnGround); + moveEntityPacket.setTeleported(teleported); + + session.sendUpstreamPacket(moveEntityPacket); } @Override @@ -85,7 +98,6 @@ public class BoatEntity extends Entity { @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Time since last hit if (entityMetadata.getId() == 7) { metadata.put(EntityData.HURT_TIME, entityMetadata.getValue()); diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index cf169a209..afcdb7e03 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -130,7 +130,7 @@ public enum EntityType { THROWN_ENDERPEARL(ThrowableEntity.class, 87, 0.25f, 0.25f, 0.25f, 0f, "minecraft:ender_pearl"), LEASH_KNOT(LeashKnotEntity.class, 88, 0.5f, 0.375f), WITHER_SKULL(WitherSkullEntity.class, 89, 0.3125f), - BOAT(BoatEntity.class, 90, 0.7f, 1.6f, 1.6f, 0.35f), + BOAT(BoatEntity.class, 90, 0.6f, 1.6f, 1.6f, 0.35f), WITHER_SKULL_DANGEROUS(WitherSkullEntity.class, 91, 0f), LIGHTNING_BOLT(Entity.class, 93, 0f), SMALL_FIREBALL(ItemedFireballEntity.class, 94, 0.3125f), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java index b053a204c..fbfaafb43 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -45,9 +45,8 @@ public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator Date: Mon, 31 May 2021 22:35:25 -0400 Subject: [PATCH 2/3] Register permissions in Spigot plugin.yml (#2246) --- .../spigot/src/main/resources/plugin.yml | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/bootstrap/spigot/src/main/resources/plugin.yml b/bootstrap/spigot/src/main/resources/plugin.yml index fee71ab1f..e0a3c8bda 100644 --- a/bootstrap/spigot/src/main/resources/plugin.yml +++ b/bootstrap/spigot/src/main/resources/plugin.yml @@ -8,4 +8,23 @@ api-version: 1.13 commands: geyser: description: The main command for Geyser. - usage: /geyser help \ No newline at end of file + usage: /geyser help +permissions: + geyser.command.help: + description: Shows help for all registered commands. + geyser.command.advancement: + description: Shows the advancements of the player on the server. + geyser.command.dump: + description: Dumps Geyser debug information for bug reports. + geyser.command.list: + description: List all players connected through Geyser. + geyser.command.offhand: + description: Puts an items in your offhand. + geyser.command.reload: + description: Reloads the Geyser configurations. Kicks all players when used! + geyser.command.shutdown: + description: Shuts down Geyser. + geyser.command.statistics: + description: Shows the statistics of the player on the server. + geyser.command.version: + description: Shows the current Geyser version and checks for updates. \ No newline at end of file From aaa100b2d308e6b23c8fe574ac48435024de8fb5 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 5 Jun 2021 01:02:10 +0100 Subject: [PATCH 3/3] Add static variable to disable bedrock listener (#2254) * Add static variable to disable bedrock listener * Add default value * Add javadoc comment --- .../geysermc/connector/GeyserConnector.java | 25 +++++++++++++------ pom.xml | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 3f82889f5..c93cd4e9d 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -99,6 +99,12 @@ public class GeyserConnector { private static GeyserConnector instance; + /** + * This is used in GeyserConnect to stop the bedrock server binding to a port + */ + @Setter + private static boolean shouldStartListener = true; + @Setter private AuthType defaultAuthType; @@ -219,14 +225,17 @@ public class GeyserConnector { } bedrockServer.setHandler(new ConnectorServerEventHandler(this)); - bedrockServer.bind().whenComplete((avoid, throwable) -> { - if (throwable == null) { - logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); - } else { - logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); - throwable.printStackTrace(); - } - }).join(); + + if (shouldStartListener) { + bedrockServer.bind().whenComplete((avoid, throwable) -> { + if (throwable == null) { + logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); + } else { + logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort()))); + throwable.printStackTrace(); + } + }).join(); + } if (config.getMetrics().isEnabled()) { metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger("")); diff --git a/pom.xml b/pom.xml index 4462c3f47..554fd5e3b 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ org.projectlombok lombok - 1.18.4 + 1.18.20 provided