Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- prefix: &6Mines&8:&7
- on quit:
- delete {mine.user.%uuid of player%.isConfirmingMine}
- delete {mine.user.%uuid of player%.isShowingMine}
- loop {mine.user.%uuid of player%.fallingBlocks::*}:
- kill loop-value
- on disable:
- loop all players:
- delete {mine.user.%uuid of loop-player%.isConfirmingMine}
- delete {mine.user.%uuid of loop-player%.isShowingMine}
- loop {mine.user.%uuid of loop-player%.fallingBlocks::*}:
- kill loop-value-2
- command /mine [<text>] [<text>] [<text>] [<text>] [<text>]:
- aliases: /mines
- trigger:
- if executor is not a player:
- send "{@prefix} This command can only be executed by a player."
- else if arg-1 is "create":
- if arg-2 is not set:
- send "{@prefix} Invalid Usage! &e/mine create <id> <length> <depth> <width>&7."
- else if {mine.list::*} contains arg-2 in lower case:
- send "{@prefix} A mine with the id &e%arg-2 in lower case% &7already exists."
- else if {mine.user.%uuid of player%.isConfirmingMine} is true:
- send "{@prefix} You are already creating a mine. Either cancel or confirm the mine first."
- else if isNotANumber(player, arg-3, "<length>", "<depth>", "<width>"), isNotANumber(player, arg-4, arg-3, "<depth>", "<width>") or isNotANumber(player, arg-5, arg-3, arg-4, "<width>") is false:
- stop
- else:
- set {mine.user.%uuid of player%.isConfirmingMine} to true
- set {mine.user.%uuid of player%.location} to location of block at location of player
- set {mine.user.%uuid of player%.id} to arg-2 in lower case
- set {mine.user.%uuid of player%.length} to arg-3 parsed as an integer
- set {mine.user.%uuid of player%.depth} to arg-4 parsed as an integer
- set {mine.user.%uuid of player%.width} to arg-5 parsed as an integer
- showMineToConfirm(player)
- send "{@prefix} Please confirm you want to create a mine with as parameters &e%arg-3% &e%arg-4% &e%arg-5%&7."
- send "{@prefix} To confirm, please type &e/mine <confirm | cancel>&7."
- else if arg-1 is "delete":
- # Delete a mine
- else if arg-1 is "confirm":
- if {mine.user.%uuid of player%.isConfirmingMine} is not true:
- send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
- else:
- if {mine.list::*} contains {mine.user.%uuid of player%.id}:
- send "{@prefix} A mine with the id &e%arg-2 in lower case% &7already exists."
- delete {mine.user.%uuid of player%.isConfirmingMine}
- delete {mine.user.%uuid of player%.isShowingMine}
- else:
- loop {mine.user.%uuid of player%.fallingBlocks::*}:
- set health of loop-value to 0
- # Confirm creating a mine
- else if arg-1 is "cancel":
- if {mine.user.%uuid of player%.isConfirmingMine} is not true:
- send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
- else:
- delete {mine.user.%uuid of player%.isConfirmingMine}
- delete {mine.user.%uuid of player%.isShowingMine}
- send "{@prefix} You have cancelled creating the mine."
- loop {mine.user.%uuid of player%.fallingBlocks::*}:
- kill loop-value
- else:
- send "{@prefix} Invalid Usage! &e/mine <create | delete> <id> <length> <depth> <width>&7."
- function isNotANumber(player: Player, input: String, length: String, depth: String, width: String) :: Boolean:
- if {_input} parsed as an integer is not set:
- send "{@prefix} Invalid Usage! &e/mine create <id> %{_length}% &e%{_depth}% &e%{_width}%&7." to {_player}
- return false
- return true
- function showMineToConfirm(player: Player):
- set {_uuid} to uuid of {_player}
- if {mine.user.%{_uuid}%.isShowingMine} is true:
- stop
- set {mine.user.%{_uuid}%.isShowingMine} to true
- set {_locationOffsetNorth::*} to 0, 0, {mine.user.%{_uuid}%.length} and {mine.user.%{_uuid}%.length}
- set {_locationOffsetEast::*} to 0, {mine.user.%{_uuid}%.width}, {mine.user.%{_uuid}%.width} and 0
- loop 8 times:
- if loop-value < 5:
- spawn falling sea lantern at location {_locationOffsetNorth::%loop-value%} meters north, {_locationOffsetEast::%loop-value%} meters east of {mine.user.%{_uuid}%.location}
- else:
- spawn falling sea lantern at location {mine.user.%{_uuid}%.depth} meters below, {_locationOffsetNorth::%loop-value - 4%} meters north, {_locationOffsetEast::%loop-value - 4%} meters east of {mine.user.%{_uuid}%.location}
- set {_entity} to spawned entity
- hide {_entity} for all players
- show {_entity} to {_player}
- add {_entity} to {mine.user.%{_uuid}%.fallingBlocks::*}
- add "{NoGravity:1b,Invulnerable:1b}" to nbt of {_entity}
- # Blocks pop??????
Advertisement
Add Comment
Please, Sign In to add comment