Stangest thing.

Discussion in 'Plugin Development' started by the_merciless, Jun 1, 2012.

  1. Offline

    the_merciless

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I use this code in my plugin:

    Code:
    public void resetgame() {
        Tributes.set("Tributes.", null);
        SaveYamls();
    }
    (Tributes being a yaml file, this isnt the whole code, just the bit in question.)

    Now i know you are all thinking "that wont work", But it does. (or did)
    I ran this plugin on my server on my laptop and it never gave me an error, but now i just got a host server and moved all my files over to it and guess what? It gives me an error. Can anyone explain?

    This post has been edited 1 time. It was last edited by the_merciless Jun 1, 2012.
  2. Offline

    the_merciless

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    If its not clear, what im trying to do is take a string list like this:

    Tributes:
    john: 1
    mark: 2
    peter: 3

    and turn it into this

    Tributes:
  3. Offline

    jamietech

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    We might need to see a bit more of your code and an error message to understand what difficulties you are having.
  4. Offline

    the_merciless

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This is error:

    Code:
    2012-05-31 19:42:05 [INFO] [WorldEdit] Disabling WorldEdit v5.3
    2012-05-31 19:42:05 [INFO] Stopping Minequery server
    2012-05-31 19:42:05 [INFO] [BukkitCompat] Disabling BukkitCompat vr20A
    2012-05-31 19:42:05 [INFO] [RawcriticsOreObfuscationPlugin] Disabling RawcriticsOreObfuscationPlugin v1.8.1.1
    2012-05-31 19:42:05 [INFO] [SEVERE] Ore Obfuscation Plugin Cannot Attach To The Engine:
    2012-05-31 19:42:05 [INFO] Ore Obufuscate Engine is not installed, please add the required class to the server jar
    2012-05-31 19:42:05 [INFO] OreObfuscate Plugin Disabled
    2012-05-31 19:42:05 [INFO] [Buycraft] Disabling Buycraft v4.5
    2012-05-31 19:42:05 [INFO] [Buycraft] Plugin has been disabled.
    2012-05-31 19:42:05 [INFO] [Multiverse-Core] Disabling Multiverse-Core v2.4-b545
    2012-05-31 19:42:05 [INFO] [Multiverse-Adventure] Disabling Multiverse-Adventure v2.4-b547
    2012-05-31 19:42:05 [INFO] [Multiverse-Core] - Disabled
    2012-05-31 19:42:05 [INFO] [NoCheat] Disabling NoCheat v3.5.0
    2012-05-31 19:42:05 [INFO] [NoCheat] version [3.5.0] is disabled.
    2012-05-31 19:42:05 [INFO] [mhg] Disabling mhg v1.0.0 [1.2.5-R1,0]
    2012-05-31 19:42:05 [INFO] [mhg] was successfully disabled!
    2012-05-31 19:42:05 [INFO] [WorldGuard] Disabling WorldGuard v5.5.2
    2012-05-31 19:42:05 [INFO] [Essentials] Disabling Essentials v2.9.1
    2012-05-31 19:42:05 [INFO] [EssentialsProtect] Disabling EssentialsProtect v2.9.1
    2012-05-31 19:46:45 [INFO] Starting minecraft server version 1.2.5
    2012-05-31 19:46:45 [INFO] Loading properties
    2012-05-31 19:46:45 [INFO] Starting Minecraft server on 72.29.93.111:25565
    2012-05-31 19:46:45 [INFO] This server is running CraftBukkit version git-Bukkit-1.2.5-R3.0-b2203jnks (MC: 1.2.5) (Implementing API version 1.2.5-R3.0)
    2012-05-31 19:46:45 [INFO] Starting Minequery server on 72.29.93.111:25566
    2012-05-31 19:46:46 [INFO] [BorderGuard] Loading BorderGuard v4.31
    2012-05-31 19:46:46 [INFO] [GroupManager] Loading GroupManager v1.9 (2.9.1) (Phoenix)
    2012-05-31 19:46:46 [INFO] [Minequery] Loading Minequery v1.5
    2012-05-31 19:46:46 [INFO] [WorldEdit] Loading WorldEdit v5.3
    2012-05-31 19:46:46 [INFO] [BukkitCompat] Loading BukkitCompat vr20A
    2012-05-31 19:46:46 [INFO] [RawcriticsOreObfuscationPlugin] Loading RawcriticsOreObfuscationPlugin v1.8.1.1
    2012-05-31 19:46:46 [INFO] [Buycraft] Loading Buycraft v4.5
    2012-05-31 19:46:46 [INFO] [Multiverse-Core] Loading Multiverse-Core v2.4-b545
    2012-05-31 19:46:46 [INFO] [NoCheat] Loading NoCheat v3.5.0
    2012-05-31 19:46:46 [INFO] [mhg] Loading mhg v1.0.0 [1.2.5-R1,0]
    2012-05-31 19:46:46 [INFO] [WorldGuard] Loading WorldGuard v5.5.2
    2012-05-31 19:46:46 [INFO] [Essentials] Loading Essentials v2.9.1
    2012-05-31 19:46:46 [INFO] [EssentialsProtect] Loading EssentialsProtect v2.9.1
    2012-05-31 19:46:46 [INFO] MLog clients using java 1.4+ standard logging.
    2012-05-31 19:46:46 [INFO] [EssentialsSpawn] Loading EssentialsSpawn v2.9.1
    2012-05-31 19:46:46 [INFO] [Multiverse-Adventure] Loading Multiverse-Adventure v2.4-b547
    2012-05-31 19:46:46 [INFO] [EssentialsChat] Loading EssentialsChat v2.9.1
    2012-05-31 19:46:46 [INFO] Preparing level "world"
    2012-05-31 19:46:46 [INFO] Default game type: 0
    2012-05-31 19:46:46 [INFO] Preparing start region for level 0 (Seed: 1371370122424011604)
    2012-05-31 19:46:46 [INFO] Preparing start region for level 1 (Seed: -2879218693836524207)
    2012-05-31 19:46:47 [INFO] [BorderGuard] Enabling BorderGuard v4.31
    2012-05-31 19:46:47 [INFO] BorderGuard version 4.31 is enabled!
    2012-05-31 19:46:47 [INFO] [GroupManager] Enabling GroupManager v1.9 (2.9.1) (Phoenix)
    2012-05-31 19:46:47 [INFO] GroupManager - INFO - World Found: world
    2012-05-31 19:46:47 [INFO] GroupManager - INFO - World Found: world_hg
    2012-05-31 19:46:47 [INFO] GroupManager - INFO - Superperms support enabled.
    2012-05-31 19:46:47 [INFO] GroupManager - INFO - Scheduled Data Saving is set for every 10 minutes!
    2012-05-31 19:46:47 [INFO] GroupManager - INFO - Backups will be retained for 24 hours!
    2012-05-31 19:46:47 [INFO] GroupManager version 1.9 (2.9.1) (Phoenix) is enabled!
    2012-05-31 19:46:47 [INFO] [Minequery] Enabling Minequery v1.5
    2012-05-31 19:46:47 [INFO] [WorldEdit] Enabling WorldEdit v5.3
    2012-05-31 19:46:47 [INFO] WEPIF: Using the Bukkit Permissions API.
    2012-05-31 19:46:47 [INFO] [BukkitCompat] Enabling BukkitCompat vr20A
    2012-05-31 19:46:47 [INFO] MCMACOMPAT r20A
    2012-05-31 19:46:47 [INFO] McMyAdmin Compatibility Plugin version r20A started.
    2012-05-31 19:46:47 [INFO] [RawcriticsOreObfuscationPlugin] Enabling RawcriticsOreObfuscationPlugin v1.8.1.1
    2012-05-31 19:46:47 [INFO] RawcriticsOreObfuscationPlugin 1.8.1.1 plugin enabled
    2012-05-31 19:46:47 [INFO] [SEVERE] Ore Obfuscation Plugin Cannot Attach To The Engine:
    2012-05-31 19:46:47 [INFO] Ore Obufuscate Engine is not installed, please add the required class to the server jar
    2012-05-31 19:46:47 [INFO] [Buycraft] Enabling Buycraft v4.5
    2012-05-31 19:46:47 [INFO] [Buycraft] Loaded 11 package(s) into the cache.
    2012-05-31 19:46:47 [INFO] [Buycraft] Plugin has been successfully enabled.
    2012-05-31 19:46:47 [INFO] [Multiverse-Core] Enabling Multiverse-Core v2.4-b545
    2012-05-31 19:46:47 [INFO] [Multiverse-Core] - Version 2.4-b545 (API v14) Enabled - By Rigby, fernferret, lithium3141 and main--
    2012-05-31 19:46:47 [INFO] [AllPay] - Version 10.0 - hooked into Essentials Economy for Multiverse-Core v2.4-b545
    2012-05-31 19:46:48 [INFO] Preparing start region for level 2 (Seed: -7257284672624330610)
    2012-05-31 19:46:49 [INFO] [Multiverse-Core] 3 - World(s) loaded.
    2012-05-31 19:46:49 [INFO] [NoCheat] Enabling NoCheat v3.5.0
    2012-05-31 19:46:49 [INFO] [NoCheat] version [3.5.0] is enabled.
    2012-05-31 19:46:49 [INFO] [mhg] Enabling mhg v1.0.0 [1.2.5-R1,0]
    2012-05-31 19:46:49 [INFO] [mhg]is enabled, version: 1.0.0 [1.2.5-R1,0]
    2012-05-31 19:46:49 [INFO] [mhg]written by [The_Merciless]
    2012-05-31 19:46:49 [INFO] [WorldGuard] Enabling WorldGuard v5.5.2
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world) TNT ignition is blocked.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world) Lighters are PERMITTED.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world) Lava fire is blocked.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world) All fire spread is disabled.
    2012-05-31 19:46:49 [INFO] [WorldGuard] Loaded configuration for world 'world'
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_the_end) TNT ignition is blocked.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_the_end) Lighters are PERMITTED.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_the_end) Lava fire is blocked.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_the_end) All fire spread is disabled.
    2012-05-31 19:46:49 [INFO] [WorldGuard] Loaded configuration for world 'world_the_end'
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_hg) TNT ignition is blocked.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_hg) Lighters are PERMITTED.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_hg) Lava fire is blocked.
    2012-05-31 19:46:49 [INFO] [WorldGuard] (world_hg) All fire spread is disabled.
    2012-05-31 19:46:49 [INFO] [WorldGuard] Loaded configuration for world 'world_hg'
    2012-05-31 19:46:49 [INFO] [WorldGuard] 1 regions loaded for 'world'
    2012-05-31 19:46:49 [INFO] [WorldGuard] 0 regions loaded for 'world_the_end'
    2012-05-31 19:46:49 [INFO] [WorldGuard] 1 regions loaded for 'world_hg'
    2012-05-31 19:46:49 [INFO] [Essentials] Enabling Essentials v2.9.1
    2012-05-31 19:46:49 [INFO] Essentials: Using GroupManager based permissions.
    2012-05-31 19:46:49 [INFO] [EssentialsProtect] Enabling EssentialsProtect v2.9.1
    2012-05-31 19:46:49 [INFO] Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
    2012-05-31 19:46:50 [INFO] [EssentialsSpawn] Enabling EssentialsSpawn v2.9.1
    2012-05-31 19:46:50 [INFO] [Multiverse-Adventure] Enabling Multiverse-Adventure v2.4-b547
    2012-05-31 19:46:50 [INFO] [Multiverse-Adventure] - Version 2.4-b547 Enabled - By main()
    2012-05-31 19:46:50 [INFO] [EssentialsChat] Enabling EssentialsChat v2.9.1
    2012-05-31 19:46:50 [INFO] Server permissions file permissions.yml is empty, ignoring it
    2012-05-31 19:46:50 [INFO] Done (4.225s)! For help, type "help" or "?"
    2012-05-31 19:46:50 [INFO] Starting GS4 status listener
    2012-05-31 19:46:50 [INFO] Setting default query port to 25565
    2012-05-31 19:46:50 [INFO] 'spawn-protection' in server.properties has been moved to 'settings.spawn-radius' in bukkit.yml. I will move your config for you.
    2012-05-31 19:46:50 [INFO] Query running on 72.29.93.111:25565
    2012-05-31 19:46:50 [INFO] [Multiverse-Adventure] Beginning reset of world 'world_hg'...
    2012-05-31 19:46:50 [INFO] [Essentials] [Metrics] null
    2012-05-31 19:46:50 [INFO] [Multiverse-Core] World 'world_hg' was unloaded from memory.
    2012-05-31 19:46:50 [INFO] GroupManager - INFO - Bukkit Permissions Updated!
    2012-05-31 19:46:50 [INFO] Preparing start region for level 2 (Seed: -7257284672624330610)
    2012-05-31 19:46:51 [INFO] [Multiverse-Adventure] Reset of world 'world_hg' finished.
    2012-05-31 19:53:46 [INFO] classic_bottle [/98.244.163.29:27120] logged in with entity id 6410 at ([world] -226.26548140841138, 63.0, 188.57459183952062)
    2012-05-31 19:54:03 [INFO] [PLAYER_COMMAND] classic_bottle: /help
    2012-05-31 19:54:23 [INFO] [PLAYER_COMMAND] classic_bottle: /help 2
    2012-05-31 19:54:46 [INFO] [PLAYER_COMMAND] classic_bottle: /ping
    2012-05-31 19:55:00 [INFO] [PLAYER_COMMAND] classic_bottle: /help 3
    2012-05-31 19:55:05 [INFO] [PLAYER_COMMAND] classic_bottle: /rules
    2012-05-31 19:56:23 [INFO] Connection reset
    2012-05-31 19:56:23 [INFO] classic_bottle lost connection: disconnect.quitting
    2012-05-31 19:56:47 [INFO] GroupManager - INFO - Data files refreshed.
    2012-05-31 19:58:26 [INFO] The_Merciless [/94.175.133.235:59740] logged in with entity id 7248 at ([world] -222.2413543337922, 63.0, 190.25737207469953)
    2012-05-31 19:58:30 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'hgstop' in plugin mhg v1.0.0 [1.2.5-R1,0]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:42)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:166)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:479)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:821)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:781)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:764)
    at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:34)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:567)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:459)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.IllegalArgumentException: Cannot set to an empty path
    at org.apache.commons.lang.Validate.notEmpty(Validate.java:363)
    at org.bukkit.configuration.MemorySection.set(MemorySection.java:156)
    at org.bukkit.configuration.MemorySection.set(MemorySection.java:186)
    at me.merci.hg.Main.resetgame(Main.java:182)
    at me.merci.hg.Main.onCommand(Main.java:388)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:40)
    ... 12 more
    
    and heres the code:

    Code:
    public void resetgame() {
                Bukkit.getScheduler().cancelTask(task1);
                Bukkit.getScheduler().cancelTask(task2);
                getConfig().set("Countdown", 120);
                Tributes.set("Number of tributes", 0);
                Tributes.set("Tributes.", null);          //line 182
                saveConfig();
                saveYamls();
        }
     
     
     
     
        if (cmd.getName().equalsIgnoreCase("hgstop")){
                if (p.hasPermission("hg.admin")){
                resetgame();      //line 388
                p.sendMessage("The game has been cancelled");
                return true;
                }
            }
  5. Offline

    Kanaryux

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Could it possibly be because you're trying to set to "Tributes" but you're typing "Tributes." instead?
  6. Offline

    the_merciless

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I dont think so. i litteraly copied and pasted the .jar from 1 server to another. worked fine on 1st gave error on 2nd
  7. Online

    ShootToMaim

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I'm sorry, but you're giving us snippets of your original code..
    Can you give us... from line 370 to line 400? I'd like to see if you made any errors before hgstop.
  8. Offline

    Digi

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    The error is "Caused by: java.lang.IllegalArgumentException: Cannot set to an empty path" which is self-eplainatory, and "Tributes." could be an empty path because the node is split by dots and the 2nd node in the array is empty.... so just remove that freaking dot.
  9. Offline

    the_merciless

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    OK OK, i done that last night and got it working, BUT im asking why it worked, when clearly it shouldnt.
  10. Offline

    Digi

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    What clearly shouldn't work ? :confused: I don't know what you did and what you changed, it can be a typo, it can be different bukkit or craftbukkit versions, I don't know what you have there so I can't estimate anything :}
  11. Online

    evilmidget38 BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Yeah, this is an error caused by the newer versions of craftbukkit(or bukkit, one of the two). It's an issue that MobArena has as well currently.
  12. Offline

    Gravity BukkitDev Team Lead Moderator BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I think what you should do is either save a list of "tributes" and their corresponding number.

    ex:
    Code:
    List<String> list = new ArrayList<String>();
    list.add("john:3");
    list.add("joe:2");
    list.add("jake:1");
    config.set("Tributes",list);
    Then you could do List list = config.getList("Tributes").

    Or, you would do a loop and store each player like so:
    Code:
    for(Player player : listOfPlayers)
    {
      String name = player.getName();
      int level = //however you get the level here
      config.set("Tributes."+name,level);
    }
    Then you could get it back like so:
    Code:
    int level = config.getInt("Tributes."+player.getName());
    fromgate likes this.
  13. Offline

    ferrybig

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I dont think the first methode is working, as far I know it gives places the '-' token in from of the vlaue, and places ' around it
  14. Offline

    Gravity BukkitDev Team Lead Moderator BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    That's supposed to happen.... it's a list... when you do config.getList() those go away.

Share This Page