Date: 2017/05/08 11:49:49 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
RepairGem:
type: item
material: i@emerald
display name: "<&a>Repair Gem"
no_id: true
lore:
- "<&6>Used to repair your items."
ItemRepair:
type: world
events:
on player right clicks anvil:
- if <player.has_flag[repairing]> {
- determine cancelled
}
- if <player.has_flag[repair_status].not> && <player.inventory.contains[RepairGem]> {
- narrate "<&a>Do you want to use <&b>Repair Gems<&a> to fix your item?"
- narrate "<&a>Say in chat <&b>yes <&a>or <&c>no"
- flag repair_request:repair
- determine cancelled
}
- if <player.flag[repair_status]> contains 'yes' {
- if <player.inventory.contains[RepairGem].not> {
- narrate "<&a>You do not have a <&b>Repair Gem<&a> in your inventory!"
- narrate "<&a>Using regular repair mode instead."
- flag repair_status:!
} else if <player.inventory.contains[RepairGem]> {
- flag repair_status:!
- if <player.item_in_hand.repairable> {
- determine cancelled passively
- flag repairing:yes duration:4s
- narrate "<&a>Beginnning gem repair!"
- adjust <player.item_in_hand> "durability:0" save:item
- displayitem <player.item_in_hand> <context.location.add[0,1,0]> duration:4s
- take iteminhand
- take RepairGem
- wait 4s
- give <entry[item].result>
- playsound <player.location> sound:BLOCK_ANVIL_USE pitch:2
- narrate "<&a>Repair complete!"
} else {
- narrate "<&a>You need to hold a repairable item in your hand..."
}
}
}
on player chats:
- if <player.has_flag[repair_request]> && <context.message.contains[no]> {
- flag repair_status:no duration:10s
- narrate "<&a>Gem repair mode disabled, right-click anvil again to repair normally."
- determine cancelled
}
- if <player.has_flag[repair_request]> && <context.message.contains[yes]> {
- flag repair_status:yes duration:10s
- narrate "<&a>Gem repair mode enabled, right-click anvil again."
- determine cancelled
}
- if <player.has_flag[repair_request]> {
- flag repair_status:!
}