diff --git a/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/StaffPlayer.java b/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/StaffPlayer.java index 0e817cce..d3dc501b 100644 --- a/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/StaffPlayer.java +++ b/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/StaffPlayer.java @@ -33,6 +33,7 @@ import lombok.Getter; import lombok.Setter; import lombok.SneakyThrows; +import lombok.val; import org.bukkit.*; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -565,7 +566,11 @@ public void saveHealthAndFood() { @Override public void restoreHealthAndFood() { if (!playerInventoryConfig.contains("health")) return; - player.setHealth(playerInventoryConfig.getDouble("health")); player.setFoodLevel(playerInventoryConfig.getInt("food")); + val health = playerInventoryConfig.getDouble("health"); + if (health > 20) + player.setHealth(20); + else + player.setHealth(health); } } diff --git a/MAStaff-Common/src/main/kotlin/es/angelillo15/mast/handler/OnStaffMessageEvent.kt b/MAStaff-Common/src/main/kotlin/es/angelillo15/mast/handler/OnStaffMessageEvent.kt index ae992086..af59d308 100644 --- a/MAStaff-Common/src/main/kotlin/es/angelillo15/mast/handler/OnStaffMessageEvent.kt +++ b/MAStaff-Common/src/main/kotlin/es/angelillo15/mast/handler/OnStaffMessageEvent.kt @@ -15,6 +15,7 @@ open class OnStaffMessageEvent { fun onStaffMessageEvent(player: String, message: String, server: String): Boolean { if (!CommonConfig.StaffChat.enabled()) return false + if (!CommonConfig.StaffChat.Prefix.enabled()) return false val key = CommonConfig.StaffChat.Prefix.key() var strippedMessage = message diff --git a/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/cmd/CustomCommand.kt b/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/cmd/CustomCommand.kt index dda56a15..f7f537ac 100644 --- a/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/cmd/CustomCommand.kt +++ b/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/cmd/CustomCommand.kt @@ -10,7 +10,7 @@ import es.angelillo15.mast.api.cmd.sender.CommandSender import es.angelillo15.mast.api.cmd.sender.VelocityConsoleCommandSender import es.angelillo15.mast.api.cmd.sender.VelocityPlayerCommandSender -class CustomCommand(private var command: Command, private var permission: String?) : SimpleCommand { +class CustomCommand(private var command: Command, private var permission: String) : SimpleCommand { @Inject private lateinit var logger: ILogger; override fun execute(invocation: SimpleCommand.Invocation?) { @@ -23,16 +23,12 @@ class CustomCommand(private var command: Command, private var permission: String return } - command.onCommand(sender, invocation.alias(), invocation.arguments()) - } - - override fun hasPermission(invocation: SimpleCommand.Invocation?): Boolean { - if (permission.isNullOrBlank()) return true - - if (invocation is Player) { - return invocation.hasPermission(permission) + if (invocation.source().hasPermission(permission)) { + command.onCommand(sender, invocation.alias(), invocation.arguments()) } + } - return true + override fun hasPermission(invocation: SimpleCommand.Invocation): Boolean { + return invocation.source().hasPermission(permission) } } \ No newline at end of file diff --git a/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/listeners/staffchat/OnPlayerChat.kt b/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/listeners/staffchat/OnPlayerChat.kt index 86715627..78ade4eb 100644 --- a/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/listeners/staffchat/OnPlayerChat.kt +++ b/MAStaff-Velocity/src/main/java/es/angelillo15/mast/velocity/listeners/staffchat/OnPlayerChat.kt @@ -7,6 +7,8 @@ import es.angelillo15.mast.handler.OnStaffMessageEvent class OnPlayerChat : OnStaffMessageEvent() { @Subscribe fun onPlayerChat(event: PlayerChatEvent) { + if (!event.player.hasPermission("mast.staffchat")) return + if (onStaffMessageEvent( event.player.username, event.message, event.player.currentServer.get().serverInfo.name ) diff --git a/build.gradle.kts b/build.gradle.kts index b21e2efa..b954dfcf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "es.angelillo15" -version = "2.4.0" +version = "2.4.1" tasks.shadowJar { relocate("es.angelillo15.configmanager", "es.angelillo15.mast.libs.config.manager")