Trouble executing code inside command

Discussion in 'Plugin Development' started by kag359six, Jun 30, 2012.

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

    kag359six

    In order to clean up my code and make things reusable, I made a new class for constructing a building programmatically. This class is called Structures. When i call the methods inside of that class in my onCommand method it doesn't execute as far as i can tell. The command gives no errors, but it just doesnt generate the building. I dont see the issue, any help? My Structure class takes in three integers, a CommandSender, and a command.
    Code:
    public class SuperStructures implements CommandExecutor {
     
        private MinecraftPlugin plugin;
        private Structures s;
     
        public SuperStructures(MinecraftPlugin plugin) {
         
            this.plugin = plugin;
         
        }
     
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[]arg) {
         
            if(cmd.getName().equalsIgnoreCase("createstructure")) {
             
                Player player = sender.getServer().getPlayer(sender.getName());
                Block b = player.getTargetBlock(null, 100);
                org.bukkit.Location loc = b.getLocation();
                World world = loc.getWorld();
             
                int posX = loc.getBlockX();
             
                int posY = loc.getBlockY();
     
                int posZ = loc.getBlockZ();
             
                s = new Structures(13, 25, 13, sender, world);
             
                s.createWallFront(posX, posY, posZ);
                s.createWallRight(posX, posY, posZ);
                s.createWallBack(posX, posY, posZ);
                s.createWallLeft(posX, posY, posZ);
                s.createRoof(posX, posY, posZ);
                s.createFloors(posX, posY, posZ);
                s.createFrontDoor(posX, posY, posZ);
             
             
                return true;
             
            }
         
            else {
             
                return false;
             
            }
         
        }
     
    }
    EDIT: after a few more tests it seems that i can use the command once, but then it no longer registers as a command and just chat text. Is there a limit to the number of blocks that can spawn or something?
     
Thread Status:
Not open for further replies.

Share This Page