Advertisement
Guest User

Eclipse Code (BossBar.java)

a guest
Jun 27th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. package me.HDTVSteve;
  2.  
  3. import me.confuser.barapi.BarAPI;
  4.  
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.permissions.Permission;
  10. import org.bukkit.plugin.PluginManager;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. public class BossBar extends JavaPlugin {
  14.  
  15. public Permission playerPermission = new Permission("BossBarAPI.canEnable");
  16. public Permission playerPermission2 = new Permission("BossBarAPI.canDisable");
  17.  
  18. @Override
  19. public void onEnable() {
  20. getLogger().info("- Success (Enabled)");
  21. saveDefaultConfig();
  22. new pmListener(this);
  23. PluginManager pm = getServer().getPluginManager();
  24. pm.addPermission(playerPermission);
  25. pm.addPermission(playerPermission2);
  26.  
  27. }
  28.  
  29. @Override
  30. public void onDisable() {
  31. getLogger().info("- Disabled");
  32. }
  33.  
  34. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  35. if (label.equalsIgnoreCase("BossBarOn")) {
  36.  
  37. Player player = (Player) sender;
  38. if (player.hasPermission("BossBarAPI.canEnable"))
  39.  
  40. BarAPI.setMessage((Player) sender, getConfig().getString("BarAPI Message for BossBarOn"), 15f);
  41.  
  42. }else{
  43. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "MAC" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "- You do not have permission to do this! Be off!");
  44. }
  45.  
  46. if (label.equalsIgnoreCase("BossBarOff")) {
  47.  
  48. Player player = (Player) sender;
  49. if (player.hasPermission("BossBarAPI.canDisable"))
  50.  
  51. if (BarAPI.hasBar((Player) sender)) {
  52.  
  53. BarAPI.removeBar((Player) sender);
  54.  
  55. }else{
  56. sender.sendMessage(ChatColor.GRAY + "[" + ChatColor.RED + "MAC" + ChatColor.GRAY + "] " + ChatColor.YELLOW + "- You do not have permission to do this! Be off!");
  57.  
  58. }
  59.  
  60. return true;
  61.  
  62. }
  63.  
  64. return false;
  65. }
  66.  
  67. }
  68.  
  69. // 1 YEAR = 31,556,952 SECONDS = BarAPI.(float = 31,556,952 NO "," 31556952 f )
  70. // Buggy on the LimitlessBossBarAPI
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement