Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void dropPlayerMoney(double amount, Location location) {
- if (amount > 64) {
- int stacks = (int) (amount / 64);
- int rest = (int) (amount % 64);
- if (stacks <= 6) {
- for (int i = 1; i <= stacks; i++) {
- drop(64, location);
- }
- if (rest != 0) {
- drop(rest, location);
- }
- } else {
- int stackValue = (int) (amount / 6);
- for (int i = 1; i <= 6; i++) {
- drop(stackValue, location);
- }
- }
- } else {
- drop(amount, location);
- }
- }
- public void drop(double amount, Location location){
- ItemStack itemStack = new ItemStack(Material.EMERALD, (int) amount);
- ItemMeta itemMeta = itemStack.getItemMeta();
- itemMeta.setDisplayName("$$" + amount);
- itemStack.setItemMeta(itemMeta);
- location.getWorld().dropItemNaturally(location, itemStack);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement