Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. package net.vandesdelca32.websitespam;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.configuration.file.FileConfiguration;
  7. import org.bukkit.configuration.file.FileConfigurationOptions;
  8.  
  9. public final class WebsiteSpam extends org.bukkit.plugin.java.JavaPlugin
  10. {
  11. public WebsiteSpam() {}
  12.  
  13. public void onDisable() {}
  14.  
  15. public void onEnable()
  16. {
  17. saveDefaultConfig();
  18. getConfig().options().copyDefaults(true);
  19. }
  20.  
  21.  
  22. public void onLoad() {}
  23.  
  24.  
  25. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  26. {
  27. if (cmd.getName().equalsIgnoreCase("website")) {
  28. if (args.length == 1) {
  29. if (("donations".equalsIgnoreCase(args[0])) || ("2".equalsIgnoreCase(args[0])))
  30. {
  31. SendLink(sender, "donate");
  32. return true;
  33. }
  34. if (("register".equalsIgnoreCase(args[0])) || ("3".equalsIgnoreCase(args[0])))
  35. {
  36. SendLink(sender, "register");
  37. return true;
  38. }
  39. if (("vote".equalsIgnoreCase(args[0])) || ("4".equalsIgnoreCase(args[0])))
  40. {
  41. SendLink(sender, "vote");
  42. return true;
  43. }
  44. if ("reload".equalsIgnoreCase(args[0]))
  45. {
  46. if (sender.hasPermission("websitespam.reload"))
  47. {
  48. reloadConfig();
  49.  
  50. SendLink(sender, "reload");
  51. return true;
  52. }
  53.  
  54. sender.sendMessage("§cYou don't have permission to do that.");
  55. return false;
  56. }
  57.  
  58. }
  59. else
  60. {
  61. SendLink(sender, "main");
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67.  
  68. private void SendLink(CommandSender target, String linktype) {
  69. String message = "§a§o";
  70. if ("donate".equalsIgnoreCase(linktype)) {
  71. message = message + "Donations§r: §6" + getDonationLink();
  72. } else if ("main".equalsIgnoreCase(linktype)) {
  73. message = message + "Main Website§r: §6" + getMainLink();
  74. } else if ("register".equalsIgnoreCase(linktype)) {
  75. message = message + "Register§r: §6" + getRegisterLink();
  76. } else if ("vote".equalsIgnoreCase(linktype)) {
  77. message = message + "Vote§r: §6" + getVoteLink();
  78. } else if ("reload".equalsIgnoreCase(linktype)) {
  79. message = message + ChatColor.GREEN + "Config reloaded";
  80. } else {
  81. message = message + ChatColor.RED + "I don't know what to say to you...";
  82. }
  83. target.sendMessage("§3§o[WebsiteSpammer]§r " + message);
  84. }
  85.  
  86. private String getDonationLink()
  87. {
  88. return getConfig().getString("links.donations");
  89. }
  90.  
  91. private String getRegisterLink()
  92. {
  93. return getConfig().getString("links.register");
  94. }
  95.  
  96. private String getVoteLink() {
  97. return getConfig().getString("links.vote");
  98. }
  99.  
  100. private String getMainLink()
  101. {
  102. return getConfig().getString("links.main");
  103. }
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement