mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 20:05:02 -04:00
signature: configuration options
This commit is contained in:
parent
f4bb0f2c52
commit
264d86751a
@ -18,6 +18,7 @@ import de.bixilon.minosoft.config.profile.ProfileManager
|
||||
import de.bixilon.minosoft.config.profile.profiles.Profile
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.delegate
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.latestVersion
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.signature.SignatureC
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.skin.SkinC
|
||||
import de.bixilon.minosoft.data.entities.entities.player.Arms
|
||||
|
||||
@ -55,6 +56,7 @@ class ConnectionProfile(
|
||||
var mainArm by delegate(Arms.RIGHT)
|
||||
|
||||
val skin = SkinC()
|
||||
val signature = SignatureC()
|
||||
|
||||
var autoRespawn by delegate(false)
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.config.profile.profiles.connection.signature
|
||||
|
||||
import de.bixilon.minosoft.config.profile.profiles.connection.ConnectionProfileManager.delegate
|
||||
|
||||
class SignatureC {
|
||||
|
||||
/**
|
||||
* Hides all bad signed messages
|
||||
*/
|
||||
val ignoreBadSignedMessages by delegate(false)
|
||||
|
||||
/**
|
||||
* Does not fetch/load the private key, thus forcing the unsigned mode
|
||||
*/
|
||||
val disableKeys by delegate(false)
|
||||
|
||||
/**
|
||||
* Send commands as message
|
||||
*/
|
||||
val sendCommandAsMessage by delegate(false)
|
||||
}
|
@ -94,7 +94,7 @@ class ConnectionUtil(
|
||||
|
||||
@Deprecated("message will re removed as soon as brigadier is fully implemented")
|
||||
fun sendCommand(message: String, stack: CommandStack) {
|
||||
if (!connection.version.requiresSignedChat) {
|
||||
if (!connection.version.requiresSignedChat || connection.profiles.connection.signature.sendCommandAsMessage) {
|
||||
return sendChatMessage(message)
|
||||
}
|
||||
TODO("Can not send signed chat!")
|
||||
|
@ -185,7 +185,7 @@ class PlayConnection(
|
||||
Log.log(LogMessageType.ASSETS, LogLevels.INFO) { "Assets verified!" }
|
||||
}
|
||||
var privateKey: PlayerPrivateKey? = null
|
||||
if (version.requiresSignedChat) {
|
||||
if (version.requiresSignedChat && !profiles.connection.signature.disableKeys) {
|
||||
taskWorker += WorkerTask(optional = true) {
|
||||
val minecraftKey = account.fetchKey(latch) ?: return@WorkerTask
|
||||
minecraftKey.requireSignature(account.uuid)
|
||||
|
@ -110,6 +110,14 @@ class SignedChatMessageS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
|
||||
}
|
||||
|
||||
override fun handle(connection: PlayConnection) {
|
||||
if (message.error != null) {
|
||||
// failed
|
||||
Log.log(LogMessageType.CHAT_IN, LogLevels.WARN) { "Signature error: ${message.error}: ${message.text}" }
|
||||
|
||||
if (connection.profiles.connection.signature.ignoreBadSignedMessages) {
|
||||
return
|
||||
}
|
||||
}
|
||||
connection.fireEvent(ChatMessageReceiveEvent(connection, EventInitiators.SERVER, message))
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user