Untitled

 avatar
unknown
plain_text
2 years ago
13 kB
2
Indexable
# Skyblock Management Commands:

import:
  java.io.File
  com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats
  com.sk89q.worldedit.bukkit.BukkitAdapter

effect paste [:(revertable)] schematic %string% at %locations% [:(including air)]:
  parse:
    set {_include air} to true if parse tags contains "including air" otherwise false
    set {_revertable} to true if parse tags contains "revertable" otherwise false
    continue
  trigger:
    set {_file} to new File(expr-1)
    set {_schematic} to ClipboardFormats.findByFile({_file}).load({_file})
    loop exprs-2:
      {_schematic}.paste(BukkitAdapter.adapt(loop-value.getWorld()), BukkitAdapter.asBlockVector(loop-value), {_revertable}, {_include air}, null)

#! CREATE OFFSETS !#
# This just creates our offset vars
on load:
	# offset is 2, change to your liking
	set {-dir::1} to vector(10,0,0)
	set {-dir::2} to vector(0,0,-10)
	set {-dir::3} to vector(-10,0,0)
	set {-dir::4} to vector(0,0,10)

on load:
	if {-spiral::nbt} is not set:
		set {-spiral::nbt} to nbt compound from "{}"
		set int tag "gap" of {-spiral::nbt} to 0
		set int tag "pos" of {-spiral::nbt} to 0
		set byte tag "vec" of {-spiral::nbt} to 1
		# Change this location to where you want your spiral to start
		set compound tag "lastLoc" of {-spiral::nbt} to saveLoc(location(0,100,0, world "world"))

#! GET LOC FROM NBT FUNCTION !#
# this just gets a location from NBT you wont need to worry about this
function getLoc(n: nbt compound) :: location:
	set {_x} to tag "x" of {_n}
	set {_y} to tag "y" of {_n}
	set {_z} to tag "z" of {_n}
	set {_ws} to tag "world" of {_n}
	set {_w} to world({_ws})
	set {_l} to location({_x}, {_y}, {_z}, {_w})
	return {_l}
    

#! SAVE LOC TO NBT FUNCTION !#
# this just saves a location into NBT format, you wont need to worry about this
function saveLoc(l: location) :: nbt compound:
	set {_n} to nbt compound from "{}"
	set int tag "x" of {_n} to x coord of {_l}
	set int tag "y" of {_n} to y coord of {_l}
	set int tag "z" of {_n} to z coord of {_l}
	set {_w} to "skyblock"
	set tag "world" of {_n} to {_w}
	return {_n}

#! MAIN SPIRAL FUNCTION !#
# this gets the next location in your spiral
# this is the key ingredient you are going to want to use
function getNext() :: location:
	set {_lastLoc} to compound tag "lastLoc" of {-spiral::nbt}
	set {_loc} to getLoc({_lastLoc})
	set {_gape} to tag "gape" of {-spiral::nbt}
	set {_pos} to tag "pos" of {-spiral::nbt}
	set {_vec} to tag "vec" of {-spiral::nbt}
	set {_loc} to {_loc} ~ {-dir::%{_vec}%}
	add 1 to {_pos}
	if {_pos} >= {_gape}:
		set {_pos} to 0
		add 1 to {_vec}
		if {_vec} = 2 or 4:
			add 1 to {_gape}
	if {_vec} > 4:
		set {_vec} to 1
	set int tag "gape" of {-spiral::nbt} to {_gape}
	set int tag "pos" of {-spiral::nbt} to {_pos}
	set byte tag "vec" of {-spiral::nbt} to {_vec}
	set compound tag "lastLoc" of {-spiral::nbt} to saveLoc({_loc})
	return {_loc}

function createIsland(istype: text, p: player, isname: text):
    set {_p} to {islandOwner::%{island::%uuid of {_p}%}%}
    add {_p} to {islandMembers::%{island::%uuid of {_p}%}%}
    set {hasIsland::%uuid of {_p}%} to true
    set {islandName::%uuid of {_p}%} to {_isname}
    set {_loc} to getNext()
    paste schematic "/home/Synthplex/plugins/FastAsyncWorldEdit/schematics/%{_istype}%.schem" at {_loc}
    wait 1 ticks
    send "test" to {_p}

command /resetvariables:
    permission: op
    trigger:
        set {hasIsland::%uuid of player%} to false

