Help

Discussion in 'Plugin Development' started by jolbol1, Jul 29, 2013.

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

    jolbol1

    Hi, im trying to implement battle arena so i can make arenas for a the plugin im developing the trouble is im not sure what to do, i have two class files, the main one and the arena one and the game is called gungame. i have implemented it i think and i ran it all through the console. it retured a this error
    Code:
    23:28:33 [SEVERE] java.lang.NullPointerException
    23:28:33 [SEVERE]    at mc.alk.arena.util.FileUtil.getInputStream(FileUtil.java:51)
    23:28:33 [SEVERE]    at mc.alk.arena.controllers.APIRegistrationController.loadFile(APIRegistrationController.java:92)
    23:28:33 [SEVERE]    at mc.alk.arena.controllers.APIRegistrationController._registerCompetition(APIRegistrationController.java:201)
    23:28:33 [SEVERE]    at mc.alk.arena.controllers.APIRegistrationController.registerCompetition(APIRegistrationController.java:169)
    23:28:33 [SEVERE]    at mc.alk.arena.controllers.APIRegistrationController.registerCompetition(APIRegistrationController.java:161)
    23:28:33 [SEVERE]    at mc.alk.arena.controllers.APIRegistrationController.registerCompetition(APIRegistrationController.java:154)
    23:28:33 [SEVERE]    at mc.alk.arena.controllers.APIRegistrationController.registerCompetition(APIRegistrationController.java:145)
    23:28:33 [SEVERE]    at mc.alk.arena.BattleArena.registerCompetition(BattleArena.java:448)
    23:28:33 [SEVERE]    at me.jolbol1.gungame.GunGame.onEnable(GunGame.java:18)
    23:28:33 [SEVERE]    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
    23:28:33 [SEVERE]    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
    23:28:33 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
    23:28:33 [SEVERE]    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugin(CraftServer.java:282)
    23:28:33 [SEVERE]    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.enablePlugins(CraftServer.java:264)
    23:28:33 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.l(MinecraftServer.java:313)
    23:28:33 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.f(MinecraftServer.java:290)
    23:28:33 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.a(MinecraftServer.java:250)
    23:28:33 [SEVERE]    at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:151)
    23:28:33 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:391)
    23:28:33 [SEVERE]    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    and it didnt let me do the command /gg
    heres my code
    GunGame Class
    Code:
    package me.jolbol1.gungame;
     
    import mc.alk.arena.BattleArena;
    import mc.alk.arena.util.Log;
     
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.plugin.java.JavaPlugin;
    public class GunGame extends JavaPlugin{
     
        @Override
        public void onEnable(){
            /// Registers this plugin with BattleArena
            /// this: our plugin
            /// "Paintball": The name of our competition
            /// "pb": the name of our command alias ( who really wants to type in the entire word paintball?)
            /// PaintballArena.class: which arena should this competition use
            /// Register a Paintball
            BattleArena.registerCompetition(this, "GunGame", "gg", GunGameArena.class);
     
            /// create our default config if it doesn't exist
            saveDefaultConfig();
     
            /// Load our config options
            loadConfig();
     
            Log.info("[" + getName()+ "] v" + getDescription().getVersion()+ " enabled!");
        }
     
        @Override
        public void onDisable(){
            Log.info("[" + getName()+ "] v" + getDescription().getVersion()+ " stopping!");
        }
     
        @Override
        public void reloadConfig(){
            super.reloadConfig();
            loadConfig();
        }
     
        public void loadConfig(){
            /// Allow the damage to be set through the config.yml, if it exists and has the section: 'damage: <value>'
            /// Like 'damage: 15'
            FileConfiguration config = getConfig();
           
        }
     
    }
    Gungamearena class
    Code:
    package me.jolbol1.gungame;
     
    import mc.alk.arena.objects.arenas.Arena;
    import mc.alk.arena.objects.events.MatchEventHandler;
     
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.EntityType;
    import org.bukkit.entity.Player;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
     
    public class GunGameArena extends Arena{
        static int damage = 20;
     
        /**
        * This is how you create customized events.  You specify a method as a @MatchEventHandler
        * and give it at least one bukkit event as the first argument.  In this case its EntityDamageByEntityEvent
        * These events will ONLY be called when a match is ongoing
        * If the event returns a player (in this case it does) then the event only gets called when
        * 1) match is ongoing
        * 2) player is still alive in the match
        *
        * @param event: Which bukkit event are we listening to
        */
        @SuppressWarnings("deprecation")
        @MatchEventHandler
        public void onKill(PlayerDeathEvent e) {
            String prefix = ChatColor.GOLD + "[GunGame]" + ChatColor.RESET;
            Player killer = e.getEntity().getKiller();
            Player killed = e.getEntity();
            String killername = e.getEntity().getKiller().getName();
           
            if(killer.getInventory().contains(Material.WOOD_HOE)) {
                for (ItemStack i : killer.getInventory()) {
                    if (i.getType() == Material.WOOD_HOE
                          && i.hasItemMeta() && i.getItemMeta().hasDisplayName()
                          && i.getItemMeta().getDisplayName().equalsIgnoreCase("B23R")) {
                        ItemStack item = i;
                        killer.getInventory().remove(i);
                        Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "shot give " + killername + " kap-40");
                       
                    }
            }
           
           
           
           
        }
        }
    }
    
     
  2. Offline

    etaxi341

    jolbol1 The problem is at this point:
    Code:java
    1. BattleArena.registerCompetition(this, "GunGame", "gg", GunGameArena.class);

    Could you show us the Class BattleArena
     
  3. Offline

    jolbol1

    i dont have a battle arena class, thats in the jar battlearena. its a api
     
  4. Offline

    etaxi341

    jolbol1 Ohh okay. I don't know how this API is working so I can't help you :( But there is something wrong in this line. Maybe you should check again the Page of the API to see how it normally should be?
     
  5. Offline

    lDucks

    BattleArena source code is found here.
     
Thread Status:
Not open for further replies.

Share This Page