1. This one's stupidly simple but I can't work it out. How do I do 2 different colours in a play message? 2. How could I make it so when a player did a command it gave them a permission but when the died it removed that permission until they did that command again?
Jellydude 1. Like formatting and a color? ChatColor.BOLD + "" + ChatColor.RED + "this would be a bold red message"
marti.2001 That doesn't answer my question. What is the code for it and how do I make the permission get removed when they die.
Jellydude This makes no sense please elaborate. Like when the player chats the name on the left is red and blue?
xTrollxDudex No for example when a player runs a command the server sends them a message saying "Hello world" and Hello would be red and world would be blue.
Jellydude Ok I give up But chat colors go like this Code:java ChatColor.RED + "Hello" + ChatColor.BLUE + "World"
xTrollxDudex Thanks the reason I can't explain very well is I'm on my iPad so it takes forever to type a message.
Jellydude Give them permissions when they type the command and take them in PlayerDeathEvent. 1. Download Vault here: http://dev.bukkit.org/bukkit-plugins/vault/ 2. Add it to your build path (where bukkit.jar is) 3. Add this to your plugin.yml: Code: depend: [Vault] 4. Add this: Code:java public static Permission perms = null; 5. Add this somewhere in your class: Code:java private boolean setupPermissions() { RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class); perms = rsp.getProvider(); return perms != null;} 6. Add this to your onEnable(): Code:java setupPermissions(); Now you're ready to use Vault (but your plugin will be unable to run without it installed on the server) To add permissions: Code:java public boolean onCommand(CommandSender sender, Command cmd, String label, String[]args){ if(cmd.getName().equalsIgnoreCase("giveperms")){ if(sender instanceof Player){ Player p = (Player) sender; perms.playerAdd(p, "your.permission"); } } return false;} To remove the permission when the player dies add this to your listener class: Code:java @EventHandlerpublic void onPlayerDeath(PlayerDeathEvent e){ playerRemove(e.getPlayer, "your.permission");} (haven't tested this code)
Jellydude hello to add a permission, use player.addAttachment(plugin, "permission.node", true) and remove it by changing the true to false.
marti.2001 Awesome info but looking at the common mistakes stick, using Vault is actually slower than using the normal .hasPermission(). Besides vault uses .hasPermission() anyway so why bother!
marti.2001 My point still stands. Instead of using vault which is a bit complex considering registering and other plugin.yml, try looking at this