Hey guys so I'm trying to make a plugin where when I type /start it takes all from an array and it sets that one player as owner. Here is what I have. Code: WorldGuardPlugin worldGuard = this.getWorldGuard(); This is where an error is showing. And here is getting worldguard Code: public WorldGuardPlugin getWorldGuard() { Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard"); if (plugin == null || !(plugin instanceof WorldGuardPlugin)) { return null; } return (WorldGuardPlugin) plugin; } public void ChooseRegions(){ for (int i=0; i<24; i++) { if (Bukkit.getOnlinePlayers().length > i) { if (joined.toArray()[i] != null) { if(this.worldGuard != null){ Player player = (Player)joined.toArray()[i]; DefaultDomain owner = new DefaultDomain(); player.sendMessage(ChatColor.RED + "You Are Slot: " + i); owner.addPlayer(player.getName()); ProtectedRegion region = worldGuard.getRegionManager(Bukkit.getWorld("world")).getRegion("R" + i); region.setOwners(owner); } } } } }
Based on the stack trace i can only assume that world guard loads after your plugin, there-fore causing a null pointer when you try to get world guard in onEnable() (assuming) in your plugin.yml add Code: softdepend: [WorldGuard] or Code: depend: [WorldGuard]
Yeah I did :O Code: name: Build_Off version: 1.0 main: LavaisWatery.BuildOff.BuildOff description: > softdepend: [WorldGuard] commands: start: description: create: description: checkassigned: description: gm: description: test: description: test command ci: description: settheme: description: whitelisted: description: hat: description: alive: description: gamemaker: description: gamemakerremove: description: theme: description: Check The Theme! buildoff: description: All Commands Accessed By Regular Players createblock: description: fighttime: description: killallplayers: description: setspectate: description: spectate: description: Spectate The Game!