Staff Pick: Kit System
By
MwthornCreated: 2016/09/09 17:26:49 UTC-07:00 (8 years and 105 days ago)
Edited: 2016/09/09 17:28:17 UTC-07:00 (8 years and 105 days ago)
Likes: 1
Staff pick as of: 2016/09/11 02:38:22 UTC-07:00 (8 years and 103 days ago)
Denizen Version: 0.9.7 Build 1610
Script Version: 2
Description:
A kit system with a menu to show your status on your available kits.
Use "/kit" or "/kits" to open up your menu. You can also just type /kit (kit-name)" to get the kit specified.
Includes a config kit system for players to make their lives easier.
Also includes a sorting system to change the order for the items you get.
If you want to change the kits, look for the comment that says "Edit your kits below here"
Download script |
View raw scriptKitSystem_Version:
type: version
name: KitSystem
id: 108
description: A kit system with a menu and config for all players.
version: 2
KitSystem_Config:
type: yaml data
config:
permission: "essentials.kits.%kit%"
default_order:
- Sword
- Bow
- Rod
- Gaps
- Food
- Armor
- Arrow
order_items:
Sword: 'i@diamond_sword[display_name=&dSword]'
Bow: 'i@bow[display_name=&dBow]'
Rod: 'i@fishing_rod[display_name=&dRod]'
Gaps: 'i@GOLDEN_APPLE[display_name=&dGaps;lore=&7May not be included in /kit pvp]'
Food: 'i@cooked_beef[display_name=&dFood]'
Armor: 'i@iron_chestplate[display_name=&dAll Armor;lore=&7Helmet|&7Chestplate|&7Leggings|&7Boots]'
Arrow: 'i@arrow[display_name=&dArrows]'
kits:
# Edit your kits below here
PvP:
permission: essentials.kits.pvp
cooldown: 10
items:
Sword:
- i@diamond_sword
Bow:
- i@bow
Rod:
- i@fishing_rod
Gaps: []
Food:
- i@cooked_beef[quantity=16]
Armor:
- i@iron_helmet
- i@iron_chestplate
- i@iron_leggings
- i@iron_boots
Arrow:
- i@arrow[quantity=64]
Master:
permission: essentials.kits.master
cooldown: 36000
items:
Sword:
- i@diamond_sword[display_name=&aMaster;enchantments=DAMAGE_ALL,2|DURABILITY,1]
Bow:
- i@bow[display_name=&aMaster;enchantments=ARROW_DAMAGE,2|DURABILITY,1]
Rod:
- i@fishing_rod
Gaps:
- i@GOLDEN_APPLE[quantity=4]
Food:
- i@cooked_beef[quantity=16]
Armor:
- i@diamond_helmet[display_name=&aMaster;enchantments=PROTECTION_ENVIRONMENTAL,3]
- i@diamond_chestplate[display_name=&aMaster;enchantments=PROTECTION_ENVIRONMENTAL,2]
- i@diamond_leggings[display_name=&aMaster;enchantments=PROTECTION_ENVIRONMENTAL,2]
- i@diamond_boots[display_name=&aMaster;enchantments=PROTECTION_ENVIRONMENTAL,2]
Arrow:
- i@arrow[quantity=64]
Master1:
permission: essentials.kits.Master1
cooldown: 10
items:
Sword:
- i@diamond_sword
Bow:
- i@bow
Rod:
- i@fishing_rod
Gaps: []
Food:
- i@cooked_beef[quantity=16]
Armor:
- i@diamond_helmet
- i@iron_chestplate
- i@iron_leggings
- i@diamond_boots
Arrow:
- i@arrow[quantity=64]
KitSystem_Events:
type: world
debug: false
events:
# BC's data tracker.
on system time hourly:
- webget "http://stats.denizenscript.com/tracker?script=<s@KitSystem_Version.yaml_key[id]>&version=<s@KitSystem_Version.yaml_key[version]>"
on player respawns:
- if <player.has_flag[KitSystem_Status_AutoKit].not> {
- wait 10t
- if <player.is_online> {
- if <player.has_permission[essentials.kits.master1].global> {
- execute as_player "kit master1"
}
else {
- execute as_player "kit pvp"
}
}
}
on player drags in KitSystem_OrderMenu:
- determine cancelled
on player clicks in KitSystem_OrderMenu:
- determine cancelled passively
- if <context.slot_type> == "CONTAINER" {
- define order <s@KitSystem_Config.yaml_key[config.default_order]>
- if <context.slot> <= <def[order].size> {
- if <player.has_flag[KitSystem_SelectedItem]> {
- define slot1 <context.slot>
- define list <player.flag[KitSystem_sort_config]>
- define slot2 <player.flag[KitSystem_SelectedItem]>
- define new_list <def[list].set[<def[list].get[<def[slot2]>]>].at[<def[slot1]>]>
- define new_list <def[new_list].set[<def[list].get[<def[slot1]>]>].at[<def[slot2]>]>
- flag player KitSystem_sort_config:<def[new_list]>
- flag player KitSystem_SelectedItem:!
- flag server "KitSystem_Target_ConfigMenu:<player>"
- inject KitSystem_ConfigOrderPrepare
}
else {
- flag player KitSystem_SelectedItem:<context.slot>
}
}
}
on player drags in KitSystem_KitsMenu:
- determine cancelled
on player clicks in KitSystem_KitsMenu:
- determine cancelled passively
- if <context.item.display_name.strip_color.starts_with[Kit<&co>].not||true> {
- if <context.item.scriptname||null> == "KitSystem_KitConfigItem" {
- execute as_player "kitconfig"
}
- queue clear
}
- inventory close d:<context.inventory>
- define title <context.item.display_name.strip_color.after[Kit<&co><&sp>]||null>
- if <def[title]> == null {
- queue clear
}
- execute as_player "kit <def[title]>"
on player clicks KitSystem_ConfigItem1 in KitSystem_ConfigMenu:
- determine cancelled passively
- flag server "KitSystem_Target_ConfigMenu:<player>"
- inject KitSystem_ConfigOrderPrepare
on player clicks KitSystem_ConfigItem2 in KitSystem_ConfigMenu:
- determine cancelled passively
- if <player.has_Flag[KitSystem_Status_AutoKit]> {
- flag player KitSystem_Status_AutoKit:!
}
else {
- flag player KitSystem_Status_AutoKit
}
- flag server "KitSystem_Target_ConfigMenu:<player>"
- inventory open d:in@KitSystem_ConfigMenu
on player clicks KitSystem_ConfigItem3 in KitSystem_ConfigMenu:
- determine cancelled passively
- if <player.has_Flag[KitSystem_Status_AutoArmor]> {
- flag player KitSystem_Status_AutoArmor:!
}
else {
- flag player KitSystem_Status_AutoArmor
}
- flag server "KitSystem_Target_ConfigMenu:<player>"
- inventory open d:in@KitSystem_ConfigMenu
KitSystem_Command:
type: command
name: kit
description: Kit command to your kits
debug: false
usage: /kit
aliases:
- kits
script:
- if <context.args.size> >= 1 {
- define kit <context.args.get[1]||pvp>
- if <s@KitSystem_Config.list_keys[config.kits].contains[<def[kit]>]||false> {
- define permission <s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.permission]>
- if <player.has_permission[<def[permission]>].global.not||true> {
- narrate "<&c>No acccess to that kit!"
- queue clear
}
- define cd_flag KitSystem_Cooldown_<def[kit]>
- if <player.has_flag[<def[cd_flag]>]||true> {
- narrate "<&7>The kit <&c><def[kit]> <&7>can be taken at <&c><player.flag[<def[cd_flag]>].expiration.formatted>"
- queue clear
}
- narrate "<&3>Giving kit<&co> <&6><&l><def[kit]>"
- if <player.has_flag[KitSystem_Notify_Cooldown].not> {
- flag player KitSystem_Notify_Cooldown duration:30m
- narrate "<&a>/kitconfig <&3>to change the order of your kit!"
}
- define itemtypes <s@KitSystem_Config.list_keys[config.kits.<def[kit]>.items]||i@dirt>
- define cooldown <s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.cooldown]||10>
- if <player.has_flag[KitSystem_sort_config].not> {
- define order <s@KitSystem_Config.yaml_key[config.default_order]>
- flag player "KitSystem_sort_config:<def[order]>"
}
- foreach <player.flag[KitSystem_sort_config]> {
- define items <s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.items.<def[value]>]>
- if <def[items].is_empty.not> {
- if <def[value]> == "Armor" {
- if <player.has_flag[KitSystem_Status_AutoArmor].not> {
- if <player.equipment> == "li@i@air|i@air|i@air|i@air" {
- adjust <player> equipment:<s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.items.<def[value]>].parse_color.as_list.reverse>
}
else {
- give <s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.items.<def[value]>].parse_color>
}
}
else {
- give <s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.items.<def[value]>].parse_color>
}
}
else {
- give <s@KitSystem_Config.yaml_key[config.kits.<def[kit]>.items.<def[value]>].parse_color>
}
}
}
- if <player.is_op.not> {
- flag player "<def[cd_flag]>" "duration:<def[cooldown]>s"
}
- queue clear
}
else {
- narrate "<&c>That kit does not exist..."
}
}
else {
- flag server "KitSystem_Target_KitsMenu:<player>"
- inventory open d:in@KitSystem_KitsMenu
}
KitSystem_KitsMenu:
type: inventory
debug: false
inventory: CHEST
title: <&8>Kits Menu
size: 27
definitions:
Item1: <proc[KitSystem_KitsMenu_Proc].context[1|PvP]>[display_name=<proc[KitSystem_KitsMenu_Proc].context[2|PvP]>;lore=<proc[KitSystem_KitsMenu_Proc].context[3|PvP]>]
Item2: <proc[KitSystem_KitsMenu_Proc].context[1|Master]>[display_name=<proc[KitSystem_KitsMenu_Proc].context[2|Master]>;lore=<proc[KitSystem_KitsMenu_Proc].context[3|Master]>]
Item3: <proc[KitSystem_KitsMenu_Proc].context[1|Master1]>[display_name=<proc[KitSystem_KitsMenu_Proc].context[2|Master1]>;lore=<proc[KitSystem_KitsMenu_Proc].context[3|Master1]>]
Config: KitSystem_KitConfigItem
P: STAINED_GLASS_PANE,7
slots:
- "[Config] [P] [P] [item1] [item2] [item3] [P] [P] [Config]"
KitSystem_KitsMenu_Proc:
type: procedure
debug: false
definitions: line|item
script:
- define target <server.flag[KitSystem_Target_KitsMenu]>
- define permission <s@KitSystem_Config.yaml_key[config.kits.<def[item]>.permission]>
- define access <def[target].has_permission[<def[permission]>]>
- choose "<def[line]>":
- case "1":
- define cd_flag KitSystem_Cooldown_<def[item]>
- if <def[access]> {
- if <def[target].has_flag[<def[cd_flag]>]> {
- determine "STAINED_GLASS_PANE,4"
}
else {
- determine "STAINED_GLASS_PANE,5"
}
}
else {
- determine "STAINED_GLASS_PANE,14"
}
- case "2":
- determine "<&6><&l>Kit<&co> <def[item]>"
- case "3":
- define cd_flag KitSystem_Cooldown_<def[item]>
- if <def[access]> {
- if <def[target].has_flag[<def[cd_flag]>]> {
- determine "<&e>Can be taken in <&b><def[target].flag[<def[cd_flag]>].expiration.formatted>"
}
else {
- determine "<&a>Ready!"
}
}
else {
- determine "<&c>No Access!"
}
- default:
- determine "Chosen default in <def[item]>"
KitSystem_KitConfigItem:
type: item
debug: false
material: ENDER_CHEST
display name: <&d>KitConfig
lore:
- <&9>Order, automatic kits, etc.
KitSystem_ConfigCommand:
type: command
name: kitconfig
description: Kit command for your kits
debug: false
usage: /kitconfig
script:
- flag server "KitSystem_Target_ConfigMenu:<player>"
- inventory open d:in@KitSystem_ConfigMenu
KitSystem_ConfigOrderPrepare:
type: task
script:
- if <player.has_flag[KitSystem_sort_config].not> {
- define order <s@KitSystem_Config.yaml_key[config.default_order]>
- flag player "KitSystem_sort_config:<def[order]>"
}
- inventory open d:in@KitSystem_OrderMenu
KitSystem_ConfigMenu:
type: inventory
debug: false
inventory: CHEST
title: <&6>Kit Config
size: 9
definitions:
Item1: i@KitSystem_ConfigItem1
Item2: i@KitSystem_ConfigItem2
Item3: i@KitSystem_ConfigItem3
P: STAINED_GLASS_PANE,7
slots:
- "[] [] [Item1] [] [Item2] [] [Item3] [] []"
KitSystem_ConfigItem1:
type: item
material: CHEST
display name: <&d>Kit Order
lore:
- <&3>Here you can change the order
- <&3>when you get your kit.
KitSystem_ConfigItem2:
type: item
debug: false
material: IRON_SWORD
display name: <&d>Auto-Kit
lore:
- <&9>Status<&co> <proc[KitSystem_ConfigMenu_Proc].context[AutoKit]>
- <&3>When you respawn, your kit
- <&3>will be automatic given
- <&3>if not on cooldown.
KitSystem_ConfigItem3:
type: item
debug: false
material: Iron_Chestplate
display name: <&d>Auto-Armor
lore:
- <&9>Status<&co> <proc[KitSystem_ConfigMenu_Proc].context[AutoArmor]>
- <&3>Your armor is equipped instead
- <&3>of being filled in your inventory.
- <&3>This only happens when you take your kit.
KitSystem_ConfigMenu_Proc:
type: procedure
debug: false
definitions: item
script:
- define target <server.flag[KitSystem_Target_ConfigMenu]>
- define status_flag KitSystem_Status_<def[item]>
- if <def[target].has_flag[<def[status_flag]>]> {
- determine "<&c>Turned Off"
}
else {
- determine "<&a>Turned On"
}
KitSystem_OrderMenu:
type: inventory
debug: false
inventory: CHEST
title: <&8>Click on 2 items to swap.
size: 9
definitions:
Item1: <proc[KitSystem_OrderMenu_Proc].context[1]>
Item2: <proc[KitSystem_OrderMenu_Proc].context[2]>
Item3: <proc[KitSystem_OrderMenu_Proc].context[3]>
Item4: <proc[KitSystem_OrderMenu_Proc].context[4]>
Item5: <proc[KitSystem_OrderMenu_Proc].context[5]>
Item6: <proc[KitSystem_OrderMenu_Proc].context[6]>
Item7: <proc[KitSystem_OrderMenu_Proc].context[7]>
Item8: <proc[KitSystem_OrderMenu_Proc].context[8]>
Item9: <proc[KitSystem_OrderMenu_Proc].context[9]>
slots:
- "[Item1] [Item2] [Item3] [Item4] [Item5] [Item6] [Item7] [Item8] [Item9]"
KitSystem_OrderMenu_Proc:
type: procedure
debug: false
definitions: item
script:
- define target <server.flag[KitSystem_Target_ConfigMenu]>
- define item <def[target].flag[KitSystem_sort_config].after[li@].split[|].get[<def[item]>]||null>
- determine <s@KitSystem_Config.yaml_key[config.order_items.<def[item]>].parse_color||i@air>
View History