Need a tester/fixer

Discussion in 'Plugin Development' started by theearlypc423, Jan 3, 2013.

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

    theearlypc423

    Hi,
    I have been working on a chat plugin for quite some time now and I need sombody to test it. I named my plugin LMC masterchat because LMC is the name of my plugin team and masterchat is the perfect name for the plugin... It is all config file based, no commands. I will credit the tester on my bukkit dev plugin and grant membership to my plugin team.:)

    Thanks.[diamond]

    BTW: I don't want sombody who is liek this all the time! :mad:
     
  2. Offline

    Jogy34

    Why can't you just test it yourself?
     
  3. Offline

    theearlypc423

    Cuz I have tested it and theres a problem I just have no clue what it exactly is I need a expert.
     
  4. Offline

    Jogy34

    Or you could just explain what is wrong and probably post the code that is doing whatever it is and we could help you that way.
     
  5. Offline

    theearlypc423

    Ok well the config files will not generate when I set it up and i'd bet this relates to some bigger problem in my plugin that exists.
     
  6. Offline

    Jogy34

    Are you making sure to save the config after you edit it for the first time?
     
  7. Offline

    theearlypc423

    Yes I believe my worker did do that but the file was also made last august.
     
  8. Offline

    Jogy34

    can you post the code where you edit the config the first time?
     
  9. Offline

    theearlypc423

    But I probaly could use sombody to test it tho because it could possibly be a problem with my test server. Because this guy that made the file and all that is a really good programmer but he is gonna be offline for months at a time.
     
  10. Offline

    ForsakenRealmz

    Hate to break it to someone.. But I have about a whole 10 hours worth of hardcore coding for plugins, and what I found out from tutorials, etc was this code to generate a config file and it worked for me.

    Code:
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    Put that code in the "onEnable"

    Edit* I also already had a config.yml created so I guess it just grabbed the already created one once the plugin is started and it generated it.
     
  11. Offline

    theearlypc423

    Dude I just tryed to upload and this website wont let me upload YML files so what now?

    Ok I will also check if I have that in my onenable section. But I have 5 classes in my plugin and 2 packages, can it work anywhere else exept for by the onEnable part?

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

    Jogy34

    [quote uid=90695149 name="andrewyunt" post=1487109]Dude I just tryed to upload and this website wont let me upload YML files so what now?[/quote]
    Well for one why are you trying to upload a .yml file.

    2. <Edit by Moderator: Redacted mediafire url>

    3. again just post the code where you are editing your config file. I'm still pretty sure that you just forgot to save it.

    4. You don't actually need what ForsakenRealmz said. That will just save and empty config.yml file.
     
    Last edited by a moderator: Nov 8, 2016
  13. Offline

    theearlypc423

    [quote uid=90565555 name="Jogy34" post=1487113]Well for one why are you trying to upload a .yml file.

    2. <Edit by Moderator: Redacted mediafire url>

    3. again just post the code where you are editing your config file. I'm still pretty sure that you just forgot to save it.

    4. You don't actually need what ForsakenRealmz said. That will just save and empty config.yml file.[/quote]I wasn't editing the config file. What my real problem is is the fact that when I start my server it says started masterchat in the console but my yml config files will not show up in my plugins folder. I need to somehow fix my plugin from doing this.

    Oh and the file for some reason is named channels.yml...

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

    Jogy34

    The config file is generated the first time you call the saveConfig() method of your main class
     
  15. Offline

    ForsakenRealmz

    I think you could watch this video by theBCBroz on how to generate a config file. If that is not the correct way.. Please correct me.

     
  16. Offline

    theearlypc423

    Ok I will watch that vid! I'll tell u if it worked!
     
  17. Offline

    Jogy34

    That is one way to make a config file but if you don't have a default config in your .jar then it will just make an empty config.yml file and again the config.yml file is generated the first you call the saveConfig() method of your main class.
     
  18. Offline

    theearlypc423

    Well the vid didn't do much. Here check out the structure of my plugin I will upload it for you.

    I decided that I am going to pm you guys the plugin so check your inboxes soon.

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

    Jogy34

    Dude just post the code here. It isn't all that hard. Just copy your existing code then past it into a code box
     
  20. Offline

    ForsakenRealmz

    Sorry about the video, I think I linked an older version of it. The same Youtube guy made an advanced config file creation in his 24th video found below. I think that is the one I used.

    I wish I could help more.. Sadly I am trying to still teach myself plugins. If it helps.. I try to think of coding like writing a sentence. What helps me when thinking of listeners and events is thinking of it like a sentence. Same of the coding of other stuff.. "If bob hits jim, jim gets hurt." "If player types 'text', then the color red it added."

    Haha I'm not sure man.. I am probably just talking out of my ass by now!
     
  21. Offline

    theearlypc423

    Code:
    package me.andrew.MasterChat;
     
     
     
     
    import info.bytecraft.sabersamus.MasterChat.ChannelChat;
    import info.bytecraft.sabersamus.MasterChat.ChannelConfig;
     
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class MasterChat extends JavaPlugin {
        private static MasterChat plugin;
       
        public void onEnable(){
            plugin = this; // Creates a static instance of this plugin, so you don't need to make a constructor (Masterchat plugin)
            ChannelConfig.load(); //Loads channels.yml
            getLogger().info("Masterchat is now enabled!");
            getServer().getPluginManager().registerEvents(new ChannelChat(), this); // Registers PlayerChatEvent for channels.
        }
     
        public void onDisable(){
            getLogger().info("Disabling Masterchat...");
            //onEnable and onDisable methods created above ^^
        }
       
        public static MasterChat getInstance(){
            return plugin;
        }
    // OH PENISSES IT's THE END OF YOUR FUCKING PLUGIN ANDREW!
    }
    here this is my main file
     
  22. Offline

    Jogy34

    And what about your ChannelConfig class?
     
  23. Offline

    theearlypc423

    Code:
    package info.bytecraft.sabersamus.MasterChat;
     
    import java.io.File;
    import java.io.InputStream;
     
     
     
     
    import me.andrew.MasterChat.MasterChat;
     
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.configuration.file.YamlConfiguration;
     
    public class ChannelConfig{
       
        private static File file = null;
        private static FileConfiguration fileConfig = null;
       
        public static void load(){
           
        }
       
        public static FileConfiguration getConfig(){
            if(fileConfig == null){
                reloadConfig();
            }
            return fileConfig;
        }
       
        public static void reloadConfig(){
            if(file == null){
                file = new File(MasterChat.getInstance().getDataFolder(), "Channels.yml");
            }
            fileConfig = YamlConfiguration.loadConfiguration(file);
           
            InputStream defConfigStream = MasterChat.getInstance().getResource("Channels.yml");
            if(defConfigStream != null){
                YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
                fileConfig.setDefaults(defConfig);
            }
        }
    }
    Oh sorry here man
     
  24. Offline

    Jogy34

    That's your problem
     
  25. Offline

    theearlypc423

    SO how do I fix the problem what should the code look like?
     
  26. Offline

    Jogy34

    You are attempting to create a custom config file. Here's a tutorial on that. If you still can't figure out how to generate is after you implemented what you are missing just ask.
     
  27. Offline

    theearlypc423

    Ok um I still don't really get how that works, well could you show me that code in the fixed version?
     
  28. Offline

    Jogy34

    It gives you the code that you are missing in the tutorial. Like almost exactly, you just have to change a few variable names.
     
  29. Offline

    theearlypc423

    ok well I thank you for your time would you like to be a contributer on our project on bukkit dev???
     
  30. Offline

    gomeow

    The wiki has a nice tutorial on this...
     
Thread Status:
Not open for further replies.

Share This Page