SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.    
  4. on load:   
  5.     set {_&} to "&"
  6.     if yaml value "CHAT-FORMAT" from file "plugins/TNTTag/config.yml" is not set:  
  7.         set yaml value "CHAT-FORMAT" from file "plugins/TNTTag/config.yml" to "%{_&}%3{player} %{_&}%8%{_&}%l{arrow-right} %{_&}%7{message}"           
  8.     if yaml value "COMMANDS.KILL" from file "plugins/TNTTag/config.yml" is not set:
  9.         set yaml value "COMMANDS.KILL" from file "plugins/TNTTag/config.yml" to "eco give {player} 5"      
  10.     if yaml value "COMMANDS.WIN" from file "plugins/TNTTag/config.yml" is not set: 
  11.         set yaml value "COMMANDS.WIN" from file "plugins/TNTTag/config.yml" to "eco give {player} 20"  
  12.     if yaml value "COMMANDS.GOAL" from file "plugins/TNTTag/config.yml" is not set:
  13.         set yaml value "COMMANDS.GOAL" from file "plugins/TNTTag/config.yml" to "eco give {player} 10"     
  14.     if yaml value "TIMERS.WAITING" from file "plugins/TNTTag/config.yml" is not set:   
  15.         set yaml value "TIMERS.WAITING" from file "plugins/TNTTag/config.yml" to 30        
  16.     if yaml value "ITEMS.LEAVE" from file "plugins/TNTTag/config.yml" is not set:  
  17.         set yaml value "ITEMS.LEAVE" from file "plugins/TNTTag/config.yml" to "red bed"
  18.     if yaml value "ITEMS.LEAVE-NAME" from file "plugins/TNTTag/config.yml" is not set: 
  19.         set yaml value "ITEMS.LEAVE-NAME" from file "plugins/TNTTag/config.yml" to "%{_&}%c%{_&}%lLeave the game." 
  20.     if yaml value "MESSAGES.PREFIX" from file "plugins/TNTTag/config.yml" is not set:
  21.         set yaml value "MESSAGES.PREFIX" from file "plugins/TNTTag/config.yml" to "%{_&}%6%{_&}%lTNTTag %{_&}%8%{_&}%l{arrow-right} %{_&}%7"       
  22.     if yaml value "MESSAGES.JOIN-MESSAGE" from file "plugins/TNTTag/config.yml" is not set:
  23.         set yaml value "MESSAGES.JOIN-MESSAGE" from file "plugins/TNTTag/config.yml" to "%{_&}%a{player} %{_&}%ehas joined to the game &e(&b{player-count}&e/&b{max-players}&e)."  
  24.     if yaml value "MESSAGES.LEFT-MESSAGE" from file "plugins/TNTTag/config.yml" is not set:
  25.         set yaml value "MESSAGES.LEFT-MESSAGE" from file "plugins/TNTTag/config.yml" to "%{_&}%a{player} %{_&}%ehas left the game."
  26.     if yaml value "MESSAGES.STARTING-IN" from file "plugins/TNTTag/config.yml" is not set: 
  27.         set yaml value "MESSAGES.STARTING-IN" from file "plugins/TNTTag/config.yml" to "%{_&}%eStarting in %{_&}%6{seconds} %{_&}%eseconds"    
  28.     if yaml value "SCOREBOARD.WEBSITE" from file "plugins/TNTTag/config.yml" is not set:   
  29.         set yaml value "SCOREBOARD.WEBSITE" from file "plugins/TNTTag/config.yml" to "%{_&}%eMC.SERVER.NET"            
  30.     if yaml value "STATUS.INGAME" from file "plugins/TNTTag/config.yml" is not set:
  31.         set yaml value "STATUS.INGAME" from file "plugins/TNTTag/config.yml" to "%{_&}%cINGAME"
  32.     if yaml value "STATUS.STARTING" from file "plugins/TNTTag/config.yml" is not set:  
  33.         set yaml value "STATUS.STARTING" from file "plugins/TNTTag/config.yml" to "%{_&}%3STARTING..."
  34.     if yaml value "STATUS.WAITING" from file "plugins/TNTTag/config.yml" is not set:   
  35.         set yaml value "STATUS.WAITING" from file "plugins/TNTTag/config.yml" to "%{_&}%aWAITING"  
  36.     if yaml value "STATUS.RESTARTING" from file "plugins/TNTTag/config.yml" is not set:
  37.         set yaml value "STATUS.RESTARTING" from file "plugins/TNTTag/config.yml" to "%{_&}%cRESTARTING..."         
  38.     if yaml value "MESSAGES.IN-GAME" from file "plugins/TNTTag/config.yml" is not set:     
  39.         set yaml value "MESSAGES.IN-GAME" from file "plugins/TNTTag/config.yml" to "%{_&}%cYou are already in game."   
  40.     if yaml value "MESSAGES.NOT-IN-GAME" from file "plugins/TNTTag/config.yml" is not set:     
  41.         set yaml value "MESSAGES.NOT-IN-GAME" from file "plugins/TNTTag/config.yml" to "%{_&}%c%{_&}%lYou are not in game."
  42.     if yaml value "MESSAGES.KILL-MESSAGE" from file "plugins/TNTTag/config.yml" is not set:    
  43.         set yaml value "MESSAGES.KILL-MESSAGE" from file "plugins/TNTTag/config.yml" to "%{_&}%7{victim} %{_&}%7was killed by %{_&}%7{killer}" 
  44.     if yaml list "MESSAGES.SUMMARY" from file "plugins/TNTTag/config.yml" is not set:  
  45.         add "%{_&}%a----------------------------------------------", " ", "                     %{_&}%e%{_&}%lTNTTag    ", " ", "                  %{_&}%e1st Place: - %{_&}%7{1}       ", "                  %{_&}%e2nd Place: - %{_&}%7{2}       ", "                  %{_&}%e3rd Place: - %{_&}%7{3}       ", " " and "%{_&}%a----------------------------------------------" to {_SUMMARY::*}
  46.         loop {_SUMMARY::*}:
  47.             add "%loop-value%" to yaml list "MESSAGES.SUMMARY" from file "plugins/TNTTag/config.yml"       
  48.     if yaml list "MESSAGES.ROUND" from file "plugins/TNTTag/config.yml" is not set:
  49.         add "", "              %{_&}%f%{_&}%lRound {round} Has Started!        ", "          %{_&}%eThe TNT has been released to {players}", "" and "            {run-or-tag}" to {_ROUND::*}
  50.         loop {_ROUND::*}:
  51.             add "%loop-value%" to yaml list "MESSAGES.ROUND" from file "plugins/TNTTag/config.yml"                         
  52.     delete {tnt::*}
  53.     loop "CHAT-FORMAT", "ITEMS.LEAVE", "ITEMS.LEAVE-NAME", "SCOREBOARD.WEBSITE", "COMMANDS.KILL", "COMMANDS.WIN", "MESSAGES.PREFIX", "MESSAGES.JOIN-MESSAGE", "MESSAGES.LEFT-MESSAGE", "MESSAGES.IN-GAME", "STATUS.WAITING", "STATUS.INGAME", "STATUS-STARTING", "MESSAGES.NOT-IN-GAME", "MESSAGES.NOT-IN-GAME", "MESSAGES.KILL-MESSAGE" and "MESSAGES.STARTING-IN":
  54.         set {tnt::CONFIG::%loop-value%} to yaml value "%loop-value%" from file "plugins/TNTTag/config.yml" 
  55.     loop {tnt::CONFIG::*}:
  56.         replace all "&" with "§" in {tnt::CONFIG::%loop-index%}
  57.         replace all "{arrow-right}" with "»" in {tnt::CONFIG::%loop-index%}   
  58.         replace all "{arrow-left}" with "«" in {tnt::CONFIG::%loop-index%}    
  59.  
  60.  
  61. function format_slot(inv: inventory, slot: number, amount: number, item: item, name: text = "", lore: text = ""):
  62.     {_lore} is not "":
  63.         set {_line} to 1
  64.         loop {_lore} split at "||":
  65.             set line {_line} of the lore of {_item} to colored loop-value
  66.             add 1 to {_line}
  67.     set slot {_slot} of {_inv} to {_amount} of {_item} named {_name}
  68.        
  69. command /tnttag [<text = help>] [<text>] [<text>]:
  70.     aliases: tnt
  71.     executable by: players
  72.     trigger:
  73.         if arg-1 is "help" or "createarena" or "SetSpawn" or "join" or "leave" or "setlobby" or "deleteArena" or "list" or "autojoin" or "savearena" or "autojoin" or "stats" or "SetArenaLobby" or "start" or "reload" or "SetMin" or "SetMax" or "SetSpawn" or "SetMapName":
  74.             if player have permission "tnt.player":
  75.                 if arg 1 is "help":
  76.                     send "&7&l------------&8[ &6&ltntTag &8]&7&l------------"
  77.                     send "&7/tnt list"
  78.                     send "&7/tnt join &8(&7arena_name&8)"
  79.                     send "&7/tnt autojoin"
  80.                     send "&7/tnt leave"
  81.                     if player have permission "tnt.admin":
  82.                         send "&7/tnt Start"            
  83.                         send "&7/tnt ResetStats &8(&7player_name&8)"               
  84.                         send "&7/tnt SetLobby"
  85.                         send "&7/tnt CreateArena &8(&7arena_name&8)"           
  86.                         send "&7/tnt SetArenaLobby &8(&7arena_name&8)" 
  87.                         send "&7/tnt SetMin &8(&7arena_name&8)"
  88.                         send "&7/tnt SetMax &8(&7arena_name&8)"    
  89.                         send "&7/tnt SetSpawn &8(&7arena_name&8)"          
  90.                         send "&7/tnt SetMapName &8(&7arena_name&8)"                    
  91.                         send "&7/tnt SaveArena &8(&7arena_name&8)"                         
  92.                         send "&7/tnt DeleteArena &8(&7arena_name&8)"                   
  93.                         send "&7&l------------------------------------------"
  94.                         stop
  95.                 if arg 1 is "join":    
  96.                     tnt_join(player, arg-2)
  97.                 if arg 1 is "list":    
  98.                     if {tnt.player::%uuid of player%.state} is not set:
  99.                         open chest inventory with 6 rows named "&8&l» &7TNTTag - ARENAS" to player
  100.                         set {_slot} to 10                  
  101.                         set slot 0, 1, 2, 3, 4, 5, 6, 7, 17, 26, 35, 44, 18, 27, 36, 9, 45, 46, 47, 48, 49, 50, 51, 52, 53 and 8 of player's current inventory to green glass pane named "&8 "         
  102.                         loop {tnt.arenas::*}:
  103.                             format_slot(player's current inventory, {_slot}, 1, green clay, "&e", "&8&l» &7ARENA: &e&l%loop-value%||||&8&l» &7MAP: &a%{tnt.arena.%loop-value%.map}%||||&8&l» &7PLAYING: &a%size of {tnt.arena.%loop-value%.ninjas::*}%&7/&a%{tnt.arena.%loop-value%.max}%||||&8&l» &7STATE: &a%{tnt.arena.%loop-value%.status}%")
  104.                             add 1 to {_slot}
  105.                             if {_slot} is 17 or 26 or 35:
  106.                                 add 2 to {_slot}                       
  107.                 if arg 1 is "leave":   
  108.                     tnt_leave(player)
  109.                 if arg 1 is "autojoin":    
  110.                     if {tnt.player::%uuid of player%.state} is not set:
  111.                         loop {tnt.arenas::*}:
  112.                             if {tnt.arena.%loop-value%.status} is "WAITING" or "STARTING":
  113.                                 tnt_join(player, loop-value)
  114.                                 stop
  115.                 if arg-1 is "stats":
  116.                     send "&e&l✦&7&l&m--------------------------------------&e&l✦"
  117.                     send ""
  118.                     send "&8&l»          &6&lTNTTag STATS        &8&l«"      
  119.                     send ""            
  120.                     send "&6&l» &7&lWins &c%{tnt.stats.wins::%uuid of player%}%"  
  121.                     send "&6&l» &7&lLoses &c%{tnt.stats.loses::%uuid of player%}%"            
  122.                     send ""
  123.                     send "&e&l✦&7&l&m--------------------------------------&e&l✦"
  124.                 if arg 1 is "createarena": 
  125.                     if player has permission "tnt.admin":      
  126.                         if arg-2 is set:
  127.                             if {tnt.arena.%arg-2%.state} is not set:
  128.                                 set {tnt.arena.%arg-2%.state} to "created"
  129.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been created!"
  130.                             else:
  131.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aThis arena already exists!"   
  132.                         else:
  133.                             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aSpecify Arena!"               
  134.                 if arg 1 is "SetArenaLobby" or "SetMax" or "SetMin" or "SetSpawn" or "SetMapName":
  135.                     if player has permission "tnt.admin":  
  136.                         if {tnt.arena.%arg-2%.state} is "created" or "ready":
  137.                             if arg 1 is "SetArenaLobby":
  138.                                 set {tnt.arena.%arg-2%.lobby} to location of player
  139.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aLobby for Arena &3%arg-2% &ahas been set!"
  140.                             if arg 1 is "SetMax":
  141.                                 set {tnt.arena.%arg-2%.max} to arg-3 parsed as number
  142.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aMaximum players for Arena &3%arg-2% &ahas been set!"  
  143.                             if arg 1 is "SetMapName":
  144.                                 set {tnt.arena.%arg-2%.map} to arg-3
  145.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aMap Name for Arena &3%arg-2% &ahas been set!"                             
  146.                             if arg 1 is "SetMin":
  147.                                 set {tnt.arena.%arg-2%.min} to arg-3 parsed as number
  148.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aMinimum players for Arena &3%arg-2% &ahas been set!"                          
  149.                             if arg 1 is "SetSpawn":
  150.                                 set {tnt.arena.%arg-2%.spawn} to location of player
  151.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aSpawn for Arena &3%arg-2% &ahas been set!"                        
  152.                         else:
  153.                             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"                                        
  154.                 if arg 1 is "setlobby":
  155.                     if player has permission "tnt.admin":
  156.                         set {tnt.lobby} to location of player
  157.                         send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aLobby set."                                       
  158.                 if arg 1 is "resetstats":  
  159.                     if player has permission "tnt.admin":      
  160.                         set {_p} to arg-2 parsed as player
  161.                         tnt_stats("reset", {_p})
  162.                         send "%{tnt::CONFIG::MESSAGES.PREFIX}% &cReseted Stats for &a%{_p}%"                       
  163.                 if arg 1 is "start":
  164.                     if player has permission "tnt.admin":
  165.                         #size of {tnt.arena.%{tnt.player::%uuid of player%.arena}%.ninjas::*} > 1
  166.                         tnt_start({tnt.player::%uuid of player%.arena})
  167.                 if arg 1 is "reload":      
  168.                     if player has permission "tnt.admin":
  169.                         broadcast "%{tnt::CONFIG::MESSAGES.PREFIX}% &aReloading..."
  170.                         make console execute command "sk reload %script%"
  171.                 if arg 1 is "savearena":   
  172.                     if player has permission "tnt.admin":      
  173.                         if {tnt.arena.%arg-2%.state} is "created":
  174.                             if {tnt.arena.%arg-2%.lobby} is set:                       
  175.                                 if {tnt.arena.%arg-2%.spawn} is set:   
  176.                                     if {tnt.arena.%arg-2%.max} is set: 
  177.                                         if {tnt.arena.%arg-2%.min} is set: 
  178.                                             if {tnt.arena.%arg-2%.map} is set: 
  179.                                                 set {tnt.arena.%arg-2%.state} to "ready"
  180.                                                 add arg-2 to {tnt.arenas::*}
  181.                                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been saved."
  182.                                                 tnt_resetarena(arg-2)
  183.                                             else:
  184.                                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aMap name is not set!"                                         
  185.                                         else:
  186.                                             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aMinimum players is not set!"                                          
  187.                                     else:
  188.                                         send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aMaximum players is not set!"                                  
  189.                                 else:
  190.                                     send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aArena spawn is not set!"                                                                                                                                                                      
  191.                             else:
  192.                                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aLobby is not set!"                    
  193.                         else:
  194.                             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  195.                 if arg 1 is "deletearena": 
  196.                     if player has permission "tnt.admin":      
  197.                         if {tnt.arena.%arg-2%.state} is set:
  198.                             tnt_resetarena(arg-2)
  199.                             delete {tnt.arena.%arg-2%.lobby}
  200.                             delete {tnt.arena.%arg-2%.seconds}
  201.                             delete {tnt.arena.%arg-2%.minutes}
  202.                             delete {tnt.arena.%arg-2%.status}
  203.                             delete {tnt.arena.%arg-2%.min}
  204.                             delete {tnt.arena.%arg-2%.max}
  205.                             delete {tnt.arena.%arg-2%.ninjas::*}
  206.                             delete {tnt.arena.%arg-2%.bad-ninjas::*}
  207.                             delete {tnt.arena.%arg-2%.exploding-ninjas::*}                     
  208.                             delete {tnt.arena.%arg-2%.state}
  209.                             delete {tnt.arena.%arg-2%.explode} 
  210.                             loop 3 times:
  211.                                 delete {tnt.arena.%{_arena}%.summary.%loop-number%}
  212.                             remove arg-2 from {tnt.arenas::*}
  213.                             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aArena &c%arg-2% &ahas been deleted."
  214.                         else:
  215.                             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aThis arena not exists"
  216.    
  217.    
  218. on chat:
  219.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  220.         cancel event
  221.         set {_msg} to {tnt::CONFIG::CHAT-FORMAT}
  222.         replace all "{player}" in {_msg} with player's displayname
  223.         replace all "&" with " " in message
  224.         replace all "{message}" with message in {_msg}         
  225.         send {_msg} to {tnt.arena.%{tnt.player::%uuid of player%.arena}%.ninjas::*} and {tnt.arena.%{tnt.player::%uuid of player%.arena}%.bad-ninjas::*}
  226.  
  227. on drop:
  228.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  229.         cancel event
  230.                    
  231. on hunger bar change:  
  232.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  233.         set player's hunger to 20
  234.        
  235.        
  236. on damage of player:
  237.     if {tnt.player::%uuid of victim%.state} is "IN-GAME":
  238.         if {tnt.arena.%{tnt.player::%uuid of victim%.arena}%.status} is "STARTING" or "WAITING":
  239.             cancel event
  240.             damage cause is void
  241.             teleport victim to {tnt.arena.%{tnt.player::%uuid of victim%.arena}%.lobby}
  242.         if {tnt.arena.%{tnt.player::%uuid of victim%.arena}%.status} is "INGAME":
  243.             heal victim
  244.             attacker is player:
  245.                 if {tnt.player::%uuid of attacker%.has-tnt} is set:
  246.                     tnt_set({tnt.player::%uuid of victim%.arena}, victim)
  247.                     delete {tnt.player::%uuid of attacker%.has-tnt}
  248.                     remove attacker from {tnt.arena.%{tnt.player::%uuid of victim%.arena}%.exploding-ninjas::*}
  249.                     clear attacker's inventory
  250.                     milk attacker
  251.                     apply potion of speed 2 without any particles to attacker for 7 days
  252.                     launch "CREEPER" firework at block above victim timed 0 coloured "GREEN"
  253.                     make console execute command "nte player %attacker% prefix &7"
  254.                     send "%attacker's prefix%%attacker% &cTagged you!" to victim
  255.                     send "&aYou tagged %victim's prefix%%victim%!" to attacker 
  256.             else:
  257.                 cancel event
  258.     if {tnt.player::%uuid of victim%.state} is "IN-GAME-SPEC":
  259.         cancel event
  260.     if {tnt.player::%uuid of attacker%.state} is "IN-GAME-SPEC":
  261.         cancel event
  262.        
  263. function tnt_check_win(arena: text):
  264.     size of {tnt.arena.%{_arena}%.ninjas::*} is 1
  265.     set {tnt.arena.%{_arena}%.status} to "RESTARTING"
  266.     loop {tnt.arena.%{_arena}%.ninjas::*}:
  267.         set {_p} to loop-value-1
  268.     loop yaml list "MESSAGES.SUMMARY" from file "plugins/TNTTag/config.yml":
  269.         set {_msg} to loop-value-1
  270.         replace all "{1}" with "%{_p}%" in {_msg}
  271.         loop "1", "2" and "3":
  272.             if {tnt.arena.%{_arena}%.summary.%loop-value-2%} is set:   
  273.                 replace all "{%loop-value-2%}" with "%{tnt.arena.%{_arena}%.summary.%loop-value-2%}%" in {_msg}
  274.             else:  
  275.                 replace all "{%loop-value-2%}" with "&7Loading..." in {_msg}
  276.         send coloured {_msg} to {tnt.arena.%{_arena}%.ninjas::*} and {tnt.arena.%{_arena}%.bad-ninjas::*}              
  277.     set {_uuid} to uuid of {_p}
  278.     add 1 to {tnt.stats.wins::%{_uuid}%}
  279.     loop 10 times:
  280.         launch "BALL" firework at location of {_p} timed 1 coloured "RED" and "BLUE" AND "YELLOW" AND "GREEN"
  281.         wait a second  
  282.     tnt_resetarena({_arena})   
  283.                    
  284.                    
  285. function tnt_remove(p: player, arena: text):
  286.     remove {_p} from {tnt.arena.%{_arena}%.ninjas::*}
  287.     if {tnt.arena.%{_arena}%.status} is "INGAME":  
  288.         tnt_check_win({_arena})
  289.            
  290. on load:
  291.     delete {tnt.player::*}
  292.     send "&7&l--------------------------------------------" to console
  293.     send " " to console
  294.     send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aLoading &ev.0.0.1&a..." to console
  295.     wait a tick
  296.     broadcast "%{tnt::CONFIG::MESSAGES.PREFIX}% &aPlugin loaded!"
  297.     send " " to console
  298.     send "&7&l--------------------------------------------" to console
  299.     loop {tnt.arenas::*}:
  300.         delete {tnt.arena.%loop-value-1%.ninjas::*} and {tnt.arena.%loop-value-1%.bad-ninjas::*}
  301.         tnt_resetarena(loop-value)
  302.  
  303.  
  304. on unload:
  305.     send "&7&l--------------------------------------------" to console
  306.     send " " to console
  307.     send "%{tnt::CONFIG::MESSAGES.PREFIX}% &aDisabling &ev.0.0.1&a..." to console
  308.     send "%{tnt::CONFIG::MESSAGES.PREFIX}% &ev.0.0.1 &adisabled!" to console
  309.     send " " to console
  310.     send "&7&l--------------------------------------------" to console
  311.  
  312.  
  313. function tnt_stats(do: text, p: player):
  314.     set {_uuid} to uuid of {_p}
  315.     {_do} is "check":
  316.         loop "loses" and "wins":
  317.             {tnt.stats.%loop-value%::%{_uuid}%} is not set
  318.             set {tnt.stats.%loop-value%::%{_uuid}%} to 0
  319.     {_do} is "reset":
  320.         loop "loses" and "wins":
  321.             set {tnt.stats.%loop-value%::%{_uuid}%} to 0   
  322.    
  323. function tnt_leave(p: player):
  324.     set {_uuid} to uuid of {_p}
  325.     if {tnt.player::%{_uuid}%.state} is "IN-GAME":
  326.         set {_arena} to {tnt.player::%{_uuid}%.arena}
  327.         set {_msg} to {tnt::CONFIG::MESSAGES.LEFT-MESSAGE}
  328.         replace all "{player}" in {_msg} with {_p}'s display name
  329.         tnt_remove({_p}, {tnt.player::%{_uuid}%.arena})
  330.         send "%{tnt::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {tnt.arena.%{tnt.player::%{_uuid}%.arena}%.ninjas::*}  
  331.         loop {tnt.arena.%{_arena}%.ninjas::*}:
  332.             size of {tnt.arena.%{_arena}%.ninjas::*} = 4 or 3 or 2 or 1:
  333.                 set {_size} to size of {tnt.arena.%{_arena}%.ninjas::*}
  334.                 set {tnt.arena.%{_arena}%.summary.%{_size}%} to loop-value-2       
  335.         tnt_check_win({tnt.player::%{_uuid}%.arena})   
  336.         tnt_clear_player({_p})
  337.         tnt_deleteBoard({_p})
  338.         loop "arena" and "state" and "has-tnt":
  339.             delete {tnt.player::%{_uuid}%.%loop-value%}        
  340.         teleport {_p} to {tnt.lobby}
  341.     else:
  342.         send "%{tnt::CONFIG::MESSAGES.PREFIX}% %{tnt::CONFIG::MESSAGES.NOT-IN-GAME}%" to {_p}
  343.        
  344.        
  345. function tnt_join(p: player, arena: text): 
  346.     set {_uuid} to uuid of {_p}
  347.     if {tnt.player::%{_uuid}%.state} is not set:
  348.         if {tnt.arena.%{_arena}%.state} is "ready":
  349.             if {tnt.arena.%{_arena}%.status} is "WAITING" or "STARTING":
  350.                 if size of {tnt.arena.%{_arena}%.ninjas::*} < {tnt.arena.%{_arena}%.max}:
  351.                     tnt_clear_player({_p})
  352.                     set {tnt.player::%{_uuid}%.state} to "IN-GAME"
  353.                     set {tnt.player::%{_uuid}%.arena} to {_arena}
  354.                     set {tnt.player::%{_uuid}%.kills} to 0
  355.                     set slot 8 of {_p} to {tnt::CONFIG::ITEMS.LEAVE} parsed as material named "%{tnt::CONFIG::ITEMS.LEAVE-NAME}%"
  356.                     add {_p} to {tnt.arena.%{_arena}%.ninjas::*}       
  357.                     if size of {tnt.arena.%{_arena}%.ninjas::*} = 2:
  358.                         tnt_start_countdown({_arena})                                          
  359.                     set {_msg} to {tnt::CONFIG::MESSAGES.JOIN-MESSAGE}
  360.                     replace all "{player}" in {_msg} with {_p}'s displayname
  361.                     replace all "{player-count}" in {_msg} with "%size of {tnt.arena.%{_arena}%.ninjas::*}%"
  362.                     replace all "{max-players}" in {_msg} with "%{tnt.arena.%{_arena}%.max}%"
  363.                     send "%{tnt::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {tnt.arena.%{_arena}%.ninjas::*}
  364.                     teleport {_p} to {tnt.arena.%{_arena}%.lobby}
  365.                     tnt_createBoard({_p}, "TNT-WAITING", 10)
  366.                 else:
  367.                     send "%{tnt::CONFIG::MESSAGES.PREFIX}% &7This arena is full" to {_p}
  368.             else:
  369.                 send "%{tnt::CONFIG::MESSAGES.PREFIX}% &7This game is running" to {_p}
  370.         else:
  371.             send "%{tnt::CONFIG::MESSAGES.PREFIX}% &7This arena not exists" to {_p}
  372.     else:
  373.         send "%{tnt::CONFIG::MESSAGES.PREFIX}% %{tnt::CONFIG::MESSAGES.IN-GAME}%" to {_p}
  374.                    
  375. on join:
  376.     tnt_stats("check", player)
  377.        
  378. on right click:
  379.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  380.         name of event-item is {tnt::CONFIG::ITEMS.LEAVE-NAME}:
  381.             cancel event
  382.             tnt_leave(player)
  383. on quit:
  384.     tnt_leave(player)
  385.  
  386. on break:
  387.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  388.         cancel event
  389.    
  390. on place:
  391.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  392.         cancel event
  393.        
  394. on inventory click:
  395.     if display name of top inventory of player is "&8&l» &7TNTTag - ARENAS":
  396.         cancel event
  397.         event-item is green clay
  398.         set {_arena} to line 1 of the lore of event-item
  399.         tnt_join(player, last element of {_arena} split at "&8&l» &7ARENA: &e&l")
  400.     if {tnt.player::%uuid of player%.state} is "IN-GAME" or "IN-GAME-SPEC":
  401.         cancel event
  402.    
  403. function tnt_start_round(arena: text):
  404.     set {tnt.arena.%{_arena}%.explode} to 55
  405.     tnt_timer({_arena})
  406.     size of {tnt.arena.%{_arena}%.ninjas::*} > 4:
  407.         set {_total} to size of {tnt.arena.%{_arena}%.ninjas::*}
  408.         set {_r} to rounded {_total} * 20/100
  409.         set {_backup::*} to {tnt.arena.%{_arena}%.ninjas::*}
  410.         loop {_r} times:
  411.             set {_p} to a random element out of {_backup::*}
  412.             remove {_p} from {_backup::*}
  413.             tnt_set({_arena}, {_p})
  414.     else:
  415.         tnt_set({_arena}, random element out of {tnt.arena.%{_arena}%.ninjas::*})
  416.     loop {tnt.arena.%{_arena}%.ninjas::*}:
  417.         loop yaml list "MESSAGES.ROUND" from file "plugins/TNTTag/config.yml":
  418.             set {_msg} to loop-value-2
  419.             replace all "{round}" with "%{tnt.arena.%{_arena}%.round}%" in {_msg}
  420.             replace all "{players}" with "&7%{tnt.arena.%{_arena}%.exploding-ninjas::*}%" in {_msg}
  421.             if {tnt.player::%uuid of loop-value-1%.has-tnt} is set:
  422.                 set {_tag} to "&cYou START as IT! Tag Someone"
  423.             else:
  424.                 set {_tag} to "&aYou did NOT start as IT! Run away!"
  425.             replace all "{run-or-tag}" with "%{_tag}%" in {_msg}   
  426.             send coloured {_msg} to loop-value-1       
  427.            
  428. function tnt_timer(arena: text):
  429.     loop {tnt.arena.%{_arena}%.explode} times:
  430.         if {tnt.arena.%{_arena}%.status} is "INGAME":
  431.             remove 1 from {tnt.arena.%{_arena}%.explode}
  432.             {tnt.arena.%{_arena}%.explode} = 0:
  433.                 loop {tnt.arena.%{_arena}%.exploding-ninjas::*}:
  434.                     loop blocks in radius 3 of loop-value-2:
  435.                         show large explosion at loop-value-3
  436.                     play sound "ENTITY_GENERIC_EXPLODE" with volume 1 at loop-value-2
  437.                     size of {tnt.arena.%{_arena}%.ninjas::*} = 4 or 3 or 2 or 1:
  438.                         set {_size} to size of {tnt.arena.%{_arena}%.ninjas::*}
  439.                         set {tnt.arena.%{_arena}%.summary.%{_size}%} to loop-value-2
  440.                     remove loop-value-2 from {tnt.arena.%{_arena}%.ninjas::*}
  441.                     remove loop-value-2 from {tnt.arena.%{_arena}%.exploding-ninjas::*}
  442.                     add loop-value-2 to {tnt.arena.%{_arena}%.bad-ninjas::*}
  443.                     send "&7%loop-value-2% &eblew up!" to {tnt.arena.%{_arena}%.ninjas::*} and {tnt.arena.%{_arena}%.bad-ninjas::*}
  444.                     delete {tnt.player::%uuid of loop-value-2%.has-tnt}
  445.                     add 1 to {tnt.stats.loses::%uuid of loop-value-2%}
  446.                     tnt_setspec(loop-value-2)
  447.                     size of {tnt.arena.%{_arena}%.ninjas::*} = 1:
  448.                         tnt_check_win({_arena})
  449.                     else:
  450.                         add 1 to {tnt.arena.%{_arena}%.round}
  451.                         wait 5 seconds
  452.                         if {tnt.arena.%{_arena}%.status} is "INGAME":
  453.                             tnt_start_round({_arena})
  454.         else:
  455.             stop
  456.         wait a second  
  457.  
  458. function tnt_set(arena: text, p: player):  
  459.     set {_uuid} to uuid of {_p}
  460.     if {tnt.player::%{_uuid}%.has-tnt} is not set:
  461.         set {tnt.player::%{_uuid}%.has-tnt} to true
  462.         add {_p} to {tnt.arena.%{_arena}%.exploding-ninjas::*}
  463.         loop numbers between 0 and 8:
  464.             set slot loop-number of {_p} to tnt named "&cTNT"
  465.         set {_p}'s helmet to tnt
  466.         apply potion of speed 4 without any particles to {_p} for 7 days
  467.         send "%{_p}'s prefix%%{_p}% &7is IT!" to {tnt.arena.%{_arena}%.ninjas::*}
  468.         make console execute command "nte player %{_p}% prefix &c"
  469.         while {tnt.player::%{_uuid}%.has-tnt} is set:
  470.             show mob spawner flames at {_p}
  471.             wait a second
  472.  
  473.  
  474.        
  475. function tnt_setspec(p: player):
  476.     tnt_clear_player({_p})
  477.     set {_uuid} to uuid of {_p}
  478.     set {tnt.player::%{_uuid}%.state} to "IN-GAME-SPEC"
  479.     set {_p}'s gamemode to adventure
  480.     set {_p}'s flight mode to true 
  481.     apply potion of invisibility without any particles to {_p} for 7 days
  482.     push {_p} upwards at speed 2
  483.     make console execute command "nte player %{_p}% clear"
  484.     hide {_p} from all players
  485.     send title "&c&lBOOM" with subtitle "&7&nYou are eliminated!" to {_p} for 3 seconds
  486.                
  487. function tnt_start(arena: text):
  488.     set {tnt.arena.%{_arena}%.explode} to 55
  489.     set {tnt.arena.%{_arena}%.status} to "INGAME"  
  490.     set {tnt.arena.%{_arena}%.round} to 1
  491.     loop {tnt.arena.%{_arena}%.ninjas::*}: 
  492.         tnt_clear_player(loop-value)
  493.         tnt_createBoard(loop-value, "TNT-GAME", 11)
  494.         apply blindness to loop-value for 1 second
  495.         apply potion of speed 2 without any particles to loop-value for 7 days     
  496.         teleport loop-value-1 to {tnt.arena.%{_arena}%.spawn}
  497.         make console execute command "nte player %loop-value-1% prefix &7"
  498.     wait a second
  499.     if {tnt.arena.%{_arena}%.status} is "INGAME":
  500.         tnt_start_round({_arena})
  501.        
  502.  
  503. function tnt_start_countdown(arena: text):
  504.     set {tnt.arena.%{_arena}%.status} to "STARTING"
  505.     loop {tnt.arena.%{_arena}%.seconds} times:
  506.         if {tnt.arena.%{_arena}%.status} is "STARTING" or "WAITING":
  507.             size of {tnt.arena.%{_arena}%.ninjas::*} >= {tnt.arena.%{_arena}%.min}:
  508.                 wait a second
  509.                 remove 1 from {tnt.arena.%{_arena}%.seconds}   
  510.                 if {tnt.arena.%{_arena}%.seconds} = 1 or 2 or 3 or 4 or 5 or 10:
  511.                     set {_msg} to {tnt::CONFIG::MESSAGES.STARTING-IN}
  512.                     replace all "{seconds}" in {_msg} with "%{tnt.arena.%{_arena}%.seconds}%"
  513.                     send "%{tnt::CONFIG::MESSAGES.PREFIX}% %{_msg}%" to {tnt.arena.%{_arena}%.ninjas::*}
  514.                     {tnt.arena.%{_arena}%.seconds} > 1:
  515.                         send title "&eGame Starts in &a%{tnt.arena.%{_arena}%.seconds}%" with subtitle "&eSeconds" to {tnt.arena.%{_arena}%.ninjas::*} for a second
  516.                     else:
  517.                         send title "&eGame Starts in &a%{tnt.arena.%{_arena}%.seconds}%" with subtitle "&eSecond" to {tnt.arena.%{_arena}%.ninjas::*} for a second
  518.                 if {tnt.arena.%{_arena}%.seconds} = 1:
  519.                     size of {tnt.arena.%{_arena}%.ninjas::*} >= {tnt.arena.%{_arena}%.min}:
  520.                         tnt_start({_arena})
  521.             else:
  522.                 set {tnt.arena.%{_arena}%.status} to "WAITING"
  523.                 set {tnt.arena.%{_arena}%.seconds} to yaml value "TIMERS.WAITING" from file "plugins/TNTTag/config.yml"
  524.                 stop
  525.        
  526. function tnt_resetarena(arena: text):
  527.     loop {tnt.arena.%{_arena}%.ninjas::*} and {tnt.arena.%{_arena}%.bad-ninjas::*}:
  528.         if {tnt.player::%uuid of loop-value%.state} is "IN-GAME-SPEC":
  529.             reveal loop-value to all players
  530.         loop "arena" and "state" and "has-tnt":
  531.             delete {tnt.player::%uuid of loop-value-1%.%loop-value-2%} 
  532.         tnt_clear_player(loop-value-1)
  533.         tnt_deleteBoard(loop-value-1)
  534.         set loop-value-1's gamemode to spectator
  535.         push loop-value-1 upwards at speed 0.5
  536.         teleport loop-value-1 to {tnt.lobby}
  537.         set loop-value-1's gamemode to survival
  538.     loop 3 times:
  539.         delete {tnt.arena.%{_arena}%.summary.%loop-number%}    
  540.     delete {tnt.arena.%{_arena}%.ninjas::*} and {tnt.arena.%{_arena}%.bad-ninjas::*} and {tnt.arena.%{_arena}%.exploding-ninjas::*}                
  541.     set {tnt.arena.%{_arena}%.seconds} to yaml value "TIMERS.WAITING" from file "plugins/TNTTag/config.yml"
  542.     set {tnt.arena.%{_arena}%.status} to "WAITING"
  543.                            
  544. function tnt_clear_player(p: player):                      
  545.     heal {_p}
  546.     extinguish {_p}
  547.     set {_p}'s food to 20  
  548.     clear {_p}'s level
  549.     clear {_p}'s inventory
  550.     set {_p}'s gamemode to survival
  551.     set {_p}'s flight mode to false    
  552.     milk {_p}  
  553.    
  554. function tnt_deleteBoard(p: player):
  555.     loop "TNT-GAME" and "TNT-WAITING":
  556.         if stylish scoreboard "%loop-value-1%-%{_p}%" exists:
  557.             loop 15 times:
  558.                 delete the id based score "%{_p}%Slot%loop-number-2%" in stylish scoreboard "%loop-value-1%-%{_p}%"
  559.             delete stylish scoreboard "%loop-value-1%-%{_p}%"
  560.            
  561. function tnt_setSlot(p: player, board: text, slot: integer, t: text):
  562.     add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
  563.     if {_slot} is between 1 and 15:
  564.         set text of id "%{_p}%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"  
  565.  
  566. function tnt_createBoard(p: player, t: text, size: integer = 15):
  567.     set {_uuid} to uuid of {_p}
  568.     tnt_deleteBoard({_p})
  569.     add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
  570.     if stylish scoreboard "%{_t}%-%{_p}%" does not exist:
  571.         create new stylish scoreboard named "%{_t}%-%{_p}%"
  572.         loop {_size} times:
  573.             create a new id based score "%{_p}%Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%-%{_p}%"
  574.         wait a tick
  575.         set stylish scoreboard of {_p} to "%{_t}%-%{_p}%"
  576.     if {_t} is "TNT-GAME":
  577.         set title of stylish scoreboard "TNT-GAME-%{_p}%" to "&e&lTNT TAG"
  578.         while {tnt.arena.%{tnt.player::%{_uuid}%.arena}%.status} is "INGAME":
  579.             if {tnt.player::%{_uuid}%.has-tnt} is set:
  580.                 set {_target} to "&cTag Someone!"
  581.                 loop {tnt.arena.%{tnt.player::%{_uuid}%.arena}%.ninjas::*}:
  582.                     if {tnt.player::%uuid of loop-value%.has-tnt} is not set:
  583.                         set {_closest} to distance between loop-value-1 and {_p}
  584.                         distance between loop-value-1 and {_p} < {_closest}:
  585.                             set {_closest} to distance between loop-value-1 and {_p}
  586.                 send action bar "&cYou're IT, &ctag Someone! &7(&aNearest player %{_closest}%m&7)" to {_p}
  587.             else:
  588.                 set {_target} to "&aRun away!"
  589.                 send action bar "&aRun away!" to {_p}
  590.             if stylish scoreboard "TNT-GAME-%{_p}%" exists:
  591.                 tnt_setSlot({_p}, "TNT-GAME", 11, "&7%now%")       
  592.                 tnt_setSlot({_p}, "TNT-GAME", 10, "")                  
  593.                 tnt_setSlot({_p}, "TNT-GAME", 9, "&7Round ##%{tnt.arena.%{tnt.player::%{_uuid}%.arena}%.round}%")                  
  594.                 tnt_setSlot({_p}, "TNT-GAME", 8, "")               
  595.                 tnt_setSlot({_p}, "TNT-GAME", 7, "&eExplosion In &c%{tnt.arena.%{tnt.player::%{_uuid}%.arena}%.explode}%&cs")  
  596.                 tnt_setSlot({_p}, "TNT-GAME", 6, "")               
  597.                 tnt_setSlot({_p}, "TNT-GAME", 5, "&fGoal: %{_target}%")                
  598.                 tnt_setSlot({_p}, "TNT-GAME", 4, "")       
  599.                 tnt_setSlot({_p}, "TNT-GAME", 3, "&fAlive: &a%size of {tnt.arena.%{tnt.player::%{_uuid}%.arena}%.ninjas::*}% &aPlayers")                   
  600.                 tnt_setSlot({_p}, "TNT-GAME", 2, "")                                       
  601.                 tnt_setSlot({_p}, "TNT-GAME", 1, "%{tnt::CONFIG::SCOREBOARD.WEBSITE}%")            
  602.             else:
  603.                 stop               
  604.             wait a second
  605.     if {_t} is "TNT-WAITING":
  606.         set title of stylish scoreboard "TNT-WAITING-%{_p}%" to "&e&lTNT TAG"
  607.         while {tnt.arena.%{tnt.player::%{_uuid}%.arena}%.status} is "WAITING" or "STARTING":   
  608.             if stylish scoreboard "TNT-WAITING-%{_p}%" exists: 
  609.                 tnt_setSlot({_p}, "TNT-WAITING", 10, "&7%now%")
  610.                 tnt_setSlot({_p}, "TNT-WAITING", 9, "")    
  611.                 tnt_setSlot({_p}, "TNT-WAITING", 8, "&fMap: &a%{tnt.arena.%{tnt.player::%{_uuid}%.arena}%.map}%")      
  612.                 tnt_setSlot({_p}, "TNT-WAITING", 7, "&fPlayers: &a%size of {tnt.arena.%{tnt.player::%{_uuid}%.arena}%.ninjas::*}%/%{tnt.arena.%{tnt.player::%{_uuid}%.arena}%.max}%")  
  613.                 tnt_setSlot({_p}, "TNT-WAITING", 6, "")            
  614.                 tnt_setSlot({_p}, "TNT-WAITING", 5, "&fStarting in: &a%{tnt.arena.%{tnt.player::%{_uuid}%.arena}%.seconds}%s")             
  615.                 tnt_setSlot({_p}, "TNT-WAITING", 4, "")                    
  616.                 tnt_setSlot({_p}, "TNT-WAITING", 3, "&fArena: &a%{tnt.player::%{_uuid}%.arena}%")                  
  617.                 tnt_setSlot({_p}, "TNT-WAITING", 2, "")
  618.                 tnt_setSlot({_p}, "TNT-WAITING", 1, "%{tnt::CONFIG::SCOREBOARD.WEBSITE}%")             
  619.             else:
  620.                 stop           
  621.             wait a second
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top