command /newisland [<text>]:
    aliases: nisland, newis
    trigger:
        if {hasIsland::%uuid of player%} is false:
            if arg-1 is set:
                set metadata tag "newIslandMenu" of player to chest inventory with 3 rows named "&8&l&k|a| &c&lChoose your island! &8&l&k|a|"
                set slot 0 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 1 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 2 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 3 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 4 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 5 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 6 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 7 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 8 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 9 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 10 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 11 of metadata tag "newIslandMenu" of player to grass block named "&a&lOriginal Island"
                set slot 12 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 13 of metadata tag "newIslandMenu" of player to sand named "&e&lDesert Island"
                set slot 14 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 15 of metadata tag "newIslandMenu" of player to jungle log named "&2&lJungle Island"
                set slot 16 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 17 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 18 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 19 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 20 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 21 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 22 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 23 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 24 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                set slot 25 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
                set slot 26 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
                open (metadata tag "newIslandMenu" of player) to player
                set {islandName::%uuid of player%} to arg-1
            else:
                send "You need to specify a name for your island!"
        else:
            send "You already have an island!"

on inventory click:
    if event-inventory = (metadata tag "newIslandMenu" of player):
        cancel event
        if index of event-slot is 11:
            createIsland("original", player, {islandName::%uuid of player%})
        else if index of event-slot is 13:
            createIsland("desert", player, {islandName::%uuid of player%})
        else if index of event-slot is 15:
            createIsland("jungle", player, {islandName::%uuid of player%})

command /replaceisland [<text>]:
    trigger:
        if arg-1 is not set:
            set metadata tag "newIslandMenu" of player to chest inventory with 3 rows named "&8&l&k|a| &c&lChoose your island! &8&l&k|a|"
            set slot 0 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 1 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 2 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 3 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 4 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 5 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 6 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 7 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 8 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 9 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 10 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 11 of metadata tag "newIslandMenu" of player to grass block named "&a&lOriginal Island"
            set slot 12 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 13 of metadata tag "newIslandMenu" of player to sand named "&e&lDesert Island"
            set slot 14 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 15 of metadata tag "newIslandMenu" of player to jungle log named "&2&lJungle Island"
            set slot 16 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 17 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 18 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 19 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 20 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 21 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 22 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 23 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 24 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            set slot 25 of metadata tag "newIslandMenu" of player to gray stained glass pane named " "
            set slot 26 of metadata tag "newIslandMenu" of player to black stained glass pane named " "
            open (metadata tag "newIslandMenu" of player) to player
        else if arg-1 is set:
            if arg-1 is "confirm":
                if {replaceIsland::%uuid of player%} is "original":
                    execute console command "mv delete original_%{uuid of player}%"
                    wait 2 ticks
                    execute console command "mv confirm"
                    wait 2 ticks
                    execute console command "mv clone original %{uuid of player}%"
                    teleport player to location(0, 100, 0, world "original_%{uuid of player}%")
                    send "Your island has been replaced with the original island!"
                else if {replaceIsland::%uuid of player%} is "desert":
                    execute console command "mv delete desert_%{uuid of player}%"
                    wait 2 ticks
                    execute console command "mv confirm"
                    wait 2 ticks
                    execute console command "mv clone desert %{uuid of player}%"
                    teleport player to location(0, 100, 0, world "desert_%{uuid of player}%")
                    send "Your island has been replaced with the desert island!"
                else if {replaceIsland::%uuid of player%} is "jungle":
                    execute console command "mv delete jungle_%{uuid of player}%"
                    wait 2 ticks
                    execute console command "mv confirm"
                    wait 2 ticks
                    execute console command "mv clone jungle %{uuid of player}%"
                    teleport player to location(0, 100, 0, world "jungle_%{uuid of player}%")
                    send "Your island has been replaced with the jungle island!"
                else:
                    send "You need to choose an island first!"
            else:
                send "This command does not need any arguments."

on inventory click:
    if event-inventory = (metadata tag "vanillaGUI" of player):
        cancel event
        if index of event-slot is 11:
            send "Type /replaceisland confirm to replace your island with the original island."
            set {replaceIsland::%uuid of player%} to "original"
        else if index of event-slot is 13:
            send "Type /replaceisland confirm to replace your island with the desert island."
            set {replaceIsland::%uuid of player%} to "desert"
        else if index of event-slot is 15:
            send "Type /replaceisland confirm to replace your island with the jungle island."
            set {replaceIsland::%uuid of player%} to "jungle"

command /coop [<text>] [<player>]:
    trigger:
        send "wip"
Editor is loading...