What could be causing this conflict?

Discussion in 'Plugin Development' started by ketchupcoke, Nov 15, 2015.

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

    mythbusterma

    @ketchupcoke

    I would certianly recommend just not using "SimpleFactions," a cursory glance at its source code indicates it is simply awful. Why don't you try another plugin like Factions or Towny (I know they aren't much better, but at least they ought not cause issues)? Also, it looks like the error is on line 2 of "skripts.sk," so I really don't understand why you're saying "I don't have any scripts loaded," as you are obviously trying to use a script. Try it without that script.
     
    Zombie_Striker and teej107 like this.
  2. Offline

    ketchupcoke

    I might have to resort to that if I cannot get Simple Factions to work. Also, my skript (skripts.sk) loads fine if Simple Factions is not installed - therefore it must be Simple Factions that is preventing it from being loaded in.
     
  3. Offline

    mcdorli

    "It worked before, but then Bob came and now it doesn't work. It is Bob's fault." This is your sentence in a simpler way.
     
    Zombie_Striker likes this.
  4. Offline

    ketchupcoke

    I don't quite understand. Yes, I am implying that it is an error with Simple Factions - it must be - since Skript works fine with 60 other plugins. It is only when I install simple factions that Skript does not work. Again, I did not make either of the plugins.
     
  5. Offline

    mcdorli

    Simple factions is crap. Like really crap. The code sometimes just doesn't make sense, or is stuck on the same level as chinese programmers do things, use factions
     
  6. Offline

    ketchupcoke

    Lol. Yes I know it has its flaws - but Kingdoms (my version) is all fixed up. On its own, Kingdoms works fine for my server. The only problem I have with it now is the conflict.

    The reason I don't use factions is because.. well.. it's ugly. My server has a specific aesthetic and factions would be too hard to modify to make it fit that style - e.g. lots of the grammatical structures of messages don't make sense, the map is ugly etc.

    That's why I chose to use Simple Factions as a base for Kingdoms - I could edit it freely and add new features more easily.
     
  7. Offline

    Zombie_Striker

    @ketchupcoke
    Why can't you just decompile the Working factions, fix the grammatical errors where it's needed, and use that.
     
  8. Offline

    ketchupcoke

    Because it might be easier for me to just keep trying to fix this conflict that re-doing the whole thing again. If I can't and nobody else has any ideas, that's what I'm going to have to do.

    EDIT: Just wondering if getJSONObject() could cause a conflict?
     
    Last edited: Nov 27, 2015
  9. Offline

    Zombie_Striker

    @ketchupcoke
    You're saying that fixing massive problems with another plugin would be better than editing a few words?
     
  10. Offline

    ketchupcoke

    I'm saying it would be easier than modifying every message sent to the player to fit the format of my server. Including maps, lists, help pages, error messages and everything else.
     
  11. Offline

    Zombie_Striker

    But still, you would rather try to fix a bug you have no idea how to fix then to do a some text editing?

    This thread has been alive for 12 days now. It should take far less then that to edit everything you need.
     
  12. Offline

    ketchupcoke

    Hey, I've just had another look at this and I have located the class that causes the error. Would anyone be able to tell me what in this could be causing a conflict?

    package com.crossedshadows.simpleFactions;
    import java.io.File;
    import java.io.FilenameFilter;
    public class FileUtil {
    public String[] listTheFiles(String dir) {

    File directory = new File(dir);

    if (!directory.isDirectory()) {
    System.out.println("No directory provided");
    return null;
    }

    //create a FilenameFilter and override its accept-method
    FilenameFilter filefilter = new FilenameFilter() {

    public boolean accept(File dir, String name) {
    //if the file extension is .txt return true, else false
    return name.endsWith(".json");
    }
    };

    return directory.list(filefilter);
    }
    }
     
  13. Offline

    mythbusterma

    @ketchupcoke

    You'd likely have to know where that method is called from.

    Also, why don't you just use a not awful factions system?
     
  14. Offline

    ketchupcoke

    Strangely, the problem still occurs even when taking out it's only method call (from the main class simpleFactions).

    Also, having looked through alternatives, I have decided that simple factions is the way to go due to its lack of excess features that could potentially take up CPU. I don't believe Simple Factions is coded particularly poorly at all.
     
  15. Offline

    mythbusterma

    @ketchupcoke

    So you're legitimately worried about a tiny amount of CPU usage by a plugin when you're running a server with some of the worst NPC AI ever written?

    It is incredibly poorly written, regardless of any opinions. It is far worse than Factions or Towny, both of which are also coded poorly, so that's saying something.

    You can afford a few extra cycles. Or better yet, write your own. Even a beginner programmer could write something better than SimpleFactions.
     
  16. Offline

    ketchupcoke

    It is far more efficient for me to find a solution than to write or modify a whole new plugin. I am looking for help with a plugin, not arguments about what I should be doing.
     
  17. Offline

    mythbusterma

    @ketchupcoke

    We've already helped you as much as we can. You have to work this out on your own. If you have specific questions, ask them.
     
  18. Offline

    ketchupcoke

    (Specific question)
     
  19. Offline

    mythbusterma

    @ketchupcoke

    Sorry, I meant the problem is likely where it's called from.
     
  20. Offline

    ketchupcoke

    Actually, I believe it is the class itself that causes the error - even without any calls from other classes it causes the conflict.
     
  21. Offline

    mcdorli

    How could that code cause conflicts with simplefactions? You maybe have commands, wich equal in both plugins (just a guess)
     
  22. Offline

    mythbusterma

    @ketchupcoke

    So that classfile, in and of itself being loaded causes an issue?
     
  23. @ketchupcoke honestly dude, you're a developer... why are you using skript? Skript manages so many things it probably leads to performance drops. Just code your plugins in Java. And if you need help, you can always ask me.
     
  24. Offline

    ketchupcoke

    Bump - after having another look at this I have managed to pinpoint the exact cause of the conflict:

    Code:
        public static void loadFactionDisk(String uuid){
    
            createDirectories();
           
            File factionFile = new File(dataFolder + "/factionData/" + uuid + ".json");
            if(!factionFile.exists()){
                try {
                    FileWriter fw = new FileWriter(factionFile);
                    BufferedWriter bw=new BufferedWriter(fw);
                    Faction.createFaction(uuid);
                    bw.write(factionData.toString(8));
                    bw.newLine();
                    bw.close();
                } catch (IOException e) {
                    e.printStackTrace();
                    reportErrorMessage(e);
                }
            }
           
            try {
               
                Scanner scan = new Scanner(new FileReader(dataFolder + "/factionData/" + uuid + ".json"));
                scan.useDelimiter("\\Z");
                factionData = new JSONObject(scan.next());
               
                for(int i = 0; i < Data.Factions.length(); i++){
                    if(Data.Factions.getJSONObject(i).getString("ID").equalsIgnoreCase(uuid)){
                        Data.Factions.remove(i);
                    }
                }
               
                Data.Factions.put(factionData);
                scan.close();
               
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                reportErrorMessage(e);
            }
           
        }
    This is in simpleFactions.java - it loads in factions from the disk. If someone could see what's causing a conflict here it would be much appreciated!
     
  25. Offline

    ketchupcoke

  26. Offline

    ketchupcoke

Thread Status:
Not open for further replies.

Share This Page