Solved Need help storing blocks in array

Discussion in 'Plugin Help/Development/Requests' started by benthomas7777, Jun 11, 2015.

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

    benthomas7777

    I am trying to store a 11 by 11 by 11 area around a block that is placed and then when the player types a command that area is copied relative to them.

    This is the section of my code that keeps having errors.

    Code:
        Block[][][] Wall;
    Block b = event.getBlock();
                for (int x = -5; x < 6; x++) {
                    for (int z = -5; z < 6; z++) {
                        for (int y = 0; y < 11; y++) {
                            Wall[x][y][z] = b.getLocation().add(x, y, z).getBlock();
                        }
                           
                }
            }
            }
    
     
  2. Offline

    Markyroson

    what errors are you getting exactly (could we please have a stack trace or error that your IDE is throwing)?
     
  3. Offline

    benthomas7777

    Yes, the IDE doesn't throw an errors, run when the code is run and i place the block that triggers this code i get this

    Error Log (open)

    Code:
    [21:20:19] [Server thread/INFO]: Starting minecraft server version 1.8.3
    [21:20:19] [Server thread/INFO]: Loading properties
    [21:20:19] [Server thread/INFO]: Default game type: SURVIVAL
    [21:20:19] [Server thread/INFO]: Generating keypair
    [21:20:19] [Server thread/INFO]: Starting Minecraft server on *:25565
    [21:20:19] [Server thread/INFO]: Using default channel type
    [21:20:20] [Server thread/INFO]: This server is running CraftBukkit version git-Bukkit-6e0120a (MC: 1.8.3) (Implementing API version 1.8.3-R0.1-SNAPSHOT)
    [21:20:20] [Server thread/INFO]: [AgeofEmpires] Loading AgeofEmpires v1.0
    [21:20:20] [Server thread/INFO]: Preparing level "world"
    [21:20:20] [Server thread/INFO]: Preparing start region for level 0 (Seed: -3064742164155234582)
    [21:20:21] [Server thread/INFO]: Preparing spawn area: 89%
    [21:20:21] [Server thread/INFO]: Preparing start region for level 1 (Seed: 6883102785784422186)
    [21:20:22] [Server thread/INFO]: Preparing spawn area: 84%
    [21:20:22] [Server thread/INFO]: Preparing start region for level 2 (Seed: 6883102785784422186)
    [21:20:22] [Server thread/INFO]: [AgeofEmpires] Enabling AgeofEmpires v1.0
    [21:20:22] [Server thread/INFO]: [AgeofEmpires] Plugin Started
    [21:20:22] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [21:20:23] [Server thread/INFO]: Done (2.797s)! For help, type "help" or "?"
    [21:21:08] [User Authenticator #1/INFO]: UUID of player benthomas7777 is 9574d196-e777-4f8f-a99f-5af393d02a43
    [21:21:08] [Server thread/INFO]: benthomas7777[/127.0.0.1:53088] logged in with entity id 105 at ([world]392.8924408691563, 4.0, 2452.4246568199387)
    [21:21:14] [Server thread/ERROR]: Could not pass event BlockPlaceEvent to AgeofEmpires v1.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.event.CraftEventFactory.callBlockPlaceEvent(CraftEventFactory.java:124) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.ItemStack.placeItem(ItemStack.java:156) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PlayerInteractManager.interact(PlayerInteractManager.java:502) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java:703) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:52) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PlayerConnectionUtils$1.run(SourceFile:13) [bukkit.jar:git-Bukkit-6e0120a]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_40]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_40]
        at net.minecraft.server.v1_8_R2.SystemUtils.a(SourceFile:60) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.A(MinecraftServer.java:670) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:336) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:626) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:534) [bukkit.jar:git-Bukkit-6e0120a]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_40]
    Caused by: java.lang.NullPointerException
        at me.benthomas7777.ageofempires.Main.onBlockPlace(Main.java:108) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_40]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_40]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_40]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_40]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[bukkit.jar:git-Bukkit-6e0120a]
        ... 18 more
    [21:21:19] [Server thread/ERROR]: Could not pass event BlockPlaceEvent to AgeofEmpires v1.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [bukkit.jar:git-Bukkit-6e0120a]
        at org.bukkit.craftbukkit.v1_8_R2.event.CraftEventFactory.callBlockPlaceEvent(CraftEventFactory.java:124) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.ItemStack.placeItem(ItemStack.java:156) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PlayerInteractManager.interact(PlayerInteractManager.java:502) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java:703) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:52) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.PlayerConnectionUtils$1.run(SourceFile:13) [bukkit.jar:git-Bukkit-6e0120a]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_40]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_40]
        at net.minecraft.server.v1_8_R2.SystemUtils.a(SourceFile:60) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.A(MinecraftServer.java:670) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:336) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:626) [bukkit.jar:git-Bukkit-6e0120a]
        at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:534) [bukkit.jar:git-Bukkit-6e0120a]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_40]
    Caused by: java.lang.NullPointerException
        at me.benthomas7777.ageofempires.Main.onBlockPlace(Main.java:108) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_40]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_40]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_40]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_40]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[bukkit.jar:git-Bukkit-6e0120a]
        ... 18 more
    
     
    Markyroson likes this.
  4. Offline

    BizarrePlatinum

    @benthomas7777 Whatever is on line 108 of your main class is returning null, could you post that line and what it's supposed to do/where the line should be getting the information.
     
  5. Offline

    benthomas7777

    108 is part of the code i posted above. It is the line bellow
    Code:
                        Wall[x][y][z] = b.getLocation().add(x, y, z).getBlock();
     
  6. Offline

    Markyroson

    thank you
    I am not at home at the moment or I would try the code myself and try to help out more on it. But at least the community (we) now have the stack trace and clarification that the editor does not throw an error. Hopefully that helps the ones that can actively help.

    Please do let me know when you get this resolved okay?
     
  7. Offline

    benthomas7777

    Will do. Still no luck from the few things i've tried. But thanks
     
    Markyroson likes this.
  8. Offline

    Markyroson

    Thank you. No problem and I apologize for not being able to help more (at the moment).
     
  9. Offline

    BizarrePlatinum

    @benthomas7777 The problem is with your array. Search around for another way of creating cuboids(I would suggest a way, however I have never done anything with cuboids).
     
  10. Offline

    benthomas7777

    I have tried many other ways, but have been unable to find one that works. Im not sure why at this point
     
Thread Status:
Not open for further replies.

Share This Page