Did more config stuff and added to readme.md

This commit is contained in:
5vl 2022-04-07 11:15:36 +02:00
parent a9d81942f6
commit d4332868c4
No known key found for this signature in database
GPG Key ID: DA8938F22548E4D5
4 changed files with 30 additions and 5 deletions

View File

@ -1,2 +1,19 @@
# Staff
I made this plugin by request of a friend, and because I didn't have anything to do.
# Features:
- PlaceholderAPI support
- Staffmode
- Freezing (through command or freeze wand in staffmode)
- Open inventory (through command or inventory wand in staffmode)
- Knockback Stick (in staffmode)
# Commands and permissions:
- /staffmode - staff.staffmode
- /freeze - staff.freeze
- /openinv - staff.openinv
# Staff mode items:
- Disable staffmode - staff.staffmode
- Freeze wand - staff.freeze.wand
- Inventory wand - staff.openinv.wand
- Knockback Stick - staff.kbstick

View File

@ -4,4 +4,6 @@ import org.bukkit.configuration.file.FileConfiguration
object Config {
var config: FileConfiguration? = null
val mustBePlayer = config?.getString("must-be-player")
val noPermission = config?.getString("no-permission")
}

View File

@ -1,5 +1,6 @@
package me.fivevl.staff.commands
import me.fivevl.staff.Config
import me.fivevl.staff.Utils
import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
@ -9,10 +10,14 @@ import org.bukkit.entity.Player
class StaffModeCommand : CommandExecutor {
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if (sender !is Player) {
sender.sendMessage(Utils.hex(Utils.getPlaceholders(null, "&cYou must be a player to use this command!")))
sender.sendMessage(Utils.hex(Utils.getPlaceholders(null, Config.mustBePlayer!!)))
return true
}
val p = sender.player!!
if (!p.hasPermission("staff.staffmode")) {
p.sendMessage(Utils.hex(Utils.getPlaceholders(p, Config.noPermission!!)))
return true
}
val p = sender.player
return true
}
}

View File

@ -1 +1,2 @@
must-be-player: "&cYou must be a player to use this command!"
must-be-player: "&cYou must be a player to use this command!"
no-permission: "&cYou don't have permission to use this command!"