We're updating the issue view to help you get more done. 

GroupManager API error

Description

I was making a plugin and why isn't it working.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 package me.narpzy.ranks; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; public class ranks extends JavaPlugin { private GMHook gmHook; public void onEnable() { saveDefaultConfig(); } @EventHandler public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player p = (Player) sender; if(cmd.getName().equalsIgnoreCase("rank")) { if(p.hasPermission("ranks.use")) { if(args.length == 2) { Player target = Bukkit.getPlayer(args[0]); // String name = target.getName(); // - .getServer() String rank = args[1]; p.sendMessage(ChatColor.GREEN + "Player " + target.getDisplayName() + ChatColor.GREEN + " is now rank " + ChatColor.GREEN + rank.toUpperCase()); target.sendMessage(ChatColor.GREEN + "You are now " + rank.toUpperCase()); for (Player online : Bukkit.getOnlinePlayers()) { if(online.hasPermission("ranks.notify")) { String prefix = ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix")); online.sendMessage(prefix + " " + ChatColor.RED + p.getDisplayName() + ChatColor.WHITE + " set rank of " + target.getName() + " to " + ChatColor.RED + rank.toUpperCase()); } } if(target != null) { gmHook.setGroup(target, rank); } } else if(args.length >= 2) { p.sendMessage(ChatColor.RED + "Too many arguments!"); p.sendMessage(ChatColor.WHITE + "Usage: /rank <player> <rank>"); } else if(args.length <= 2) { p.sendMessage(ChatColor.RED + "Too few arguments!"); p.sendMessage(ChatColor.WHITE + "Usage: /rank <player> <rank>"); } } else { p.sendMessage(ChatColor.RED + "You must be the rank admin or higher to use this command!"); } } return false; } }

Environment

So I was creating a plugin, and why isn't it working.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 package me.narpzy.ranks; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; public class ranks extends JavaPlugin { private GMHook gmHook; public void onEnable() { saveDefaultConfig(); } @EventHandler public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player p = (Player) sender; if(cmd.getName().equalsIgnoreCase("rank")) { if(p.hasPermission("ranks.use")) { if(args.length == 2) { Player target = Bukkit.getPlayer(args[0]); // String name = target.getName(); // - .getServer() String rank = args[1]; p.sendMessage(ChatColor.GREEN + "Player " + target.getDisplayName() + ChatColor.GREEN + " is now rank " + ChatColor.GREEN + rank.toUpperCase()); target.sendMessage(ChatColor.GREEN + "You are now " + rank.toUpperCase()); for (Player online : Bukkit.getOnlinePlayers()) { if(online.hasPermission("ranks.notify")) { String prefix = ChatColor.translateAlternateColorCodes('&', getConfig().getString("prefix")); online.sendMessage(prefix + " " + ChatColor.RED + p.getDisplayName() + ChatColor.WHITE + " set rank of " + target.getName() + " to " + ChatColor.RED + rank.toUpperCase()); } } if(target != null) { gmHook.setGroup(target, rank); } } else if(args.length >= 2) { p.sendMessage(ChatColor.RED + "Too many arguments!"); p.sendMessage(ChatColor.WHITE + "Usage: /rank <player> <rank>"); } else if(args.length <= 2) { p.sendMessage(ChatColor.RED + "Too few arguments!"); p.sendMessage(ChatColor.WHITE + "Usage: /rank <player> <rank>"); } } else { p.sendMessage(ChatColor.RED + "You must be the rank admin or higher to use this command!"); } } return false; } }

Status

Assignee

RobertG

Reporter

NarpZ - Nerd

External issue ID

None

AssemblaID

None

Priority

Normal