Advertisement
Guest User

Everything related to Vault is error, I have included Vault

a guest
Jul 27th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. package me.calebbfmv.test;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import net.milkbowl.vault.chat.Chat;
  6. import net.milkbowl.vault.economy.Economy;
  7. import net.milkbowl.vault.permission.Permission;
  8.  
  9. import org.bukkit.command.Command;
  10. import org.bukkit.command.CommandSender;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.plugin.RegisteredServiceProvider;
  13. import org.bukkit.plugin.java.JavaPlugin;
  14.  
  15. public class Test extends JavaPlugin {
  16.  
  17. private static final Logger log = Logger.getLogger("Minecraft");
  18. public static Economy econ = null;
  19. public static Permission perms = null;
  20. public static Chat chat = null;
  21.  
  22. @Override
  23. public void onDisable() {
  24. log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
  25. }
  26.  
  27. @Override
  28. public void onEnable() {
  29. if (!setupPermissions() ) {
  30. log.info(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
  31. getServer().getPluginManager().disablePlugin(this);
  32. return;
  33. }
  34. setupPermissions();
  35.  
  36. }
  37. private boolean setupPermissions() {
  38. RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
  39. perms = rsp.getProvider();
  40. return perms != null;
  41. }
  42.  
  43. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
  44. if(!(sender instanceof Player)) {
  45. log.info("Only players are supported for this Example Plugin, but you should not do this!!!");
  46. return true;
  47. }
  48.  
  49. Player player = (Player) sender;
  50. if(command.getLabel().equals("test-permission")) {
  51. // Lets test if user has the node "example.plugin.awesome" to determine if they are awesome or just suck
  52. if(perms.has(player, "example.plugin.awesome")) {
  53. sender.sendMessage("You are awesome!");
  54. } else {
  55. sender.sendMessage("You suck!");
  56. }
  57.  
  58. }
  59. return false;
  60. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement