stoneharry

Untitled

Mar 5th, 2012
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1.   public Item[] GivePlayersMoneyLolol(Location location, int amount)
  2.   {
  3.     if (amount <= 0)
  4.       return null;
  5.  
  6.     Material mat = Material.getMaterial(getConfig().getInt("Dropped Material ID", 266));
  7.     if (mat == null) {
  8.       System.err.println("[StoneharryLoot] Material not found, what is this madness?!");
  9.       return null;
  10.     }
  11.     int stack = mat.getMaxStackSize();
  12.     int loops = amount / stack;
  13.     if (amount % stack != 0) {
  14.       loops++;
  15.     }
  16.     Item[] items = new Item[loops];
  17.     World w = location.getWorld();
  18.     WorldSettings s = (WorldSettings)worldconfigs.get(w);
  19.     for (int i = 0; i < loops; i++) {
  20.       if (i == loops - 1) {
  21.         items[i] = w.dropItemNaturally(location, new ItemStack(s.getMaterialID(), amount, 9001));
  22.       }
  23.       else {
  24.         items[i] = w.dropItemNaturally(location, new ItemStack(s.getMaterialID(), stack, 9001));
  25.         amount -= stack;
  26.       }
  27.     }
  28.     return items;
  29.   }
Advertisement
Add Comment
Please, Sign In to add comment