Command execution Error

Discussion in 'Plugin Development' started by GoogleMaps, Jan 3, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    GoogleMaps

    So basically I classes for gui's and then in the main class I got 2 commands to open the gui's any way here are the classes
    Main
    Code:
    package com.GoogleMaps.GUI;
    
    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.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener {
         private YTMenu ytmenu;
        private TagMenu tagmenu;
        
         public void onEnable() {
            
             tagmenu = new TagMenu(this);
             ytmenu = new YTMenu(this);
             Bukkit.getServer().getPluginManager().registerEvents(this, this);
    }
         @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            Player p = (Player) sender;
             if(label.equalsIgnoreCase("youtubers"))
            {
                ytmenu.show(p);
               
            }
            
             if(label.equalsIgnoreCase("tags"))
             {
                 if(p.hasPermission("googlemaps.tags.trashtalker"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.ezraid"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezr);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezr);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.youmadbro"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.mad);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.mad);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.og"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.og);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.og);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.quickd"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.drop);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.drop);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.cannon"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.can);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.can);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.destroyer"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.des);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.des);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.ezsplit"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezs);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezs);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.rekt"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.rekt);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.rekt);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.trashtalker"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                     return true;
                 } if(p.hasPermission("googlemaps.tags.babe"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.babe);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.babe);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.dropped"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.getd);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.getd);
                     return true;
                 }
                 if(p.hasPermission("googlemaps.tags.wannabe"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.wannabe);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.wannabe);
                     return true;
                 }
                 ytmenu.show(p);
           
                
             }
            return false;
        }
        
        
       
       
    
    }
    
    TagMenu
    Code:
    package com.GoogleMaps.GUI;
    
    import java.util.Arrays;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.event.inventory.InventoryType;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.RegisteredServiceProvider;
    
    import net.milkbowl.vault.chat.Chat;
    
    public class TagMenu implements Listener{
        private Inventory inv;
        public ItemStack trash,mad,og,drop,ezr,can,des,
        ezs,rekt,babe,getd,wannabe
        = new ItemStack(Material.NAME_TAG);
        public static Chat chat = null;
         public TagMenu(Plugin p)
         {
             setupChat();
             setName("Trash Talker",trash);
             setName("YouMadBro?", mad);
             setName("OG", og);
             setName("QuickDropper", drop);
             setName("EzRaided", ezr);
             setName("Cannoner", can);
             setName("Destroyer", des);
             setName("EzSplit", ezs);
             setName("GetEzRekt", rekt);
             setName("Babe", babe);
             setName("Get Dropped", getd);
             setName("Wannabe", wannabe);
             inv = Bukkit.getServer().createInventory(null, InventoryType.ENDER_CHEST, ChatColor.AQUA + "Tags");
             Bukkit.getServer().getPluginManager().registerEvents(this, p);
             inv.setItem(0, trash);
             inv.setItem(1, mad);
             inv.setItem(2, og);
             inv.setItem(3, drop);
             inv.setItem(4, ezr);
             inv.setItem(5, can);
             inv.setItem(6, des);
             inv.setItem(7, ezs);
             inv.setItem(8, rekt);
             inv.setItem(9, babe);
             inv.setItem(10, getd);
             inv.setItem(11, wannabe);
             Bukkit.getServer().getPluginManager().registerEvents(this, p);
            
         }
         public void setLore(String lore, ItemStack c)
         {
             ItemMeta meta = c.getItemMeta();
             meta.setLore(Arrays.asList(lore));
             c.setItemMeta(meta);
         }
         private void setName(String name, ItemStack c)
         {
             ItemMeta meta = c.getItemMeta();
             meta.setDisplayName(ChatColor.AQUA + name);
             c.setItemMeta(meta);    
         }
         public void openInv(Player p)
         {
             p.openInventory(inv);
         }
           private boolean setupChat() {
                RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
                chat = rsp.getProvider();
                return chat != null;
            }
         @EventHandler
         public void onInvClick(InventoryClickEvent e)
         {
            
           
             Player p = (Player) e.getWhoClicked();
             String itemname = e.getCurrentItem().getItemMeta().getDisplayName();
             if (!e.getInventory().getName().equalsIgnoreCase(inv.getName())) return;
             if(itemname.contains("Trash Talker"))
             {
                 if(!p.hasPermission("googlemaps.tags.trashtalker"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
           
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&&8[&3TrashTalker&8]"));
                 }
                
                
                 if(!p.hasPermission("googlemaps.tags.youmadbro"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&6YouMadBro&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.ezraid"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&bEzRaided&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.og"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
    
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&c&lO&6&lG&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.quickd"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&5QuickDropper&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.cannon"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                    
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&aCannoner&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.destroyer"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&2Destroyer&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.ezsplit"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&1EzSplit&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.rekt"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&cGetEzRekt&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.babe"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&cF&ba&cZ&be&8"));
                 }
                 if(!p.hasPermission("googlemaps.tags.dropped"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&5GetDropped&8]"));
                 }
                 if(!p.hasPermission("googlemaps.tags.wannabe"))
                 {
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', "&8[&&4Wannabe&8]"));
                 }
                
                
                
                
                
             }
         
            
                
            
                
         }
        
        
        
        
        
        
    
    }
    
    YtMenu
    Code:
    package com.GoogleMaps.GUI;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.SkullType;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.inventory.meta.SkullMeta;
    import org.bukkit.plugin.Plugin;
    
    public class YTMenu implements Listener {
         private Inventory inv;
         private ItemStack c, s, a,b,e,pane;
       
         public YTMenu(Plugin p) {
                 inv = Bukkit.getServer().createInventory(null, 9, ChatColor.RED + "Youtubers");
                c =  new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
               
                setMeta(c,"Kryptiiq");
                new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
                s = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
                setMeta(s, "KonvictedCrafts");
                a = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
                setMeta(a, "NetoTazmon");
                b = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
                setMeta(b, "prestomesto");
                e = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
                setMeta(e, "RickyTurboYT");
    
                pane = new ItemStack(Material.STAINED_GLASS_PANE);
                ItemMeta aa = pane.getItemMeta();
                aa.setDisplayName(ChatColor.RED + "Coming Soon");
                pane.setItemMeta(aa);
             
                
               
                 inv.setItem(0, c);
                 inv.setItem(1, s);
                 inv.setItem(2, a);
                 inv.setItem(3, b);
                 inv.setItem(4, e);
               
                 Bukkit.getServer().getPluginManager().registerEvents(this, p);
         }
       
    
        private void setMeta(ItemStack c, String name)
        {
              SkullMeta meta = (SkullMeta) c.getItemMeta();
              meta.setOwner(name);
              meta.setDisplayName(ChatColor.RED + name);
              c.setItemMeta(meta);
        }
        
        
         public void show(Player p) {
                 p.openInventory(inv);
         }
         @EventHandler
         public void onInventoryClick(InventoryClickEvent e) {
             Player p = (Player) e.getWhoClicked();
                 if (!e.getInventory().getName().equalsIgnoreCase(inv.getName())) return;
                
                 if(e.getCurrentItem().getItemMeta().getDisplayName().contains("Kryptiiq"))
                 {
                     e.setCancelled(true);
                     p.sendMessage("§8[§cYou§fTube§8] §6https://www.youtube.com/channel/UCTmbJUU5JmqBIZS3pUKo7QA");                
                     e.getWhoClicked().closeInventory();
                    
                 }
                 if(e.getCurrentItem().getItemMeta().getDisplayName().contains("KonvictedCrafts"))
                 {
                     e.setCancelled(true);
                     p.sendMessage("§8[§cYou§fTube§8] §6https://www.youtube.com/channel/UC829jEDFXdk9t3-Kh-ou5-A");                
                     e.getWhoClicked().closeInventory();
                    
                 }
                 if(e.getCurrentItem().getItemMeta().getDisplayName().contains("NetoTazmon"))
                 {
                     e.setCancelled(true);
                     p.sendMessage("§8[§cYou§fTube§8] §6https://www.youtube.com/channel/UCDGwbhQw2JcKJzd3vH7Z7nA");                
                     e.getWhoClicked().closeInventory();
                    
                 }
                 if(e.getCurrentItem().getItemMeta().getDisplayName().contains("RickyTurboYT"))
                 {
                     e.setCancelled(true);
                     p.sendMessage("§8[§cYou§fTube§8] §6https://www.youtube.com/channel/UCgUL4cqFm9nt0uIex74ad4w");                
                     e.getWhoClicked().closeInventory();
                    
                 }
                 if(e.getCurrentItem().getItemMeta().getDisplayName().contains("prestomesto"))
                 {
                     e.setCancelled(true);
                     p.sendMessage("§8[§cYou§fTube§8] §6https://www.youtube.com/channel/UCeVcFevRxy2Bfis6LG_smjg");                
                     e.getWhoClicked().closeInventory();
                    
                 }
                 if(e.getCurrentItem().getItemMeta().getDisplayName().contains("Coming Soon"))
                 {
                     e.setCancelled(true);
                 }
                
                
                
         }
        
    }
    
    Now for the errors
    This is when I do /youtubers
    PHP:
    03.01 05:34:54 [ServerINFO ... 13 more
    03.01 05
    :34:54 [ServerINFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at com.GoogleMaps.GUI.Main.onCommand(Main.java:28) ~[?:?]
    03.01 05:34:54 [ServerINFO Caused byjava.lang.NullPointerException
    03.01 05
    :34:54 [ServerINFO at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 05:34:54 [ServerINFO org.bukkit.command.CommandExceptionUnhandled exception executing command 'youtubers' in plugin GoogleGUI v1.0
    This is when I do /tags
    Code:
    03.01 06:45:03 [Server] INFO ... 13 more
    03.01 06:45:03 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at com.GoogleMaps.GUI.Main.onCommand(Main.java:36) ~[?:?]
    03.01 06:45:03 [Server] INFO Caused by: java.lang.NullPointerException
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    03.01 06:45:03 [Server] INFO org.bukkit.command.CommandException: Unhandled exception executing command 'tags' in plugin GoogleGUI v1.0
    03.01 06:45:03 [Server] ERROR null
     
  2. Offline

    mine-care

    https://bukkit.org/threads/how-to-r...ubleshoot-your-own-plugins-by-yourself.32457/
    That is all you need.

    Also a couple of notes:
    Naming conventions!

    Dont cast without checking!

    Use Command#getName(), not label for alias support.


    Dont use the color character directly! use ChatColor instead for future compatibility.

    Is all this code required? You could set the prefix based on the presmission and send the message at the end of the if's, this way you wrap it up a bit and you dont have to change them all one by one in case you want to change it.
     
    Last edited: Jan 3, 2016
  3. Offline

    GoogleMaps

    Uhm that stack-trace thing didn't really help I already knew where to find the line of it but I don't know what is wrong with it.
    Edit: If you look at e.g line 36 I don't see how there is an error same with line 27
    I think I'm using the spigot that is 1.8 and 1.7 compatible
    Edit: Now getting this error when running it
    Code:
     Error occurred while enabling GoogleGUI v1.0 (Is it up to date?)
    java.lang.NullPointerException
            at com.GoogleMaps.GUI.TagMenu.setName(TagMenu.java:67) ~[?:?]
            at com.GoogleMaps.GUI.TagMenu.<init>(TagMenu.java:30) ~[?:?]
            at com.GoogleMaps.GUI.Main.onEnable(Main.java:17) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[craftbukkit.jar:git-Bukkit-18fbb24]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [craftbukkit.jar:git-Bukkit-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:342) [craftbukkit.jar:git-Bukkit-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:314) [craftbukkit.jar:git-Bukkit-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:406) [craftbukkit.jar:git-Bukkit-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:370) [craftbukkit.jar:git-Bukkit-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:325) [craftbukkit.jar:git-Bukkit-18fbb24]
            at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:235) [craftbukkit.jar:git-Bukkit-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:504) [craftbukkit.jar:git-Bukkit-18fbb24]
    Edit also tried this on bukkit 1.8 and it still didn't work
     
    Last edited: Jan 3, 2016
  4. Offline

    Xerox262

    @GoogleMaps You really can't tell what is null on this line?
    Code:
             ItemMeta meta = c.getItemMeta();
    I'll give you a hint, doing this
    Code:
    public ItemStack trash,mad,og,drop,ezr,can,des,
        ezs,rekt,babe,getd,wannabe
       = new ItemStack(Material.NAME_TAG);
    
    Does not set all ItemStacks to a NameTag, it only sets wannabe (The only one that actually has an equals sign)
     
    mine-care likes this.
  5. Offline

    GoogleMaps

    yES but what is the error I don't know why it is null
     
  6. Offline

    KingFaris11

    He just explained it. Please learn the basics of Java before making Bukkit plugins, it clears this Bukkit forums from 'Java help' instead of actual 'Bukkit help', thanks.

    Right now, all your variables for ItemStacks are null, except 'wannabe'. Set all of them to new ItemStacks, not just wannabe.
     
  7. Offline

    GoogleMaps

    @KingFaris11 @GoogleMaps
    Code:
    04.01 07:22:10 [Server] INFO ... 13 more
    04.01 07:22:10 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at com.GoogleMaps.GUI.Main.onCommand(Main.java:38) ~[?:?]
    04.01 07:22:10 [Server] INFO Caused by: java.lang.NullPointerException
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:65) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:880) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:1043) [spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:767) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:181) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-1.7.9-R0.2-205-g6a8d903]
    04.01 07:22:10 [Server] INFO org.bukkit.command.CommandException: Unhandled exception executing command 'tags' in plugin GoogleGUI v1.0
    Now this happened?
    Also here is my updated code
    TAGMENU
    Code:
    package com.GoogleMaps.GUI;
    
    import java.util.Arrays;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.Plugin;
    import org.bukkit.plugin.RegisteredServiceProvider;
    
    import net.milkbowl.vault.chat.Chat;
    
    public class TagMenu implements Listener{
        private Inventory taginv;
        public ItemStack trash,mad,og,drop,ezr,can,des,
        ezs,rekt,babe,getd,wannabe,helmp,salt,pvpm,glasspane,faze;
        public static Chat chat = null;
         @SuppressWarnings("deprecation")
        public TagMenu(Plugin p)
         {
             glasspane = new ItemStack(Material.getMaterial(160));
             helmp = new ItemStack(Material.NAME_TAG);
             faze = new ItemStack(Material.NAME_TAG);
             salt = new ItemStack(Material.NAME_TAG);
             pvpm = new ItemStack(Material.NAME_TAG);
             wannabe = new ItemStack(Material.NAME_TAG);
             getd = new ItemStack(Material.NAME_TAG);
             babe = new ItemStack(Material.NAME_TAG);
             rekt = new ItemStack(Material.NAME_TAG);
             ezs = new ItemStack(Material.NAME_TAG);
             des = new ItemStack(Material.NAME_TAG);
             can = new ItemStack(Material.NAME_TAG);
             ezr = new ItemStack(Material.NAME_TAG);
             drop = new ItemStack(Material.NAME_TAG);
             og = new ItemStack(Material.NAME_TAG);
             mad = new ItemStack(Material.NAME_TAG);
             trash = new ItemStack(Material.NAME_TAG);
             setupChat();
             setName("Trash Talker",trash);
             setName("SaltyMuch?",salt);
             setName("Helm Popper",helmp);
             setName("PvpMuch?",pvpm);
             setName("YouMadBro?", mad);
             setName("OG", og);
             setName("QuickDropper", drop);
             setName("EzRaided", ezr);
             setName("Cannoner", can);
             setName("Destroyer", des);
             setName("EzSplit", ezs);
             setName("GetEzRekt", rekt);
             setName("Babe", babe);
             setName("Get Dropped", getd);
             setName("Wannabe", wannabe);
             taginv = Bukkit.getServer().createInventory(null, 54, ChatColor.RED + "Tags");
             Bukkit.getServer().getPluginManager().registerEvents(this, p);
             taginv.setItem(0, trash);
             taginv.setItem(1, glasspane);
             taginv.setItem(2, og);
             taginv.setItem(3, glasspane);
             taginv.setItem(4, drop);
             taginv.setItem(5, glasspane);
             taginv.setItem(6, ezr);
             taginv.setItem(7, glasspane);
             taginv.setItem(8, can);
             taginv.setItem(9, glasspane);
             taginv.setItem(10, glasspane);
             taginv.setItem(11, glasspane);
             taginv.setItem(12, glasspane);
             taginv.setItem(13, glasspane);
             taginv.setItem(14, glasspane);
             taginv.setItem(15, glasspane);
             taginv.setItem(16, glasspane);
             taginv.setItem(17, glasspane);
             taginv.setItem(18, glasspane);
             taginv.setItem(19, des);
             taginv.setItem(20, glasspane);
             taginv.setItem(21, ezs);
             taginv.setItem(22, glasspane);
             taginv.setItem(23, rekt);
             taginv.setItem(24, glasspane);
             taginv.setItem(25, babe);
             taginv.setItem(26, glasspane);
             taginv.setItem(27, getd);
             taginv.setItem(28, glasspane);
             taginv.setItem(29, glasspane);
             taginv.setItem(30, glasspane);
             taginv.setItem(31, glasspane);
             taginv.setItem(32, glasspane);
             taginv.setItem(33, glasspane);
             taginv.setItem(34, glasspane);
             taginv.setItem(35, glasspane);
             taginv.setItem(36, glasspane);
             taginv.setItem(37, glasspane);
             taginv.setItem(38, wannabe);
             taginv.setItem(39, glasspane);
             taginv.setItem(38, faze);
             taginv.setItem(40, glasspane);
             taginv.setItem(41, pvpm);
             taginv.setItem(42, glasspane);
             taginv.setItem(43, helmp);
             taginv.setItem(44, glasspane);
             taginv.setItem(45, salt);
             taginv.setItem(46, glasspane);
             taginv.setItem(47, glasspane);
             taginv.setItem(48, glasspane);
             taginv.setItem(49, glasspane);
             taginv.setItem(50, glasspane);
             taginv.setItem(51, glasspane);
             taginv.setItem(52, glasspane);
             taginv.setItem(53, glasspane);
             taginv.setItem(54, glasspane);
           
             Bukkit.getServer().getPluginManager().registerEvents(this, p);
            
         }
         public void setLore(String lore, ItemStack c)
         {
             ItemMeta meta = c.getItemMeta();
             meta.setLore(Arrays.asList(lore));
             c.setItemMeta(meta);
         }
         private void setName(String name, ItemStack d)
         {
             ItemMeta meta = d.getItemMeta();
             meta.setDisplayName(ChatColor.AQUA + name);
             d.setItemMeta(meta);    
         }
         public void openInv(Player p)
         {
             p.openInventory(taginv);
         }
         public void closeInv(Player p)
         {
             p.closeInventory();
         }
           private boolean setupChat() {
                RegisteredServiceProvider<Chat> rsp = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
                chat = rsp.getProvider();
                return chat != null;
            }
         @EventHandler
         public void onInvClick(InventoryClickEvent e)
         {
            
           
             Player p = (Player) e.getWhoClicked();
             String itemname = e.getCurrentItem().getItemMeta().getDisplayName();
             if (!e.getInventory().getName().equalsIgnoreCase(taginv.getName())) return;
             if(itemname.contains("Trash Talker"))
             {
                 if(!p.hasPermission("googlemaps.tags.trashtalker"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                    
           
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&3TrashTalker&8]"));
                 }
             }
    
                
                 if(itemname.contains("YouMadBro?"))
                 {
                 if(!p.hasPermission("googlemaps.tags.youmadbro"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&6YouMadBro&8]"));
                 }
                 }
                 if(itemname.contains("EzRaided"))
                 {
                 if(!p.hasPermission("googlemaps.tags.ezraid"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&bEzRaided&8]"));
                 }
                 }
                 if(itemname.contains("OG"))
                 {
                 if(!p.hasPermission("googlemaps.tags.og"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
    
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&c&lO&6&lG&8]"));
                 }
                 }
                 if(itemname.contains("QuickDropper"))
                 {
                 if(!p.hasPermission("googlemaps.tags.quickd"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&5QuickDropper&8]"));
                 }
                 }
                 if(itemname.contains("Cannoner"))
                 {
                 if(!p.hasPermission("googlemaps.tags.cannon"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                    
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                     chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&aCannoner&8]"));
                 }
                 }
                 if(itemname.contains("Destroyer"))
                 {
                 if(!p.hasPermission("googlemaps.tags.destroyer"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&2Destroyer&8]"));
                 }
                 }
                 if(itemname.contains("EzSplit"))
                 {
                 if(!p.hasPermission("googlemaps.tags.ezsplit"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&1EzSplit&8]"));
                 }
                 }
                 if(itemname.contains("GetEzRekt"))
                 {
                 if(!p.hasPermission("googlemaps.tags.rekt"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&cGetEzRekt&8]"));
                 }
                 }
                 if(itemname.contains("Babe"))
                 {
                 if(!p.hasPermission("googlemaps.tags.babe"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&cF&ba&cZ&be&8"));
                 }
                 }
                 if(itemname.contains("Get Dropped"))
                 {
                 if(!p.hasPermission("googlemaps.tags.dropped"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&5GetDropped&8]"));
                 }
                 }
                 if(itemname.contains("Wannabe"))
                 {
                 if(!p.hasPermission("googlemaps.tags.wannabe"))
                 {
                     closeInv(p);
                     e.setCancelled(true);
                     p.closeInventory();
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You don't have permission to use this tag! You can buy it from /buy");
                 }else{
                     closeInv(p);
                     e.setCancelled(true);
                     p.sendMessage("§8[§cTranscendingTags§8] §7>>> You have Successfully set your new tag! :)");
                        chat.setPlayerSuffix(p, ChatColor.translateAlternateColorCodes('&', " &8[&&4Wannabe&8]"));
                 }
                 }
                
                
                
                
                
             }
         
            
                
            
                
         }
        
        
        
        
        
        
    
    
    
    Main
    Code:
    package com.GoogleMaps.GUI;
    
    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.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener {
         private YTMenu ytmenu;
        private TagMenu tagmenu;
        
         public void onEnable() {
            
             tagmenu = new TagMenu(this);
             ytmenu = new YTMenu(this);
            
             Bukkit.getServer().getPluginManager().registerEvents(this, this);
    }
         @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            Player p = (Player) sender;
             if(label.equalsIgnoreCase("youtubers"))
            {
                
                
                ytmenu.show(p);
                return true;
               
            }
            
             if(label.equalsIgnoreCase("tags"))
             {
                 if(p.hasPermission("googlemaps.tags.trashtalker"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                   
                 }
                 if(p.hasPermission("googlemaps.tags.ezraid"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezr);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezr);
                   
                 }
                 if(p.hasPermission("googlemaps.tags.youmadbro"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.mad);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.mad);
               
                 }
                 if(p.hasPermission("googlemaps.tags.og"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.og);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.og);
               
                 }
                 if(p.hasPermission("googlemaps.tags.quickd"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.drop);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.drop);
                    
                 }
                 if(p.hasPermission("googlemaps.tags.cannon"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.can);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.can);
                   
                 }
                 if(p.hasPermission("googlemaps.tags.destroyer"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.des);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.des);
                   
                 }
                 if(p.hasPermission("googlemaps.tags.ezsplit"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezs);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.ezs);
                    
                 }
                 if(p.hasPermission("googlemaps.tags.rekt"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.rekt);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.rekt);
               
                 }
                 if(p.hasPermission("googlemaps.tags.trashtalker"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.trash);
                    
                 } if(p.hasPermission("googlemaps.tags.babe"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.babe);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.babe);
                   
                 }
                 if(p.hasPermission("googlemaps.tags.dropped"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.getd);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.getd);
                    
                 }
                 if(p.hasPermission("googlemaps.tags.wannabe"))
                 {
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.wannabe);
                 }else{
                     tagmenu.setLore(ChatColor.GREEN + "You have this tag", tagmenu.wannabe);
               
                 }
                tagmenu.openInv(p);
           
                
             }
            return false;
        }
        
        
       
       
    
    }
    
     
  8. Offline

    Zombie_Striker

    Tagging yourself eh?
    Main 38:
    Now, the error says there is something null on this line:
    • Tagmenu can be null
    • .setLore cannot be null.
    • Chatcolor cannot be null.
    • That string cannot be null
    • tagmenu.trash can be null
    Now here's the fun part. You get to test what is null! Once you find out what's null, then all you need to do is figure out why it's null.
     
    mine-care likes this.
  9. Offline

    GoogleMaps

    Lol didn't know I tagged myself, I will now test what is null ty :)
    But how do I test?
     
  10. Offline

    Zombie_Striker

    @GoogleMaps
    If(Something == null)
    //The object is null!
     
  11. Offline

    GoogleMaps

    @Zombie_Striker
    So would I do like if (tagmenu == null) then I disable the plugin or something and If it's disabled then it is tagmenu but if I do it for the itemstack then we know that it's the itemstack?
     
  12. Offline

    Zombie_Striker

    @GoogleMaps
    Just test it. The main point of that is to figure out what is null.
     
  13. Offline

    GoogleMaps

    @Zombie_Striker Ok I figured it out but for some reason in the main jar file I have it so it sets the lore if they have a certain permission but it's not setting the lore
     
  14. Offline

    Zombie_Striker

Thread Status:
Not open for further replies.

Share This Page