Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let item: Item = WOODEN_PICKAXE
- let numbe: Number = 0
- let position1: Position
- let position2: Position
- let pos1place = true
- let pos2place = true
- let copy1: Position
- let copy2: Position
- function filler(num1:Position,num2:Position,blocktype:string) {
- blocks.fill(blocks.blockByName(blocktype), num1, num2, FillOperation.Replace)
- }
- function replace(num1:Position,num2:Position,blocktype1:string,blocktype2:string) {
- blocks.replace(blocks.blockByName(blocktype2), blocks.blockByName(blocktype1), num1, num2)
- }
- function filler2(num1:Position,num2:Position,blocktype:Block) {
- blocks.fill(blocktype, num1, num2, FillOperation.Replace)
- }
- function copypaste(num1:Position,num2:Position) {
- blocks.clone(num1, num2, player.position().add(pos(0,-1,0)), CloneMask.Replace, CloneMode.Normal)
- }
- function volumer() {
- let x1 = position1.getValue(Axis.X)
- let y1 = position1.getValue(Axis.Y)
- let z1 = position1.getValue(Axis.Z)
- let x2 = position2.getValue(Axis.X)
- let y2 = position2.getValue(Axis.Y)
- let z2 = position2.getValue(Axis.Z)
- let x = (x1-x2)+1
- let y = (y1-y2)+1
- let z = (z1-z2)+1
- let volume = (x*z)*y
- if (volume < 0) {
- volume = volume * -1
- }
- return (volume)
- }
- player.onItemInteracted(item, function () {
- if (numbe == 0) {
- numbe = 1
- if (position1 != null) {
- if (pos1place == true) {
- filler(position1,position1,"AIR")
- } else {
- pos1place = true
- }
- position1 = player.position().add(pos(0,-1,0))
- filler2(position1,position1,BLUE_STAINED_GLASS)
- player.say("§9§lPosition 1 set: §f("+position1+")")
- } else {
- position1 = player.position().add(pos(0,-1,0))
- filler2(position1,position1,BLUE_STAINED_GLASS)
- player.say("§9§lPosition 1 set: §f("+position1+")")
- }
- } else {
- numbe = 0
- if (position2 != null) {
- if (pos2place == true) {
- filler(position2,position2,"AIR")
- } else {
- pos2place = true
- }
- position2 = player.position().add(pos(0,-1,0))
- filler2(position2,position2,MAGENTA_STAINED_GLASS)
- player.say("§9§lPosition 2 set: §f("+position2+")")
- } else {
- position2 = player.position().add(pos(0,-1,0))
- filler2(position2,position2,MAGENTA_STAINED_GLASS)
- player.say("§9§lPosition 2 set: §f("+position2+")")
- }
- }
- })
- player.onChat(";fill", function () {
- if (position1 != null && position2 != null) {
- pos1place = false
- pos2place = false
- let block:string = player.getChatArg(0)
- let volume = volumer()
- if (volume < 0) {
- volume = volume * -1
- }
- if (volume != 1) {
- player.say("§9§lFilled §7"+volume+"§9 blocks")
- } else {
- player.say("§9§lFilled §7"+volume+"§9 block")
- }
- filler(position1,position2,block)
- } else {
- player.say("§4§lPositions must be set first!")
- }
- })
- player.onChat(";replace", function () {
- if (position1 != null && position2 != null) {
- pos1place = false
- pos2place = false
- let block1:string = player.getChatArg(0)
- let block2:string = player.getChatArg(1)
- let volume = volumer()
- if (volume < 0) {
- volume = volume * -1
- }
- if (volume != 1) {
- player.say("§9§lReplaced a zone of §7"+volume+"§9 blocks")
- } else {
- player.say("§9§lReplaced a zone of §7"+volume+"§9 block")
- }
- replace(position1,position2,block1,block2)
- blocks.place(blocks.blockByName(block2), position1)
- blocks.place(blocks.blockByName(block2), position2)
- } else {
- player.say("§4§lPositions must be set first!")
- }
- })
- player.onChat(";copy", function () {
- if (position1 != null && position2 != null) {
- copy1 = position1
- copy2 = position2
- let volume = volumer()
- if (volume != 1) {
- player.say("§9§lCopied a zone of §7"+volume+"§9 blocks")
- } else {
- player.say("§9§lCopied a zone of §7"+volume+"§9 block")
- }
- } else {
- player.say("§4§lPositions must be set first!")
- }
- })
- player.onChat(";paste", function () {
- if (copy1 != null) {
- blocks.place(blocks.blockByName("AIR"), position1)
- blocks.place(blocks.blockByName("AIR"), position2)
- copypaste(copy1,copy2)
- player.say("§9§lZone pasted")
- } else {
- player.say("§4§lYou must copy a selection first!")
- }
- })
- player.onChat(";destroy", function () {
- if (position1 != null && position2 != null) {
- pos1place = false
- pos2place = false
- let volume = volumer()
- if (volume < 0) {
- volume = volume * -1
- }
- if (volume != 1) {
- player.say("§9§lDestroyed §7"+volume+"§9 blocks")
- } else {
- player.say("§9§lDestroyed §7"+volume+"§9 block")
- }
- filler(position1,position2,"AIR")
- } else {
- player.say("§4§lPositions must be set first!")
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement