Solved Working with Vault

Discussion in 'Plugin Development' started by Rufus5, Jul 10, 2015.

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

    Rufus5

    Okay, so I'm tryingto use Vault to deposit money into a player's account when they break a block. I'm using Craftconomy 3 for econ.

    Code:
    Economy economy = null;
    Code:
    @EventHandler
        public void onBreak(BlockBreakEvent e){
            e.getPlayer().sendMessage("registered");
            int amt = 0;
            switch(e.getBlock().getType()){
            default:
                break;
            case STONE:
                amt =1;
                break;
            case COAL_ORE:
                amt=5;
                break;
            case IRON_ORE:
                amt=10;
                break;
            case REDSTONE_ORE:
                amt=30;
                break;
            case GOLD_ORE:
                amt=20;
                break;
            case DIAMOND_ORE:
                amt=100;
                break;
            case EMERALD_ORE:
                amt=150;
                break;
            case QUARTZ_ORE:
                amt=20;
                break;
            }
            e.getPlayer().sendMessage("Block = " + e.getBlock().getType().toString());
            e.getPlayer().sendMessage("amt = " + amt);
            economy.depositPlayer(Bukkit.getServer().getOfflinePlayer(e.getPlayer().getUniqueId()), amt);
            e.getPlayer().sendMessage("Check");
        }
    
    }
    The messages I receive when I break a block are "registered", "amt = (amount)", and "Block = (block name)", but I don't get the "check" message. So somehow, the code is breaking on economy.depositPlayer. How can I get this to work?
     
  2. Offline

    justin_393

    did you register the economy in your Main class?

    Copy the setupEconomy() method from GitHub, paste it in your main class, then onenable call setupEconomy()
     
    Rufus5 likes this.
  3. Offline

    Rufus5

    It worked!! Thanks!
     
Thread Status:
Not open for further replies.

Share This Page