Irratating Bug

Discussion in 'Plugin Development' started by mydeblob, Feb 4, 2014.

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

    mydeblob

    Hey. So I currently have a plugin that over rides the /fly plugin in essentials. It was working fine until I upgraded to the 1.7 ro.3 builds. Downgrading does not help. For some reason in the console I'm getting this bug
    Code:
    [21:29:57] [Server thread/INFO]: [Fly in Plot World] Enabling Fly in Plot World v1.0
    [21:29:57] [Server thread/INFO]: [Fly in Plot World] No config.yml found, making a new one.
    [21:29:57] [Server thread/ERROR]: Error occurred while enabling Fly in Plot World v1.0 (Is it up to date?)
    java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins/FlyInPlotWorld.jar
        at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:150) ~[bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:138) ~[bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at com.mydeblob.Main.onEnable(Main.java:20) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:218) ~[bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:384) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugin(CraftServer.java:298) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.enablePlugins(CraftServer.java:280) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.m(MinecraftServer.java:342) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.g(MinecraftServer.java:319) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.a(MinecraftServer.java:275) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.DedicatedServer.init(DedicatedServer.java:175) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:424) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
        at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [bukkit.jar:git-Bukkit-1.7.2-R0.2-b2974jnks]
    Only problem is that no where in my code do I tell it to create a config.yml. That's why there isn't one in the jar.
    This is my full code, and as you can see it's not being told anywhere to make a config.
    Code:java
    1. public class Main extends JavaPlugin implements Listener{
    2. ArrayList<String> isFlying = new ArrayList<String>();
    3. public void onEnable(){
    4. getCommand("fly").setExecutor(this);
    5. getServer().getPluginManager().registerEvents(this, this);
    6. }
    7. public void onDisable(){
    8. for(Player p : Bukkit.getOnlinePlayers()){
    9. if(isFlying.contains(p.getName())){
    10. p.setAllowFlight(false);
    11. p.setFlying(false);
    12. }
    13. }
    14. }
    15. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    16. Player p = (Player) sender;
    17. if(cmd.getName().equalsIgnoreCase("fly")){
    18. if(p.hasPermission("templarcraft.fly")){
    19. if(p.getWorld().getName().equalsIgnoreCase("plotworld") && !p.isOp()){
    20. if(isFlying.contains(p.getName())){
    21. p.sendMessage(ChatColor.GREEN + "You are no longer flying.");
    22. isFlying.remove(p.getName());
    23. p.setAllowFlight(false);
    24. p.setFlying(false);
    25. }else{
    26. p.sendMessage(ChatColor.GREEN + "You are now flying.");
    27. isFlying.add(p.getName());
    28. p.setAllowFlight(true);
    29. p.setFlying(true);
    30. }
    31. }else{
    32. p.sendMessage(ChatColor.DARK_RED + "You can only fly in the plot world!");
    33. }
    34. }
    35. return true;
    36. }
    37. return false;
    38. }
    39. @EventHandler
    40. public void changeWorld(PlayerChangedWorldEvent event){
    41. if(isFlying.contains(event.getPlayer().getName()) && !event.getPlayer().isOp()){
    42. event.getPlayer().sendMessage(ChatColor.GREEN + "You are no longer flying, you can only fly in the plot world.");
    43. event.getPlayer().setAllowFlight(false);
    44. event.getPlayer().setFlying(false);
    45. }
    46. }
    47. }
    48.  

    I've been trying to fix this for days, but I can't figure out whats causing it. Any help is appreciated.
     
  2. Offline

    xTrollxDudex

    mydeblob
    Is that... Really the plugin casuing the error?
     
    Twisted_Panda likes this.
  3. Offline

    mydeblob

    xTrollxDudex
    Yup. It's super strange. I've tried letting the server run without it for a bit then adding it again and I get the same error. I've also tried exporting it with different versions of the 1.7 API and I get the same result. I'm really stumped on this one.

    EDIT: By the way, the reason in the stack trace it says it's getting in error
    In my onEnable on line 20 but in the code line 20 is in the onCommand method is because I never posted my imports on here.
     
  4. Offline

    NinjaWAffles

    You mentioned in your above post that you were trying to override the "/fly" in Essentials. Is Essentials running alongside this plugin? If so, try disabling/removing it, and see if it is, in fact, Essentials causing the issue.
     
  5. Offline

    mydeblob

    NinjaWAffles
    Essentials lets other plugins override there commands by default, however I has the same thought as you. Even with Essentials removed I'm getting the same error.
     
  6. Offline

    NinjaWAffles

    Sadly, I don't know what it is, but I think it's you. :p I literally copied and pasted your code, modified the indention to fit my coding convention, and ran it... The result: it didn't give me any error. I hope someone else can help you on this, because I sure as hell can't seem to figure it out.
     
  7. Offline

    mydeblob

  8. Offline

    NinjaWAffles

    It was run with *this* build. It's a month out-of-date. I know, I know. I only create custom plugins, so I've never found a reason to be on top of updating every time there's a dev build out, unless I have an issue with my current build.
     
  9. Offline

    mydeblob

    NinjaWAffles
    Ok. I will try it out and let you guys know the results.
     
  10. Offline

    Goblom

    Do you have a config.yml inside the jar when you build or export the jar?
     
Thread Status:
Not open for further replies.

Share This Page