Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public void dropPlayerMoney(double amount, Location location) {
  2.  
  3. if (amount > 64) {
  4.  
  5. int stacks = (int) (amount / 64);
  6. int rest = (int) (amount % 64);
  7.  
  8. if (stacks <= 6) {
  9.  
  10. for (int i = 1; i <= stacks; i++) {
  11.  
  12. drop(64, location);
  13. }
  14.  
  15. if (rest != 0) {
  16.  
  17. drop(rest, location);
  18. }
  19. } else {
  20.  
  21. int stackValue = (int) (amount / 6);
  22.  
  23. for (int i = 1; i <= 6; i++) {
  24.  
  25. drop(stackValue, location);
  26. }
  27. }
  28.  
  29. } else {
  30.  
  31. drop(amount, location);
  32. }
  33. }
  34.  
  35. public void drop(double amount, Location location){
  36.  
  37. ItemStack itemStack = new ItemStack(Material.EMERALD, (int) amount);
  38.  
  39. ItemMeta itemMeta = itemStack.getItemMeta();
  40. itemMeta.setDisplayName("$$" + amount);
  41. itemStack.setItemMeta(itemMeta);
  42.  
  43. location.getWorld().dropItemNaturally(location, itemStack);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement