3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-24 15:20:25 +01:00

Merge remote-tracking branch 'upstream/master' into feature/blocky

Dieser Commit ist enthalten in:
Joshua Castle 2023-01-02 02:15:43 -08:00
Commit 41947f3e80
9 geänderte Dateien mit 83 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -223,7 +223,10 @@ public class GeyserImpl implements GeyserApi {
logger.info(message);
if (platformType == PlatformType.STANDALONE) {
logger.warning(GeyserLocale.getLocaleStringLog("geyser.core.movement_warn"));
if (config.getRemote().authType() != AuthType.FLOODGATE) {
// If the auth-type is Floodgate, then this Geyser instance is probably owned by the Java server
logger.warning(GeyserLocale.getLocaleStringLog("geyser.core.movement_warn"));
}
} else if (config.getRemote().authType() == AuthType.FLOODGATE) {
VersionCheckUtils.checkForOutdatedFloodgate(logger);
}
@ -329,7 +332,7 @@ public class GeyserImpl implements GeyserApi {
Key key = new AesKeyProducer().produceFrom(config.getFloodgateKeyPath());
cipher = new AesCipher(new Base64Topping());
cipher.init(key);
logger.debug(GeyserLocale.getLocaleStringLog("geyser.auth.floodgate.loaded_key"));
logger.debug("Loaded Floodgate key!");
// Note: this is positioned after the bind so the skin uploader doesn't try to run if Geyser fails
// to load successfully. Spigot complains about class loader if the plugin is disabled.
skinUploader = new FloodgateSkinUploader(this).start();

Datei anzeigen

@ -40,6 +40,13 @@ public class AgeableEntity extends CreatureEntity {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
}
@Override
protected void initializeMetadata() {
super.initializeMetadata();
// Required as of 1.19.3 Java
dirtyMetadata.put(EntityData.SCALE, getAdultSize());
}
public void setBaby(BooleanEntityMetadata entityMetadata) {
boolean isBaby = entityMetadata.getPrimitiveValue();
dirtyMetadata.put(EntityData.SCALE, isBaby ? getBabySize() : getAdultSize());

Datei anzeigen

@ -25,7 +25,6 @@
package org.geysermc.geyser.entity.type.living.animal;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
@ -42,11 +41,6 @@ public class RabbitEntity extends AnimalEntity {
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
}
@Override
public void setBaby(BooleanEntityMetadata entityMetadata) {
super.setBaby(entityMetadata);
}
public void setRabbitVariant(IntEntityMetadata entityMetadata) {
int variant = entityMetadata.getPrimitiveValue();

Datei anzeigen

@ -33,6 +33,8 @@ import it.unimi.dsi.fastutil.objects.Object2IntMaps;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import lombok.Getter;
import lombok.Setter;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.scoreboard.Scoreboard;
import org.geysermc.geyser.scoreboard.ScoreboardUpdater.ScoreboardSession;
import org.geysermc.geyser.session.GeyserSession;
@ -61,6 +63,17 @@ public final class WorldCache {
private int currentSequence;
private final Object2IntMap<Vector3i> unverifiedPredictions = new Object2IntOpenHashMap<>(1);
/**
* <ul>
* <li>NOT_SET = not yet triggered</li>
* <li>FALSE = enforce-secure-profile is true but player hasn't chatted yet</li>
* <li>TRUE = enforce-secure-profile is enabled, and player has chatted and they have seen our message.</li>
* </ul>
*/
@Getter
@Setter
private @NonNull TriState chatWarningSent = TriState.NOT_SET;
public WorldCache(GeyserSession session) {
this.session = session;
this.scoreboard = new Scoreboard(session);

Datei anzeigen

@ -26,8 +26,9 @@
package org.geysermc.geyser.translator.protocol.bedrock;
import com.nukkitx.protocol.bedrock.packet.TextPacket;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.translator.text.MessageTranslator;
@ -48,6 +49,15 @@ public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
return;
}
if (session.getWorldCache().getChatWarningSent() == TriState.FALSE) {
if (Boolean.parseBoolean(System.getProperty("Geyser.PrintSecureChatInformation", "true"))) {
session.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.chat.secure_info_1", session.locale()));
session.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.chat.secure_info_2", session.locale(), "https://geysermc.link/secure-chat"));
}
// Never send this message again for this session.
session.getWorldCache().setChatWarningSent(TriState.TRUE);
}
session.sendChat(message);
}
}

Datei anzeigen

@ -0,0 +1,44 @@
/*
* Copyright (c) 2019-2022 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.geyser.translator.protocol.java;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundServerDataPacket;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@Translator(packet = ClientboundServerDataPacket.class)
public class JavaServerDataTranslator extends PacketTranslator<ClientboundServerDataPacket> {
@Override
public void translate(GeyserSession session, ClientboundServerDataPacket packet) {
// We only want to warn about chat maybe not working once
if (packet.isEnforcesSecureChat() && session.getWorldCache().getChatWarningSent() == TriState.NOT_SET) {
session.getWorldCache().setChatWarningSent(TriState.FALSE);
}
}
}

Datei anzeigen

@ -40,7 +40,6 @@ import org.geysermc.geyser.entity.type.Entity;
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.session.cache.TeleportCache;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.util.ChunkUtils;
@ -97,7 +96,7 @@ public class JavaPlayerPositionTranslator extends PacketTranslator<ClientboundPl
ChunkUtils.updateChunkPosition(session, pos.toInt());
if (session.getGeyser().getConfig().isDebugMode()) {
session.getGeyser().getLogger().debug(GeyserLocale.getLocaleStringLog("geyser.entity.player.spawn", packet.getX(), packet.getY(), packet.getZ()));
session.getGeyser().getLogger().debug("Spawned player at " + packet.getX() + " " + packet.getY() + " " + packet.getZ());
}
return;
}

Datei anzeigen

@ -36,7 +36,6 @@ import org.geysermc.geyser.entity.type.*;
import org.geysermc.geyser.entity.type.player.PlayerEntity;
import org.geysermc.geyser.registry.Registries;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
@ -53,7 +52,7 @@ public class JavaAddEntityTranslator extends PacketTranslator<ClientboundAddEnti
EntityDefinition<?> definition = Registries.ENTITY_DEFINITIONS.get(packet.getType());
if (definition == null) {
session.getGeyser().getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.entity.type_null", packet.getType()));
session.getGeyser().getLogger().warning("Could not find an entity definition with type " + packet.getType());
return;
}

@ -1 +1 @@
Subproject commit a9cf5999af605902b18dd5c77d3562481f8d7f3d
Subproject commit f6685c4ccc6e77b07402d45cb41213559004b7d6