Help with one plugin

Discussion in 'Archived: Plugin Requests' started by BeeT, Jan 22, 2012.

  1. Offline

    BeeT

    Hello, I have directbank plugin and i want to fix bug.
    When player use many sings all banks are busy, so how to fix it?

    How to check is it player already use bank or no?
    For example if I already clicked on one sign i couldn't click in another sign.


    Code:
      public void onPlayerInteract(PlayerInteractEvent e) {
        Block Clicked = e.getClickedBlock();
        if ((Clicked != null) && 
          ((Clicked.getType() == Material.SIGN_POST) || (Clicked.getType() == Material.WALL_SIGN)) && 
          (this.s.isKnownSign(Clicked.getLocation()))) {
          Sign sign = (Sign)Clicked.getState();
          Player player = e.getPlayer();
          String signMeta = this.s.getSign(Clicked.getLocation());
          
         if ((!this.signInUse.containsKey(loc2str(e.getClickedBlock().getLocation()))) || (this.signInUse.getProperty(loc2str(e.getClickedBlock().getLocation())).equals(e.getPlayer().getName()))) {
            this.signInUse.setProperty(loc2str(e.getClickedBlock().getLocation()), e.getPlayer().getName());
            
            if ((signMeta.equals("bank")) && ((e.getPlayer().isOp()) || (e.getPlayer().hasPermission("directbank.bank.use")) || (e.getPlayer().hasPermission("directbank.user")) || (this.c.getConfig("permissions").equals("false")))) {
              if (e.getAction() == Action.LEFT_CLICK_BLOCK) {
                String playername = e.getPlayer().getName();
     
                if ((this.c.hasConfig("oldprefix")) && 
                  (!this.c.getConfig("oldprefix").equals("")) && 
                  (Methods.getMethod().hasAccount(this.c.getConfig("oldprefix") + e.getPlayer().getName()))) {
                  double balance = Methods.getMethod().getAccount(this.c.getConfig("oldprefix") + e.getPlayer().getName()).balance();
                  this.m.addMoney(playername, balance);
                  Methods.getMethod().getAccount(this.c.getConfig("oldprefix") + e.getPlayer().getName()).remove();
                }
     
                if (Money.exist(playername))
                {
                  String ps;
                  if (this.playerState.containsKey(playername)) {
                    ps = this.playerState.getProperty(playername);
                  } else {
                    SignReset xs = new SignReset(sign, e.getPlayer().getName(), e.getClickedBlock().getLocation(), this);
                    xs.start();
                    this.playerState.setProperty(playername, "deposit");
                    ps = "deposit";
                    player.sendMessage(this.l.getLang("bank1"));
                    player.sendMessage(this.l.getLang("bank2"));
                  }
                  setSign(sign, playername);
                  if (ps.equals("send")) {
                    sign.setLine(3, this.l.getLang("deposit"));
                    this.playerState.setProperty(playername, "deposit");
                    sign.update();
                  } else if (ps.equals("deposit")) {
                    sign.setLine(3, this.l.getLang("withdraw"));
                    this.playerState.setProperty(playername, "withdraw");
                    sign.update();
                  } else {
                    this.playerState.setProperty(playername, "send");
                    sign.setLine(3, this.l.getLang("send"));
                    sign.update();
                  }
                } else {
                  player.sendMessage(this.l.getLang("bank1"));
                  player.sendMessage(this.l.getLang("create-bank-account"));
                  this.playerState.setProperty(playername, "create");
                }
              } else {
                sign.setLine(1, "");
                sign.setLine(2, ChatColor.GOLD + "$$$");
                sign.setLine(3, "");
                sign.update();
                this.playerState.remove(player.getName());
              }
     
            }
          }
          else
          {
            e.getPlayer().sendMessage(this.l.getLang("sign-in-use"));
          }
        }
      }
    
     
  2. Offline

    hammale

    U might get better results if u post in the plugin development thread :D
     
  3. Offline

    BeeT

    I did it, sorry.
     

Share This Page