PageRenderTime 80ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/src/com/gmail/nossr50/command/Commands.java

https://github.com/krinsdeath/mcMMO
Java | 942 lines | 829 code | 44 blank | 69 comment | 256 complexity | 73c879804eb638069af74d93a49cf967 MD5 | raw file
  1. package com.gmail.nossr50.command;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import java.util.logging.Level;
  5. import java.util.logging.Logger;
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.ChatColor;
  8. import org.bukkit.Location;
  9. import org.bukkit.Material;
  10. import org.bukkit.command.Command;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.entity.Player;
  13. import org.getspout.spoutapi.player.SpoutPlayer;
  14. import com.gmail.nossr50.Leaderboard;
  15. import com.gmail.nossr50.Users;
  16. import com.gmail.nossr50.m;
  17. import com.gmail.nossr50.mcMMO;
  18. import com.gmail.nossr50.mcPermissions;
  19. import com.gmail.nossr50.config.LoadProperties;
  20. import com.gmail.nossr50.datatypes.HUDType;
  21. import com.gmail.nossr50.datatypes.HUDmmo;
  22. import com.gmail.nossr50.datatypes.PlayerProfile;
  23. import com.gmail.nossr50.datatypes.SkillType;
  24. import com.gmail.nossr50.locale.mcLocale;
  25. import com.gmail.nossr50.party.Party;
  26. import com.gmail.nossr50.skills.Skills;
  27. import com.gmail.nossr50.spout.SpoutStuff;
  28. public class Commands
  29. {
  30. //Setup some vars
  31. public static final Logger log = Logger.getLogger("Minecraft");
  32. public static boolean xpevent = false;
  33. static int oldrate = LoadProperties.xpGainMultiplier;
  34. public static boolean isPlayer(String playerName){
  35. for(Player herp : Bukkit.getServer().getOnlinePlayers()){
  36. if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. public static Player getPlayer(String playerName){
  43. for(Player herp : Bukkit.getServer().getOnlinePlayers()){
  44. if(herp.getName().toLowerCase().equals(playerName.toLowerCase())){
  45. return herp;
  46. }
  47. }
  48. return null;
  49. }
  50. public static boolean processCommands(CommandSender sender, Command command, String label, String[] args)
  51. {
  52. Player player = null;
  53. PlayerProfile PP = null;
  54. if(sender instanceof Player)
  55. {
  56. player = (Player) sender;
  57. PP = Users.getProfile(player);
  58. }
  59. String[] split = new String[args.length + 1];
  60. split[0] = label;
  61. for(int a = 0; a < args.length; a++){
  62. split[a + 1] = args[a];
  63. }
  64. //Check if the command is an MMO related help command
  65. if(label.equalsIgnoreCase("taming") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillTaming").toLowerCase())){
  66. float skillvalue = (float)PP.getSkillLevel(SkillType.TAMING);
  67. String percentage = String.valueOf((skillvalue / 1000) * 100);
  68. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillTaming")}));
  69. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainTaming")}));
  70. if(mcPermissions.getInstance().taming(player))
  71. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.TAMING), PP.getSkillXpLevel(SkillType.TAMING), PP.getXpToLevel(SkillType.TAMING)}));
  72. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  73. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming1_0"), mcLocale.getString("m.EffectsTaming1_1")}));
  74. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming2_0"), mcLocale.getString("m.EffectsTaming2_1")}));
  75. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming3_0"), mcLocale.getString("m.EffectsTaming3_1")}));
  76. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming4_0"), mcLocale.getString("m.EffectsTaming4_1")}));
  77. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1")}));
  78. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1")}));
  79. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  80. if(PP.getSkillLevel(SkillType.TAMING) < 100)
  81. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming1")}));
  82. else
  83. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming1_0"), mcLocale.getString("m.AbilBonusTaming1_1")}));
  84. if(PP.getSkillLevel(SkillType.TAMING) < 250)
  85. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming2")}));
  86. else
  87. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming2_0"), mcLocale.getString("m.AbilBonusTaming2_1")}));
  88. if(PP.getSkillLevel(SkillType.TAMING) < 500)
  89. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming3")}));
  90. else
  91. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming3_0"), mcLocale.getString("m.AbilBonusTaming3_1")}));
  92. if(PP.getSkillLevel(SkillType.TAMING) < 750)
  93. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming4")}));
  94. else
  95. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusTaming4_0"), mcLocale.getString("m.AbilBonusTaming4_1")}));
  96. player.sendMessage(mcLocale.getString("m.TamingGoreChance", new Object[] {percentage}));
  97. }
  98. else if(label.equalsIgnoreCase("woodcutting") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillWoodCutting").toLowerCase())){
  99. float skillvalue = (float)PP.getSkillLevel(SkillType.WOODCUTTING);
  100. int ticks = 2;
  101. int x = PP.getSkillLevel(SkillType.WOODCUTTING);
  102. while(x >= 50){
  103. x-=50;
  104. ticks++;
  105. }
  106. String percentage = String.valueOf((skillvalue / 1000) * 100);
  107. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillWoodCutting")}));
  108. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainWoodCutting")}));
  109. if(mcPermissions.getInstance().woodcutting(player))
  110. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.WOODCUTTING), PP.getSkillXpLevel(SkillType.WOODCUTTING), PP.getXpToLevel(SkillType.WOODCUTTING)}));
  111. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  112. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting1_0"), mcLocale.getString("m.EffectsWoodCutting1_1")}));
  113. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting2_0"), mcLocale.getString("m.EffectsWoodCutting2_1")}));
  114. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsWoodCutting3_0"), mcLocale.getString("m.EffectsWoodCutting3_1")}));
  115. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  116. if(PP.getSkillLevel(SkillType.WOODCUTTING) < 100)
  117. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockWoodCutting1")}));
  118. else
  119. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusWoodCutting1_0"), mcLocale.getString("m.AbilBonusWoodCutting1_1")}));
  120. player.sendMessage(mcLocale.getString("m.WoodCuttingDoubleDropChance", new Object[] {percentage}));
  121. player.sendMessage(mcLocale.getString("m.WoodCuttingTreeFellerLength", new Object[] {ticks}));
  122. }
  123. else if(label.equalsIgnoreCase("archery") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillArchery").toLowerCase())){
  124. Integer rank = 0;
  125. if(PP.getSkillLevel(SkillType.ARCHERY) >= 50)
  126. rank++;
  127. if(PP.getSkillLevel(SkillType.ARCHERY) >= 250)
  128. rank++;
  129. if(PP.getSkillLevel(SkillType.ARCHERY) >= 575)
  130. rank++;
  131. if(PP.getSkillLevel(SkillType.ARCHERY) >= 725)
  132. rank++;
  133. if(PP.getSkillLevel(SkillType.ARCHERY) >= 1000)
  134. rank++;
  135. float skillvalue = (float)PP.getSkillLevel(SkillType.ARCHERY);
  136. String percentage = String.valueOf((skillvalue / 1000) * 100);
  137. int ignition = 20;
  138. if(PP.getSkillLevel(SkillType.ARCHERY) >= 200)
  139. ignition+=20;
  140. if(PP.getSkillLevel(SkillType.ARCHERY) >= 400)
  141. ignition+=20;
  142. if(PP.getSkillLevel(SkillType.ARCHERY) >= 600)
  143. ignition+=20;
  144. if(PP.getSkillLevel(SkillType.ARCHERY) >= 800)
  145. ignition+=20;
  146. if(PP.getSkillLevel(SkillType.ARCHERY) >= 1000)
  147. ignition+=20;
  148. String percentagedaze;
  149. if(PP.getSkillLevel(SkillType.ARCHERY) < 1000){
  150. percentagedaze = String.valueOf((skillvalue / 2000) * 100);
  151. } else {
  152. percentagedaze = "50";
  153. }
  154. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillArchery")}));
  155. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainArchery")}));
  156. if(mcPermissions.getInstance().archery(player))
  157. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.ARCHERY), PP.getSkillXpLevel(SkillType.ARCHERY), PP.getXpToLevel(SkillType.ARCHERY)}));
  158. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  159. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery1_0"), mcLocale.getString("m.EffectsArchery1_1")}));
  160. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery2_0"), mcLocale.getString("m.EffectsArchery2_1")}));
  161. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery3_0"), mcLocale.getString("m.EffectsArchery3_1")}));
  162. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsArchery4_0"), mcLocale.getString("m.EffectsArchery4_1")}));
  163. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  164. player.sendMessage(mcLocale.getString("m.ArcheryDazeChance", new Object[] {percentagedaze}));
  165. player.sendMessage(mcLocale.getString("m.ArcheryRetrieveChance", new Object[] {percentage}));
  166. player.sendMessage(mcLocale.getString("m.ArcheryIgnitionLength", new Object[] {(ignition / 20)}));
  167. player.sendMessage(mcLocale.getString("m.ArcheryDamagePlus", new Object[] {rank}));
  168. }
  169. else if(label.equalsIgnoreCase("axes") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAxes"))){
  170. String percentage;
  171. float skillvalue = (float)PP.getSkillLevel(SkillType.AXES);
  172. if(PP.getSkillLevel(SkillType.AXES) < 750){
  173. percentage = String.valueOf((skillvalue / 1000) * 100);
  174. } else {
  175. percentage = "75";
  176. }
  177. int ticks = 2;
  178. int x = PP.getSkillLevel(SkillType.AXES);
  179. while(x >= 50){
  180. x-=50;
  181. ticks++;
  182. }
  183. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillAxes")}));
  184. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainAxes")}));
  185. if(mcPermissions.getInstance().axes(player))
  186. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.AXES), PP.getSkillXpLevel(SkillType.AXES), PP.getXpToLevel(SkillType.AXES)}));
  187. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  188. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes1_0"), mcLocale.getString("m.EffectsAxes1_1")}));
  189. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes2_0"), mcLocale.getString("m.EffectsAxes2_1")}));
  190. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAxes3_0"), mcLocale.getString("m.EffectsAxes3_1")}));
  191. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  192. player.sendMessage(mcLocale.getString("m.AxesCritChance", new Object[] {percentage}));
  193. if(PP.getSkillLevel(SkillType.AXES) < 500){
  194. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockAxes1")}));
  195. } else {
  196. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusAxes1_0"), mcLocale.getString("m.AbilBonusAxes1_1")}));
  197. }
  198. player.sendMessage(mcLocale.getString("m.AxesSkullLength", new Object[] {ticks}));
  199. }
  200. else if(label.equalsIgnoreCase("swords") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillSwords").toLowerCase())){
  201. int bleedrank = 2;
  202. String percentage, parrypercentage = null, counterattackpercentage;
  203. float skillvalue = (float)PP.getSkillLevel(SkillType.SWORDS);
  204. if(PP.getSkillLevel(SkillType.SWORDS) < 750){
  205. percentage = String.valueOf((skillvalue / 1000) * 100);
  206. } else {
  207. percentage = "75";
  208. }
  209. if(skillvalue >= 750)
  210. bleedrank+=1;
  211. if(PP.getSkillLevel(SkillType.SWORDS) <= 900){
  212. parrypercentage = String.valueOf((skillvalue / 3000) * 100);
  213. } else {
  214. parrypercentage = "30";
  215. }
  216. if(PP.getSkillLevel(SkillType.SWORDS) <= 600){
  217. counterattackpercentage = String.valueOf((skillvalue / 2000) * 100);
  218. } else {
  219. counterattackpercentage = "30";
  220. }
  221. int ticks = 2;
  222. int x = PP.getSkillLevel(SkillType.SWORDS);
  223. while(x >= 50){
  224. x-=50;
  225. ticks++;
  226. }
  227. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillSwords")}));
  228. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainSwords")}));
  229. if(mcPermissions.getInstance().swords(player))
  230. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.SWORDS), PP.getSkillXpLevel(SkillType.SWORDS), PP.getXpToLevel(SkillType.SWORDS)}));
  231. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  232. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords1_0"), mcLocale.getString("m.EffectsSwords1_1")}));
  233. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords2_0"), mcLocale.getString("m.EffectsSwords2_1")}));
  234. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords3_0"), mcLocale.getString("m.EffectsSwords3_1")}));
  235. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords4_0"), mcLocale.getString("m.EffectsSwords4_1")}));
  236. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsSwords5_0"), mcLocale.getString("m.EffectsSwords5_1")}));
  237. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  238. player.sendMessage(mcLocale.getString("m.SwordsCounterAttChance", new Object[] {counterattackpercentage}));
  239. player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] {bleedrank}));
  240. player.sendMessage(mcLocale.getString("m.SwordsTickNote"));
  241. player.sendMessage(mcLocale.getString("m.SwordsBleedLength", new Object[] {percentage}));
  242. player.sendMessage(mcLocale.getString("m.SwordsParryChance", new Object[] {parrypercentage}));
  243. player.sendMessage(mcLocale.getString("m.SwordsSSLength", new Object[] {ticks}));
  244. }
  245. else if(label.equalsIgnoreCase("acrobatics") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillAcrobatics").toLowerCase())){
  246. String dodgepercentage;
  247. float skillvalue = (float)PP.getSkillLevel(SkillType.ACROBATICS);
  248. String percentage = String.valueOf((skillvalue / 1000) * 100);
  249. String gracepercentage = String.valueOf(((skillvalue / 1000) * 100) * 2);
  250. if(PP.getSkillLevel(SkillType.ACROBATICS) <= 800){
  251. dodgepercentage = String.valueOf((skillvalue / 4000 * 100));
  252. } else {
  253. dodgepercentage = "20";
  254. }
  255. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillAcrobatics")}));
  256. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainAcrobatics")}));
  257. if(mcPermissions.getInstance().acrobatics(player))
  258. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS)}));
  259. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  260. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAcrobatics1_0"), mcLocale.getString("m.EffectsAcrobatics1_1")}));
  261. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAcrobatics2_0"), mcLocale.getString("m.EffectsAcrobatics2_1")}));
  262. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsAcrobatics3_0"), mcLocale.getString("m.EffectsAcrobatics3_1")}));
  263. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  264. player.sendMessage(mcLocale.getString("m.AcrobaticsRollChance", new Object[] {percentage}));
  265. player.sendMessage(mcLocale.getString("m.AcrobaticsGracefulRollChance", new Object[] {gracepercentage}));
  266. player.sendMessage(mcLocale.getString("m.AcrobaticsDodgeChance", new Object[] {dodgepercentage}));
  267. }
  268. else if(label.equalsIgnoreCase("mining") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillMining"))){
  269. float skillvalue = (float)PP.getSkillLevel(SkillType.MINING);
  270. String percentage = String.valueOf((skillvalue / 1000) * 100);
  271. int ticks = 2;
  272. int x = PP.getSkillLevel(SkillType.MINING);
  273. while(x >= 50){
  274. x-=50;
  275. ticks++;
  276. }
  277. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillMining")}));
  278. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainMining")}));
  279. if(mcPermissions.getInstance().mining(player))
  280. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.MINING), PP.getSkillXpLevel(SkillType.MINING), PP.getXpToLevel(SkillType.MINING)}));
  281. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  282. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsMining1_0"), mcLocale.getString("m.EffectsMining1_1")}));
  283. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsMining2_0"), mcLocale.getString("m.EffectsMining2_1")}));
  284. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  285. player.sendMessage(mcLocale.getString("m.MiningDoubleDropChance", new Object[] {percentage}));
  286. player.sendMessage(mcLocale.getString("m.MiningSuperBreakerLength", new Object[] {ticks}));
  287. }
  288. else if(label.equalsIgnoreCase("repair") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillRepair").toLowerCase())){
  289. float skillvalue = (float)PP.getSkillLevel(SkillType.REPAIR);
  290. String percentage = String.valueOf((skillvalue / 1000) * 100);
  291. String repairmastery = String.valueOf((skillvalue / 500) * 100);
  292. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillRepair")}));
  293. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainRepair")}));
  294. if(mcPermissions.getInstance().repair(player))
  295. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR)}));
  296. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  297. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair1_0"), mcLocale.getString("m.EffectsRepair1_1")}));
  298. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair2_0"), mcLocale.getString("m.EffectsRepair2_1")}));
  299. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair3_0"), mcLocale.getString("m.EffectsRepair3_1")}));
  300. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsRepair4_0", new Object[]{LoadProperties.repairdiamondlevel}), mcLocale.getString("m.EffectsRepair4_1")}));
  301. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  302. player.sendMessage(mcLocale.getString("m.RepairRepairMastery", new Object[] {repairmastery}));
  303. player.sendMessage(mcLocale.getString("m.RepairSuperRepairChance", new Object[] {percentage}));
  304. }
  305. else if(label.equalsIgnoreCase("unarmed")){
  306. String percentage, arrowpercentage;
  307. float skillvalue = (float)PP.getSkillLevel(SkillType.UNARMED);
  308. if(PP.getSkillLevel(SkillType.UNARMED) < 1000){
  309. percentage = String.valueOf((skillvalue / 4000) * 100);
  310. } else {
  311. percentage = "25";
  312. }
  313. if(PP.getSkillLevel(SkillType.UNARMED) < 1000){
  314. arrowpercentage = String.valueOf(((skillvalue / 1000) * 100) / 2);
  315. } else {
  316. arrowpercentage = "50";
  317. }
  318. int ticks = 2;
  319. int x = PP.getSkillLevel(SkillType.UNARMED);
  320. while(x >= 50){
  321. x-=50;
  322. ticks++;
  323. }
  324. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillUnarmed")}));
  325. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainUnarmed")}));
  326. if(mcPermissions.getInstance().unarmed(player))
  327. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.UNARMED), PP.getSkillXpLevel(SkillType.UNARMED), PP.getXpToLevel(SkillType.UNARMED)}));
  328. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  329. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed1_0"), mcLocale.getString("m.EffectsUnarmed1_1")}));
  330. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed2_0"), mcLocale.getString("m.EffectsUnarmed2_1")}));
  331. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed3_0"), mcLocale.getString("m.EffectsUnarmed3_1")}));
  332. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed4_0"), mcLocale.getString("m.EffectsUnarmed4_1")}));
  333. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsUnarmed5_0"), mcLocale.getString("m.EffectsUnarmed5_1")}));
  334. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  335. player.sendMessage(mcLocale.getString("m.UnarmedArrowDeflectChance", new Object[] {arrowpercentage}));
  336. player.sendMessage(mcLocale.getString("m.UnarmedDisarmChance", new Object[] {percentage}));
  337. if(PP.getSkillLevel(SkillType.UNARMED) < 250){
  338. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockUnarmed1")}));
  339. } else if(PP.getSkillLevel(SkillType.UNARMED) >= 250 && PP.getSkillLevel(SkillType.UNARMED) < 500){
  340. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusUnarmed1_0"), mcLocale.getString("m.AbilBonusUnarmed1_1")}));
  341. player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockUnarmed2")}));
  342. } else {
  343. player.sendMessage(mcLocale.getString("m.AbilityBonusTemplate", new Object[] {mcLocale.getString("m.AbilBonusUnarmed2_0"), mcLocale.getString("m.AbilBonusUnarmed2_1")}));
  344. }
  345. player.sendMessage(mcLocale.getString("m.UnarmedBerserkLength", new Object[] {ticks}));
  346. }
  347. else if(label.equalsIgnoreCase("herbalism") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillHerbalism").toLowerCase())){
  348. int rank = 0;
  349. if(PP.getSkillLevel(SkillType.HERBALISM) >= 50)
  350. rank++;
  351. if (PP.getSkillLevel(SkillType.HERBALISM) >= 150)
  352. rank++;
  353. if (PP.getSkillLevel(SkillType.HERBALISM) >= 250)
  354. rank++;
  355. if (PP.getSkillLevel(SkillType.HERBALISM) >= 350)
  356. rank++;
  357. if (PP.getSkillLevel(SkillType.HERBALISM) >= 450)
  358. rank++;
  359. if (PP.getSkillLevel(SkillType.HERBALISM) >= 550)
  360. rank++;
  361. if (PP.getSkillLevel(SkillType.HERBALISM) >= 650)
  362. rank++;
  363. if (PP.getSkillLevel(SkillType.HERBALISM) >= 750)
  364. rank++;
  365. int bonus = 0;
  366. if(PP.getSkillLevel(SkillType.HERBALISM) >= 200)
  367. bonus++;
  368. if(PP.getSkillLevel(SkillType.HERBALISM) >= 400)
  369. bonus++;
  370. if(PP.getSkillLevel(SkillType.HERBALISM) >= 600)
  371. bonus++;
  372. int ticks = 2;
  373. int x = PP.getSkillLevel(SkillType.HERBALISM);
  374. while(x >= 50){
  375. x-=50;
  376. ticks++;
  377. }
  378. float skillvalue = (float)PP.getSkillLevel(SkillType.HERBALISM);
  379. String percentage = String.valueOf((skillvalue / 1000) * 100);
  380. String gpercentage = String.valueOf((skillvalue / 1500) * 100);
  381. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillHerbalism")}));
  382. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainHerbalism")}));
  383. if(mcPermissions.getInstance().herbalism(player))
  384. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.HERBALISM), PP.getSkillXpLevel(SkillType.HERBALISM), PP.getXpToLevel(SkillType.HERBALISM)}));
  385. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  386. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism1_0"), mcLocale.getString("m.EffectsHerbalism1_1")}));
  387. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism2_0"), mcLocale.getString("m.EffectsHerbalism2_1")}));
  388. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism3_0"), mcLocale.getString("m.EffectsHerbalism3_1")}));
  389. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism4_0"), mcLocale.getString("m.EffectsHerbalism4_1")}));
  390. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsHerbalism5_0"), mcLocale.getString("m.EffectsHerbalism5_1")}));
  391. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  392. player.sendMessage(mcLocale.getString("m.HerbalismGreenTerraLength", new Object[] {ticks}));
  393. player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbChance", new Object[] {gpercentage}));
  394. player.sendMessage(mcLocale.getString("m.HerbalismGreenThumbStage", new Object[] {bonus}));
  395. player.sendMessage(mcLocale.getString("m.HerbalismDoubleDropChance", new Object[] {percentage}));
  396. player.sendMessage(mcLocale.getString("m.HerbalismFoodPlus", new Object[] {rank}));
  397. }
  398. else if(label.equalsIgnoreCase("excavation") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillExcavation").toLowerCase()))
  399. {
  400. int ticks = 2;
  401. int x = PP.getSkillLevel(SkillType.EXCAVATION);
  402. while(x >= 50){
  403. x-=50;
  404. ticks++;
  405. }
  406. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillExcavation")}));
  407. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainExcavation")}));
  408. if(mcPermissions.getInstance().excavation(player))
  409. player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION)}));
  410. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  411. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1")}));
  412. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1")}));
  413. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  414. player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] {ticks}));
  415. }
  416. else if(label.equalsIgnoreCase("sorcery") || split[0].toLowerCase().equalsIgnoreCase(mcLocale.getString("m.SkillSorcery").toLowerCase()))
  417. {
  418. /*
  419. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillExcavation")}));
  420. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainExcavation")}));
  421. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")}));
  422. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1")}));
  423. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1")}));
  424. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")}));
  425. player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] {ticks}));
  426. */
  427. }
  428. else if(LoadProperties.mcmmoEnable && label.equalsIgnoreCase(LoadProperties.mcmmo))
  429. {
  430. player.sendMessage(ChatColor.RED+"-----[]"+ChatColor.GREEN+"mcMMO"+ChatColor.RED+"[]-----");
  431. String description = mcLocale.getString("mcMMO.Description", new Object[] {LoadProperties.mcc});
  432. String[] mcSplit = description.split(",");
  433. for(String x : mcSplit)
  434. {
  435. player.sendMessage(x);
  436. }
  437. if(LoadProperties.spoutEnabled && player instanceof SpoutPlayer)
  438. {
  439. SpoutPlayer sPlayer = (SpoutPlayer)player;
  440. if(LoadProperties.donateMessage)
  441. sPlayer.sendNotification("[mcMMO] Donate!", "Paypal nossr50@gmail.com", Material.CAKE);
  442. }
  443. else
  444. {
  445. if(LoadProperties.donateMessage)
  446. player.sendMessage(ChatColor.GREEN+"If you like my work you can donate via Paypal: nossr50@gmail.com");
  447. }
  448. }
  449. else if(LoadProperties.mccEnable && label.equalsIgnoreCase(LoadProperties.mcc))
  450. {
  451. player.sendMessage(ChatColor.RED+"---[]"+ChatColor.YELLOW+"mcMMO Commands"+ChatColor.RED+"[]---");
  452. if(mcPermissions.getInstance().party(player)){
  453. player.sendMessage(mcLocale.getString("m.mccPartyCommands"));
  454. player.sendMessage(LoadProperties.party+" "+mcLocale.getString("m.mccParty"));
  455. player.sendMessage(LoadProperties.party+" q "+mcLocale.getString("m.mccPartyQ"));
  456. if(mcPermissions.getInstance().partyChat(player))
  457. player.sendMessage("/p "+mcLocale.getString("m.mccPartyToggle"));
  458. player.sendMessage(LoadProperties.invite+" "+mcLocale.getString("m.mccPartyInvite"));
  459. player.sendMessage(LoadProperties.accept+" "+mcLocale.getString("m.mccPartyAccept"));
  460. if(mcPermissions.getInstance().partyTeleport(player))
  461. player.sendMessage(LoadProperties.ptp+" "+mcLocale.getString("m.mccPartyTeleport"));
  462. }
  463. player.sendMessage(mcLocale.getString("m.mccOtherCommands"));
  464. player.sendMessage(LoadProperties.stats+ChatColor.RED+" "+mcLocale.getString("m.mccStats"));
  465. player.sendMessage("/mctop <skillname> <page> "+ChatColor.RED+mcLocale.getString("m.mccLeaderboards"));
  466. if(mcPermissions.getInstance().mySpawn(player)){
  467. player.sendMessage(LoadProperties.myspawn+" "+ChatColor.RED+mcLocale.getString("m.mccMySpawn"));
  468. player.sendMessage(LoadProperties.clearmyspawn+" "+ChatColor.RED+mcLocale.getString("m.mccClearMySpawn"));
  469. }
  470. if(mcPermissions.getInstance().mcAbility(player))
  471. player.sendMessage(LoadProperties.mcability+ChatColor.RED+" "+mcLocale.getString("m.mccToggleAbility"));
  472. if(mcPermissions.getInstance().adminChat(player)){
  473. player.sendMessage("/a "+ChatColor.RED+mcLocale.getString("m.mccAdminToggle"));
  474. }
  475. if(mcPermissions.getInstance().whois(player))
  476. player.sendMessage(LoadProperties.whois+" "+mcLocale.getString("m.mccWhois"));
  477. if(mcPermissions.getInstance().mmoedit(player)){
  478. //player.sendMessage(LoadProperties.mmoedit+" [skill] [newvalue] "+ChatColor.RED+"Modify the designated skill value");
  479. player.sendMessage(LoadProperties.mmoedit+mcLocale.getString("m.mccMmoedit"));
  480. }
  481. if(mcPermissions.getInstance().mcgod(player))
  482. player.sendMessage(LoadProperties.mcgod+ChatColor.RED+" "+mcLocale.getString("m.mccMcGod"));
  483. player.sendMessage(mcLocale.getString("m.mccSkillInfo"));
  484. player.sendMessage(LoadProperties.mcmmo+" "+mcLocale.getString("m.mccModDescription"));
  485. }
  486. else if(LoadProperties.mcabilityEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(LoadProperties.mcability)){
  487. if(PP.getAbilityUse()){
  488. player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
  489. PP.toggleAbilityUse();
  490. } else {
  491. player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
  492. PP.toggleAbilityUse();
  493. }
  494. }
  495. else if (LoadProperties.xprateEnable && label.equalsIgnoreCase(LoadProperties.xprate))
  496. {
  497. if(sender instanceof Player)
  498. {
  499. if(!mcPermissions.getInstance().admin(player))
  500. {
  501. player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
  502. return true;
  503. }
  504. if(split.length <= 1)
  505. {
  506. player.sendMessage(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate}));
  507. player.sendMessage(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate}));
  508. }
  509. if(split.length == 2 && split[1].equalsIgnoreCase("reset"))
  510. {
  511. if(xpevent)
  512. {
  513. for(Player x : Bukkit.getServer().getOnlinePlayers())
  514. x.sendMessage(mcLocale.getString("Commands.xprate.over"));
  515. xpevent = !xpevent;
  516. LoadProperties.xpGainMultiplier = oldrate;
  517. } else
  518. {
  519. LoadProperties.xpGainMultiplier = oldrate;
  520. }
  521. }
  522. if(split.length >= 2 && m.isInt(split[1]))
  523. {
  524. oldrate = LoadProperties.xpGainMultiplier;
  525. if(split.length >= 3 && (split[2].equalsIgnoreCase("true") || split[2].equalsIgnoreCase("false")))
  526. {
  527. if(split[2].equalsIgnoreCase("true"))
  528. xpevent = true;
  529. else
  530. xpevent = false;
  531. } else
  532. {
  533. player.sendMessage(mcLocale.getString("Commands.xprate.proper3"));
  534. return true;
  535. }
  536. LoadProperties.xpGainMultiplier = m.getInt(split[1]);
  537. if(xpevent = true)
  538. for(Player x : Bukkit.getServer().getOnlinePlayers())
  539. {
  540. x.sendMessage(mcLocale.getString("Commands.xprate.started"));
  541. x.sendMessage(mcLocale.getString("Commands.xprate.started2", new Object[] {LoadProperties.xpGainMultiplier}));
  542. }
  543. }
  544. } else
  545. {
  546. if(split.length <= 1)
  547. {
  548. System.out.println(mcLocale.getString("Commands.xprate.proper", new Object[] {LoadProperties.xprate}));
  549. System.out.println(mcLocale.getString("Commands.xprate.proper2", new Object[] {LoadProperties.xprate}));
  550. }
  551. if(split.length == 2 && split[1].equalsIgnoreCase("reset"))
  552. {
  553. if(xpevent)
  554. {
  555. for(Player x : Bukkit.getServer().getOnlinePlayers())
  556. x.sendMessage(mcLocale.getString("Commands.xprate.over"));
  557. xpevent = !xpevent;
  558. LoadProperties.xpGainMultiplier = oldrate;
  559. } else
  560. {
  561. LoadProperties.xpGainMultiplier = oldrate;
  562. }
  563. }
  564. if(split.length >= 2 && m.isInt(split[1]))
  565. {
  566. oldrate = LoadProperties.xpGainMultiplier;
  567. if(split.length >= 3 && (split[2].equalsIgnoreCase("true") || split[2].equalsIgnoreCase("false")))
  568. {
  569. if(split[2].equalsIgnoreCase("true"))
  570. xpevent = true;
  571. else
  572. xpevent = false;
  573. } else
  574. {
  575. System.out.println(mcLocale.getString("Commands.xprate.proper3"));
  576. return true;
  577. }
  578. LoadProperties.xpGainMultiplier = m.getInt(split[1]);
  579. if(xpevent = true)
  580. for(Player x : Bukkit.getServer().getOnlinePlayers())
  581. {
  582. x.sendMessage(ChatColor.GOLD+"XP EVENT FOR mcMMO HAS STARTED!");
  583. x.sendMessage(ChatColor.GOLD+"mcMMO XP RATE IS NOW "+LoadProperties.xpGainMultiplier+"x!!");
  584. }
  585. }
  586. }
  587. }
  588. /*
  589. * FFS -> MySQL
  590. */
  591. else if(label.equalsIgnoreCase("mmoupdate"))
  592. {
  593. if(!mcPermissions.getInstance().admin(player))
  594. {
  595. player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
  596. return true;
  597. }
  598. player.sendMessage(ChatColor.GRAY+"Starting conversion...");
  599. Users.clearUsers();
  600. m.convertToMySQL();
  601. for(Player x : Bukkit.getServer().getOnlinePlayers())
  602. {
  603. Users.addUser(x);
  604. }
  605. player.sendMessage(ChatColor.GREEN+"Conversion finished!");
  606. }
  607. /*
  608. * LEADER BOARD COMMAND
  609. */
  610. else if(LoadProperties.mctopEnable && label.equalsIgnoreCase(LoadProperties.mctop)){
  611. if(LoadProperties.useMySQL == false){
  612. /*
  613. * POWER LEVEL INFO RETRIEVAL
  614. */
  615. if(split.length == 1){
  616. int p = 1;
  617. String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
  618. player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
  619. int n = 1 * p; //Position
  620. for(String x : info){
  621. if(x != null){
  622. String digit = String.valueOf(n);
  623. if(n < 10)
  624. digit ="0"+String.valueOf(n);
  625. String[] splitx = x.split(":");
  626. //Format: 1. Playername - skill value
  627. player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
  628. n++;
  629. }
  630. }
  631. }
  632. if(split.length >= 2 && m.isInt(split[1])){
  633. int p = 1;
  634. //Grab page value if specified
  635. if(split.length >= 2){
  636. if(m.isInt(split[1])){
  637. p = Integer.valueOf(split[1]);
  638. }
  639. }
  640. int pt = p;
  641. if(p > 1){
  642. pt -= 1;
  643. pt += (pt * 10);
  644. pt = 10;
  645. }
  646. String[] info = Leaderboard.retrieveInfo(SkillType.ALL.toString(), p);
  647. player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
  648. int n = 1 * pt; //Position
  649. for(String x : info){
  650. if(x != null){
  651. String digit = String.valueOf(n);
  652. if(n < 10)
  653. digit ="0"+String.valueOf(n);
  654. String[] splitx = x.split(":");
  655. //Format: 1. Playername - skill value
  656. player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
  657. n++;
  658. }
  659. }
  660. }
  661. /*
  662. * SKILL SPECIFIED INFO RETRIEVAL
  663. */
  664. if(split.length >= 2 && Skills.isSkill(split[1]))
  665. {
  666. int p = 1;
  667. //Grab page value if specified
  668. if(split.length >= 3)
  669. {
  670. if(m.isInt(split[2])){
  671. p = Integer.valueOf(split[2]);
  672. }
  673. }
  674. int pt = p;
  675. if(p > 1){
  676. pt -= 1;
  677. pt += (pt * 10);
  678. pt = 10;
  679. }
  680. String firstLetter = split[1].substring(0,1); // Get first letter
  681. String remainder = split[1].substring(1); // Get remainder of word.
  682. String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
  683. String[] info = Leaderboard.retrieveInfo(split[1].toUpperCase(), p);
  684. player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] {capitalized}));
  685. int n = 1 * pt; //Position
  686. for(String x : info)
  687. {
  688. if(x != null)
  689. {
  690. String digit = String.valueOf(n);
  691. if(n < 10)
  692. digit ="0"+String.valueOf(n);
  693. String[] splitx = x.split(":");
  694. //Format: 1. Playername - skill value
  695. player.sendMessage(digit+". "+ChatColor.GREEN+splitx[1]+" - "+ChatColor.WHITE+splitx[0]);
  696. n++;
  697. }
  698. }
  699. }
  700. } else {
  701. /*
  702. * MYSQL LEADERBOARDS
  703. */
  704. String powerlevel = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics";
  705. if(split.length >= 2 && Skills.isSkill(split[1])){
  706. /*
  707. * Create a nice consistent capitalized leaderboard name
  708. */
  709. String lowercase = split[1].toLowerCase(); //For the query
  710. String firstLetter = split[1].substring(0,1); //Get first letter
  711. String remainder = split[1].substring(1); //Get remainder of word.
  712. String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
  713. player.sendMessage(mcLocale.getString("mcPlayerListener.SkillLeaderboard", new Object[] {capitalized}));
  714. if(split.length >= 3 && m.isInt(split[2])){
  715. int n = 1; //For the page number
  716. int n2 = Integer.valueOf(split[2]);
  717. if(n2 > 1){
  718. //Figure out the 'page' here
  719. n = 10;
  720. n = n * (n2-1);
  721. }
  722. //If a page number is specified
  723. HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
  724. +LoadProperties.MySQLtablePrefix+"skills WHERE "+lowercase+" > 0 ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
  725. for(int i=n;i<=n+10;i++){
  726. if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
  727. break;
  728. HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
  729. player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
  730. }
  731. return true;
  732. }
  733. //If no page number is specified
  734. HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+lowercase+", user_id FROM "
  735. +LoadProperties.MySQLtablePrefix+"skills WHERE "+lowercase+" > 0 ORDER BY `"+LoadProperties.MySQLtablePrefix+"skills`.`"+lowercase+"` DESC ");
  736. for(int i=1;i<=10;i++){ //i<=userslist.size()
  737. if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
  738. break;
  739. HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
  740. player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
  741. }
  742. return true;
  743. }
  744. if(split.length >= 1){
  745. player.sendMessage(mcLocale.getString("mcPlayerListener.PowerLevelLeaderboard"));
  746. if(split.length >= 2 && m.isInt(split[1])){
  747. int n = 1; //For the page number
  748. int n2 = Integer.valueOf(split[1]);
  749. if(n2 > 1){
  750. //Figure out the 'page' here
  751. n = 10;
  752. n = n * (n2-1);
  753. }
  754. //If a page number is specified
  755. HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT "+powerlevel+", user_id FROM "
  756. +LoadProperties.MySQLtablePrefix+"skills WHERE "+powerlevel+" > 0 ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
  757. for(int i=n;i<=n+10;i++){
  758. if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
  759. break;
  760. HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
  761. player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
  762. }
  763. return true;
  764. }
  765. HashMap<Integer, ArrayList<String>> userslist = mcMMO.database.Read("SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics, user_id FROM "
  766. +LoadProperties.MySQLtablePrefix+"skills WHERE "+powerlevel+" > 0 ORDER BY taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics DESC ");
  767. for(int i=1;i<=10;i++){
  768. if (i > userslist.size() || mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'") == null)
  769. break;
  770. HashMap<Integer, ArrayList<String>> username = mcMMO.database.Read("SELECT user FROM "+LoadProperties.MySQLtablePrefix+"users WHERE id = '" + Integer.valueOf(userslist.get(i).get(1)) + "'");
  771. player.sendMessage(String.valueOf(i)+". "+ChatColor.GREEN+userslist.get(i).get(0)+" - "+ChatColor.WHITE+username.get(1).get(0));
  772. //System.out.println(username.get(1).get(0));
  773. //System.out.println("Mining : " + userslist.get(i).get(0) + ", User id : " + userslist.get(i).get(1));
  774. }
  775. }
  776. }
  777. }
  778. else if(LoadProperties.mcrefreshEnable && label.equalsIgnoreCase(LoadProperties.mcrefresh)){
  779. if(!mcPermissions.getInstance().mcrefresh(player)){
  780. player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
  781. return true;
  782. }
  783. if(split.length >= 2 && isPlayer(split[1])){
  784. player.sendMessage("You have refreshed "+split[1]+"'s cooldowns!");
  785. player = getPlayer(split[1]);
  786. }
  787. /*
  788. * PREP MODES
  789. */
  790. PP = Users.getProfile(player);
  791. PP.setRecentlyHurt((long) 0);
  792. PP.setHoePreparationMode(false);
  793. PP.setAxePreparationMode(false);
  794. PP.setFistsPreparationMode(false);
  795. PP.setSwordsPreparationMode(false);
  796. PP.setPickaxePreparationMode(false);
  797. /*
  798. * GREEN TERRA
  799. */
  800. PP.setGreenTerraMode(false);
  801. PP.setGreenTerraDeactivatedTimeStamp((long) 0);
  802. /*
  803. * GIGA DRILL BREAKER
  804. */
  805. PP.setGigaDrillBreakerMode(false);
  806. PP.setGigaDrillBreakerDeactivatedTimeStamp((long) 0);
  807. /*
  808. * SERRATED STRIKE
  809. */
  810. PP.setSerratedStrikesMode(false);
  811. PP.setSerratedStrikesDeactivatedTimeStamp((long) 0);
  812. /*
  813. * SUPER BREAKER
  814. */
  815. PP.setSuperBreakerMode(false);
  816. PP.setSuperBreakerDeactivatedTimeStamp((long) 0);
  817. /*
  818. * TREE FELLER
  819. */
  820. PP.setTreeFellerMode(false);
  821. PP.setTreeFellerDeactivatedTimeStamp((long) 0);
  822. /*
  823. * BERSERK
  824. */
  825. PP.setBerserkMode(false);
  826. PP.setBerserkDeactivatedTimeStamp((long)0);
  827. player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesRefreshed"));
  828. }
  829. /*
  830. * GODMODE COMMAND
  831. */
  832. else if(LoadProperties.mcgodEnable && label.equalsIgnoreCase(LoadProperties.mcgod))
  833. {
  834. if(mcPermissions.permissionsEnabled)
  835. {
  836. if(!mcPermissions.getInstance().mcgod(player))
  837. {
  838. player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
  839. return true;
  840. }
  841. if(PP.getGodMode())
  842. {
  843. player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
  844. PP.toggleGodMode();
  845. } else
  846. {
  847. player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeEnabled"));
  848. PP.toggleGodMode();
  849. }
  850. }
  851. }
  852. else if(LoadProperties.clearmyspawnEnable && LoadProperties.enableMySpawn && label.equalsIgnoreCase(LoadProperties.clearmyspawn) && mcPermissions.getInstance().mySpawn(player))
  853. {
  854. double x = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getX();
  855. double y = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getY();
  856. double z = Bukkit.getServer().getWorlds().get(0).getSpawnLocation().getZ();
  857. String worldname = Bukkit.getServer().getWorlds().get(0).getName();
  858. PP.setMySpawn(x, y, z, worldname);
  859. player.sendMessage(mcLocale.getString("mcPlayerListener.MyspawnCleared"));
  860. }
  861. else if(LoadProperties.mmoeditEnable && mcPermissions.permissionsEnabled && label.equalsIgnoreCase(""+LoadProperties.mmoedit))
  862. {
  863. if(!mcPermissions.getInstance().mmoedit(player))
  864. {
  865. player.sendMessage(ChatColor.YELLOW+"[mcMMO] "+ChatColor.DARK_RED +mcLocale.getString("mcPlayerListener.NoPermission"));
  866. return true;
  867. }
  868. if(split.length < 3)
  869. {
  870. player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue");
  871. return true;
  872. }
  873. if(split.length == 4)
  874. {
  875. if(isPlayer(split[1]) && m.isInt(split[3]) && Skills.isSkill(split[2]))
  876. {
  877. int newvalue = Integer.valueOf(split[3]);
  878. Users.getProfile(getPlayer(split[1])).modifyskill(Skills.getSkillType(split[2]), newvalue);
  879. player.sendMessage(ChatColor.RED+split[2]+" has been modified.");
  880. }
  881. }
  882. else if(split.length == 3)
  883. {
  884. if(m.isInt(split[2]) && Skills.isSkill(split[1]))
  885. {
  886. int newvalue = Integer.valueOf(split[2]);
  887. PP.modifyskill(Skills.getSkillType(split[1]), newvalue);
  888. player.sendMessage(ChatColor.RED+split[1]+" has been modified.");
  889. }
  890. } else
  891. {
  892. player.sendMessage(ChatColor.RED+"Usage is /"+LoadProperties.mmoedit+" playername skillname newvalue");
  893. }
  894. }
  895. /*
  896. * ADD EXPERIENCE COMMAND
  897. */
  898. else if(LoadProperties.addxpEna