old code & cant figure out how to replace it

Discussion in 'Plugin Development' started by skylerthebozz, Jul 18, 2016.

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

    skylerthebozz

    Ok what im trying to do is make it to when you right click a stair you will sit in it. Ive got the mechanics down but this one line of code seems to be screwing stuff up. And honestly im new to java and im a noob. i need this line of code changed to 1.10

    Code:
    if ((block.getRelative(BlockFace.DOWN).getTypeId() == 0) || (!net.minecraft.server.Block.byId[block.getRelative(BlockFace.DOWN).getTypeId()].a())) {
              return;
    this is what i got

    Code:
      @EventHandler
      public void onPlayerInteract(PlayerInteractEvent event) {
        if ((event.hasBlock()) && (event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
          org.bukkit.block.Block block = event.getClickedBlock();
    
          if (this.plugin.allowedBlocks.contains(block.getType())) {
            Player player = event.getPlayer();
            Stairs stairs = (Stairs)block.getState().getData();
            int chairwidth = 1;
    
            if ((block.getRelative(BlockFace.DOWN).getTypeId() == 0) || (!net.minecraft.server.Block.byId[block.getRelative(BlockFace.DOWN).getTypeId()].a())) {
              return;


    I figured it out
     
    Last edited: Jul 20, 2016
  2. @skylerthebozz Tell us what you are trying to do and we can help. One thing to change though, getTypeId change for getType and use the Material enumerator.
     
Thread Status:
Not open for further replies.

Share This Page