on load: #VARRIABLES# if {prefix} is not set: set {prefix} to "&8&l[&5SkyWars&8&l]" if {startWaitTime} is not set: set {startWaitTime} to 2 minutes if {minPlayers} is not set: set {minPlayers} to 2 if {maxPlayers} is not set: set {maxPlayers} to 12 if {winTokenRewards} is not set: set {winTokenRewards} to 10 if {looseTokenRewards} is not set: set {looseTokenRewards} to -1 if {killTokenRewards} is not set: set {killTokenRewards} to 1 #CONFIG.YML# if file "../../AmazingSkyWars/config.yml" does not exists: create file "../../AmazingSkyWars/config.yml" if file "../../AmazingSkyWars/arenas.yml" does not exists: create file "../../AmazingSkyWars/arenas.yml" set yaml value "Prefix" from file "../../AmazingSkyWars/config.yml" to "%{prefix}% ##Sets the prefix of AmazingSkyWars" set yaml value "Start Time" from file "../../AmazingSkyWars/config.yml" to "%{startWaitTime}% ##Sets how long you have to wait before the arena starts" set yaml value "Minimum Players" from file "../../AmazingSkyWars/config.yml" to "%{minPlayers}% ##Sets the default minimum amount of players in an arena" set yaml value "Maximum Players" from file "../../AmazingSkyWars/config.yml" to "%{maxPlayers}% ##Sets the default maximum amount of players in an arena" set yaml value "Win Token Rewards" from file "../../AmazingSkyWars/config.yml" to "%{winTokenRewards}% ##Sets the amount of tokens the winner of a game receives" set yaml value "Loose Token Rewards" from file "../../AmazingSkyWars/config.yml" to "%{looseTokenRewards}% ##Sets the amount of tokens the looser(s) of a game receives (or gets taken)" set yaml value "Kill Token Rewards" from file "../../AmazingSkyWars/config.yml" to "%{killTokenRewards}% ##Sets the amount of tokens a player receives when they kill another player" #SELECTION WAND# on left click with stick: if name of item contains "&9&lSkyWars Selection Wand": if player has permission "asw.admin": cancel event wait 2 ticks set {wand.pos1} to location of clicked block send "&bPos1 set to %{wand.pos1}%" to player else: send "&cYou do not have permission to use this command!" to sender on right click with stick: if name of item contains "&9&lSkyWars Selection Wand": if player has permission "asw.admin": cancel event wait 2 ticks set {wand.pos2} to location of clicked block send "&ePos2 set to %{wand.pos2}%" to player else: send "&cYou do not have permission to use this command!" to sender #COMMANDS# command /amazingskywars [] [] []: description: The main command for AmazingSkyWars aliases: /sw, /asw, /swars usage: /amazingskywars [arg 1] [arg 2] [arg 3] executable by: console and players trigger: if sender is in world "skywars": #/sw help# if sender has permission "asw.help": if sender does not have permission "asw.admin": if arg 1 is not set: wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw help [page]&7: Shows the help page" to sender send "&a/sw join [arena name]&7: Join a game" to sender send "&a/sw kit [kit]&7: Choose a kit" to sender send "&a/sw leave&7: Leaves the game you joined" to sender send "&a/sw glass&7: Chooses your glass color" to sender send "&a/sw shop&7: Opens the shop GUI" to sender send "&8&l=============&1&l[&91/2&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is not set: wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw help [page]&7: Shows the help page" to sender send "&a/sw join [arena name]&7: Join a game" to sender send "&a/sw kit [kit]&7: Choose a kit" to sender send "&a/sw leave&7: Leaves the game you joined" to sender send "&a/sw glass&7: Chooses your glass color" to sender send "&a/sw shop&7: Opens the shop GUI" to sender send "&8&l=============&1&l[&91/2&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "1": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw help [page]&7: Shows the help page" to sender send "&a/sw join [arena name]&7: Join a game" to sender send "&a/sw kit [kit]&7: Choose a kit" to sender send "&a/sw leave&7: Leaves the game you joined" to sender send "&a/sw glass [color]&7: Chooses your glass color" to sender send "&a/sw shop&7: Opens the shop GUI" to sender send "&8&l=============&1&l[&91/2&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "2": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw togglescoreboard&7: Toggles the scoreboard" to sender send "&a/sw stats [player]&7: Shows a player's stats" to sender send "&a/sw togglemessages&7: Toggles all skywars messages" to sender send "&a/sw spec &7: Spectate a game" to sender send "&a/sw togglefireworks&7: Toggles the win fireworks" to sender send "&a/sw toggledeathscreen&7: Toggle the death screen" to sender send "&8&l=============&1&l[&92/2&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is set: if arg 2 is not an integer: send "%{prefix}% &cArgument 2 must be an integer!" to sender stop trigger else: if arg 2 is not "1" or "2": send "%{prefix}% &cThere is no page number %arg 2%" to sender stop trigger else: send "&cYou do not have permission to use this command!" to sender if sender has permission "asw.admin": if arg 1 is not set: wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw help [page]&7: Shows the help page" to sender send "&a/sw join [arena name]&7: Join a game" to sender send "&a/sw kit [kit]&7: Choose a kit" to sender send "&a/sw leave&7: Leaves the game you joined" to sender send "&a/sw glass&7: Chooses your glass color" to sender send "&a/sw shop&7: Opens the shop GUI" to sender send "&8&l=============&1&l[&91/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is not set: wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw help [page]&7: Shows the help page" to sender send "&a/sw join [arena name]&7: Join a game" to sender send "&a/sw kit [kit]&7: Choose a kit" to sender send "&a/sw leave&7: Leaves the game you joined" to sender send "&a/sw glass&7: Chooses your glass color" to sender send "&a/sw shop&7: Opens the shop GUI" to sender send "&8&l=============&1&l[&91/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "1": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw help [page]&7: Shows the help page" to sender send "&a/sw join [arena name]&7: Join a game" to sender send "&a/sw kit [kit]&7: Choose a kit" to sender send "&a/sw leave&7: Leaves the game you joined" to sender send "&a/sw glass [color]&7: Chooses your glass color" to sender send "&a/sw shop&7: Opens the shop GUI" to sender send "&8&l=============&1&l[&91/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "2": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw togglescoreboard&7: Toggles the scoreboard" to sender send "&a/sw stats [player]&7: Shows a player's stats" to sender send "&a/sw togglemessages&7: Toggles all skywars messages" to sender send "&a/sw spec &7: Spectate a game" to sender send "&a/sw togglefireworks&7: Toggles the win fireworks" to sender send "&a/sw toggledeathscreen&7: Toggle the death screen" to sender send "&8&l=============&1&l[&92/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "3": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw arenalist&7: Lists all arenas" to sender send "&a/sw wand&7: Gives you the skywars wand" to sender send "&a/sw create &7: Creates an arena" to sender send "&a/sw remove &7: Removes an arena" to sender send "&a/sw setspawn &7: Sets the spawn points" to sender send "&a/sw setminplayers &7: Set the minimum amount of players" to sender send "&8&l=============&1&l[&93/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "4": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw forcestart &7: Force starts an arena" to sender send "&a/sw reload&7: Reloads the plugin" to sender send "&a/sw listplayers &7: Shows the players in an arena" to sender send "&a/sw searchplayer &7: Finds a player" to sender send "&a/sw disable &7: Disables an arena" to sender send "&a/sw enable &7: Enables an arena" to sender send "&8&l=============&1&l[&94/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is "5": wait 2 ticks send "&8&l===========&1&l[&9SkyWars&1&l]&8&l===========" to sender send "&a/sw setlobby&7: Sets the lobby" to sender send "&c--------" to sender send "&c--------" to sender send "&c--------" to sender send "&c--------" to sender send "&c--------" to sender send "&8&l=============&1&l[&95/5&1&l]&8&l============" to sender stop trigger if arg 1 is "help": if arg 2 is set: if arg 2 is not an integer: wait 2 ticks send "%{prefix}% &cArgument 2 must be an number 1 to 5!" to sender stop trigger else: send "&cYou do not have permission to use this command!" to sender #/sw wand# if arg 1 is "wand": if arg 2 is not set: wait 2 ticks give 1 stick named "&9&lSkyWars Selection Wand" with lore "&eLeft click to set pos 1 &9| &eRight click to set pos2 " to player #/sw create# if sender has permission "asw.admin": if arg 1 is "create": if arg 2 is set: if {wand.pos1} is set: if {wand.pos2} is set: wait 2 ticks set {arenaName} to arg 2 set yaml value "Arenas.%{arenaName}%.Region.Pos1" from file "../../AmazingSkyWars/arenas.yml" to "%{wand.pos1}%" set yaml value "Arenas.%{arenaName}%.Region.Pos2" from file "../../AmazingSkyWars/arenas.yml" to "%{wand.pos2}%" set yaml value "Arenas.%{arenaName}%.Options.Min-Players" from file "../../AmazingSkyWars/arenas.yml" to "%{minPlayers}%" set yaml value "Arenas.%{arenaName}%.Options.Max-Players" from file "../../AmazingSkyWars/arenas.yml" to "%{maxPlayers}%" set yaml value "Arenas.%{arenaName}%.Options.Start-Wait-Time" from file "../../AmazingSkyWars/arenas.yml" to "%{startWaitTime}%" set yaml value "Arenas.%{arenaName}%.Options.Win-Reward" from file "../../AmazingSkyWars/arenas.yml" to "%{winTokenRewards}%" send "&aArena %{arenaName}% created successfully." else: wait 2 ticks send "%{prefix}% &cYou need to set &ePos2 &cbefore you create an arena!" to sender else: wait 2 ticks send "%{prefix}% &cYou need to set &bPos1 &cbefore you create an arena!" to sender else: wait 2 ticks send "%{prefix}% &cYou need to add an arena name!" else: wait 2 ticks send "&cYou do not have permission to use this command!" to sender #/sw setspawn# if sender has permission "asw.admin": if arg 1 is "setspawn": if arg 2 is set: if arg 3 is set: if arg 3 is a number: set {arenaName} to arg 2 set {spawnNumber} to arg 3 set {spawnPos} to location of player set yaml value "Arenas.%{arenaName}%.Spawns.%{spawnNumber}%" from file "../../AmazingSkyWars/arenas.yml" to "%{spawnPos}%" send "%{prefix}% &aSpawn %arg 3% was set successfully!" if arg 3 is not a number: send "%{prefix}% &cArgument 3 needs to be a number!" to sender else: send "%{prefix}% &cYou need to state a spawn number!" to sender else: send "%{prefix}% &cYou need to state an arena!" to sender else: send "&cYou do not have permission to use this command!" to sender #/sw remove# if sender has permission "asw.admin": if arg 1 is "remove": if arg 2 is set: wait 2 ticks set {arenaName} to arg 2 delete yaml value "Arenas.%{arenaName}%.Region.Pos1" from file "../../AmazingSkyWars/arenas.yml" delete yaml value "Arenas.%{arenaName}%.Region.Pos2" from file "../../AmazingSkyWars/arenas.yml" delete yaml value "Arenas.%{arenaName}%.Options.Min-Players" from file "../../AmazingSkyWars/arenas.yml" delete yaml value "Arenas.%{arenaName}%.Options.Max-Players" from file "../../AmazingSkyWars/arenas.yml" delete yaml value "Arenas.%{arenaName}%.Options.Start-Wait-Time" from file "../../AmazingSkyWars/arenas.yml" delete yaml value "Arenas.%{arenaName}%.Options.Win-Reward" from file "../../AmazingSkyWars/arenas.yml" send "&aArena &9%{arenaName}% &aremoved successfully." else: wait 2 ticks send "%{prefix}% &cYou need to state an arena!" to sender else: wait 2 ticks send "&cYou do not have permission to use this command!" to sender else: wait 2 ticks send "&cYou can not use this command in this world" command /testcmd: trigger: wait 2 ticks send "%{prefix}%" to sender send "%{startWaitTime}%" to sender send "%{minPlayers}%" to sender send "%{maxPlayers}%" to sender send "%{winTokenRewards}%" to sender send "%{looseTokenRewards}%" to sender send "%{killTokenRewards}%" to sender