I need help on creating sign with a command, and make it cost.

Discussion in 'Plugin Development' started by SuippoKala, Apr 12, 2014.

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

    SuippoKala

    Okay hey everyone, i dont know how do i add my command to sign, i've made a plugin with /sword, wich gives you a supersword and i want to add it to sign, and i want to make it cost $1000 how can i do that? Do i need vault for that?
     
  2. Hope this helps

    Code:
    @EventHandler
    
        public void onSignClick(PlayerInteractEvent ev){
    
            Player p = ev.getPlayer();
    
            if(ev.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
    
                if(ev.getClickedBlock().getType() == Material.WALL_SIGN
    || ev.getClickedBlock().getType() == Material.SIGN_POST){
    
                    Sign si = (Sign) ev.getClickedBlock();
    
                    String s = si.getLine(0);
    
                    if(s.equalsIgnoreCase("sword")){
    
                        Bukkit.dispatchCommand(p, "/sword");
    
                        //here you can take the money from the player
    
                        //for instance econ.setBalance(p.getName(), (p.getBalance()-1000))
    
                    }
    
                }
    
            }
    
        }
    
    cheers
    sn1cko

    ps: if not tell me whats the problem

    EDITED
     
    Last edited: Jan 8, 2015
  3. sn1cko likes this.
  4. haha he said he doesn't know how to add a command to a sign
    i just showed him how he COULD use it :)


    i am happy to write some code 'cause i am bored in school right now and have enough time to do it haha
     
  5. @sn1cko That's fair enough, but doing so isn't helpful. By the way, Material.SIGN is the one in inventory, WALL_SIGN and SIGN_POST are the placed blocks :)
     
    sn1cko likes this.
  6. thanks haha, sorry haven't tested it :)
     
    AdamQpzm likes this.
Thread Status:
Not open for further replies.

Share This Page