Advertisement
Guest User

Src

a guest
Feb 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1.  
  2. Save New Duplicate & Edit Just Text Twitter
  3. 1
  4. 2
  5. 3
  6. 4
  7. 5
  8. 6
  9. 7
  10. 8
  11. 9
  12. 10
  13. 11
  14. 12
  15. 13
  16. 14
  17. 15
  18. 16
  19. 17
  20. 18
  21. 19
  22. 20
  23. 21
  24. 22
  25. 23
  26. 24
  27. 25
  28. 26
  29. 27
  30. 28
  31. 29
  32. 30
  33. 31
  34. 32
  35. 33
  36. 34
  37. 35
  38. 36
  39. 37
  40. 38
  41. 39
  42. 40
  43. 41
  44. 42
  45. 43
  46. 44
  47. 45
  48. 46
  49. 47
  50. 48
  51. 49
  52. 50
  53. 51
  54. 52
  55. 53
  56. 54
  57. 55
  58. 56
  59. 57
  60. 58
  61. 59
  62. 60
  63. 61
  64. 62
  65. 63
  66. 64
  67. 65
  68. 66
  69. 67
  70. 68
  71. 69
  72. 70
  73. 71
  74. 72
  75. 73
  76. 74
  77. 75
  78. package takahatashun.antidote;
  79. import org.bukkit.Bukkit;
  80. import org.bukkit.ChatColor;
  81. import org.bukkit.entity.Player;
  82. import org.bukkit.event.Listener;
  83. import org.bukkit.plugin.java.JavaPlugin;
  84. import org.bukkit.potion.PotionEffectType;
  85. import org.bukkit.command.CommandSender;
  86. import org.bukkit.command.Command;
  87. public final class main extends JavaPlugin implements Listener {
  88. @Override
  89. public void onEnable() {
  90. getConfig().options().copyDefaults(true);
  91. saveConfig();
  92. Bukkit.getServer().getLogger().info("Antidote đã được bật");
  93. }
  94. @Override
  95. public boolean onCommand(CommandSender sender, Command cmd, String arg2, String[] args) {
  96. if (cmd.getName().equalsIgnoreCase("antidote")) {
  97. if (!(sender instanceof Player)) {
  98. sender.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.OnlyPlayer")));
  99. }
  100. Player p = (Player) sender;
  101.  
  102. if (!(p.hasPermission("Antidote.use"))) {
  103. p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.Prefix")) + ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.NoPerm")));
  104. return true;
  105. }
  106. p.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.Used")));
  107. if (p.hasPotionEffect(PotionEffectType.BLINDNESS) == true) {
  108. p.removePotionEffect(PotionEffectType.BLINDNESS);
  109. }
  110. if (p.hasPotionEffect(PotionEffectType.CONFUSION) == true) {
  111. p.removePotionEffect(PotionEffectType.CONFUSION);
  112. }
  113. if (p.hasPotionEffect(PotionEffectType.HUNGER) == true) {
  114. p.removePotionEffect(PotionEffectType.HUNGER);
  115. }
  116. if (p.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE) == true) {
  117. p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
  118. }
  119. if (p.hasPotionEffect(PotionEffectType.POISON) == true) {
  120. p.removePotionEffect(PotionEffectType.POISON);
  121. }
  122. if (p.hasPotionEffect(PotionEffectType.SLOW) == true) {
  123. p.removePotionEffect(PotionEffectType.SLOW);
  124. }
  125. if (p.hasPotionEffect(PotionEffectType.SLOW_DIGGING) == true) {
  126. p.removePotionEffect(PotionEffectType.SLOW_DIGGING);
  127. }
  128. if (p.hasPotionEffect(PotionEffectType.WEAKNESS) == true) {
  129. p.removePotionEffect(PotionEffectType.WEAKNESS);
  130. }
  131. return true;
  132. }
  133. if (cmd.getName().equalsIgnoreCase("antidotereload")) {
  134. Player p2 = (Player) sender;
  135.  
  136. if (!(p2.hasPermission("Antidote.reload"))) {
  137. p2.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.Prefix")) + ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.NoPerm")));
  138. return true;
  139. }
  140. reloadConfig();
  141. saveConfig();
  142. p2.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("Msg.Reloaded")));
  143. return true;
  144. }
  145. return false;
  146. }
  147.  
  148. @Override
  149. public void onDisable () {
  150. Bukkit.getServer().getLogger().info("Antidote đã bị tắt");
  151. }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement