diff --git a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/CommandHandler.kt b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/CommandHandler.kt index ae6c887..4441587 100644 --- a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/CommandHandler.kt +++ b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/CommandHandler.kt @@ -1,37 +1,21 @@ package com.faithl.bukkit.faithllevel.internal.command import com.faithl.bukkit.faithllevel.FaithlLevel -import com.faithl.bukkit.faithllevel.api.FaithlLevelAPI import com.faithl.bukkit.faithllevel.internal.command.impl.* -import com.faithl.bukkit.faithllevel.internal.conf.Loader -import com.faithl.bukkit.faithllevel.internal.level.Level -import com.faithl.bukkit.faithllevel.internal.level.data.ExpDataManager -import org.bukkit.Bukkit -import org.bukkit.Bukkit.getPlayerExact import org.bukkit.command.CommandSender -import org.bukkit.entity.Player -import taboolib.common.platform.ProxyCommandSender -import taboolib.common.platform.ProxyPlayer import taboolib.common.platform.command.CommandBody import taboolib.common.platform.command.CommandHeader import taboolib.common.platform.command.mainCommand import taboolib.common.platform.command.subCommand import taboolib.common.platform.function.adaptCommandSender -import taboolib.common.platform.function.adaptPlayer -import taboolib.common.platform.function.onlinePlayers -import taboolib.common.platform.function.pluginVersion -import taboolib.common5.Coerce import taboolib.module.chat.TellrawJson -import taboolib.module.lang.Language -import taboolib.module.lang.sendLang import taboolib.platform.util.asLangText -import taboolib.platform.util.sendLang @CommandHeader(name = "faithllevel", aliases = ["fl","flevel","level"], permission = "FaithlLevel.access") object CommandHandler { @CommandBody - val boot = CommandBoot.command + val booster = CommandBooster.command @CommandBody val status = CommandStatus.command @@ -103,7 +87,7 @@ object CommandHandler { displayArg("set", sender.asLangText("Command-Set-Description")) displayArg("take", sender.asLangText("Command-Take-Description")) if (FaithlLevel.ap) - displayArg("boot", sender.asLangText("Command-Boot-Description")) + displayArg("booster", sender.asLangText("Command-Booster-Description")) displayArg("status", sender.asLangText("Command-Status-Description")) displayArg("reload", sender.asLangText("Command-Reload-Description")) proxySender.sendMessage("") diff --git a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandBoot.kt b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandBooster.kt similarity index 88% rename from src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandBoot.kt rename to src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandBooster.kt index fc54f31..28212ad 100644 --- a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandBoot.kt +++ b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandBooster.kt @@ -2,9 +2,7 @@ package com.faithl.bukkit.faithllevel.internal.command.impl import com.faithl.bukkit.faithllevel.api.FaithlLevelAPI import com.faithl.bukkit.faithllevel.internal.level.Level -import com.faithl.bukkit.faithllevel.internal.level.data.ExpDataManager -import com.faithl.bukkit.faithllevel.util.getBoot -import com.faithl.bukkit.faithllevel.util.setBoot +import com.faithl.bukkit.faithllevel.util.setBooster import org.bukkit.Bukkit import taboolib.common.platform.ProxyCommandSender import taboolib.common.platform.ProxyPlayer @@ -13,7 +11,7 @@ import taboolib.common.platform.function.onlinePlayers import taboolib.common5.Coerce import taboolib.module.lang.sendLang -object CommandBoot { +object CommandBooster { val command = subCommand { execute{ sender, _, _ -> sender.sendLang("Command-Boot-Error") @@ -32,7 +30,7 @@ object CommandBoot { val level = FaithlLevelAPI.getLevelData(context.argument(-1)) ?: return@execute val value = Coerce.toDouble(argument)/100 val player = Bukkit.getPlayerExact(sender.name) ?: return@execute - player.setBoot(level,value) + player.setBooster(level,value) sender.sendLang("Command-Boot-Info", level.name!!,sender.name,"${argument}%") } //value @@ -48,7 +46,7 @@ object CommandBoot { val target = Bukkit.getPlayerExact(context.argument(-1)) ?: return@execute val level = FaithlLevelAPI.getLevelData(context.argument(-2)) ?: return@execute val value = Coerce.toDouble(argument)/100 - target.setBoot(level,value) + target.setBooster(level,value) sender.sendLang("Command-Boot-Info", level.name!!,target.name,"${argument}%") } } diff --git a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandStatus.kt b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandStatus.kt index 52a5e05..8904b5c 100644 --- a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandStatus.kt +++ b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/command/impl/CommandStatus.kt @@ -3,7 +3,6 @@ package com.faithl.bukkit.faithllevel.internal.command.impl import com.faithl.bukkit.faithllevel.api.FaithlLevelAPI import com.faithl.bukkit.faithllevel.internal.level.Level import com.faithl.bukkit.faithllevel.internal.level.data.ExpDataManager -import com.faithl.bukkit.faithllevel.util.getBoot import org.bukkit.Bukkit import taboolib.common.platform.ProxyCommandSender import taboolib.common.platform.ProxyPlayer @@ -17,7 +16,7 @@ object CommandStatus { for (levelSystem in Level.levels){ val playerData: ExpDataManager = FaithlLevelAPI.getPlayerData(sender.cast(),levelSystem) sender.sendLang("Command-Status-Info", - levelSystem.name!!,sender.name,playerData.getDisplay(),playerData.exp,playerData.getMaxExp(),playerData.getTotalBoot()) + levelSystem.name!!,sender.name,playerData.getDisplay(),playerData.exp,playerData.getMaxExp(),playerData.getTotalBooster()) } } dynamic { @@ -29,7 +28,7 @@ object CommandStatus { for (levelSystem in Level.levels){ val playerData: ExpDataManager = FaithlLevelAPI.getPlayerData(target,levelSystem) sender.sendLang("Command-Status-Info", - levelSystem.name!!,target.name,playerData.getDisplay(),playerData.exp,playerData.getMaxExp(),playerData.getTotalBoot()) + levelSystem.name!!,target.name,playerData.getDisplay(),playerData.exp,playerData.getMaxExp(),playerData.getTotalBooster()) } } } diff --git a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/Level.kt b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/Level.kt index d1a5b7c..1276de8 100644 --- a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/Level.kt +++ b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/Level.kt @@ -17,7 +17,7 @@ class Level(private val configurationSection:ConfigurationSection) { val messages: ConfigurationSection? = configurationSection.getConfigurationSection("Messages") val permission: MutableList? = configurationSection.getStringList("Permissions") val ap: ConfigurationSection? = configurationSection.getConfigurationSection("AttributePlus") - val permissionBoot: MutableList? = configurationSection.getStringList("Exp-Permission-Boot") + val permissionBooster: MutableList? = configurationSection.getStringList("Exp-Permission-Booster") init { levels.add(this) requireNotNull(key) { diff --git a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/data/ExpDataManager.kt b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/data/ExpDataManager.kt index f9b8365..0922145 100644 --- a/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/data/ExpDataManager.kt +++ b/src/main/kotlin/com/faithl/bukkit/faithllevel/internal/level/data/ExpDataManager.kt @@ -34,16 +34,16 @@ class ExpDataManager(val player: Player, val levelData: Level) { } fun getTotalAddExp(addExpAmount: Int): Int { - return addExpAmount.times(1 + getTotalBoot()).roundToInt() + return addExpAmount.times(1 + getTotalBooster()).roundToInt() } - fun getTotalBoot(): Double { + fun getTotalBooster(): Double { var boot = 0.0 if (FaithlLevel.ap && levelData.ap?.getString("Exp-Boot-Attribute")!=null){ boot += AttributeAPI.getAttrData(player).getRandomValue(levelData.ap.getString("Exp-Boot-Attribute")).toDouble()/100 } - boot += getPermissionBoot() - boot += player.getBoot(levelData) + boot += getPermissionBooster() + boot += player.getBooster(levelData) return boot } @@ -202,8 +202,8 @@ class ExpDataManager(val player: Player, val levelData: Level) { return display.replaceWithOrder(this.level).colored() } - private fun getPermissionBoot(): Double { - val permissionBootList = levelData.permissionBoot ?: return 0.0 + private fun getPermissionBooster(): Double { + val permissionBootList = levelData.permissionBooster ?: return 0.0 if (this.getMaxLevel() < level) { return 0.0 } diff --git a/src/main/kotlin/com/faithl/bukkit/faithllevel/util/Data.kt b/src/main/kotlin/com/faithl/bukkit/faithllevel/util/Data.kt index 74c9b76..f6f50e8 100644 --- a/src/main/kotlin/com/faithl/bukkit/faithllevel/util/Data.kt +++ b/src/main/kotlin/com/faithl/bukkit/faithllevel/util/Data.kt @@ -7,7 +7,7 @@ import taboolib.expansion.getDataContainer import taboolib.expansion.releaseDataContainer import taboolib.expansion.setupDataContainer -fun Player.getBoot(level:Level):Double { +fun Player.getBooster(level:Level):Double { releaseDataContainer() setupDataContainer() return getDataContainer()["${level.key}_boot"]?.toDoubleOrNull() ?: return 0.0 @@ -25,7 +25,7 @@ fun Player.getFLevel(level:Level): Int { return Coerce.toInteger(getDataContainer()["${level.key}_level"]) } -fun Player.setBoot(level:Level,value:Double) { +fun Player.setBooster(level:Level,value:Double) { releaseDataContainer() setupDataContainer() getDataContainer()["${level.key}_boot"]=value diff --git a/src/main/resources/lang/zh_CN.yml b/src/main/resources/lang/zh_CN.yml index cc73e75..3fbc3aa 100644 --- a/src/main/resources/lang/zh_CN.yml +++ b/src/main/resources/lang/zh_CN.yml @@ -18,9 +18,9 @@ Command-Set-Error: '&8[&3FaithlLevel&8][&cERROR&8] &r错误的用法, 请使用& Command-Set-Info: '&8[&3FaithlLevel&8][&b{0}&8] &r设置 &b{1}&r 玩家等级为: &b{2}&r 级。' Command-Status-Description: '查看玩家信息' Command-Status-Info: '&8[&3FaithlLevel&8][&b{0}&8] &r玩家 &b{1} &r当前信息: &b{2}&8 - &r[&b{3}&8/&3{4}&r], 经验加成: &b{5}&r。' -Command-Boot-Description: '玩家经验加成设置' -Command-Boot-Info: '&8[&3FaithlLevel&8][&b{0}&8] &r玩家 &b{1} &r的经验加成已设置为 &b{2}&r。' -Command-Boot-Error: '&8[&3FaithlLevel&8][&cERROR&8] &r错误的用法, 请使用&b/faithllevel boot [Level] [玩家] [数值]&r。' +Command-Booster-Description: '玩家经验加成设置' +Command-Booster-Info: '&8[&3FaithlLevel&8][&b{0}&8] &r玩家 &b{1} &r的经验加成已设置为 &b{2}&r。' +Command-Booster-Error: '&8[&3FaithlLevel&8][&cERROR&8] &r错误的用法, 请使用&b/faithllevel boot [Level] [玩家] [数值]&r。' Level-Loader-Loaded: '&8[&3FaithlLevel&8][&bINFO&8] &b{0} &r个等级已加载 &8({1} ms)' Level-Loader-Failed: '&8[&3FaithlLevel&8][&cERROR&8] &b{0} &r等级加载失败, 原因:{1}' diff --git "a/src/main/resources/levels/\347\244\272\344\276\213\344\270\273\347\255\211\347\272\247.yml" "b/src/main/resources/levels/\347\244\272\344\276\213\344\270\273\347\255\211\347\272\247.yml" index dde0671..a1d397c 100644 --- "a/src/main/resources/levels/\347\244\272\344\276\213\344\270\273\347\255\211\347\272\247.yml" +++ "b/src/main/resources/levels/\347\244\272\344\276\213\344\270\273\347\255\211\347\272\247.yml" @@ -11,7 +11,7 @@ MainLevel: - "10:50" - "100:100" #权限经验加成,若玩家含有该权限则获得加成,单位% - Exp-Permission-Boot: + Exp-Permission-Booster: - "5:faithl.access:100" Permissions: #填写default为不需权限