3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 22:40:18 +01:00

Merge branch 'master' into feature/viaproxy-platform

Dieser Commit ist enthalten in:
RK_01 2023-11-04 16:18:20 +01:00 committet von GitHub
Commit cbb84d91bc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
6 geänderte Dateien mit 44 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -70,6 +70,8 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
private GeyserImpl geyser; private GeyserImpl geyser;
private static boolean INITIALIZED = false;
@Override @Override
public void onLoad() { public void onLoad() {
GeyserLocale.init(this); GeyserLocale.init(this);
@ -133,7 +135,12 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
// Big hack - Bungee does not provide us an event to listen to, so schedule a repeating // Big hack - Bungee does not provide us an event to listen to, so schedule a repeating
// task that waits for a field to be filled which is set after the plugin enable // task that waits for a field to be filled which is set after the plugin enable
// process is complete // process is complete
if (!INITIALIZED) {
this.awaitStartupCompletion(0); this.awaitStartupCompletion(0);
} else {
// No need to "wait" for startup completion, just start Geyser - we're reloading.
this.postStartup();
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -166,8 +173,10 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
private void postStartup() { private void postStartup() {
GeyserImpl.start(); GeyserImpl.start();
if (!INITIALIZED) {
this.geyserInjector = new GeyserBungeeInjector(this); this.geyserInjector = new GeyserBungeeInjector(this);
this.geyserInjector.initializeLocalChannel(this); this.geyserInjector.initializeLocalChannel(this);
}
this.geyserCommandManager = new GeyserCommandManager(geyser); this.geyserCommandManager = new GeyserCommandManager(geyser);
this.geyserCommandManager.init(); this.geyserCommandManager.init();
@ -187,6 +196,8 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
} else { } else {
this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy()); this.geyserBungeePingPassthrough = new GeyserBungeePingPassthrough(getProxy());
} }
INITIALIZED = true;
} }
@Override @Override

Datei anzeigen

@ -64,6 +64,11 @@ import java.util.UUID;
@Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC") @Plugin(id = "geyser", name = GeyserImpl.NAME + "-Velocity", version = GeyserImpl.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
public class GeyserVelocityPlugin implements GeyserBootstrap { public class GeyserVelocityPlugin implements GeyserBootstrap {
/**
* Determines if the plugin has been ran once before, including before /geyser reload.
*/
private static boolean INITIALIZED = false;
@Inject @Inject
private Logger logger; private Logger logger;
@ -114,13 +119,20 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger); GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
this.geyser = GeyserImpl.load(PlatformType.VELOCITY, this); this.geyser = GeyserImpl.load(PlatformType.VELOCITY, this);
// Hack: Normally triggered by ListenerBoundEvent, but that doesn't fire on /geyser reload
if (INITIALIZED) {
this.postStartup();
}
} }
private void postStartup() { private void postStartup() {
GeyserImpl.start(); GeyserImpl.start();
if (!INITIALIZED) {
this.geyserInjector = new GeyserVelocityInjector(proxyServer); this.geyserInjector = new GeyserVelocityInjector(proxyServer);
// Will be initialized after the proxy has been bound // Will be initialized after the proxy has been bound
}
this.geyserCommandManager = new GeyserCommandManager(geyser); this.geyserCommandManager = new GeyserCommandManager(geyser);
this.geyserCommandManager.init(); this.geyserCommandManager.init();
@ -195,6 +207,8 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
geyserInjector.initializeLocalChannel(this); geyserInjector.initializeLocalChannel(this);
} }
} }
INITIALIZED = true;
} }
@Override @Override

Datei anzeigen

