Advertisement
Rida94

Untitled

Jun 12th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.49 KB | None | 0 0
  1. # +------------------------------------------------------+ #
  2. # | Version | #
  3. # +------------------------------------------------------+ #
  4.  
  5.  
  6. options:
  7. Version: 6.5
  8.  
  9.  
  10. # +------------------------------------------------------+ #
  11. # | Checks | #
  12. # +------------------------------------------------------+ #
  13.  
  14.  
  15. # Check for updates, create and fix config files on the script load and work as a fallback to disable the booster
  16. # if the server was offline when the booster gets expired
  17. on script enable:
  18. if yaml value "Updates.Update" from file "../../Booster/Config.yml" is not set:
  19. set yaml value "Updates.Update" from file "../../Booster/Config.yml" to "true"
  20. if yaml value "Updates.Version" from file "../../Booster/Config.yml" is not set:
  21. set yaml value "Updates.Version" from file "../../Booster/Config.yml" to "{@Version}"
  22. if yaml value "Updates.Version" from file "../../Booster/Config.yml" is not "{@Version}":
  23. set yaml value "Updates.Version" from file "../../Booster/Config.yml" to "{@Version}"
  24. if yaml value "Commands.Alias.Booster" from file "../../Booster/Config.yml" is not set:
  25. set yaml value "Commands.Alias.Booster" from file "../../Booster/Config.yml" to "mcMMoBooster"
  26. if yaml value "Commands.Alias.Thanks" from file "../../Booster/Config.yml" is not set:
  27. set yaml value "Commands.Alias.Thanks" from file "../../Booster/Config.yml" to "tip"
  28. if yaml value "Reload.Name" from file "../../Booster/Config.yml" is not set:
  29. set yaml value "Reload.Name" from file "../../Booster/Config.yml" to "Booster"
  30. if yaml value "Time.BoosterTime" from file "../../Booster/Config.yml" is not set:
  31. set yaml value "Time.BoosterTime" from file "../../Booster/Config.yml" to "1 hour"
  32. if yaml value "Time.ThanksCooldown" from file "../../Booster/Config.yml" is not set:
  33. set yaml value "Time.ThanksCooldown" from file "../../Booster/Config.yml" to "30 minutes"
  34. if yaml value "Permissions.Booster" from file "../../Booster/Config.yml" is not set:
  35. set yaml value "Permissions.Booster" from file "../../Booster/Config.yml" to "booster.booster"
  36. if yaml value "Permissions.Give" from file "../../Booster/Config.yml" is not set:
  37. set yaml value "Permissions.Give" from file "../../Booster/Config.yml" to "booster.give"
  38. if yaml value "Permissions.Cancel" from file "../../Booster/Config.yml" is not set:
  39. set yaml value "Permissions.Cancel" from file "../../Booster/Config.yml" to "booster.cancel"
  40. if yaml value "Permissions.Help" from file "../../Booster/Config.yml" is not set:
  41. set yaml value "Permissions.Help" from file "../../Booster/Config.yml" to "booster.help"
  42. if yaml value "Permissions.Reload" from file "../../Booster/Config.yml" is not set:
  43. set yaml value "Permissions.Reload" from file "../../Booster/Config.yml" to "booster.reload"
  44. if yaml value "Permissions.Version" from file "../../Booster/Config.yml" is not set:
  45. set yaml value "Permissions.Version" from file "../../Booster/Config.yml" to "booster.version"
  46. if yaml value "Permissions.Status" from file "../../Booster/Config.yml" is not set:
  47. set yaml value "Permissions.Status" from file "../../Booster/Config.yml" to "booster.status"
  48. if yaml value "Permissions.Thanks" from file "../../Booster/Config.yml" is not set:
  49. set yaml value "Permissions.Thanks" from file "../../Booster/Config.yml" to "booster.thanks"
  50. if yaml value "Permissions.Announce" from file "../../Booster/Config.yml" is not set:
  51. set yaml value "Permissions.Announce" from file "../../Booster/Config.yml" to "booster.announce"
  52. if yaml value "Permissions.Use" from file "../../Booster/Config.yml" is not set:
  53. set yaml value "Permissions.Use" from file "../../Booster/Config.yml" to "booster.use"
  54. if yaml value "Permissions.Update" from file "../../Booster/Config.yml" is not set:
  55. set yaml value "Permissions.Update" from file "../../Booster/Config.yml" to "booster.update"
  56. if yaml value "Booster.ItemID" from file "../../Booster/Config.yml" is not set:
  57. set yaml value "Booster.ItemID" from file "../../Booster/Config.yml" to "373:0"
  58. if yaml value "Booster.Name" from file "../../Booster/Config.yml" is not set:
  59. set yaml value "Booster.Name" from file "../../Booster/Config.yml" to "&4mcMMO Booster"
  60. if yaml value "Booster.Lore" from file "../../Booster/Config.yml" is not set:
  61. set yaml value "Booster.Lore" from file "../../Booster/Config.yml" to "&6Quad experience (60:0)||&f&k>> &dRight-click to activate &f&k<<"
  62. if yaml list "Activation.Activate" from file "../../Booster/Config.yml" is not set:
  63. add "/pex group default add mcmmo.perks.xp.quadruple" to yaml list "Activation.Activate" from file "../../Booster/Config.yml"
  64. add "/pex reload" to yaml list "Activation.Activate" from file "../../Booster/Config.yml"
  65. if yaml list "Activation.Deactivate" from file "../../Booster/Config.yml" is not set:
  66. add "/pex group default remove mcmmo.perks.xp.quadruple" to yaml list "Activation.Deactivate" from file "../../Booster/Config.yml"
  67. add "/pex reload" to yaml list "Activation.Deactivate" from file "../../Booster/Config.yml"
  68. if yaml list "Reward.Commands" from file "../../Booster/Config.yml" is not set:
  69. add "/eco give {Player} 100" to yaml list "Reward.Commands" from file "../../Booster/Config.yml"
  70. add "/tell {Player2} You thanked {Player}, and received a reward!" to yaml list "Reward.Commands" from file "../../Booster/Config.yml"
  71. add "/eco give {Player2} 10" to yaml list "Reward.Commands" from file "../../Booster/Config.yml"
  72. add "/tell {Player} {Player2} has thanked you, and you have received a reward!" to yaml list "Reward.Commands" from file "../../Booster/Config.yml"
  73. if yaml value "BoosterActivated" from file "../../Booster/Messages.yml" is not set:
  74. set yaml value "BoosterActivated" from file "../../Booster/Messages.yml" to "§a§l{Player} §6§lhas activated their mcMMO quad experience booster for 1 hour, type /thanks to thank them!"
  75. if yaml value "BoosterExpired" from file "../../Booster/Messages.yml" is not set:
  76. set yaml value "BoosterExpired" from file "../../Booster/Messages.yml" to "§a§l{Player}'s §4§lmcMMO quad experience booster has expired!"
  77. if yaml value "NoPermCommand" from file "../../Booster/Messages.yml" is not set:
  78. set yaml value "NoPermCommand" from file "../../Booster/Messages.yml" to "§4Error:§c You do not have permission to use this command!"
  79. if yaml value "NoPermBooster" from file "../../Booster/Messages.yml" is not set:
  80. set yaml value "NoPermBooster" from file "../../Booster/Messages.yml" to "§4Error:§c You do not have a permission to use a booster!"
  81. if yaml value "InvalidArgument" from file "../../Booster/Messages.yml" is not set:
  82. set yaml value "InvalidArgument" from file "../../Booster/Messages.yml" to "§4Error:§c Invalid argument!"
  83. if yaml value "GameMode" from file "../../Booster/Messages.yml" is not set:
  84. set yaml value "GameMode" from file "../../Booster/Messages.yml" to "§4You can not use a booster in this gamemode."
  85. if yaml value "Activate" from file "../../Booster/Messages.yml" is not set:
  86. set yaml value "Activate" from file "../../Booster/Messages.yml" to "§aYou have activated mcMMO quad experience booster for 1 hour!"
  87. if yaml value "ErrorActivated" from file "../../Booster/Messages.yml" is not set:
  88. set yaml value "ErrorActivated" from file "../../Booster/Messages.yml" to "§4You can not activate mcMMO quad experience booster, because there is an active booster!"
  89. if yaml value "ErrorCooldown" from file "../../Booster/Messages.yml" is not set:
  90. set yaml value "ErrorCooldown" from file "../../Booster/Messages.yml" to "§4You can use this command once every 30 minutes!"
  91. if yaml value "NoActiveBooster" from file "../../Booster/Messages.yml" is not set:
  92. set yaml value "NoActiveBooster" from file "../../Booster/Messages.yml" to "§4There is no active booster!"
  93. if yaml value "BoosterReceived" from file "../../Booster/Messages.yml" is not set:
  94. set yaml value "BoosterReceived" from file "../../Booster/Messages.yml" to "§aYou have received a booster!"
  95. if yaml value "BoosterSent" from file "../../Booster/Messages.yml" is not set:
  96. set yaml value "BoosterSent" from file "../../Booster/Messages.yml" to "§aYou have sent a booster to {Player}!"
  97. if yaml value "SelfThanks" from file "../../Booster/Messages.yml" is not set:
  98. set yaml value "SelfThanks" from file "../../Booster/Messages.yml" to "§4Sorry, you can not thank yourself!"
  99. if yaml value "ConsoleThanks" from file "../../Booster/Messages.yml" is not set:
  100. set yaml value "ConsoleThanks" from file "../../Booster/Messages.yml" to "§4Sorry, this command is only executable by players!"
  101. if yaml value "JoinActive" from file "../../Booster/Messages.yml" is not set:
  102. set yaml value "JoinActive" from file "../../Booster/Messages.yml" to "§a§l{Player} §6§lhas an active mcMMO quad experience booster, do /thanks to thank them!"
  103. if yaml value "CancelMSG" from file "../../Booster/Messages.yml" is not set:
  104. set yaml value "CancelMSG" from file "../../Booster/Messages.yml" to "§aYou have successfully canceled the current booster!"
  105. if yaml value "CurrentBooster" from file "../../Booster/Messages.yml" is not set:
  106. set yaml value "CurrentBooster" from file "../../Booster/Messages.yml" to "§aThere is an active booster!"
  107. if yaml value "CancelAnnounce" from file "../../Booster/Messages.yml" is not set:
  108. set yaml value "CancelAnnounce" from file "../../Booster/Messages.yml" to "§a§l{Player}'s §4§lmcMMO quad experience booster has been canceled by §a§l{Player2}§4§l!"
  109. if yaml value "BoosterActivateNotOnlineMSG" from file "../../Booster/Messages.yml" is not set:
  110. set yaml value "BoosterActivateNotOnlineMSG" from file "../../Booster/Messages.yml" to "§4Error:§c This player is not online."
  111. if yaml value "BoosterMSG" from file "../../Booster/Messages.yml" is not set:
  112. set yaml value "BoosterMSG" from file "../../Booster/Messages.yml" to "§6Do ""/booster help"" For help."
  113. if yaml value "BoosterGiveUsage" from file "../../Booster/Messages.yml" is not set:
  114. set yaml value "BoosterGiveUsage" from file "../../Booster/Messages.yml" to "§4Usage:§c /booster give <player>"
  115. if yaml value "BoosterStatusUsage" from file "../../Booster/Messages.yml" is not set:
  116. set yaml value "BoosterStatusUsage" from file "../../Booster/Messages.yml" to "§4Usage:§c /booster status"
  117. if yaml value "BoosterCancelUsage" from file "../../Booster/Messages.yml" is not set:
  118. set yaml value "BoosterCancelUsage" from file "../../Booster/Messages.yml" to "§4Usage:§c /booster cancel"
  119. if yaml value "BoosterVersionUsage" from file "../../Booster/Messages.yml" is not set:
  120. set yaml value "BoosterVersionUsage" from file "../../Booster/Messages.yml" to "§4Usage:§c /booster version"
  121. if yaml value "Version" from file "../../Booster/Messages.yml" is not set:
  122. set yaml value "Version" from file "../../Booster/Messages.yml" to "&amcMMO Booster version {Version} created by CodeRida."
  123. if yaml list "Help" from file "../../Booster/Messages.yml" is not set:
  124. add "&6&m------------------ &4mcMMO Booster help&6&m -----------------" to yaml list "Help" from file "../../Booster/Messages.yml"
  125. add "&f/booster help&7:&6 Print this help message." to yaml list "Help" from file "../../Booster/Messages.yml"
  126. add "&f/booster give <player>&7:&6 Give a booster to the player." to yaml list "Help" from file "../../Booster/Messages.yml"
  127. add "&f/booster cancel&7:&6 Cancel the active booster." to yaml list "Help" from file "../../Booster/Messages.yml"
  128. add "&f/booster reload&7:&6 Reload the booster script." to yaml list "Help" from file "../../Booster/Messages.yml"
  129. add "&f/booster version&7:&6 Check which version of mcMMO Booster you have." to yaml list "Help" from file "../../Booster/Messages.yml"
  130. add "&f/booster status&7:&6 Check if there is an active booster or not." to yaml list "Help" from file "../../Booster/Messages.yml"
  131. add "&f/booster activate <player>&7:&6 Activate a booster for a player" to yaml list "Help" from file "../../Booster/Messages.yml"
  132. add "&f/thanks&7:&6 Thank the person that has an active booster and receive a reward." to yaml list "Help" from file "../../Booster/Messages.yml"
  133. add "&6&m-----------------------------------------------------" to yaml list "Help" from file "../../Booster/Messages.yml"
  134. set {BoosterUpdateStatus} to yaml value "Updates.Update" from file "../../Booster/Config.yml"
  135. set {BoosterUpdateVersion} to yaml value "Updates.Version" from file "../../Booster/Config.yml"
  136. set {BoosterBoosterCommandAlias} to yaml value "Commands.Alias.Booster" from file "../../Booster/Config.yml"
  137. set {BoosterThanksCommandAlias} to yaml value "Commands.Alias.Thanks" from file "../../Booster/Config.yml"
  138. set {BoosterReloadName} to yaml value "Reload.Name" from file "../../Booster/Config.yml"
  139. set {BoosterBoosterTime} to yaml value "Time.BoosterTime" from file "../../Booster/Config.yml"
  140. set {BoosterThanksCooldown} to yaml value "Time.ThanksCooldown" from file "../../Booster/Config.yml"
  141. set {BoosterUsePerm} to yaml value "Permissions.Use" from file "../../Booster/Config.yml"
  142. set {BoosterBoosterMainCommand} to yaml value "Permissions.Booster" from file "../../Booster/Config.yml"
  143. set {BoosterGivePerm} to yaml value "Permissions.Give" from file "../../Booster/Config.yml"
  144. set {BoosterCancelPerm} to yaml value "Permissions.Cancel" from file "../../Booster/Config.yml"
  145. set {BoosterHelpPerm} to yaml value "Permissions.Help" from file "../../Booster/Config.yml"
  146. set {BoosterReloadPerm} to yaml value "Permissions.Reload" from file "../../Booster/Config.yml"
  147. set {BoosterStatusPerm} to yaml value "Permissions.Status" from file "../../Booster/Config.yml"
  148. set {BoosterVersionPerm} to yaml value "Permissions.Version" from file "../../Booster/Config.yml"
  149. set {BoosterActivatePerm} to yaml value "Permissions.Activate" from file "../../Booster/Config.yml"
  150. set {BoosterThanksPerm} to yaml value "Permissions.Thanks" from file "../../Booster/Config.yml"
  151. set {BoosterAnnouncePerm} to yaml value "Permissions.Announce" from file "../../Booster/Config.yml"
  152. set {BoosterUpdatePerm} to yaml value "Permissions.Update" from file "../../Booster/Config.yml"
  153. set {BoosterItemID} to yaml value "Booster.ItemID" from file "../../Booster/Config.yml"
  154. set {BoosterName} to yaml value "Booster.Name" from file "../../Booster/Config.yml"
  155. set {BoosterLore} to yaml value "Booster.Lore" from file "../../Booster/Config.yml"
  156. set {BoosterActivation::*} to yaml list "Activation.Activate" from file "../../Booster/Config.yml"
  157. set {BoosterDeactivation::*} to yaml list "Activation.Deactivate" from file "../../Booster/Config.yml"
  158. set {BoosterRewards::*} to yaml list "Reward.Commands" from file "../../Booster/Config.yml"
  159. set {BoosterActivated} to yaml value "BoosterActivated" from file "../../Booster/Messages.yml"
  160. set {BoosterExpired} to yaml value "BoosterExpired" from file "../../Booster/Messages.yml"
  161. set {BoosterNoPermCommand} to yaml value "NoPermCommand" from file "../../Booster/Messages.yml"
  162. set {NoPermBooster} to yaml value "NoPermBooster" from file "../../Booster/Messages.yml"
  163. set {BoosterInvalidArgument} to yaml value "InvalidArgument" from file "../../Booster/Messages.yml"
  164. set {BoosterNoGameMode} to yaml value "GameMode" from file "../../Booster/Messages.yml"
  165. set {BoosterActivate} to yaml value "Activate" from file "../../Booster/Messages.yml"
  166. set {BoosterErrorActivated} to yaml value "ErrorActivated" from file "../../Booster/Messages.yml"
  167. set {BoosterErrorCooldown} to yaml value "ErrorCooldown" from file "../../Booster/Messages.yml"
  168. set {NoActiveBooster} to yaml value "NoActiveBooster" from file "../../Booster/Messages.yml"
  169. set {BoosterReceived} to yaml value "BoosterReceived" from file "../../Booster/Messages.yml"
  170. set {BoosterSent} to yaml value "BoosterSent" from file "../../Booster/Messages.yml"
  171. set {BoosterSelfThanks} to yaml value "SelfThanks" from file "../../Booster/Messages.yml"
  172. set {BoosterConsoleThanks} to yaml value "ConsoleThanks" from file "../../Booster/Messages.yml"
  173. set {BoosterJoinActive} to yaml value "JoinActive" from file "../../Booster/Messages.yml"
  174. set {BoosterCancelMSG} to yaml value "CancelMSG" from file "../../Booster/Messages.yml"
  175. set {CurrentBooster} to yaml value "CurrentBooster" from file "../../Booster/Messages.yml"
  176. set {BoosterCancelAnnounce} to yaml value "CancelAnnounce" from file "../../Booster/Messages.yml"
  177. set {BoosterActivateNotOnlineMSG} to yaml value "BoosterActivateNotOnlineMSG" from file "../../Booster/Messages.yml"
  178. set {BoosterMSG} to yaml value "BoosterMSG" from file "../../Booster/Messages.yml"
  179. set {BoosterGiveUsage} to yaml value "BoosterGiveUsage" from file "../../Booster/Messages.yml"
  180. set {BoosterStatusUsage} to yaml value "BoosterStatusUsage" from file "../../Booster/Messages.yml"
  181. set {BoosterCancelUsage} to yaml value "BoosterCancelUsage" from file "../../Booster/Messages.yml"
  182. set {BoosterActivateUsage} to yaml value "BoosterActivateUsage" from file "../../Booster/Messages.yml"
  183. set {BoosterVersionUsage} to yaml value "BoosterVersionUsage" from file "../../Booster/Messages.yml"
  184. set {BoosterVersionMessage} to yaml value "Version" from file "../../Booster/Messages.yml"
  185. set {BoosterHelpMessages::*} to yaml list "Help" from file "../../Booster/Messages.yml"
  186. set {BoosterName} to colored {BoosterName}
  187. set {BoosterLore} to colored {BoosterLore}
  188. set {BoosterActivated} to colored {BoosterActivated}
  189. set {BoosterExpired} to colored {BoosterExpired}
  190. set {BoosterNoPermCommand} to colored {BoosterNoPermCommand}
  191. set {NoPermBooster} to colored {NoPermBooster}
  192. set {BoosterInvalidArgument} to colored {BoosterInvalidArgument}
  193. set {BoosterNoGameMode} to colored {BoosterNoGameMode}
  194. set {BoosterActivate} to colored {BoosterActivate}
  195. set {BoosterErrorActivated} to colored {BoosterErrorActivated}
  196. set {BoosterErrorCooldown} to colored {BoosterErrorCooldown}
  197. set {NoActiveBooster} to colored {NoActiveBooster}
  198. set {BoosterReceived} to colored {BoosterReceived}
  199. set {BoosterSent} to colored {BoosterSent}
  200. set {BoosterSelfThanks} to colored {BoosterSelfThanks}
  201. set {BoosterConsoleThanks} to colored {BoosterConsoleThanks}
  202. set {BoosterJoinActive} to colored {BoosterJoinActive}
  203. set {BoosterCancelMSG} to colored {BoosterCancelMSG}
  204. set {CurrentBooster} to colored {CurrentBooster}
  205. set {BoosterActivateNotOnlineMSG} to colored {BoosterActivateNotOnlineMSG}
  206. set {BoosterMSG} to colored {BoosterMSG}
  207. set {BoosterGiveUsage} to colored {BoosterGiveUsage}
  208. set {BoosterStatusUsage} to colored {BoosterStatusUsage}
  209. set {BoosterCancelUsage} to colored {BoosterCancelUsage}
  210. set {BoosterActivateUsage} to colored {BoosterActivateUsage}
  211. set {BoosterVersionUsage} to colored {BoosterVersionUsage}
  212. set {BoosterVersion} to colored {BoosterVersion}
  213. set {BoosterHelpMessages::*} to colored {BoosterHelpMessages::*}
  214. set {BoosterVersion} to colored {BoosterVersion}
  215. set {BoosterItemID} to {BoosterItemID} parsed as item type
  216. set {BoosterVersionMessage} to colored {BoosterVersionMessage}
  217. set {BoosterThanksCooldown} to {BoosterThanksCooldown} parsed as timespan
  218. set {BoosterBoosterTime} to {BoosterBoosterTime} parsed as timespan
  219. message "&a[mcMMoBooster] Loading mcMMO Booster %{BoosterUpdateVersion}%" to console
  220. message "&a[mcMMoBooster] Enabling mcMMO Booster %{BoosterUpdateVersion}%" to console
  221. message "&a[mcMMoBooster] mcMMO Booster %{BoosterUpdateVersion}% by CodeRida has been enabled" to console
  222. if {BoosterUpdateStatus} is "true":
  223. if text from "http://pastebin.com/raw/WTqrzKNV" is not "%{BoosterUpdateVersion}%":
  224. set {Booster::Version::Outdated} to true
  225. message "&a[mcMMoBooster] mcMMO booster has an update on" to console
  226. message "&a[mcMMoBooster] https://www.spigotmc.org/resources/16603/" to console
  227. else:
  228. message "&a[mcMMoBooster] You are running the latest version of mcMMO Booster" to console
  229. delete {Booster::Version::Outdated}
  230. if {Booster::Active::Status} is true:
  231. if difference between {Booster::Active::Time} and now is more than {BoosterBoosterTime}:
  232. if {BoosterDeactivation::1} is set:
  233. execute console command "%{BoosterDeactivation::1}%"
  234. if {BoosterDeactivation::2} is set:
  235. execute console command "%{BoosterDeactivation::2}%"
  236. if {BoosterDeactivation::3} is set:
  237. execute console command "%{BoosterDeactivation::3}%"
  238. if {BoosterDeactivation::4} is set:
  239. execute console command "%{BoosterDeactivation::4}%"
  240. if {BoosterDeactivation::5} is set:
  241. execute console command "%{BoosterDeactivation::5}%"
  242. if {BoosterDeactivation::6} is set:
  243. execute console command "%{BoosterDeactivation::6}%"
  244. if {BoosterDeactivation::7} is set:
  245. execute console command "%{BoosterDeactivation::7}%"
  246. if {BoosterDeactivation::8} is set:
  247. execute console command "%{BoosterDeactivation::8}%"
  248. if {BoosterDeactivation::9} is set:
  249. execute console command "%{BoosterDeactivation::9}%"
  250. if {BoosterDeactivation::10} is set:
  251. execute console command "%{BoosterDeactivation::10}%"
  252. loop all players:
  253. loop-player has the permission "%{BoosterAnnouncePerm}%":
  254. message "%{BoosterExpired}%" to loop-player
  255. delete {Booster::Owner::SelfThanks::%{Booster::Owner::Name}%}
  256. delete {Booster::Owner::Name}
  257. delete {Booster::Owner::DisplayName}
  258. delete {Booster::Cooldown::Thanks::*}
  259. delete {Booster::Active::Time}
  260. delete {Booster::Active::Status}
  261. else:
  262. stop
  263. else:
  264. stop
  265.  
  266.  
  267. # +------------------------------------------------------+ #
  268. # | Booster Item | #
  269. # +------------------------------------------------------+ #
  270.  
  271.  
  272. # Check for updates peridicly and disable the booster when its expired
  273. every 1 second:
  274. if {Booster::Active::Status} is true:
  275. if difference between {Booster::Active::Time} and now is more than {BoosterBoosterTime}:
  276. loop all players:
  277. loop-player has the permission "%{BoosterAnnouncePerm}%":
  278. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterExpired}
  279. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterExpired}
  280. message "%{BoosterExpired}%" to loop-player
  281. if {BoosterDeactivation::1} is set:
  282. execute console command "%{BoosterDeactivation::1}%"
  283. if {BoosterDeactivation::2} is set:
  284. execute console command "%{BoosterDeactivation::2}%"
  285. if {BoosterDeactivation::3} is set:
  286. execute console command "%{BoosterDeactivation::3}%"
  287. if {BoosterDeactivation::4} is set:
  288. execute console command "%{BoosterDeactivation::4}%"
  289. if {BoosterDeactivation::5} is set:
  290. execute console command "%{BoosterDeactivation::5}%"
  291. if {BoosterDeactivation::6} is set:
  292. execute console command "%{BoosterDeactivation::6}%"
  293. if {BoosterDeactivation::7} is set:
  294. execute console command "%{BoosterDeactivation::7}%"
  295. if {BoosterDeactivation::8} is set:
  296. execute console command "%{BoosterDeactivation::8}%"
  297. if {BoosterDeactivation::9} is set:
  298. execute console command "%{BoosterDeactivation::9}%"
  299. if {BoosterDeactivation::10} is set:
  300. execute console command "%{BoosterDeactivation::10}%"
  301. delete {Booster::Owner::SelfThanks::%{Booster::Owner::Name}%}
  302. delete {Booster::Owner::Name}
  303. delete {Booster::Owner::DisplayName}
  304. delete {Booster::Cooldown::Thanks::*}
  305. delete {Booster::Active::Time}
  306. delete {Booster::Active::Status}
  307. else:
  308. stop
  309. if {BoosterUpdateStatus} is "true":
  310. if text from "http://pastebin.com/raw/WTqrzKNV" is not "%{BoosterUpdateVersion}%":
  311. set {Booster::Version::Outdated} to true
  312. else:
  313. delete {Booster::Version::Outdated}
  314. stop
  315. else:
  316. stop
  317.  
  318.  
  319. # Work as a fallback to disable the booster if the server crash
  320. on script disable:
  321. message "&4[mcMMoBooster] Disabling mcMMO Booster %{BoosterUpdateVersion}%" to console
  322. message "&4[mcMMoBooster] mcMMO Booster %{BoosterUpdateVersion}% is now disabled" to console
  323. delete {BoosterUpdateStatus}
  324. delete {BoosterUpdateVersion}
  325. delete {BoosterBoosterCommandAlias}
  326. delete {BoosterThanksCommandAlias}
  327. delete {BoosterReloadName}
  328. delete {BoosterBoosterTime}
  329. delete {BoosterThanksCooldown}
  330. delete {BoosterUsePerm}
  331. delete {BoosterBoosterMainCommand}
  332. delete {BoosterGivePerm}
  333. delete {BoosterCancelPerm}
  334. delete {BoosterHelpPerm}
  335. delete {BoosterReloadPerm}
  336. delete {BoosterStatusPerm}
  337. delete {BoosterVersionPerm}
  338. delete {BoosterActivatePerm}
  339. delete {BoosterThanksPerm}
  340. delete {BoosterAnnouncePerm}
  341. delete {BoosterUpdatePerm}
  342. delete {BoosterItemID}
  343. delete {BoosterName}
  344. delete {BoosterLore}
  345. delete {BoosterActivation::*}
  346. delete {BoosterDeactivation::*}
  347. delete {BoosterRewards::*}
  348. delete {BoosterActivated}
  349. delete {BoosterExpired}
  350. delete {BoosterNoPermCommand}
  351. delete {NoPermBooster}
  352. delete {BoosterInvalidArgument}
  353. delete {BoosterNoGameMode}
  354. delete {BoosterActivate}
  355. delete {BoosterErrorActivated}
  356. delete {BoosterErrorCooldown}
  357. delete {NoActiveBooster}
  358. delete {BoosterReceived}
  359. delete {BoosterSent}
  360. delete {BoosterSelfThanks}
  361. delete {BoosterConsoleThanks}
  362. delete {BoosterJoinActive}
  363. delete {BoosterCancelMSG}
  364. delete {CurrentBooster}
  365. delete {BoosterCancelAnnounce}
  366. delete {BoosterActivateNotOnlineMSG}
  367. delete {BoosterMSG}
  368. delete {BoosterGiveUsage}
  369. delete {BoosterStatusUsage}
  370. delete {BoosterCancelUsage}
  371. delete {BoosterActivateUsage}
  372. delete {BoosterVersionUsage}
  373. delete {BoosterHelpMessages::*}
  374. delete {BoosterVersion}
  375. if {Booster::Active::Status} is true:
  376. if {BoosterDeactivation::1} is set:
  377. execute console command "%{BoosterDeactivation::1}%"
  378. if {BoosterDeactivation::2} is set:
  379. execute console command "%{BoosterDeactivation::2}%"
  380. if {BoosterDeactivation::3} is set:
  381. execute console command "%{BoosterDeactivation::3}%"
  382. if {BoosterDeactivation::4} is set:
  383. execute console command "%{BoosterDeactivation::4}%"
  384. if {BoosterDeactivation::5} is set:
  385. execute console command "%{BoosterDeactivation::5}%"
  386. if {BoosterDeactivation::6} is set:
  387. execute console command "%{BoosterDeactivation::6}%"
  388. if {BoosterDeactivation::7} is set:
  389. execute console command "%{BoosterDeactivation::7}%"
  390. if {BoosterDeactivation::8} is set:
  391. execute console command "%{BoosterDeactivation::8}%"
  392. if {BoosterDeactivation::9} is set:
  393. execute console command "%{BoosterDeactivation::9}%"
  394. if {BoosterDeactivation::10} is set:
  395. execute console command "%{BoosterDeactivation::10}%"
  396. if difference between {Booster::Active::Time} and now is more than {BoosterBoosterTime}:
  397. loop all players:
  398. loop-player has the permission "%{BoosterAnnouncePerm}%":
  399. message "%{BoosterExpired}%" to loop-player
  400. delete {Booster::Owner::SelfThanks::%{Booster::Owner::Name}%}
  401. delete {Booster::Owner::Name}
  402. delete {Booster::Owner::DisplayName}
  403. delete {Booster::Cooldown::Thanks::*}
  404. delete {Booster::Active::Time}
  405. delete {Booster::Active::Status}
  406. delete {Booster::Version::Outdated}
  407. else:
  408. stop
  409. else:
  410. delete {Booster::*}
  411. stop
  412.  
  413.  
  414. # +------------------------------------------------------+ #
  415. # | Join Event | #
  416. # +------------------------------------------------------+ #
  417.  
  418. # Annouce if there is an active booster to the player having the right permission on join
  419. # And announce if there is an update to the server admins
  420. on join:
  421. if {Booster::Active::Status} is true:
  422. if player has permission "%{BoosterAnnouncePerm}%":
  423. replace all "{Player}" with "{Booster::Owner::Name}" in {BoosterJoinActive}
  424. replace all "{PlayerDisplayName}" with "{Booster::Owner::DisplayName}" in {BoosterJoinActive}
  425. message "%{BoosterJoinActive}%"
  426. if {BoosterUpdateStatus} is "true":
  427. if {Booster::Version::Outdated} is true:
  428. player has permission "%{BoosterUpdatePerm}%"
  429. message "&a[mcMMoBooster] mcMMO booster has an update on" to player
  430. message "&a[mcMMoBooster] https://www.spigotmc.org/resources/16603/" to player
  431.  
  432.  
  433. # +------------------------------------------------------+ #
  434. # | Commands | #
  435. # +------------------------------------------------------+ #
  436.  
  437.  
  438. # The command /thanks which is used to award the player that has activated the booster
  439. # and the player that have executed the thanks command
  440. command /thanks:
  441. description: thank the booster activator.
  442. usage: /thanks
  443. trigger:
  444. if player does not have permission "%{BoosterThanksPerm}%":
  445. message "%{BoosterNoPermCommand}%"
  446. stop
  447. if {Booster::Active::Status} is true:
  448. if sender is a player:
  449. set {_Sender} to sender's name
  450. set {_SenderDName} to sender's display name
  451. if {Booster::Owner::SelfThanks::%player%} is not set:
  452. if {Booster::Cooldown::Thanks::%player%} is not set:
  453. if {BoosterRewards::1} is set:
  454. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::1}
  455. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::1}
  456. replace all "{Player2}" with "%player%" in {BoosterRewards::1}
  457. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::1}
  458. execute console command "%{BoosterRewards::1}%"
  459. if {BoosterRewards::2} is set:
  460. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::2}
  461. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::2}
  462. replace all "{Player2}" with "%player%" in {BoosterRewards::2}
  463. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::2}
  464. execute console command "%{BoosterRewards::2}%"
  465. if {BoosterRewards::3} is set:
  466. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::3}
  467. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::3}
  468. replace all "{Player2}" with "%player%" in {BoosterRewards::3}
  469. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::3}
  470. execute console command "%{BoosterRewards::3}%"
  471. if {BoosterRewards::4} is set:
  472. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::4}
  473. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::4}
  474. replace all "{Player2}" with "%player%" in {BoosterRewards::4}
  475. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::4}
  476. execute console command "%{BoosterRewards::4}%"
  477. if {BoosterRewards::5} is set:
  478. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::5}
  479. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::5}
  480. replace all "{Player2}" with "%player%" in {BoosterRewards::5}
  481. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::5}
  482. execute console command "%{BoosterRewards::5}%"
  483. if {BoosterRewards::6} is set:
  484. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::6}
  485. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::6}
  486. replace all "{Player2}" with "%player%" in {BoosterRewards::6}
  487. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::6}
  488. execute console command "%{BoosterRewards::6}%"
  489. if {BoosterRewards::7} is set:
  490. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::7}
  491. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::7}
  492. replace all "{Player2}" with "%player%" in {BoosterRewards::7}
  493. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::7}
  494. execute console command "%{BoosterRewards::7}%"
  495. if {BoosterRewards::8} is set:
  496. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::8}
  497. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::8}
  498. replace all "{Player2}" with "%player%" in {BoosterRewards::8}
  499. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::8}
  500. execute console command "%{BoosterRewards::8}%"
  501. if {BoosterRewards::9} is set:
  502. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::9}
  503. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::9}
  504. replace all "{Player2}" with "%player%" in {BoosterRewards::9}
  505. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::9}
  506. execute console command "%{BoosterRewards::9}%"
  507. if {BoosterRewards::10} is set:
  508. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterRewards::10}
  509. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterRewards::10}
  510. replace all "{Player2}" with "%player%" in {BoosterRewards::10}
  511. replace all "{PlayerDisplayName2}" with "%player's displayname%" in {BoosterRewards::10}
  512. execute console command "%{BoosterRewards::10}%"
  513. delete {_Sender}
  514. delete {_SenderDName}
  515. set {Booster::Cooldown::Thanks::%player%} to now
  516. else:
  517. if difference between {Booster::Cooldown::Thanks::%player%} and now is less than {BoosterThanksCooldown}:
  518. message "%{BoosterErrorCooldown}%"
  519. else:
  520. delete {Booster::Cooldown::Thanks::%player%}
  521. else:
  522. message "%{BoosterSelfThanks}%"
  523. if sender is not a player:
  524. message "%{BoosterConsoleThanks}%"
  525. else:
  526. message "%{NoActiveBooster}%"
  527.  
  528.  
  529. # The main command of this script
  530. command /booster [<text>] [<player>]:
  531. description: Main command for the mcMMO booster.
  532. usage: /booster <help:give:cancel:reload:status:version>
  533. trigger:
  534. if player does not have permission "%{BoosterBoosterMainCommand}%":
  535. message "%{BoosterNoPermCommand}%"
  536. stop
  537. if argument 1 is not set:
  538. message "%{BoosterMSG}%"
  539. if argument 1 is "help":
  540. if argument 2 is not set:
  541. if player does not have permission "%{BoosterHelpPerm}%":
  542. message "%{BoosterNoPermCommand}%"
  543. stop
  544. else:
  545. if {BoosterHelpMessages::1} is set:
  546. message "%{BoosterHelpMessages::1}%"
  547. if {BoosterHelpMessages::2} is set:
  548. message "%{BoosterHelpMessages::2}%"
  549. if {BoosterHelpMessages::3} is set:
  550. message "%{BoosterHelpMessages::3}%"
  551. if {BoosterHelpMessages::4} is set:
  552. message "%{BoosterHelpMessages::4}%"
  553. if {BoosterHelpMessages::5} is set:
  554. message "%{BoosterHelpMessages::5}%"
  555. if {BoosterHelpMessages::6} is set:
  556. message "%{BoosterHelpMessages::6}%"
  557. if {BoosterHelpMessages::7} is set:
  558. message "%{BoosterHelpMessages::7}%"
  559. if {BoosterHelpMessages::8} is set:
  560. message "%{BoosterHelpMessages::8}%"
  561. if {BoosterHelpMessages::9} is set:
  562. message "%{BoosterHelpMessages::9}%"
  563. if {BoosterHelpMessages::10} is set:
  564. message "%{BoosterHelpMessages::10}%"
  565. if {BoosterHelpMessages::11} is set:
  566. message "%{BoosterHelpMessages::11}%"
  567. if argument 2 is set:
  568. message "%{BoosterHelpUsage}%"
  569.  
  570. if argument 1 is "reload":
  571. if sender is a player:
  572. if player has permission "%{BoosterReloadPerm}%":
  573. make player execute command "sk reload %{BoosterReloadName}%"
  574. else:
  575. message "%{BoosterNoPermCommand}%"
  576. else:
  577. execute console command "sk reload %{BoosterReloadName}%"
  578.  
  579. if argument 1 is "give":
  580. if sender have permission "%{BoosterGivePerm}%":
  581. if argument 2 is set:
  582. set {_Booster::Give::Player} to argument 2
  583. set {_Booster::Give::PlayerDisplayName} to argument 2's display name
  584. message "%{BoosterReceived}%" to {_Booster::Give::Player}
  585. replace all "{Player}" with "%{_Booster::Give::Player}%" in {BoosterSent}
  586. replace all "{PlayerDisplayName}" with "%{_Booster::Give::PlayerDisplayName}%" in {BoosterSent}
  587. message "%{BoosterSent}%" to sender
  588. give {_Booster::Give::Player} 1 of {BoosterItemID} named "%{BoosterName}%" with lore "%{BoosterLore}%"
  589. wait 2 ticks
  590. delete {_Booster::Give::Player}
  591. else:
  592. message "%{BoosterGiveUsage}%"
  593. else:
  594. message "%{BoosterNoPermCommand}%"
  595. if argument 1 is "status":
  596. if argument 2 is set:
  597. message "%{BoosterStatusUsage}%"
  598. if argument 2 is not set:
  599. if player does not have permission "%{BoosterStatusPerm}%":
  600. message "%{BoosterNoPermCommand}%"
  601. else:
  602. if {Booster::Active::Status} is not set:
  603. message "%{NoActiveBooster}%"
  604. else:
  605. message "%{CurrentBooster}%"
  606. if argument 1 is "cancel":
  607. if player does not have permission "%{BoosterCancelPerm}%":
  608. message "%{BoosterNoPermCommand}%"
  609. else:
  610. if argument 2 is set:
  611. message "%{BoosterCancelUsage}%"
  612. if argument 2 is not set:
  613. if {Booster::Active::Status} is not set:
  614. message "%{NoActiveBooster}%"
  615. else:
  616. loop all players:
  617. loop-player has the permission "%{BoosterAnnouncePerm}%":
  618. if sender is a player:
  619. set {_Booster::Cancel::Name} to player's name
  620. set {_Booster::Cancel::DisplayName} to player's displayname
  621. if sender is not a player:
  622. set {_Booster::Cancel::Name} to "Console"
  623. set {_Booster::Cancel::DisplayName} to "Console"
  624. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterCancelAnnounce}
  625. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterCancelAnnounce}
  626. replace all "{Player2}" with "%{_Booster::Cancel::Name}%" in {BoosterCancelAnnounce}
  627. replace all "{Player2DisplayName}" with "%{_Booster::Cancel::DisplayName}%" in {BoosterCancelAnnounce}
  628. message "%{BoosterCancelAnnounce}%" to loop-player
  629. if {BoosterDeactivation::1} is set:
  630. execute console command "%{BoosterDeactivation::1}%"
  631. if {BoosterDeactivation::2} is set:
  632. execute console command "%{BoosterDeactivation::2}%"
  633. if {BoosterDeactivation::3} is set:
  634. execute console command "%{BoosterDeactivation::3}%"
  635. if {BoosterDeactivation::4} is set:
  636. execute console command "%{BoosterDeactivation::4}%"
  637. if {BoosterDeactivation::5} is set:
  638. execute console command "%{BoosterDeactivation::5}%"
  639. if {BoosterDeactivation::6} is set:
  640. execute console command "%{BoosterDeactivation::6}%"
  641. if {BoosterDeactivation::7} is set:
  642. execute console command "%{BoosterDeactivation::7}%"
  643. if {BoosterDeactivation::8} is set:
  644. execute console command "%{BoosterDeactivation::8}%"
  645. if {BoosterDeactivation::9} is set:
  646. execute console command "%{BoosterDeactivation::9}%"
  647. if {BoosterDeactivation::10} is set:
  648. execute console command "%{BoosterDeactivation::10}%"
  649. delete {Booster::Owner::SelfThanks::%{Booster::Owner::Name}%}
  650. delete {Booster::Owner::Name}
  651. delete {Booster::Owner::DisplayName}
  652. delete {Booster::Cooldown::Thanks::*}
  653. delete {Booster::Active::Time}
  654. delete {Booster::Active::Status}
  655. delete {_Booster::Cancel::Name}
  656. delete {_Booster::Cancel::DisplayName}
  657. message "%{BoosterCancelMSG}%" to sender
  658. if argument 1 is "version":
  659. if player does not have permission "%{BoosterVersionPerm}%":
  660. message "%{BoosterNoPermCommand}%"
  661. stop
  662. else:
  663. if argument 2 is set:
  664. message "%{BoosterVersionUsage}%"
  665. if argument 2 is not set:
  666. replace all "{Version}" with "{@Version}" in {BoosterVersionMessage}
  667. message "%{BoosterVersionMessage}%"
  668. else if text-argument is not "cancel", "version", "give", "status", "reload" or "help":
  669. message "%{BoosterInvalidArgument}%"
  670.  
  671.  
  672. # +------------------------------------------------------+ #
  673. # | Command Aliases | #
  674. # +------------------------------------------------------+ #
  675.  
  676.  
  677. on command:
  678. if "%command%" is "%{BoosterThanksCommandAlias}%":
  679. cancel event
  680. if "%arguments%" isn't "<none>":
  681. execute player command "thanks %arguments%"
  682. else:
  683. execute player command "thanks"
  684. if "%command%" is "%{BoosterBoosterCommandAlias}%":
  685. cancel event
  686. if "%arguments%" isn't "<none>":
  687. execute player command "booster %arguments%"
  688. else:
  689. execute player command "booster"
  690.  
  691.  
  692. # +------------------------------------------------------+ #
  693. # | Right Click Event | #
  694. # +------------------------------------------------------+ #
  695.  
  696.  
  697. # What to do when a player right click on a booster
  698. on rightclick:
  699. if player's tool is not {BoosterItemID} named "%{BoosterName}%" with lore "%{BoosterLore}%":
  700. stop
  701. if player's tool is {BoosterItemID} named "%{BoosterName}%" with lore "%{BoosterLore}%":
  702. if player does not have the permission "%{BoosterUsePerm}%":
  703. message "%{NoPermBooster}%"
  704. stop
  705. else:
  706. if player's gamemode is not survival:
  707. message "%{BoosterNoGameMode}%" to player
  708. stop
  709. else:
  710. if {Booster::Active::Status} is not set:
  711. cancel event
  712. set {Booster::Owner::Name} to player
  713. set {Booster::Owner::DisplayName} to player's displayname
  714. set {Booster::Owner::SelfThanks::%player%} to true
  715. message "%{BoosterActivate}%" to player
  716. loop all players:
  717. loop-player has the permission "%{BoosterAnnouncePerm}%":
  718. replace all "{Player}" with "%{Booster::Owner::Name}%" in {BoosterActivated}
  719. replace all "{PlayerDisplayName}" with "%{Booster::Owner::DisplayName}%" in {BoosterActivated}
  720. message "%{BoosterActivated}%" to loop-player
  721. set {Booster::Active::Status} to true
  722. set {Booster::Active::Time} to now
  723. if {BoosterActivation::1} is set:
  724. execute console command "%{BoosterActivation::1}%"
  725. if {BoosterActivation::2} is set:
  726. execute console command "%{BoosterActivation::2}%"
  727. if {BoosterActivation::3} is set:
  728. execute console command "%{BoosterActivation::3}%"
  729. if {BoosterActivation::4} is set:
  730. execute console command "%{BoosterActivation::4}%"
  731. if {BoosterActivation::5} is set:
  732. execute console command "%{BoosterActivation::5}%"
  733. if {BoosterActivation::6} is set:
  734. execute console command "%{BoosterActivation::6}%"
  735. if {BoosterActivation::7} is set:
  736. execute console command "%{BoosterActivation::7}%"
  737. if {BoosterActivation::8} is set:
  738. execute console command "%{BoosterActivation::8}%"
  739. if {BoosterActivation::9} is set:
  740. execute console command "%{BoosterActivation::9}%"
  741. if {BoosterActivation::10} is set:
  742. execute console command "%{BoosterActivation::10}%"
  743. set {BoosterPlayerTool} to player's tool
  744. remove 1 of tool named "%{BoosterName}%" with lore "%{BoosterLore}%" from player
  745. stop
  746. else:
  747. message "%{BoosterErrorActivated}%" to player
  748. cancel event
  749. stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement