Guest User

Untitled

a guest
Jul 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. private void splitDrop(Drop d, int amountDropped, Clan clan) {
  2. ArrayList<Player> receivingPlayers = new ArrayList<Player>();
  3. int amount = Misc.random(d.getMinAmount(), d.getMaxAmount());
  4. int price = ItemDefinition.forId(d.getItemId()).getExchangePrice() * amount;
  5. for (Player pl : Region.getLocalPlayers(location, 16)) {
  6. if (clan.getMembers().contains(pl)) {
  7. if (!getDamageManager().getEnemyHits().containsKey(pl)) {
  8. continue;
  9. }
  10. receivingPlayers.add(pl);
  11. }
  12. }
  13. int priceSplit = price / receivingPlayers.size();
  14. for (Player pl : receivingPlayers) {
  15. GroundItemManager.createGroundItem(new GroundItem(pl, new Item(995, priceSplit), getLocation(), false));
  16. pl.sendMessage("<col=009900>You received " + priceSplit + " coins as your split of the drop: " + amountDropped + "x " + ItemDefinition.forId(d.getItemId()).getName());
  17. }
  18.  
  19. }
Add Comment
Please, Sign In to add comment