Solved I can't seem to fix this syntax error, I know it's simple, but this is my first plug-in

Discussion in 'Plugin Development' started by NugNugz, Jul 31, 2020.

  1. Offline

    NugNugz

    Code:
    public class StandingBlock extends JavaPlugin { //Syntax error on token "{", { expected after this token
         new BukkitRunnable() {
            public void run(CommandSender sender) {
    
                    Player player = (Player) sender;
                    int x = player.getLocation().getBlockX();
                    int y = player.getLocation().getBlockY();
                    int z = player.getLocation().getBlockZ();
                    Location loc = new Location(player.getWorld(), x, y, z);
               
                    loc.getBlock().setType(null);
    
            }   
        }.runTaskTimer(StandingBlock, 0, 20);
    } //Syntax error, insert "}" to complete ClassBody
     
  2. Offline

    KarimAKL

    @NugNugz You need to create a method, a field or an initialization block (static or not depending on the use case).
     

Share This Page