mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-27 04:26:27 -04:00
Added defaults to new PermissionValidator functions
This commit is contained in:
@@ -22,6 +22,11 @@ enum class PermissionLevel(val numericalValue: Int) {
|
||||
SPAWN_PROTECTION_BYPASS(1),
|
||||
CHEAT_COMMANDS_AND_COMMAND_BLOCKS(2),
|
||||
MULTIPLAYER_MANAGEMENT(3),
|
||||
ALL_COMMANDS(4)
|
||||
ALL_COMMANDS(4);
|
||||
|
||||
companion object {
|
||||
fun byNumericValue(value: Int): PermissionLevel {
|
||||
return entries.first { it.numericalValue == value }
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -42,7 +42,7 @@ interface PermissionValidator {
|
||||
* @param permission The permission string being queried such as cobblemon.command.giveallpokemon.
|
||||
* @param level The permission level being queried. 4 is generally used for cheats.
|
||||
*/
|
||||
fun hasPermission(player: ServerPlayer, permission: String, level: Int): Boolean
|
||||
fun hasPermission(player: ServerPlayer, permission: String, level: Int): Boolean = hasPermission(player, CobblemonPermission(permission, PermissionLevel.byNumericValue(level)))
|
||||
|
||||
/**
|
||||
* Validates a permission for [CommandSource].
|
||||
@@ -59,5 +59,5 @@ interface PermissionValidator {
|
||||
* @param permission The permission string being queried such as cobblemon.command.giveallpokemon.
|
||||
* @param level The permission level being queried. 4 is generally used for cheats.
|
||||
*/
|
||||
fun hasPermission(source: CommandSourceStack, permission: String, level: Int): Boolean
|
||||
fun hasPermission(source: CommandSourceStack, permission: String, level: Int): Boolean = hasPermission(source, CobblemonPermission(permission, PermissionLevel.byNumericValue(level)))
|
||||
}
|
||||
+1
-1
@@ -133,7 +133,7 @@ object CatchRateModifiers {
|
||||
*/
|
||||
val LURE = WorldStateModifier { _, entity ->
|
||||
if (FishingSpawnCause.FISHED_ASPECT in entity.aspects)
|
||||
4f
|
||||
4F
|
||||
else
|
||||
1F
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user