Solved Code help :)

Discussion in 'Plugin Development' started by Retherz_, Nov 3, 2012.

Thread Status:
Not open for further replies.
  1. Hi im making a plugin and im trying to add new stuff like this i get errors:
    Code:
    package me.mercilesspvp.orenotify;
     
    import java.util.logging.Logger;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
     
    public class orenotify extends JavaPlugin{
        Logger logger = Logger.getLogger("Minecraft");
       
        public void onEnable(){
            PluginDescriptionFile pdfFile = getDescription();
            logger.info("[" + pdfFile.getName() + "] version" + pdfFile.getVersion() + "has been enabled!");
        }
        public void onDisable(){
            PluginDescriptionFile pdfFile = getDescription();
            logger.info("[" + pdfFile.getName() + "] version" + pdfFile.getVersion() + "has been disabled!");
        } <--- Error here
       
        public void breakblock(BlockBreakEvent event) {
            Player player = event.getPlayer();
            Material block = event.getBlock().getType();
            if(block == Material.DIAMOND_ORE);
            {
                for (Player players : Bukkit.getServer().getOnlinePlayers()) {
                    if(!player.isPermissionSet("notify.orenotify")){
                    }
                    if(player.hasPermission("notify.orenotify")) {
                        players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Diamond Ore");
                        {
                                }if(block == Material.IRON_ORE);
                                {
                                        if(!player.isPermissionSet("notify.orenotify")){
                                        }
                                        if(player.hasPermission("notify.orenotify")) {
                                            players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Iron Ore.");
                                        }if(block == Material.GOLD_ORE);
                                        {
                                                if(!player.isPermissionSet("notify.orenotify")){
                                                }
                                                if(player.hasPermission("notify.orenotify")) {
                                                    players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Gold Ore.");
                                                }if(block == Material.EMERALD_ORE);
                                                {
                                                        if(!player.isPermissionSet("notify.orenotify")){
                                                        }
                                                        if(player.hasPermission("notify.orenotify")) {
                                                            players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Emerald Ore.");
                                                        }if(block == Material.REDSTONE_ORE);
                                                        {
                                                                if(!player.isPermissionSet("notify.orenotify")){
                                                                }
                                                                if(player.hasPermission("notify.orenotify")) {
                                                                    players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Redstone Ore.");
                                                                }
    }
                            }<--- Error here
                                   
                                       
    
     
  2. You forget a bunch of closing braces '}' :3. Fixed code:
    Code:java
    1. package me.mercilesspvp.orenotify;
    2.  
    3. import java.util.logging.Logger;
    4. import org.bukkit.Bukkit;
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.Material;
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.event.block.BlockBreakEvent;
    11. import org.bukkit.plugin.PluginDescriptionFile;
    12. import org.bukkit.plugin.PluginManager;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. public class orenotify extends JavaPlugin{
    16. Logger logger = Logger.getLogger("Minecraft");
    17.  
    18. public void onEnable(){
    19. PluginDescriptionFile pdfFile = getDescription();
    20. logger.info("[" + pdfFile.getName() + "] version" + pdfFile.getVersion() + "has been enabled!");
    21. }
    22. public void onDisable(){
    23. PluginDescriptionFile pdfFile = getDescription();
    24. logger.info("[" + pdfFile.getName() + "] version" + pdfFile.getVersion() + "has been disabled!");
    25. }
    26.  
    27. public void breakblock(BlockBreakEvent event) {
    28. Player player = event.getPlayer();
    29. Material block = event.getBlock().getType();
    30. if(block == Material.DIAMOND_ORE);
    31. {
    32. for (Player players : Bukkit.getServer().getOnlinePlayers()) {
    33. if(!player.isPermissionSet("notify.orenotify")){
    34. }
    35. if(player.hasPermission("notify.orenotify")) {
    36. players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Diamond Ore");
    37. {
    38. }if(block == Material.IRON_ORE);
    39. {
    40. if(!player.isPermissionSet("notify.orenotify")){
    41. }
    42. if(player.hasPermission("notify.orenotify")) {
    43. players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Iron Ore.");
    44. }if(block == Material.GOLD_ORE);
    45. {
    46. if(!player.isPermissionSet("notify.orenotify")){
    47. }
    48. if(player.hasPermission("notify.orenotify")) {
    49. players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Gold Ore.");
    50. }if(block == Material.EMERALD_ORE);
    51. {
    52. if(!player.isPermissionSet("notify.orenotify")){
    53. }
    54. if(player.hasPermission("notify.orenotify")) {
    55. players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Emerald Ore.");
    56. }if(block == Material.REDSTONE_ORE);
    57. {
    58. if(!player.isPermissionSet("notify.orenotify")){
    59. }
    60. if(player.hasPermission("notify.orenotify")) {
    61. players.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.AQUA + " has mined Redstone Ore.");
    62. }
    63. }
    64. }
    65. }
    66. }
    67. }
    68. }
    69. }
    70. }
    71. }
     
    MercilessPvP likes this.
Thread Status:
Not open for further replies.

Share This Page