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}
- 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 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}
- else:
- # 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}
- send "{@prefix} You have cancelled creating the mine."
- 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
- while {mine.user.%{_uuid}%.isShowingMine} is true:
- broadcast "ONLINE"
- show 100 dust of stone at location 0.0 meters above location of {mine.user.%{_uuid}%.location} to {_player}
- wait 5 ticks
- delete {mine.user.%{_uuid}%.isShowingMine}
Advertisement
Add Comment
Please, Sign In to add comment