Solved The type java.util.Map$Entry cannot be resolved.

Discussion in 'Plugin Development' started by TeyKey1, Jun 20, 2014.

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

    TeyKey1

    Hey guys I've a Problem with my Plugin. I recieved an error in eclipse, and I tryed already to refresh, the file, but there wasn't any change.
    Here is the Error :

    The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files


    Here is my code:
    Code:
    package ch.teykey.teleporter;
     
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
     
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.Sound;
    import org.bukkit.World;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class main extends JavaPlugin{
       
        @Override
        public void onEnable(){
            this.saveDefaultConfig();
            System.out.println("[teleporter]Loaded successfully");
        }
        @Override
        public void onDisable(){
            System.out.println("[teleporter]Disabled successfully");
        }
        public String prefix = this.getConfig().getString("Config.Messages.prefix").replaceAll("&", "§");
        public String toolittle = this.getConfig().getString("Config.Messages.toolittlearguments").replaceAll("&", "§");
        public String successfullyaddedlocation = this.getConfig().getString("Config.Messages.successfullyaddedlocation").replaceAll("&", "§");
        public String teleportsuccessful = this.getConfig().getString("Config.Messages.teleportsuccessful").replaceAll("&", "§");
        public String toofewarguments = this.getConfig().getString("Config.Messages.toofewarguments").replaceAll("&", "§");
        public String nolocation = this.getConfig().getString("Config.Messages.nolocation").replaceAll("&", "§");
        public String removesuccess = this.getConfig().getString("Config.Messages.removesuccess").replaceAll("&", "§");
        public String cooldown = this.getConfig().getString("Config.Messages.cooldown").replaceAll("&", "§");
        public List<String> locationlist = this.getConfig().getStringList("Config.Locationlist");
        private main Plugin;
        public int cooldownint = this.getConfig().getInt("Config.teleportcooldown");
       
       
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, final String[] args){
            final Player p = (Player) sender;
            if(cmd.getName().equalsIgnoreCase("tplocation")){
                if(sender instanceof Player){
                    if(p.hasPermission("teleporter.setlocation")){
                        if(args.length == 1){
                            locationlist.add(args[0]);
                            this.getConfig().set("Config.Locations."+args[0]+".world", p.getLocation().getWorld().getName());
                            this.getConfig().set("Config.Locations."+args[0]+".x", p.getLocation().getX());
                            this.getConfig().set("Config.Locations."+args[0]+".y", p.getLocation().getY());
                            this.getConfig().set("Config.Locations."+args[0]+".z", p.getLocation().getZ());
                            this.getConfig().set("Config.Locationlist", locationlist);
                            this.saveConfig();
                            p.sendMessage(prefix+" "+successfullyaddedlocation);
                            return true;
                        }else{
                            p.sendMessage(prefix+" "+toolittle);
                        }
                    }
                }
            }
            if(cmd.getName().equalsIgnoreCase("tpto")){
                if(sender instanceof Player){
                    if(p.hasPermission("teleporter.tp."+args[0])){
                        if(args.length == 1){
                            if(locationlist.contains(args[0])){
                                Plugin.getServer().getScheduler().scheduleSyncDelayedTask(Plugin, new Runnable() {
     
                                    @Override
                                    public void run() {
                                        World w = Bukkit.getServer().getWorld(Plugin.getConfig().getString("Config.Locations."+args[0]+".world"));
                                        double x = Plugin.getConfig().getDouble("Config.Locations."+args[0]+".x");
                                        double y = Plugin.getConfig().getDouble("Config.Locations."+args[0]+".y");
                                        double z = Plugin.getConfig().getDouble("Config.Locations."+args[0]+".z");
                                        p.teleport(new Location(w, x, y, z));
                                        Location loc = p.getLocation();
                                        p.playSound(loc, Sound.ITEM_PICKUP, 1, 0);
                                        p.sendMessage(prefix+" "+teleportsuccessful);
                                    }
                                    }, cooldownint*20);
                                p.sendMessage(prefix+" "+cooldown);
     
                            }else{
                                p.sendMessage(prefix+" "+nolocation);
                                return true;
                            }
                        }else{
                            p.sendMessage(prefix+" "+toolittle);
                        }   
                    }
                }
            }
            if(cmd.getName().equalsIgnoreCase("tplist")){
                if(sender instanceof Player){
                    if(p.hasPermission("teleporter.list")){
                        if(args.length == 0){
                            List<String> s = this.getConfig().getStringList("Config.Locationlist");
                            p.sendMessage(prefix+" "+s);
                            return true;
                        }else{
                            p.sendMessage(prefix+" "+toofewarguments);
                        }
                    }
                }
            }
            if(cmd.getName().equalsIgnoreCase("tpremove")){
                if(sender instanceof Player){
                    if(p.hasPermission("teleporter.remove")){
                        if(args.length == 1){
                            if(locationlist.contains(args[0])){
                                String arg = args[0].toString();
                                locationlist.remove(arg);
                                this.getConfig().set("Config.Locations."+args[0]+".world", null);
                                this.getConfig().set("Config.Locations."+args[0]+".x", null);
                                this.getConfig().set("Config.Locations."+args[0]+".y", null);
                                this.getConfig().set("Config.Locations."+args[0]+".z", null);
                                p.sendMessage(prefix+" "+removesuccess);
                                return true;
                                }
                            }else{
                                p.sendMessage(prefix+" "+nolocation);
                                return true;
                            }
                        }else{
                            p.sendMessage(prefix+" "+toolittle);
                        }
                    }
                }
           
            return false;
        }
    }
    

    What is wrong, I already read, that this is a Eclipse bug, how can I fix this?

    greez
    TeyKey
     
  2. Offline

    ferrago

    Remove the import for hashmap? I dont actually see it used in here anyway.
     
  3. Offline

    TeyKey1

    Thanks, but didn't helped.
     
  4. Offline

    rfsantos1996

    Add import for Map (?)
     
  5. Offline

    TeyKey1

    Why I don't need any HashMap
     
  6. Offline

    rfsantos1996

    I thought you were using any Map.Entry on your code :confused: can you recompile and give the log error + the entire class mentioned on the error?
     
  7. Offline

    TeyKey1

    I just use the one class posted in the Thread.

    Here is the full error Report:
    Code:
    [15:20:18] [Server thread/ERROR]: Could not load 'plugins\teleporter.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.Error: Unresolved compilation problem:
        The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
     
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:355) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:317) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
    Caused by: java.lang.Error: Unresolved compilation problem:
        The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
     
        at ch.teykey.teleporter.main.<init>(main.java:1) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_05]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_05]
        at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.1-b3084jnks]
        ... 9 more
     
  8. Offline

    ferrago

    I know this will sound weird... Use java 1.7 not 1.8... I bet it fi es your problem

    The problem is your machine isnt compatible with java 1.8 and your plugin was coded in 1.8. I had the same problem when i upgraded to 1.8. I just made my IDE build and compile all projects using 1.7. Remember once you make it build and compile against 1.7 you need to do a clean build or the discrete files will still be encoded with 1.8. Just recently went through the same headache haha. Just got a diff error message in the end.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  9. Offline

    TeyKey1

    Man, thanks so much!! :)
    It worked for me, I just activated 1.7 and rebuilt the Plugin, as you said.
    Thanks and greez.
    TeyKey
     
  10. Offline

    ferrago

    Anytime glad to help.
     
Thread Status:
Not open for further replies.

Share This Page