@ -299,8 +299,9 @@ public final class EntityDefinitions {
.build(); .build();
EntityDefinition<Entity> displayBase = EntityDefinition.inherited(entityBase.factory(), entityBase) EntityDefinition<Entity> displayBase = EntityDefinition.inherited(entityBase.factory(), entityBase)
.addTranslator(null) // Interpolation start ticks .addTranslator(null) // Interpolation delay
.addTranslator(null) // Interpolation duration ID .addTranslator(null) // Transformation interpolation duration
.addTranslator(null) // Position/Rotation interpolation duration
.addTranslator(null) // Translation .addTranslator(null) // Translation
.addTranslator(null) // Scale .addTranslator(null) // Scale
.addTranslator(null) // Left rotation .addTranslator(null) // Left rotation
@ -318,6 +319,10 @@ public final class EntityDefinitions {
.type(EntityType.TEXT_DISPLAY) .type(EntityType.TEXT_DISPLAY)
.identifier("minecraft:armor_stand") .identifier("minecraft:armor_stand")
.addTranslator(MetadataType.CHAT, TextDisplayEntity::setText) .addTranslator(MetadataType.CHAT, TextDisplayEntity::setText)
.addTranslator(null) // Line width
.addTranslator(null) // Background color
.addTranslator(null) // Text opacity
.addTranslator(null) // Bit mask
.build(); .build();
INTERACTION = EntityDefinition.inherited(InteractionEntity::new, entityBase) INTERACTION = EntityDefinition.inherited(InteractionEntity::new, entityBase)

Datei anzeigen

@ -55,6 +55,7 @@ import org.geysermc.geyser.translator.inventory.item.CustomItemTranslator;
import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.util.BlockUtils; import org.geysermc.geyser.util.BlockUtils;
import org.geysermc.geyser.util.CooldownUtils;
@Translator(packet = PlayerActionPacket.class) @Translator(packet = PlayerActionPacket.class)
public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> { public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket> {
@ -281,6 +282,10 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
entity.setOnGround(false); // Increase block break time while jumping entity.setOnGround(false); // Increase block break time while jumping
break; break;
case MISSED_SWING: case MISSED_SWING:
// Java edition sends a cooldown when hitting air.
// Normally handled by BedrockLevelSoundEventTranslator, but there is no sound on Java for this.
CooldownUtils.sendCooldown(session);
// TODO Re-evaluate after pre-1.20.10 is no longer supported? // TODO Re-evaluate after pre-1.20.10 is no longer supported?
if (session.getArmAnimationTicks() == -1) { if (session.getArmAnimationTicks() == -1) {
session.sendDownstreamGamePacket(new ServerboundSwingPacket(Hand.MAIN_HAND)); session.sendDownstreamGamePacket(new ServerboundSwingPacket(Hand.MAIN_HAND));

Datei anzeigen

@ -49,7 +49,7 @@ public class JavaAddEntityTranslator extends PacketTranslator<ClientboundAddEnti
public void translate(GeyserSession session, ClientboundAddEntityPacket packet) { public void translate(GeyserSession session, ClientboundAddEntityPacket packet) {
EntityDefinition<?> definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); EntityDefinition<?> definition = Registries.ENTITY_DEFINITIONS.get(packet.getType());
if (definition == null) { if (definition == null) {
session.getGeyser().getLogger().warning("Could not find an entity definition with type " + packet.getType()); session.getGeyser().getLogger().debug("Could not find an entity definition with type " + packet.getType());
return; return;
} }

Datei anzeigen

@ -14,7 +14,7 @@ protocol-connection = "3.0.0.Beta1-20231016.115644-106"
raknet = "1.0.0.CR1-20230703.195238-9" raknet = "1.0.0.CR1-20230703.195238-9"
blockstateupdater="1.20.40-20231016.111746-1" blockstateupdater="1.20.40-20231016.111746-1"
mcauthlib = "d9d773e" mcauthlib = "d9d773e"
mcprotocollib = "1.20.2-1-20231003.141424-6" mcprotocollib = "1.20.2-1-20231101.141901-7"
adventure = "4.14.0" adventure = "4.14.0"
adventure-platform = "4.3.0" adventure-platform = "4.3.0"
junit = "5.9.2" junit = "5.9.2"