How to save an arena to a config.

Discussion in 'Plugin Development' started by Gamesareme, Aug 16, 2014.

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

    Gamesareme

    The title says what I am trying to do. So I know how to set two positions and get the blocks between them, but how can I then save the in an affective way in to a config to be reused? I am really stumped. :( Could some one please point me in the right direction.
     
  2. Offline

    fireblast709

    Gamesareme
    Code:
    foreach x between minX and maxX
        foreach y between minY and maxY
            foreach z between minZ and maxZ
                block = getBlock(x, y, z); 
                // Do whatever
     
  3. Offline

    Gamesareme

    RenegadeEagle fireblast709 So I looked through the link you gave me, but I could not work out what function to use. The list would just replace any of the same blocks, and so would the Hashmap.
     
  4. Offline

    fireblast709

    Gamesareme you are looking for a method to get data and a method to set data. Moreover, Lists allow duplicate entries, and HashMaps allow duplicate values (but not duplicate keys. However, why would you want the same location in the Map twice?)
     
  5. Offline

    Gamesareme

    fireblast709 No I am looking for a way to save lots of blocks into the config. Then when I need to I can get them out and have them rearrange them selves in the way they got put in. Does that make sense? So I know how to save things to the config, but we are talking about 1000+ blocks I am trying to save. I am looking for the most affective way to save them all in a config.

    fireblast709 so this is what I have so far.
    Code:java
    1. import java.util.ArrayList;
    2. import java.util.List;
    3.  
    4. import me.joxboyz.Blitz.Main;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.Location;
    8. import org.bukkit.block.Block;
    9. import org.bukkit.entity.Player;
    10.  
    11. public class cubgenerator {
    12. Main plugin;
    13. public cubgenerator(Main main){
    14. plugin = main;
    15. }
    16.  
    17. int totalblockcount = 0;
    18.  
    19. public void gencude(Player player, Location l1, Location l2){
    20. List<Block> blocks = new ArrayList<Block>();
    21. int mix, max, miy, may, miz, maz;
    22.  
    23. if(l1.getBlockX() < l2.getBlockX()){
    24. mix = l1.getBlockX();
    25. max = l2.getBlockX();
    26. }else{
    27. mix = l2.getBlockX();
    28. max = l1.getBlockX();
    29. }
    30.  
    31. if(l1.getBlockY() < l2.getBlockY()){
    32. miy = l1.getBlockY();
    33. may = l2.getBlockY();
    34. }else{
    35. miy = l2.getBlockY();
    36. may = l1.getBlockY();
    37. }
    38.  
    39. if(l1.getBlockZ() < l2.getBlockZ()){
    40. miz = l1.getBlockZ();
    41. maz = l2.getBlockZ();
    42. }else{
    43. miz = l2.getBlockZ();
    44. maz = l1.getBlockZ();
    45. }
    46.  
    47. for(int x = mix; x <= max; x++){
    48. for(int y = miy; y <= may; y++){
    49. for(int z = miz; z <= maz; z++){
    50. Block b = Bukkit.getWorld(plugin.sp.world).getBlockAt(x, y, z);
    51. blocks.add(b);
    52. totalblockcount++;
    53. }
    54. }
    55. }
    56. }
    57. }

    I would have thought, that if two blocks are the same, it would be replaced. Am I right?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  6. Offline

    fireblast709

    If you use a Set, it would indeed be true. Still, the Blocks would have to be exactly the same (in case of a Block this means the same x, y, z and Chunk - basically all non-static fields of the class). Lists generally don't care about this, and allow duplicates.

    Leaving that aside, since you are looping over a cuboid, it is quite unlikely you will even encounter a duplicate. Unless your for loops are incorrect and you get the same x, y and/or z twice :p.

    Regarding the code, it looks fine to me. Maybe some optimalization, but that is all I can see about now.
    Code:java
    1. // Create a Location object for the min pos
    2. Location loc = new Location(l1.getWorld(), mix, miy, miz);
    3. for x
    4. {
    5. for y
    6. {
    7. for z
    8. {
    9. // Translate to the block we intend to iterate over
    10. loc.add(x,y,z);
    11. // Useful method from Location ;3
    12. Block b = loc.getBlock();
    13. blocks.add(b);
    14. // Instead of creating a new Location each time (or using clone(), which does the same)
    15. // We revert the add() we did earlier, allowing us to reuse that same object in the
    16. // next iteration.
    17. loc.subtract(x,y,z);
    18. }
    19. }
    20. }
     
  7. Offline

    Gamesareme

    fireblast709 Hey thanks for that. It makes more sense now. I will let you know I any thing else pops up. :)

    fireblast709 :cool: I got it working. Now the arena resets when the game finishes. Thanks for the help. I have one more question though. So I ended up using the list, but it looks like this in the config.
    Code:java
    1. - STONE
    2. - STONE
    3. - STONE
    4. - STONE
    5. - STONE
    6. - STONE
    7. - STONE
    8. - DIRT
    9. - DIRT
    10. - STONE
    11. - STONE
    12. - STONE

    Now multiply that by 1000. Yey the config gets really big really quick. My question is, is their a better way to store block in the config.

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

    bennie3211

    paste the names/id's to a string with a ',' between the names/id's and then when loading split the string.
     
  9. Offline

    DinosParkour

    Gamesareme Why don't you use worldedit and paste the arena schematic every time you want to reset it :p
     
  10. Offline

    Gamesareme

    DinosParkour That is really not a good idea. I am making a fully automatic plugin, and using your idea would really suck for the users. Thanks for the help, but it is not what I want.

    bennie3211 Is that how you would do this? I have looked around a bit, and people seam to be able to use .bin. Does any one know how to use them?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  11. Offline

    xTigerRebornx

    Gamesareme IIRC, WorldEdit supports loading schematics using only code, meaning it can be fully automated just fine.
     
    bennie3211 likes this.
  12. Offline

    DinosParkour

    Gamesareme I mean the worldedit api, and make a command to save a location to the config file where the arena schematic will be automatically pasted after the game ends :p
     
  13. Offline

    Gamesareme

    DinosParkour Ok sorry about what I said above. I was unaware of this function in world edit. I have looked around a bit, but have not come up with away to use it. I probably am looking in the wrong location, but could you point me towards how to use world edit. (It sounds like a better idea than what I have above)

    xTigerRebornx so I now know how to hook into worldedit. I also know how to get the selection. However I have no idea how to save the selection. Could you please help.

    Any one?

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

    xTigerRebornx

  15. Offline

    Gamesareme

    xTigerRebornx Ok thanks for that.
    So this is what I have.
    Code:java
    1. Selection s = plugin.getWorldEdit().getSelection(player);
    2. Vector pos1 = s.getNativeMaximumPoint();
    3. Vector pos2 = s.getNativeMinimumPoint();
    4. CuboidClipboard ccb = new CuboidClipboard(pos1, pos2);

    But when it comes to actual saving the Schematic I can not seam to be able to get a proper file. Do you save the Schematic to a config, or is there a different way of saving it?
     
  16. Offline

    xTigerRebornx

    Gamesareme Can you explain what you mean by "you can't get a proper file"? From what I know, you just create a new File.
     
  17. Offline

    Gamesareme

    xTigerRebornx Well to save it I believe you go like this.
    Code:java
    1. ccb.saveSchematic();

    Inside this you put your file, but I do not how to make a file to put into it. :(
    I know how to make a new config, but I do not think that is what it is looking for.

    Really no one? :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  18. Offline

    xTigerRebornx

    Gamesareme I posted a link to a different class. CuboidClipboard doesn't contain the method save(), the class I posted does (it is a class in the WorldEdit API)
    Edit: Never mind, it contains it but the method is deprecated. Use the method in the class I posted.
    Edit again: I/O is basic Java, perhaps you should refresh yourself in it.
    Edit 3: Method internally uses the method I posted. https://github.com/sk89q/worldedit/...com/sk89q/worldedit/CuboidClipboard.java#L535 posts a fairly good example of how to call it and is deprecated because it recommends that you use the method it specifies.
     
  19. Offline

    Gamesareme

    xTigerRebornx I am doind something wrong but I can not work out what it is.
    This is my error.
    Code:
    [17:22:03 ERROR]: Could not load 'plugins/Blitz.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/sk89q/worldedit/data/DataException
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:357) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:799) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.Bukkit.reload(Bukkit.java:288) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:703) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(CraftServer.java:690) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:296) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:261) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
    Caused by: java.lang.NoClassDefFoundError: com/sk89q/worldedit/data/DataException
        at me.joxboyz.Blitz.Main.<init>(Main.java:49) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_05]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[?:1.8.0_05]
        at java.lang.Class.newInstance(Class.java:433) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        ... 14 more
    Caused by: java.lang.ClassNotFoundException: com.sk89q.worldedit.data.DataException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[?:1.8.0_05]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.8.0_05]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_05]
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_05]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_05]
        at me.joxboyz.Blitz.Main.<init>(Main.java:49) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_05]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[?:1.8.0_05]
        at java.lang.Class.newInstance(Class.java:433) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        ... 14 more
    If you need the code I can past it.

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  20. Offline

    Lactem

    Do you have WorldEdit in their and is it a dependency in your plugin.yml?
     
  21. Offline

    Gamesareme

    Lactem I do have world edit, but I do not have its dependency in the plugin.yml. I do not think that you need to. Correct me if I am wrong.
     
  22. Offline

    Lactem

    I haven't actually read the whole thread here, but if you're trying to do something when your plugin first initializes then you need to have WorldEdit as a dependency.
     
  23. Offline

    DinosParkour

    Gamesareme
    This is how I do it in my plugin:
    Code:java
    1. privatevoidschematicPaste(World world,File file, com.sk89q.worldedit.Vector origin)throws DataException, IOException, MaxChangedBlocksException{
    2. EditSession es =newEditSession(newBukkitWorld(world),999999999);
    3. @SuppressWarnings("deprecation")
    4. CuboidClipboard cc =CuboidClipboard.loadSchematic(file);
    5. cc.paste(es, origin, false);
    6. }

    Code:java
    1. publicvoidloadArena(){
    2. Location loc = //a Location you've loaded from the config and you want to paste the schematic at
    3. File Arena =newFile(this.getWorldEdit().getDataFolder().getPath()+"/schematics/"+"Arena.schematic");
    4. World World =this.s1.getWorld();
    5. try{schematicPaste(World, Arena,BukkitUtil.toVector(loc));}
    6. catch(DataException|IOException|MaxChangedBlocksException e){e.printStackTrace();}
    7. }


    Note: this will check if there's the schematic Arena in the worldedit's schematics folder (that's what I wanted). If you want to take it from your plugin's schematics folder, remove .getWorldEdit() from the file location
     
  24. Offline

    Gamesareme

    DinosParkour I still can not get it working. So this what I have so far.
    In the main class I have this,
    Code:
    import com.sk89q.worldedit.bukkit.WorldEditPlugin;
     
    public WorldEditPlugin getWorldEdit(){
        Plugin p = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
        if(p instanceof WorldEditPlugin)return (WorldEditPlugin)p;
        else return null;
    }
    Then here is how I have done what you provided.
    Code:
    import com.sk89q.worldedit.CuboidClipboard;
    import com.sk89q.worldedit.EditSession;
    import com.sk89q.worldedit.MaxChangedBlocksException;
    import com.sk89q.worldedit.bukkit.BukkitUtil;
    import com.sk89q.worldedit.bukkit.BukkitWorld;
    import com.sk89q.worldedit.data.DataException;
     
    private void schematicPaste(World world, File file, com.sk89q.worldedit.Vector origin)throws DataException, IOException, MaxChangedBlocksException{
            EditSession es = new EditSession(new BukkitWorld(world),999999999);
            @SuppressWarnings("deprecation")
            CuboidClipboard cc =CuboidClipboard.loadSchematic(file);
            cc.paste(es, origin, false);
        }
       
        public void loadArena(){
            int x = plugin.getConfig().getInt("test.x");
            int y = plugin.getConfig().getInt("test.y");
            int z = plugin.getConfig().getInt("test.z");
            String w = plugin.getConfig().getString("test.world");
            Location loc = new Location(Bukkit.getWorld(w), x, y, z);
            File Arena = new File(this.plugin.getWorldEdit().getDataFolder().getPath()+"/schematics/"+"Arena.schematic");
            World World = loc.getWorld();
            try {
                schematicPaste(World, Arena,BukkitUtil.toVector(loc));
            } catch (MaxChangedBlocksException e) {
                e.printStackTrace();
            } catch (DataException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
     
        }
    This is the error I am getting.
    Code:
    [08:57:58 ERROR]: Could not load 'plugins/Blitz.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/sk89q/worldedit/LocalWorld
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:357) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:319) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:126) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
    Caused by: java.lang.NoClassDefFoundError: com/sk89q/worldedit/LocalWorld
        at me.joxboyz.Blitz.Main.<init>(Main.java:66) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_05]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[?:1.8.0_05]
        at java.lang.Class.newInstance(Class.java:433) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        ... 9 more
    Caused by: java.lang.ClassNotFoundException: com.sk89q.worldedit.LocalWorld
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[?:1.8.0_05]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.8.0_05]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_05]
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_05]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_05]
        at me.joxboyz.Blitz.Main.<init>(Main.java:66) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_05]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_05]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_05]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[?:1.8.0_05]
        at java.lang.Class.newInstance(Class.java:433) ~[?:1.8.0_05]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        ... 9 more
    Is their something I am doing wrong?
    Also is the above code saving the schematic to a file? I do not see any thing in it that does.
     
  25. Offline

    Gater12

    Gamesareme
    Complaining a class cannot be found. Are you using the same WorldEdit jar as you have depended on in your project?
     
  26. Offline

    Gamesareme

    Gater12 I am using the same one. I have gone back and made sure.

    Any one?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  27. Offline

    ChipDev

    Its sad that you bumped in about a HOUR.
    It should be 1+days
     
  28. Offline

    Gamesareme

    ChipDev Well sorry, but this is one of the last bugs in my project. Also I have tried as much as I can to fix the bug, but I have not been able to work out what is wrong. Which is why I am here. :oops:

    Is their no one that has done this before? Why is it that when I remove that code that I posted above, the error does not show and when I add it again it shows again. It is in my understanding that this should not happen.

    Ok so I worked out how to fix the error, and I have worked out how to save to a file. But now we are getting another error :( this one I do not know if I can fix.
    this is the error.
    Code:
    [12:20:42 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'blitz' in plugin Blitz v0.0.1
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:703) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.PlayerConnection.handleCommand(PlayerConnection.java:955) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:817) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.PacketPlayInChat.a(PacketPlayInChat.java:28) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.PacketPlayInChat.handle(PacketPlayInChat.java:47) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:667) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
    Caused by: java.lang.NegativeArraySizeException
        at com.sk89q.worldedit.CuboidClipboard.<init>(CuboidClipboard.java:78) ~[?:?]
        at me.joxboyz.Blitz.protection.cubgenerator.savearena(cubgenerator.java:146) ~[?:?]
        at me.joxboyz.Blitz.Methods.seeifarenaisfinished(Methods.java:380) ~[?:?]
        at me.joxboyz.Blitz.Commands.Commands.onCommand(Commands.java:165) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[minecraft_server.jar:git-Bukkit-1.7.2-R0.3-66-g43d8943-b3078jnks]
        ... 13 more
    
    This is the code at the spot is said.
    Code:java
    1. Selection s = plugin.getWorldEdit().getSelection(player);
    2. Vector pos1 = s.getNativeMaximumPoint();
    3. Vector pos2 = s.getNativeMinimumPoint();
    4. CuboidClipboard ccb = new CuboidClipboard(pos1, pos2);

    Note the last line is the one with the problem.
    What am I meant to do?

    I feel like I am talking to my self here :'(

    So does any one know what is going wrong? I have been looking for a long time now. I know there is a way to fix this error, because world edit works fine. Could someone please help. I have been waiting and looking for a long time now. A weird thing is that the code runs fine when my locations are not negative, but the error comes when they are. I really do not want to move all the lobbies and the like though. :(

    Come on anyone please, this is taking a very long time. :'( I am really stuck and have no idea how to fix this.

    DinosParkour Have you had this problem?

    Lets do this guys. I bet this is a new record in the amount of bumps :( I am beginning to think that this forum is not very affective.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  29. Offline

    ChipDev

    Ok. I get why.. sometimes this forum is not helpful... (Sometimes) Maybe look into some code of plugins that already do it?
     
Thread Status:
Not open for further replies.

Share This Page