Solved Changing disc interact with Jukebox

Discussion in 'Plugin Development' started by BadReuben, Oct 26, 2012.

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


    I would like to know how to make is so that if a player interacts with a Jukebox with, for example, chirp in hand, the disc ward is inserted into Jukebox instead.
  2. Offline


  3. Offline


    The one thing I am not sure how to do now is to get the Jukebox to play the different disc.

    Here is the current code:
        public void PlayerInteractEvent(org.bukkit.event.player.PlayerInteractEvent e) {
            if (e.getPlayer().getDisplayName().equalsIgnoreCase("BlakkDock"))
              if(e.getAction() == Action.RIGHT_CLICK_BLOCK && (Material.RECORD_4.equals(e.getMaterial()))){
                      //play record 10
    I am having problems with this line of code; is there any way to define a jukebox from a clickedblock event?
    Jukebox juke = (Jukebox) e.getClickedBlock();

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 29, 2016
  4. Offline


    Jukebox juke = (Jukebox) e.getClickedBlock().getState();
    As a general rule in Bukkit when getting in depth info about a block, you must cast the block state.
    BlakkDock likes this.
Thread Status:
Not open for further replies.

Share This Page