added new messages and something else, please fix sm inv

This commit is contained in:
5vl 2022-04-12 15:58:32 +02:00
parent d407ce6e57
commit bdab267df1
No known key found for this signature in database
GPG Key ID: DA8938F22548E4D5
4 changed files with 20 additions and 12 deletions

View File

@ -8,8 +8,10 @@ object Config {
} }
val mustBePlayer = getConfig().getString("must-be-player")!! val mustBePlayer = getConfig().getString("must-be-player")!!
val noPermission = getConfig().getString("no-permission")!! val noPermission = getConfig().getString("no-permission")!!
val toggleStaffmode = getConfig().getString("toggle-staffmode")!! val toggleStaffmodeOn = getConfig().getString("toggle-staffmode-on")!!
val toggleVanish = getConfig().getString("toggle-vanish")!! val toggleStaffmodeOff = getConfig().getString("toggle-staffmode-off")!!
val toggleVanishOn = getConfig().getString("toggle-vanish-on")!!
val toggleVanishOff = getConfig().getString("toggle-vanish-off")!!
val staffmodeHotbar = HashMap<Int, String>().apply { val staffmodeHotbar = HashMap<Int, String>().apply {
getConfig().getConfigurationSection("staffmode-hotbar")?.getKeys(false)?.forEach { getConfig().getConfigurationSection("staffmode-hotbar")?.getKeys(false)?.forEach {
put(it.toInt(), getConfig().getString("staffmode-hotbar.$it")!!) put(it.toInt(), getConfig().getString("staffmode-hotbar.$it")!!)

View File

@ -29,6 +29,7 @@ class Main : JavaPlugin() {
DONE: DONE:
- PlaceholderAPI support - PlaceholderAPI support
- Config - Config
- Vanish command
NOT DONE: NOT DONE:
- Staff mode (Invisibility/vanish, fly, items) - Staff mode (Invisibility/vanish, fly, items)
- Freeze (Command and freeze wand in staff mode) - Freeze (Command and freeze wand in staff mode)

View File

@ -34,6 +34,7 @@ object Utils {
p.inventory.clear() p.inventory.clear()
p.inventory.contents = inStaffmode[p]!!.contents p.inventory.contents = inStaffmode[p]!!.contents
inStaffmode.remove(p) inStaffmode.remove(p)
p.sendMessage(hex(getPlaceholders(p, Config.toggleStaffmodeOff)))
} else { } else {
inStaffmode[p] = p.inventory inStaffmode[p] = p.inventory
p.inventory.clear() p.inventory.clear()
@ -48,8 +49,8 @@ object Utils {
} }
p.inventory.setItem(i - 1, item) p.inventory.setItem(i - 1, item)
} }
p.sendMessage(hex(getPlaceholders(p, Config.toggleStaffmodeOn)))
} }
p.sendMessage(hex(getPlaceholders(p, Config.toggleStaffmode)))
} }
fun toggleVanish(p: Player) { fun toggleVanish(p: Player) {
if (inVanish.contains(p)) { if (inVanish.contains(p)) {
@ -57,13 +58,14 @@ object Utils {
ps.showPlayer(instance!!, p) ps.showPlayer(instance!!, p)
} }
inVanish.remove(p) inVanish.remove(p)
p.sendMessage(hex(getPlaceholders(p, Config.toggleVanishOff)))
} else { } else {
for (ps in Bukkit.getOnlinePlayers()) { for (ps in Bukkit.getOnlinePlayers()) {
ps.hidePlayer(instance!!, p) ps.hidePlayer(instance!!, p)
} }
inVanish.add(p) inVanish.add(p)
p.sendMessage(hex(getPlaceholders(p, Config.toggleVanishOn)))
} }
p.sendMessage(hex(getPlaceholders(p, Config.toggleVanish)))
} }
fun getConfig(): FileConfiguration { fun getConfig(): FileConfiguration {

View File

@ -1,19 +1,22 @@
# In this section of the config you can change all the messages in the plugin. # In this section of the config you can change all the messages in the plugin.
must-be-player: "&cYou must be a player to use this command!" # Message shown when a player tries to use a command that requires them to be a player must-be-player: "&cYou must be a player to use this command!" # Message shown when a player tries to use a command that requires them to be a player
no-permission: "&cYou don't have permission to use this command!" # Message shown when a player tries to use a command that they don't have permission to use no-permission: "&cYou don't have permission to use this command!" # Message shown when a player tries to use a command that they don't have permission to use
toggle-staffmode: "&aToggled staffmode!" # Message shown when a player toggles staffmode toggle-staffmode-on: "&aToggled staffmode on!" # Message shown when a player toggles staffmode on
toggle-vanish: "&aToggled vanish!" # Message shown when a player toggles vanish toggle-staffmode-off: "&cToggled staffmode off!" # Message shown when a player toggles staffmode off
toggle-fly: "&aToggled fly!" # Message shown when a player toggles fly toggle-vanish-on: "&aToggled vanish on!" # Message shown when a player toggles vanish on
toggle-vanish-off: "&cToggled vanish off!" # Message shown when a player toggles vanish off
toggle-fly-on: "&aToggled fly on!" # Message shown when a player toggles fly on
toggle-fly-off: "&cToggled fly off!" # Message shown when a player toggles fly off
# In this section of the config you can change the items given to you in staffmode. # In this section of the config you can change the items given to you in staffmode.
staffmode-hotbar: # List of items to give the player when they toggle staffmode, available items: "AIR", "DISABLE_STAFFMODE", "FREEZE_WAND", "INVENTORY_WAND", "KB_STICK", "VANISH_ITEM" staffmode-hotbar: # List of items to give the player when they toggle staffmode, available items: "AIR", "DISABLE_STAFFMODE", "FREEZE_WAND", "INVENTORY_WAND", "KB_STICK", "VANISH_ITEM"
1: "AIR" 1: "DISABLE_STAFFMODE"
2: "AIR" 2: "AIR"
3: "AIR" 3: "FREEZE_WAND"
4: "AIR" 4: "AIR"
5: "AIR" 5: "INVENTORY_WAND"
6: "AIR" 6: "AIR"
7: "AIR" 7: "KB_STICK"
8: "AIR" 8: "AIR"
9: "AIR" 9: "VANISH_ITEM"
disable-staffmode-item: "&aDisable staffmode" # Item name of the item that disables staffmode disable-staffmode-item: "&aDisable staffmode" # Item name of the item that disables staffmode