Solved Plugin has randomly stopped working with LibsDisguise.

Discussion in 'Spigot Plugin Development' started by ServerProxy, Apr 19, 2017.

  1. So I am using LibDisguises to make a plugin for a server. Here is my code:
    Code (Text):
    package me.diyar.gmodgun;

    import java.util.ArrayList;
    import java.util.List;

    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    import org.bukkit.plugin.java.JavaPlugin;

    import me.libraryaddict.disguise.DisguiseAPI;
    import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;

    public class GModGun extends JavaPlugin {
       
        public void onEnable() {
            Bukkit.getServer().getPluginManager().isPluginEnabled("LibsDisguise");
            getLogger().info("[1.8] Plugin made by Diyar! Make sure you have LibsDisguise!");
            getConfig().options().copyDefaults(true);
            saveDefaultConfig();
           
           
           
        }
       
        public void onDisable() {  
           
        }
        public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]) {
            if (cmd.getName().equalsIgnoreCase("gmod")) {
            if    (!(sender instanceof Player))
                sender.sendMessage(ChatColor.GRAY + "You must be a player!");
               
            if    (!(sender.hasPermission("gmod.toggle")));
                sender.sendMessage(ChatColor.translateAlternateColorCodes('&',getConfig().getString("no-perms")));
            }else if (args.length == 0) {
                Player p = (Player) sender;
                sender.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("GMod-Mode")));
                ItemStack Gun = new ItemStack(Material.WOOD_HOE);
                ItemMeta meta = Gun.getItemMeta();
                List<String> lore = new ArrayList <String>();
                lore.add("The almighty gun of Garry's mod!");
                meta.setLore(lore);
                meta.setDisplayName(ChatColor.GRAY + ChatColor.BOLD.toString() + "PhysGun!");
                PlayerDisguise pd = new PlayerDisguise("forgottenclaw");
                DisguiseAPI.disguiseEntity(p.getPlayer(), pd);
                p.getInventory().addItem(Gun);
            }else if (args.length > 1) {
                sender.sendMessage("You can not give another player this gun!");
               
               
           
               
            }
           
            return true;
        }

    }
     
    Config.yml
    Code (Text):
    # Do not edit these hashtags or the config will crash!
    # You can edit these messages!
    # Plugin made by Diyar!
    no-perms: Sorry... You do not have access to this command!
    gmod-mode: You are now in GMod Mode!
    Plugin.yml
    Code (Text):
    main: me.diyar.gmodgun.GModGun
    name: GModGun
    version: 1.0
    commands:
        gmod:
          description: Use this to get the almighty PhysGun!

       
    I get red underlined by the PlayerDisguise and DisguiseAPI, it tells me to import and that's what I do but it does not work,

    https://gyazo.com/39a7cb57811cd485654f6e41b5f0fd8c
     
  2. electronicboy

    IRC Staff

    Well, what is the error on the import? Sounds odd, but have you tried restarting your IDE?
     
  3. It's just underlined red, telling me to import again. I have tried to restart my IDE.
     
  4. maldahleh

    Wiki Team

    If it's a local jar, did you by chance delete it from your system accidentally or maybe move where the jar is located?
     
  5. Oh my fucking god! You just saved my life, you beast!