Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- prefix: &f[&2Tycoon&f] &8>>
- version: 1.0
- command /tycoon [<text>] [<text>]:
- trigger:
- if player has permission "Tycoon.*":
- if arg 1 is "help":
- send "&f--------------[&2Tycoon&f]--------------"
- send "&a/Tycoon help &8>> &2Krijg de help pagina"
- send "&a/Tycoon shop create &8>> &2Maak een shop"
- send "&a/Tycoon shop &8>> &2Ga naar het shop gui"
- send "&a/Tycoon shop remove &8>> &2Verwijder de shop"
- send "&f--------------[&2Tycoon&f]--------------"
- if arg 1 is "shop":
- if arg 2 is "create":
- send "{@prefix} &2Succesvol een shop item gegeven."
- give player a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon"
- #send "{@prefix} &aSuccesvol de shop gemaakt!"
- #spawn Llama at player
- #set {_Llama} to last spawned Llama
- #set name of last spawned Llama to "&6Tycoon shop"
- #add "{Age:1,NoAI:1,Silent:1b,Invulnerable:1}" to nbt tag of {_Llama}
- else if arg 2 is set:
- send "{@prefix} &4Dit command is niet goed uitgevoerd, doe &c/tycoon stop create&4."
- else:
- send "{@prefix} &4Doe &c/tycoon help &4voor meer info."
- else if arg 1 is "help":
- send "&f--------------[&2Tycoon&f]--------------"
- send "&a/Tycoon help &8>> &2Krijg de help pagina"
- send "&a/Tycoon shop &8>> &2Ga naar het shop gui"
- send "&f--------------[&2Tycoon&f]--------------"
- else if arg 1 is "shop":
- send "{@prefix} &2Shop geoopent."
- on rightclick on a villager:
- wait 1 tick
- set {_world} to world of clicked entity
- set {_locX} to x-coordinate of clicked entity
- set {_locY} to y-coordinate of clicked entity
- set {_locZ} to z-coordinate of clicked entity
- open chest with 1 rows named "&6Tycoon Shop" to player
- make gui slot 0 of player with redstone dust named "&6Machine Shop" to close then run function openShop(player, "machines")
- make gui slot 8 of player with barrier named "&4Delete Shop" to run function removeShop(player, clicked entity, "%{_locX}%", "%{_locY}%", "%{_locZ}%", "%{_world}%")
- on rightclick:
- if player is holding a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon":
- set {_locX} to x-coordinate of targeted block
- set {_locY} to y-coordinate of targeted block+0.5
- set {_locZ} to z-coordinate of targeted block
- set {_block} to location of targeted block
- loop blocks in radius 5 around player:
- if location of loop-block is {_block}:
- send "{@prefix} &2Succesvol de shop gemaakt!"
- set {_gm} to gamemode of player
- if gamemode of player is not creative:
- remove 1 of tool from tool
- spawn villager at location {_locX}, {_locY}, {_locZ}
- set {_villager} to last spawned villager
- set name of last spawned villager to "&6Tycoon shop"
- add "{Profession:5,Age:1,NoAI:1,Silent:1b,Invulnerable:1}" to nbt tag of {_villager}
- add "%world of player% - %{_locX}%, %{_locY}%, %{_locZ}%" to {Tycoon::shopLocations::*}
- on death of villager:
- if attacker is a player:
- if name of villager is "&6Tycoon shop":
- set {_locX} to x-coordinate of victim
- set {_locY} to y-coordinate of victim
- set {_locZ} to z-coordinate of victim
- if {Tycoon::shopLocations::*} doesn't contain "%world of victim% - %{_locX}%, %{_locY}%, %{_locZ}%":
- stop
- else:
- remove "%world of victim% - %{_locX}%, %{_locY}%, %{_locZ}%" from {Tycoon::shopLocations::*}
- send "{@prefix} &2Succesvol de shop verwijderd!" to attacker
- play "block_wood_hit" to attacker at volume 10
- set {_item} to false
- loop items in attacker's inventory:
- if loop-item is a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon":
- set {_item} to true
- stop loop
- else:
- set {_item} to false
- if {_item} is false:
- give attacker a book named "&6Create Shop" with lore "&5Klik om een shop te maken - Tycoon"
- every 1 tick:
- loop all players:
- if loop-player is holding a paper named "&6Dirt machine" with lore "&5Tycoon Machine":
- set {_block} to location of targeted block of loop-player
- loop blocks in radius 5 around loop-player:
- if location of loop-block is {_block}:
- set {_dir} to the facing of loop-player
- set {_world} to world of loop-player
- set {_x} to x-coordinate of targeted block of loop-player
- set {_y} to y-coordinate of targeted block of loop-player + 1
- set {_z} to z-coordinate of targeted block of loop-player
- set {_y2} to y-coordinate of targeted block of loop-player
- set {tycoon::scematicDrawn::%loop-player%} to true
- if {tycoon::targetedBlock::%loop-player%} is "%{_x}%, %{_y2}%, %{_z}%, %{_world}%":
- stop loop
- if {tycoon::targetedBlock::%loop-player%} is "%{_x}%, %{_y}%, %{_z}%, %{_world}%":
- stop loop
- if {tycoon::scematic::%loop-player%} is "dirt_machine":
- removeScematic(loop-player, "dirt_machine", "%{tycoon::scematic::%loop-player%::x}%", "%{tycoon::scematic::%loop-player%::y}%", "%{tycoon::scematic::%loop-player%::z}%", {tycoon::scematic::%loop-player%::dir})
- set {tycoon::targetedBlock::%loop-player%} to "%{_x}%, %{_y}%, %{_z}%, %{_world}%"
- set {tycoon::scematic::%loop-player%::x} to "%{_x}%"
- set {tycoon::scematic::%loop-player%::y} to "%{_y}%"
- set {tycoon::scematic::%loop-player%::z} to "%{_z}%"
- set {tycoon::scematic::%loop-player%::dir} to {_dir}
- set {tycoon::scematic::%loop-player%} to "dirt_machine"
- drawScematic(loop-player, "dirt_machine", "%{_x}%", "%{_y}%", "%{_z}%", {_dir})
- else:
- if {tycoon::targetedBlock::%loop-player%} is set:
- if {tycoon::scematic::%loop-player%} is "dirt_machine":
- removeScematic(loop-player, "dirt_machine", "%{tycoon::scematic::%loop-player%::x}%", "%{tycoon::scematic::%loop-player%::y}%", "%{tycoon::scematic::%loop-player%::z}%", {tycoon::scematic::%loop-player%::dir})
- delete {tycoon::scematic::%loop-player%}
- delete {tycoon::targetedBlock::%loop-player%}
- function drawScematic(p: Player, t: String, x: String, y: String, z: String, direction: Direction):
- if {_t} is "dirt_machine":
- set {_world} to world of {_p}
- set {_opposite} to getOppositeDirection({_direction})
- #fill("%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", addNumber({_x} parsed as a number, {_y} parsed as a number, {_z} parsed as a number, {_world}, {_opposite}, 6.0), "%{_world}%", "scematic_dirt_machine", {_p})
- clear {scematic::block::%{_p}%::types::*}
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "0", "2", "-2", "0", "2")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "0", "12", "-2", "0", "12")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "0", "3", "2", "0", "11")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "-2", "0", "3", "-2", "0", "11")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "5", "2", "-2", "5", "2")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "5", "12", "-2", "5", "12")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "5", "3", "2", "5", "11")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "-2", "5", "3", "-2", "5", "11")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "1", "2", "2", "4", "2")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "-2", "1", "2", "-2", "4", "2")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "2", "1", "12", "2", "4", "12")
- fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", "-2", "1", "12", "-2", "4", "12")
- #fillDir({_p}, "scematic_dirt_machine", "%{_world}%", {_opposite}, "%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", 0, 0, 1, -2, 0, -2)
- function removeScematic(p: player, t: String, x: String, y: String, z: String, direction: Direction):
- if {_t} is "dirt_machine":
- set {_world} to world of {_p}
- set {_opposite} to getOppositeDirection({_direction})
- remove("%{_x} parsed as a number%", "%{_y} parsed as a number%", "%{_z} parsed as a number%", addNumber({_x} parsed as a number, {_y} parsed as a number, {_z} parsed as a number, {_world}, {_opposite}, 6.0), "%{_world}%", "scematic_dirt_machine", {_p})
- #BEzig met alle scematics fixen
- #Directions etc.
- #Make all strings!
- function fillDir(p: player, block: String, world: String, d: direction, x: String, y: String, z: String, xa: String, ya: String, za: String, xa2: String, ya2: String, za2: String):
- #clear {scematic::block::%{_p}%::types::*}
- set {_x1} to {_x} parsed as a number
- set {_y1} to {_y} parsed as a number
- set {_z1} to {_z} parsed as a number
- if {_d} is north OR south:
- if firstChar({_za}) is "-":
- replace all "-" in {_za} with ""
- else:
- set {_za} to "-%{_za}%"
- if firstChar({_xa}) is "-":
- replace all "-" in {_xa} with ""
- else:
- set {_xa} to "-%{_xa}%"
- if firstChar("%{_za2}%") is "-":
- send "&6%{_za2}%" to {_p}
- replace all "-" in {_za2} with ""
- else:
- set {_za2} to "-%{_za2}%"
- if firstChar({_xa2}) is "-":
- replace all "-" in {_xa2} with ""
- else:
- set {_xa2} to "-%{_xa2}%"
- set {_loc1} to location addDir({_d}, {_xa}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_za}, {_z1}) of world "%{_world}%"
- set {_loc2} to location addDir({_d}, {_xa2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_za2}, {_z1}) of world "%{_world}%"
- else:
- if firstChar({_za}) is "-":
- replace all "-" in {_za} with ""
- else:
- set {_za} to "-%{_za}%"
- if firstChar({_xa}) is "-":
- replace all "-" in {_xa} with ""
- else:
- set {_xa} to "-%{_xa}%"
- #set {_za} to {_za} parsed as a number
- #set {_xa} to {_xa} parsed as a number
- if firstChar({_za2}) is "-":
- replace all "-" in {_za2} with ""
- else:
- set {_za2} to "-%{_za2}%"
- if firstChar({_xa2}) is "-":
- replace all "-" in {_xa2} with ""
- else:
- set {_xa2} to "-%{_xa2}%"
- set {_loc1} to location addDir({_d}, {_za}, {_x1}), addDir({_d}, {_ya}, {_y1}), addDir({_d}, {_xa}, {_z1}) of world "%{_world}%"
- set {_loc2} to location addDir({_d}, {_za2}, {_x1}), addDir({_d}, {_ya2}, {_y1}), addDir({_d}, {_xa2}, {_z1}) of world "%{_world}%"
- loop blocks between block at {_loc1} and block at {_loc2}:
- add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
- if loop-block is air:
- set block at location of loop-block to green glass block
- else:
- set block at location of loop-block to red glass block
- function addDir(final: direction, rem: string, n: number) :: number:
- if firstChar({_rem}) is "-":
- replace all "-" in {_rem} with ""
- set {_rem} to {_rem} parsed as a number
- if {_final} is north:
- remove {_rem} from {_n}
- if {_final} is east:
- add {_rem} to {_n}
- if {_final} is south:
- add {_rem} to {_n}
- if {_final} is west:
- remove {_rem} from {_n}
- else:
- set {_rem} to {_rem} parsed as a number
- if {_final} is north:
- add {_rem} to {_n}
- if {_final} is east:
- remove {_rem} from {_n}
- if {_final} is south:
- remove {_rem} from {_n}
- if {_final} is west:
- add {_rem} to {_n}
- return {_n}
- function firstChar(s: String) :: String:
- add {_s} to {_s::*}
- loop {_s::*}:
- set {_fc} to first character of loop-value
- if {_fc} is "-":
- return {_fc}
- else:
- return "<none>"
- #send ({_fc} parsed as a string) to console
- set {_fc} to {_fc} parsed as a String
- return {_fc}
- function fill(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
- set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
- if {_block} is "scematic_dirt_machine":
- clear {scematic::block::%{_p}%::types::*}
- loop blocks between block at {_loc1} and block at {_loc2}:
- add "%location of loop-block%$%loop-block%" to {scematic::block::%{_p}%::types::*}
- if loop-block is air:
- set block at location of loop-block to green glass block
- else:
- set block at location of loop-block to red glass block
- function getDirectionalBlock(i: item, d: direction) :: item:
- set {_block::north} to 1
- set {_block::south} to 3
- set {_block::west} to 4
- set {_block::east} to 5
- return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
- function getOppositeDirection(direction: direction) :: direction:
- loop split "%{_direction}%" by "and":
- if {_dir} is not set:
- set {_dir} to numbersIn(loop-value)
- set {_final} to loop-value
- else if numbersIn(loop-value) > {_dir}:
- set {_dir} to numbersIn(loop-value)
- set {_final} to loop-value
- if {_final} contains "north":
- return north
- if {_final} contains "east":
- return east
- if {_final} contains "south":
- return south
- if {_final} contains "west":
- return west
- function getUpStairDirection(i: item, d: direction, j: number) :: item:
- set {_block::north} to 3
- set {_block::south} to 2
- set {_block::west} to 1
- set {_block::east} to 8
- set {_rblock} to {_block::%{_d}%}
- return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
- function getDownStairDirection(i: item, d: direction, j: number) :: item:
- set {_block::north} to 7
- set {_block::south} to 6
- set {_block::west} to 5
- set {_block::east} to 4
- set {_rblock} to {_block::%{_d}%}
- return "%{_i}%:%{_block::%{_d}%}%" parsed as an item
- function getOppositeDirection(direction: direction) :: direction:
- loop split "%{_direction}%" by "and":
- if {_dir} is not set:
- set {_dir} to numbersIn(loop-value)
- set {_final} to loop-value
- else if numbersIn(loop-value) > {_dir}:
- set {_dir} to numbersIn(loop-value)
- set {_final} to loop-value
- if {_final} contains "north":
- return north
- if {_final} contains "east":
- return east
- if {_final} contains "south":
- return south
- if {_final} contains "west":
- return west
- function numbersIn(s: String) :: number:
- set {_return} to ""
- loop {_s} split at "":
- set {_num} to loop-value parsed as a number
- if {_num} is set:
- "%{_num}%" = "%loop-value%"
- set {_return} to "%{_return}%%{_num}%"
- return {_return} parsed as a number
- function addNumber(x: number, y: number, z: number, w: world, dir: direction, num: number) :: location:
- if {_dir} is north:
- remove {_num} from {_z}
- if {_dir} is east:
- add {_num} to {_x}
- if {_dir} is south:
- add {_num} to {_z}
- if {_dir} is west:
- remove {_num} from {_x}
- set {_return} to location {_x}, {_y}, {_z} of world "%{_w}%"
- return {_return}
- function remove(x: String, y: String, z: String, loc2: location, world: String, block: String, p: player):
- set {_loc1} to location ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) of world "%{_world}%"
- if {_block} is "scematic_dirt_machine":
- loop {scematic::block::%{_p}%::types::*}:
- set {_list} to loop-value
- set {_list::*} to {_list} split at "$"
- set {_loc} to {_list::1}
- set {_type} to {_list::2}
- set {_loc::*} to {_loc} split at ","
- set {_x} to {_loc::1}
- set {_y} to {_loc::2}
- set {_z} to {_loc::3}
- replace "x: " in {_x} with ""
- replace " y: " in {_y} with ""
- replace " z: " in {_z} with ""
- set block at location at ({_x} parsed as a number), ({_y} parsed as a number), ({_z} parsed as a number) in world "%{_world}%" to ({_type} parsed as an item)
- function removeShop(p: Player, e: Entity, x: String, y: String, z: String, w: String):
- if {Tycoon::shopLocations::*} doesn't contain "%{_w}% - %{_x}%, %{_y}%, %{_z}%":
- send "Cancelled" to {_p}
- stop
- else:
- loop all villagers in radius 6 around {_p}:
- if "%location of loop-entity%" is "x: %{_x}%, y: %{_y}%, z: %{_z}%":
- set health of loop-entity to 0
- play "block_wood_hit" to {_p} at volume 10
- close {_p}'s inventory
- remove "%{_w}% - %{_x}%, %{_y}%, %{_z}%" from {Tycoon::shopLocations::*}
- function getItem(p: Player, i: string):
- if {_i} contains "_machine":
- replace "_machine" with " Machine" in {_i}
- add {_i} to {_i::*}
- loop {_i::*}:
- set {_i1} to first character of loop-value
- set {_i2} to last (length of loop-value - 1) characters of loop-value
- set {_i} to "%{_i1} to upper case%%{_i2} to lower case%"
- set {_item} to paper named "&6%{_i}%" with lore "&5Tycoon Machine"
- send "{@prefix} &a%{_i}% &2gekocht!" to {_p}
- give {_p} {_item}
- function openShop(p: Player, page: String):
- if {_page} is "machines":
- open chest with 3 rows named "&6Shop - Machines" to {_p}
- make gui slot 22 of {_p} with a barrier named "&4Sluit menu" to close
- make gui slot 0 of {_p} with dirt named "&6Dirt Machine" to close then run function getItem({_p}, "dirt_machine")
Add Comment
Please, Sign In to add comment