You are browsing as a guest.
Login | Register
~ mcmonkey's simpler pastebin ~ Inspired by Hastebin ~ home page ~ Denizen help ~
click to use the normal pastebin instead ~ Click to make your own paste ~ click to duplicate and edit this paste


Title:
Type:
Date:
By:
Raw:
Other:
...
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
14500

Cuboid Selector Tool
Denizen Script
2019/07/27 04:39:51 UTC-07:00
Guest
Click here to view this paste as a raw text file | Or download the script
Edit of paste #56131 - click here to see edit details

# +----------------------
# |
# | C u b o i d   T o o l
# |
# | Handy tool to make notable cuboids.
# |
# +----------------------
#
# @author mcmonkey
# @date 2019/07/25
# @denizen-build DEV-988
# @script-version 1.0
#
# Installation:
# Just put the script in your scripts folder and reload.
#
# Usage:
# Type command "/ctool" to get a cuboid selector tool.
# While holding the tool, left click to start a selection and right click to expand the selection.
# Requires permission "cuboidtool.ctool"
#
# Use "/cnote [name]" to note your selected cuboid as the name. For example, "/cnote myshop" adds notable cuboid 'myshop'.
# Requires permission "cuboidtool.cnote"
#
# Use "/cshow" to show your current cuboid selection.
# Requirers permission "cuboidtool.cshow"
#
# In a script or "/ex" command, use "<player.has_flag[ctool_selection]>" to check if the player has a selection
# and "<player.flag[ctool_selection].as_cuboid>" to get the selected cuboid.
#
# ---------------------------- END HEADER ----------------------------

cuboid_tool_item:
    type: item
    debug: false
    material: blaze_rod
    display name<gold><bold>Cuboid Tool
    enchantments:
    - vanishing_curse:1
    mechanisms:
        flags: HIDE_ENCHANTS
    lore:
    - Left click to start a selection.
    - Right click to expand the selection.

ctool_command:
    type: command
    debug: false
    name: ctool
    aliases:
    - cuboidtool
    permission: cuboidtool.ctool
    description: Gets a cuboid tool.
    usage: /ctool
    script:
    - give cuboid_tool_item
    - narrate "<green>Here's your cuboid tool!"

cnote_command:
    type: command
    debug: false
    name: cnote
    aliases:
    - cuboidnote
    permission: cuboidtool.cnote
    description: Notes your selected cuboid.
    usage: /cnote [name]
    script:
    - if !<player.has_flag[ctool_selection]>:
        - narrate "<red>You don't have any cuboid selected."
        - stop
    - if <context.args.size> != 1:
        - narrate "/cnote [name]"
        - stop
    - note <player.flag[ctool_selection]> as:<context.args.get[1]>
    - inject cuboid_tool_status_task
    - narrate "<green>Cuboid <aqua><context.args.get[1]><green> noted with <[message]>."

cshow_command:
    type: command
    debug: false
    name: cshow
    aliases:
    - cuboidshow
    permission: cuboidtool.cshow
    description: Shows your selected cuboid.
    usage: /cshow
    script:
    - if !<player.has_flag[ctool_selection]>:
        - narrate "<red>You don't have any cuboid selected."
        - stop
    - inject cuboid_tool_status_task
    - narrate <[message]>

cuboid_tool_status_task:
    type: task
    debug: false
    script:
    - define cuboid <player.flag[ctool_selection]>
    - define min "<aqua><[cuboid].min.simple.replace[,].with[<gray>, <aqua>]><green>"
    - define max "<aqua><[cuboid].max.simple.replace[,].with[<gray>, <aqua>]><green>"
    - define size "<aqua><[cuboid].size.simple.replace[,].with[<gray>, <aqua>]><green>"
    - define volume <aqua><[cuboid].volume><green>
    - define message "<green>Cuboid selection: from <[min]> to <[max]> (size <[size]>, volume <[volume]>)"
    - actionbar <[message]>
    - playeffect effect:flame at:<[cuboid].shell> offset:0 targets:<player>
    - playeffect effect:barrier at:<[cuboid].outline> offset:0 targets:<player>

cuboid_tool_world:
    type: world
    debug: false
    events:
        # Basic usage logic
        on player left clicks block with cuboid_tool_item:
        - if <context.location.material.name||air> == air:
            - stop
        - flag player ctool_selection:cu@<context.location>|<context.location>
        - inject cuboid_tool_status_task
        - determine cancelled
        on player right clicks block with cuboid_tool_item:
        - if <context.location.material.name||air> == air:
            - stop
        - if <player.has_flag[ctool_selection]>:
            - flag player ctool_selection:<player.flag[ctool_selection].as_cuboid.include[<context.location>]>
        - else:
            - flag player ctool_selection:cu@<context.location>|<context.location>
        - inject cuboid_tool_status_task
        - determine cancelled
        # Prevent misuse
        on player drops cuboid_tool_item:
        - remove <context.entity>
        on player clicks in inventory with cuboid_tool_item:
        - inject locally abuse_prevention_click
        on player drags in inventory with cuboid_tool_item:
        - inject locally abuse_prevention_click
    abuse_prevention_click:
        - if <context.inventory.inventory_type> == player:
            - stop
        - if <context.inventory.inventory_type> == crafting:
            - if <context.raw_slot||<context.raw_slots.numerical.first>> >= 6:
                - stop
        - determine passively cancelled
        - inventory update