Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package endlesspvp.endlessutilities;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.GameMode;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandExecutor;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10.  
  11. public class UtilitiesCommands
  12. implements CommandExecutor
  13. {
  14. private static UtilitiesMain core;
  15.  
  16. public UtilitiesCommands(UtilitiesMain core) {
  17.  
  18. core = core;
  19. }
  20.  
  21. public String getPrefix()
  22. {
  23. return ChatColor.translateAlternateColorCodes('&', core.getConfig().getString("prefix"));
  24. }
  25.  
  26. public static UtilitiesMain getInstance()
  27. {
  28. return (UtilitiesMain)JavaPlugin.getPlugin(UtilitiesMain.class);
  29. }
  30.  
  31. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  32. {
  33. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("website"));
  34. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  35. (cmd.getName().equalsIgnoreCase("website")) &&
  36. ((sender instanceof Player)))
  37. {
  38. Player player = (Player)sender;
  39. for (String messages : core.getcommandMessagesConfig().getStringList("website")) {
  40. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  41. }
  42. player.hasPermission("endless.website");
  43. return true;
  44. }
  45. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("store"));
  46. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  47. (cmd.getName().equalsIgnoreCase("store")) &&
  48. ((sender instanceof Player)))
  49. {
  50. Player player = (Player)sender;
  51. for (String messages : core.getcommandMessagesConfig().getStringList("store")) {
  52. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  53. }
  54. player.hasPermission("endless.store");
  55. return true;
  56. }
  57. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("discord"));
  58. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  59. (cmd.getName().equalsIgnoreCase("discord")) &&
  60. ((sender instanceof Player)))
  61. {
  62. Player player = (Player)sender;
  63. for (String messages : core.getcommandMessagesConfig().getStringList("discord")) {
  64. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  65. }
  66. player.hasPermission("endless.discord");
  67. return true;
  68. }
  69. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("instagram"));
  70. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  71. (cmd.getName().equalsIgnoreCase("instagram")) &&
  72. ((sender instanceof Player)))
  73. {
  74. Player player = (Player)sender;
  75. for (String messages : core.getcommandMessagesConfig().getStringList("instagram")) {
  76. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  77. }
  78. player.hasPermission("endless.instagram");
  79. return true;
  80. }
  81. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("twitter"));
  82. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  83. (cmd.getName().equalsIgnoreCase("twitter")) &&
  84. ((sender instanceof Player)))
  85. {
  86. Player player = (Player)sender;
  87. for (String messages : core.getcommandMessagesConfig().getStringList("twitter")) {
  88. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  89. }
  90. player.hasPermission("endless.twitter");
  91. return true;
  92. }
  93. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("facebook"));
  94. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  95. (cmd.getName().equalsIgnoreCase("facebook")) &&
  96. ((sender instanceof Player)))
  97. {
  98. Player player = (Player)sender;
  99. for (String messages : core.getcommandMessagesConfig().getStringList("facebook")) {
  100. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  101. }
  102. player.hasPermission("endless.facebook");
  103. return true;
  104. }
  105. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("teamspeak"));
  106. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  107. (cmd.getName().equalsIgnoreCase("teamspeak")) &&
  108. ((sender instanceof Player)))
  109. {
  110. Player player = (Player)sender;
  111. for (String messages : core.getcommandMessagesConfig().getStringList("teamspeak")) {
  112. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  113. }
  114. player.hasPermission("endless.teamspeak");
  115. return true;
  116. }
  117. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("skype"));
  118. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  119. (cmd.getName().equalsIgnoreCase("skype")) &&
  120. ((sender instanceof Player)))
  121. {
  122. Player player = (Player)sender;
  123. for (String messages : core.getcommandMessagesConfig().getStringList("skype")) {
  124. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  125. }
  126. player.hasPermission("endless.s");
  127. return true;
  128. }
  129. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("steam"));
  130. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  131. (cmd.getName().equalsIgnoreCase("steam")) &&
  132. ((sender instanceof Player)))
  133. {
  134. Player player = (Player)sender;
  135. for (String messages : core.getcommandMessagesConfig().getStringList("steam")) {
  136. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  137. }
  138. player.hasPermission("endless.steam");
  139. return true;
  140. }
  141. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("snapchat"));
  142. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  143. (cmd.getName().equalsIgnoreCase("snapchat")) &&
  144. ((sender instanceof Player)))
  145. {
  146. Player player = (Player)sender;
  147. for (String messages : core.getcommandMessagesConfig().getStringList("snapchat")) {
  148. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  149. }
  150. player.hasPermission("endless.snapchat");
  151. return true;
  152. }
  153. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("reddit"));
  154. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  155. (cmd.getName().equalsIgnoreCase("reddit")) &&
  156. ((sender instanceof Player)))
  157. {
  158. Player player = (Player)sender;
  159. for (String messages : core.getcommandMessagesConfig().getStringList("reddit")) {
  160. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  161. }
  162. player.hasPermission("endless.reddit");
  163. return true;
  164. }
  165. ChatColor.translateAlternateColorCodes('&', core.getcommandMessagesConfig().getString("banpanel"));
  166. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  167. (cmd.getName().equalsIgnoreCase("banpanel")) &&
  168. ((sender instanceof Player)))
  169. {
  170. Player player = (Player)sender;
  171. for (String messages : core.getcommandMessagesConfig().getStringList("banpanel")) {
  172. player.sendMessage(getPrefix() + ChatColor.translateAlternateColorCodes('&', messages));
  173. }
  174. player.hasPermission("endless.banpanel");
  175. return true;
  176. }
  177. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  178. (cmd.getName().equalsIgnoreCase("cmode")))
  179. {
  180. Player player = (Player)sender;
  181. if ((sender instanceof Player))
  182. {
  183. Player p = (Player)sender;
  184. p.sendMessage(ChatColor.translateAlternateColorCodes('&', core.getConfig().getString("creative.message")));
  185. if (p.getGameMode().equals(GameMode.SURVIVAL)) {
  186. p.setGameMode(GameMode.CREATIVE);
  187. }
  188. p.hasPermission("endless.cmode");
  189. return true;
  190. }
  191. }
  192. if ((core.getConfig().getBoolean("enabled_commands." + cmd.getName())) &&
  193. (cmd.getName().equalsIgnoreCase("smode")))
  194. {
  195. Player player = (Player)sender;
  196. if ((sender instanceof Player))
  197. {
  198. Player p = (Player)sender;
  199. p.sendMessage(ChatColor.translateAlternateColorCodes('&', core.getConfig().getString("survival.message")));
  200. if (p.getGameMode().equals(GameMode.CREATIVE)) {
  201. p.setGameMode(GameMode.SURVIVAL);
  202. }
  203. p.hasPermission("endless.smode");
  204. }
  205. }
  206. Player player = (Player)sender;
  207. for (String c : core.getConfig().getConfigurationSection("enabled_commands").getKeys(false)) {
  208. if ((cmd.getName().equalsIgnoreCase(c)) &&
  209. (!core.getConfig().getBoolean("enabled_commands." + c)))
  210. {
  211. player.sendMessage(ChatColor.RED + "This command is currently disabled on this server!");
  212. return false;
  213. }
  214. }
  215. return false;
  216. }
  217. }
Advertisement
RAW Paste Data Copied
Advertisement