java - syntx error, insert } to complet ClassBody -
package me.san33der.pvp; import java.util.random; import org.bukkit.chatcolor; import org.bukkit.location; import org.bukkit.material; import org.bukkit.command.command; import org.bukkit.command.commandsender; import org.bukkit.enchantments.enchantment; import org.bukkit.entity.player; import org.bukkit.inventory.itemstack; import org.bukkit.inventory.meta.itemmeta; import org.bukkit.plugin.pluginmanager; import org.bukkit.plugin.java.javaplugin; import me.san33der.pvp.listeners; public class main extends javaplugin { private static main instance; public void log(string string) { } public static main getinstance() { return instance; } public void registerlisteners() { pluginmanager pm = getserver().getpluginmanager(); pm.registerevents(new listeners(this), this); } public void registercommands() { // not used yet } @override public void onenable() { getlogger().info("has been enabled"); instance = this; registerlisteners(); registercommands(); } @override public void ondisable() { getlogger().info("has been disabled"); instance = null; } // commands @override public boolean oncommand(commandsender sender, command cmd, string commendlabel, string[] args) { // starter command if (cmd.getname().equalsignorecase("starter") && sender instanceof player) { player p = (player) sender; p.getinventory().clear(); itemstack starterbow = new itemstack(material.bow); itemmeta m = starterbow.getitemmeta(); m.setdisplayname(chatcolor.green + "starterbow"); starterbow.setitemmeta(m); starterbow.addenchantment(enchantment.arrow_fire, 1); starterbow.addenchantment(enchantment.arrow_infinite, 1); p.getinventory().additem(starterbow); p.getinventory().additem(new itemstack(material.arrow)); p.getinventory().setchestplate(new itemstack(material.iron_chestplate)); p.getinventory().setleggings(new itemstack(material.iron_leggings)); p.getinventory().setboots(new itemstack(material.iron_boots)); p.getinventory().sethelmet(new itemstack(material.iron_helmet)); p.setmaxhealth(50); p.sethealth(50); p.sendmessage(chatcolor.dark_red + "you giving the" + chatcolor.yellow + " starterkit"); } return false; // end of starter command // amateur command if(cmd.getname().equalsignorecase("amateur")&&sender instanceof player) { player p = (player) sender; p.getinventory().clear(); itemstack amateurbow = new itemstack(material.bow); itemmeta n = amateurbow.getitemmeta(); n.setdisplayname(chatcolor.yellow + "amateurbow"); amateurbow.setitemmeta(n); amateurbow.addenchantment(enchantment.arrow_fire, 1); amateurbow.addenchantment(enchantment.arrow_infinite, 1); itemstack amateursword = new itemstack(material.diamond_sword); itemmeta m = amateursword.getitemmeta(); m.setdisplayname(chatcolor.yellow + "amateursword"); amateursword.setitemmeta(m); amateursword.addenchantment(enchantment.fire_aspect, 2); amateursword.addenchantment(enchantment.knockback, 2); p.getinventory().setchestplate(new itemstack(material.iron_chestplate)); p.getinventory().setboots(new itemstack(material.iron_boots)); p.getinventory().sethelmet(new itemstack(material.iron_helmet)); p.getinventory().setleggings(new itemstack(material.iron_leggings)); p.getinventory().additem(amateursword); p.getinventory().additem(amateurbow); p.getinventory().additem(new itemstack(material.arrow, 1)); p.setmaxhealth(30); p.sethealth(30); p.sendmessage(chatcolor.gold + "you given the" + chatcolor.dark_gray + " amateurkit"); return false; } // random teleport if(cmd.getname().equalsignorecase("teleportme")&&sender instanceof player) { player player = (player) sender; location originallocation = player.getlocation(); random random = new random(); location teleportlocation = null; int x = random.nextint(10) + 1; int y = 30; int z = random.nextint(10) + 1; boolean isonland = false; while (isonland == false) { teleportlocation = new location(player.getworld(), x, y, z); if (teleportlocation.getblock().gettype() != material.air) { isonland = true; } else y--; } player.teleport(new location(player.getworld(), teleportlocation.getx(), teleportlocation.gety() + 1, teleportlocation.getz())); player.sendmessage(chatcolor.red + "you have been teleported " + (int) teleportlocation.distance(originallocation) + " blocks away!"); return true; return false; // spawn if(cmd.getname().equalsignorecase("spawn")&&sender instanceof player) { player p = (player) sender; p.teleport(p.getworld().getspawnlocation()); p.sendmessage(chatcolor.red + "you have been teleported spawn"); return false; // setspawn if (cmd.getname().equalsignorecase("setspawn") && sender instanceof player) { p.getworld().setspawnlocation(p.getlocation().getblockx(), p.getlocation().getblocky(), p.getlocation().getblockz()); p.sendmessage("spawn location has been set @ world" + p.getworld().getname()); } return false; } } }
what wrong dont did wrong.
i'd appreciate thorough explanation since started working java , want learn mistake.
look @ indentation , bracketing. each method should have opening , closing curly bracket. error you're getting caused missing bracket somewhere, meaning compiler thinks you've not closed class properly.
Comments
Post a Comment