I need help with my Bugs.

Discussion in 'Plugin Development' started by Cornyfisch, Oct 21, 2011.

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

    Cornyfisch

    Hello guys,
    i've got a problem. I had worked on a plugin and when i was testing it, console said, that there is a bug.
    Here it is:
    Code:
    2011-10-21 13:51:16 [SEVERE] Could not load 'plugins\UsefulStuff.jar' in folder 'plugins':
    java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:175)
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
        at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:136)
        at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:112)
        at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:52)
        at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:136)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.NullPointerException
        at me.cornyfisch.UsefulStuff.TextLanguages.setupDEPromts(TextLanguages.java:26)
        at me.cornyfisch.UsefulStuff.TextLanguages.<init>(TextLanguages.java:16)
        at me.cornyfisch.UsefulStuff.UsefulStuff.<init>(UsefulStuff.java:22)
        ... 13 more
    i checked TextLanguages so far, but i couldn't find the bug:mad::(:'(!

    can someone help me, please?

    That would be great!

    PS:Sorry for my bad english, i'm german
     
  2. Offline

    Father Of Time

    I'm pretty sure this is because you didn't name your packages properly. You should post your plugin.yml file, aswell as show us the name of your package namespace, I am willing to bet the problem lies somewhere there (with how you've structured your plugin).
     
  3. Offline

    Belf

  4. Offline

    DDoS

    Code:
    Caused by: java.lang.NullPointerException
        at me.cornyfisch.UsefulStuff.TextLanguages.setupDEPromts(TextLanguages.java:26)
    Post line 26 of the class (and maybe a few more) or the code for the method setupDEPromts. That will help a lot.
     
  5. I'm pretty sure you try to access something which returns null in TextLanguage.java on line 26. I'm not sure, but do you try to start a new thread on that line? If you really don't find the error, show us the full code of the TextLanguages.java file, please.

    Ich bin mir ziemlich sicher du versuchst in TextLanguage.java bei Zeile 26 auf etwas zuzugreifen das null zurückliefert. Ich bin mir nicht sicher, aber kann es sein das du bei dieser Zeile einen neuen Thread starten willst? Wenn du den Fehler wirklich nicht findest, zeig uns bitte den gesammten Kot ( :p ) der TextLanguage.java Datei.

    //EDIT: Wow, should stop to write so slowly... :D
     
  6. Offline

    Cornyfisch

    OK, this my first thread, sorry.

    here the plugin.yml


    Code:
    name: UsefulStuff
    main: me.cornyfisch.UsefulStuff.UsefulStuff
    version: 0.1
    description: Adds some useful stuff to Bukkit.
    author: Cornyfisch
    
    commands:
        weather:
            description: Changes the weather.
            permission:
            usage:
                /<command> {rain|thunder|sun}
    the TextLanguages class:

    Code:
    package me.cornyfisch.UsefulStuff;
    
    import java.util.Map;
    
    
    public class TextLanguages {
    
        private Map<enumPromt, String> dePromts;
        private Map<enumPromt, String> usPromts;
        private Map<enumPromt, String> frPromts;
        private Map<enumPromt, String> esPromts;
        private Map<enumPromt, String> itPromts;
    
        public void setupPromts() {
    
            setupDEPromts();
            setupUSPromts();
            setupFRPromts();
            setupESPromts();
            setupITPromts();
    
        }
    
        private void setupDEPromts () {
    
            dePromts.put(enumPromt.noPermissions, "Du hast nicht das Recht, diesen Befehl zu nutzen!");
            dePromts.put(enumPromt.errorTooMuchArgs, "Zu viele Parameter!");
            dePromts.put(enumPromt.errorNoArgs, "Du musst einen Parameter angeben!");
            dePromts.put(enumPromt.errorNotEnoughArgs, "Zu wenig Paramter!");
            dePromts.put(enumPromt.weatherNoSuchWeather, "Wetter nicht vorhanden. Es gibt: \"thunder\", \"rain\" und \"sun\"!");
    
        }
    
        private void setupUSPromts () {
    
            usPromts.put(enumPromt.noPermissions, "You don't have permission to use this command!");
            usPromts.put(enumPromt.errorTooMuchArgs, "Too many arguments!");
            usPromts.put(enumPromt.errorNoArgs, "You have to specify a argument!");
            usPromts.put(enumPromt.errorNotEnoughArgs, "Too little arguments!");
            usPromts.put(enumPromt.weatherNoSuchWeather, "Ther is no such weather. There are: \"thunder\", \"rain\" and \"sun\"!");
    
        }
    
        private void setupFRPromts () {
      
        }
    
        private void setupESPromts () {
      
        }
    
        private void setupITPromts () {
      
        }
    
        public String getPromt(enumLanguage language, enumPromt promt) {
    
            switch (language) {
    
                case de:
    
                    return dePromts.get(promt);
    
                case us:
    
                    return usPromts.get(promt);
    
                case fr:
    
                    return frPromts.get(promt);
    
                case es:
    
                    return esPromts.get(promt);
    
                case it:
    
                    return itPromts.get(promt);
    
                default:
    
                    return usPromts.get(promt);
    
            }
    
        }
    
    }
    
    and the onEnable method in the main class:

    Code:
        public void onEnable() {
    
            log("[UsefulStuff] has been enabled!");
            setupPermissions();
            setupNodes();
            textLang.setupPromts();
    
        }
    
        private void setupNodes() {
            
            Nodes.put(enumNode.weather, "usefulstuff.weather");
            Nodes.put(enumNode.time, "usefulstuff.time");
            
        }
    

    i hope i don't missed something
     
  7. enumPromt, which is used on line 26 is never defined, so null...
     
  8. Offline

    Cornyfisch

    oh, oh, oh, i'm a bit, ahm, STUPID!!! :eek:[pig]

    the promts must be intalizie(or something like this^^) with = new HashMap<enumPromt, String>;

    i noticed this when looked on my postings! :rolleyes:

    sorry for that, my mistake.

    CLOSED
     
Thread Status:
Not open for further replies.

Share This Page