Added worldprops option noauth_default_admin so admin-by-default can be disabled when use_auth = false, thus making it possible to have singleplayer builds where the player is not automatically given admin rights
This commit is contained in:
@@ -12,7 +12,9 @@ import java.math.BigInteger
|
||||
*/
|
||||
class ServerConstants {
|
||||
companion object {
|
||||
@JvmField
|
||||
var NOAUTH_DEFAULT_ADMIN: Boolean = true
|
||||
|
||||
@JvmField
|
||||
var DAILY_ACCOUNT_LIMIT = 3
|
||||
|
||||
@JvmField
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package rs09.auth
|
||||
|
||||
import core.game.node.entity.player.Player
|
||||
import rs09.ServerConstants
|
||||
import rs09.storage.AccountStorageProvider
|
||||
import rs09.storage.InMemoryStorageProvider
|
||||
|
||||
@@ -23,7 +24,8 @@ class DevelopmentAuthenticator : AuthProvider<AccountStorageProvider>() {
|
||||
|
||||
override fun createAccountWith(info: UserAccountInfo): Boolean {
|
||||
info.username = info.username.toLowerCase()
|
||||
info.rights = 2
|
||||
if (ServerConstants.NOAUTH_DEFAULT_ADMIN)
|
||||
info.rights = 2
|
||||
storageProvider.store(info)
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ object ServerConfigParser {
|
||||
ServerConstants.PERSIST_ACCOUNTS = data.getBoolean("server.persist_accounts", true)
|
||||
ServerConstants.DAILY_ACCOUNT_LIMIT = data.getLong("server.daily_accounts_per_ip", 3L).toInt()
|
||||
ServerConstants.DISCORD_MOD_WEBHOOK = data.getString("server.moderation_webhook", "")
|
||||
ServerConstants.NOAUTH_DEFAULT_ADMIN = data.getBoolean("server.noauth_default_admin", false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
secret_key = "2009scape_development"
|
||||
write_logs = true
|
||||
msip = "127.0.0.1"
|
||||
noauth_default_admin = true #NOTE: If we are not using auth, this determines whether or not players are admins by default.
|
||||
|
||||
[database]
|
||||
database_name = "global"
|
||||
|
||||
Reference in New Issue
Block a user