Skip to content

Instantly share code, notes, and snippets.

@2called-chaos
Created May 11, 2016 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2called-chaos/f6358e9cd70ce4790f4d4c16f3259db7 to your computer and use it in GitHub Desktop.
Save 2called-chaos/f6358e9cd70ce4790f4d4c16f3259db7 to your computer and use it in GitHub Desktop.
# !cbs one https://git.io/vwjuw -378 112 616 -o green_material\=gold_block
def com_one player, args
# args is this
# ["https://git.io/vwjuw", "-378", "112", "616", "-o", "green_material\\=gold_block"]
noair, clear, pc, build, bopts = false, false, false, true, {}
opt = OptionParser.new
opt.on("-a") { noair = true }
opt.on("-c") { clear = true }
opt.on("-l") { build = false }
opt.on("-p xyz", String) {|v| pc = v }
opt.on("-o n=v", String) {|v|
c = v.split("=")
k = c.shift
bopts[k] = c.join("=")
}
args = coord_save_optparse!(opt, args)
url = args.shift
x, y, z = args.shift, args.shift, args.shift
if url
if x && y && z
com_load(player, [url]) do |p, b|
com_pos(player, [x, y, z]) do
com_pc(player, [pc]) if pc
com_air(player, ["f"]) if noair
bopts.each {|n, v| com_opt(player, [n, v]) }
com_build(player, ["clear"]) if clear
com_build(player, []) if build
end
end
else
tellm(player, {text: "Position missing, abort!", color: "red"})
end
else
tellm(player, {text: "URL missing, abort!", color: "red"})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment