Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void splitDrop(Drop d, int amountDropped, Clan clan) {
- ArrayList<Player> receivingPlayers = new ArrayList<Player>();
- int amount = Misc.random(d.getMinAmount(), d.getMaxAmount());
- int price = ItemDefinition.forId(d.getItemId()).getExchangePrice() * amount;
- for (Player pl : Region.getLocalPlayers(location, 16)) {
- if (clan.getMembers().contains(pl)) {
- if (!getDamageManager().getEnemyHits().containsKey(pl)) {
- continue;
- }
- receivingPlayers.add(pl);
- }
- }
- int priceSplit = price / receivingPlayers.size();
- for (Player pl : receivingPlayers) {
- GroundItemManager.createGroundItem(new GroundItem(pl, new Item(995, priceSplit), getLocation(), false));
- pl.sendMessage("<col=009900>You received " + priceSplit + " coins as your split of the drop: " + amountDropped + "x " + ItemDefinition.forId(d.getItemId()).getName());
- }
- }
Add Comment
Please, Sign In to add comment