Archived
0

Work on commands. Implemented helper functions, among others to handle asynchronous commands

This commit is contained in:
Dico200
2018-07-24 01:14:23 +01:00
parent 42026191ec
commit d15d1b767b
24 changed files with 426 additions and 104 deletions

View File

@@ -6,18 +6,19 @@ import io.dico.parcels2.logger
import org.bukkit.entity.Player
import org.bukkit.plugin.java.JavaPlugin
inline val Player.hasBanBypass get() = hasPermission("plots.admin.bypass.ban")
inline val Player.hasBuildAnywhere get() = hasPermission("plots.admin.bypass.build")
inline val Player.hasGamemodeBypass get() = hasPermission("plots.admin.bypass.gamemode")
inline val Player.hasAdminManage get() = hasPermission("plots.admin.manage")
inline val Player.hasPlotHomeOthers get() = hasPermission("plots.command.home.others")
inline val Player.hasRandomSpecific get() = hasPermission("plots.command.random.specific")
val Player.plotLimit: Int
inline val Player.uuid get() = uniqueId
inline val Player.hasBanBypass get() = hasPermission("parcels.admin.bypass.ban")
inline val Player.hasBuildAnywhere get() = hasPermission("parcels.admin.bypass.build")
inline val Player.hasGamemodeBypass get() = hasPermission("parcels.admin.bypass.gamemode")
inline val Player.hasAdminManage get() = hasPermission("parcels.admin.manage")
inline val Player.hasParcelHomeOthers get() = hasPermission("parcels.command.home.others")
inline val Player.hasRandomSpecific get() = hasPermission("parcels.command.random.specific")
val Player.parcelLimit: Int
get() {
for (info in effectivePermissions) {
val perm = info.permission
if (perm.startsWith("plots.limit.")) {
val limitString = perm.substring("plots.limit.".length)
if (perm.startsWith("parcels.limit.")) {
val limitString = perm.substring("parcels.limit.".length)
if (limitString == "*") {
return Int.MAX_VALUE
}
@@ -32,7 +33,7 @@ val Player.plotLimit: Int
private const val DEFAULT_LIMIT = 1
private val prefix = Formatting.translateChars('&', "&4[&c${JavaPlugin.getPlugin(ParcelsPlugin::class.java).name}&4] &a")
fun Player.sendPlotMessage(except: Boolean = false, nopermit: Boolean = false, message: String) {
fun Player.sendParcelMessage(except: Boolean = false, nopermit: Boolean = false, message: String) {
if (except) {
sendMessage(prefix + Formatting.YELLOW + Formatting.translateChars('&', message))
} else if (nopermit) {