made items

This commit is contained in:
5vl 2022-04-16 20:06:40 +02:00
parent ebdfe8ae1f
commit a3ba0b3f76
No known key found for this signature in database
GPG Key ID: DA8938F22548E4D5
4 changed files with 49 additions and 21 deletions

View File

@ -18,4 +18,8 @@ object Config {
}
}
val disableStaffmodeItem = getConfig().getString("items.DISABLE_STAFFMODE")!!
val freezeWandItem = getConfig().getString("items.FREEZE_WAND")!!
val inventoryWandItem = getConfig().getString("items.INVENTORY_WAND")!!
val kbStickItem = getConfig().getString("items.KB_STICK")!!
val vanishItem = getConfig().getString("items.VANISH_ITEM")!!
}

View File

@ -5,10 +5,10 @@ import org.bukkit.inventory.ItemStack
enum class Items(val item: ItemStack) {
DISABLE_STAFFMODE(getStaffmodeItem()),
FREEZE_WAND(ItemStack(Material.STICK)),
INVENTORY_WAND(ItemStack(Material.STICK)),
KB_STICK(ItemStack(Material.STICK)),
VANISH_ITEM(ItemStack(Material.STICK)),
FREEZE_WAND(getFreezeWandItem()),
INVENTORY_WAND(getInventoryWandItem()),
KB_STICK(getKbStickItem()),
VANISH_ITEM(getVanishItem())
}
@Suppress("deprecation")
private fun getStaffmodeItem(): ItemStack {
@ -17,4 +17,36 @@ private fun getStaffmodeItem(): ItemStack {
meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.disableStaffmodeItem)))
item.itemMeta = meta
return item
}
@Suppress("deprecation")
private fun getFreezeWandItem(): ItemStack {
val item = ItemStack(Material.CHAIN)
val meta = item.itemMeta
meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.freezeWandItem)))
item.itemMeta = meta
return item
}
@Suppress("deprecation")
private fun getInventoryWandItem(): ItemStack {
val item = ItemStack(Material.BLAZE_ROD)
val meta = item.itemMeta
meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.inventoryWandItem)))
item.itemMeta = meta
return item
}
@Suppress("deprecation")
private fun getKbStickItem(): ItemStack {
val item = ItemStack(Material.STICK)
val meta = item.itemMeta
meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.kbStickItem)))
item.itemMeta = meta
return item
}
@Suppress("deprecation")
private fun getVanishItem(): ItemStack {
val item = ItemStack(Material.BARRIER)
val meta = item.itemMeta
meta.setDisplayName(Utils.color(Utils.getPlaceholders(null, Config.vanishItem)))
item.itemMeta = meta
return item
}

View File

@ -17,14 +17,6 @@ object Utils {
val inVanish = ArrayList<Player>()
@Suppress("deprecation")
fun mm(s: String): Component {
/*val pattern = Pattern.compile("#[a-fA-F0-9]{6}")
var match = pattern.matcher(s)
while (match.find()) {
val color = s.substring(match.start(), match.end())
s2 = s2.replace(color, ChatColor.of(color).toString())
match = pattern.matcher(s2)
}
return ChatColor.translateAlternateColorCodes('&', s2)*/
return MiniMessage.miniMessage().deserialize(s)
}
fun color(s: String): String {

View File

@ -1,13 +1,13 @@
# In this section of the config you can change all the messages in the plugin.
# For messages please use the minimessage formatting, see https://docs.adventure.kyori.net/minimessage/format.html#minimessage-format
must-be-player: "<red>You 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: "<red>You 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-on: "<green>Toggled staffmode on!" # Message shown when a player toggles staffmode on
toggle-staffmode-off: "<red>Toggled staffmode off!" # Message shown when a player toggles staffmode off
toggle-vanish-on: "<green>Toggled vanish on!" # Message shown when a player toggles vanish on
toggle-vanish-off: "<red>Toggled vanish off!" # Message shown when a player toggles vanish off
toggle-fly-on: "<green>Toggled fly on!" # Message shown when a player toggles fly on
toggle-fly-off: "<red>Toggled fly off!" # Message shown when a player toggles fly off
must-be-player: "<red>You must be a player to use this command!</red>" # Message shown when a player tries to use a command that requires them to be a player
no-permission: "<red>You do not have permission to use this command!</red>" # Message shown when a player tries to use a command that they don't have permission to use
toggle-staffmode-on: "<green>Toggled staffmode on!</green>" # Message shown when a player toggles staffmode on
toggle-staffmode-off: "<red>Toggled staffmode off!</red>" # Message shown when a player toggles staffmode off
toggle-vanish-on: "<green>Toggled vanish on!</green>" # Message shown when a player toggles vanish on
toggle-vanish-off: "<red>Toggled vanish off!</red>" # Message shown when a player toggles vanish off
toggle-fly-on: "<green>Toggled fly on!</green>" # Message shown when a player toggles fly on
toggle-fly-off: "<red>Toggled fly off!</red>" # Message shown when a player toggles fly off
# In this section of the config you can change the items given to you in staffmode. Please do not use colors here.
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"
@ -20,7 +20,7 @@ staffmode-hotbar: # List of items to give the player when they toggle staffmode,
7: "KB_STICK"
8: "AIR"
9: "VANISH_ITEM"
# For items, please use & color codes.
# For items, please use `&` color codes.
items:
DISABLE_STAFFMODE:
name: "&cDisable Staffmode"