diff options
author | Dico <dico.karssiens@gmail.com> | 2018-09-27 04:41:58 +0100 |
---|---|---|
committer | Dico <dico.karssiens@gmail.com> | 2018-09-27 04:41:58 +0100 |
commit | 307b7aee4af34e47139259db7049a85c682b7be2 (patch) | |
tree | 398ff3360f90e49cdc2a10d7872f6c6f787472bb /src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt | |
parent | cdaba0ebd5b48d1f2d4579c873d83fdf6ea1a074 (diff) |
Tweaks
Diffstat (limited to 'src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt')
-rw-r--r-- | src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt b/src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt index a660fc0..79faf36 100644 --- a/src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt +++ b/src/main/kotlin/io/dico/parcels2/command/AbstractParcelCommands.kt @@ -20,12 +20,8 @@ abstract class AbstractParcelCommands(val plugin: ParcelsPlugin) : ICommandRecei return getParcelCommandReceiver(plugin.parcelProvider, context, target, cmdName) } - protected fun error(message: String): Nothing { - throw CommandException(message) - } - protected fun checkConnected(action: String) { - if (!plugin.storage.isConnected) error("Parcels cannot $action right now because of a database error") + if (!plugin.storage.isConnected) err("Parcels cannot $action right now because of a database error") } protected suspend fun checkParcelLimit(player: Player, world: ParcelWorld) { @@ -35,7 +31,7 @@ abstract class AbstractParcelCommands(val plugin: ParcelsPlugin) : ICommandRecei val limit = player.parcelLimit if (numOwnedParcels >= limit) { - error("You have enough plots for now") + err("You have enough plots for now") } } @@ -65,10 +61,7 @@ abstract class AbstractParcelCommands(val plugin: ParcelsPlugin) : ICommandRecei } } - protected fun err(message: String): Nothing = throw CommandException(message) - override fun getCoroutineContext() = plugin.coroutineContext - - } +fun err(message: String): Nothing = throw CommandException(message)
\ No newline at end of file |