mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-01-07 08:58:23 +01:00
Move entry fee refund to after join/leave rollback.
This moves the refunding of the entry fee to after the join/leave process for the player has been rolled back, i.e. after the inventory is restored. Before this change, the refund would happen before restoring the player's inventory, which resulted in the refund getting overwritten.
This commit is contained in:
parent
7aad81e33f
commit
5ac83b6898
@ -774,9 +774,7 @@ public class ArenaImpl implements Arena
|
||||
removeClassPermissions(p);
|
||||
removePotionEffects(p);
|
||||
|
||||
if (inLobby(p) || inArena(p)) {
|
||||
refund(p);
|
||||
}
|
||||
boolean refund = inLobby(p) || inArena(p);
|
||||
|
||||
if (inLobby(p)) {
|
||||
ArenaPlayer ap = arenaPlayerMap.get(p);
|
||||
@ -791,6 +789,10 @@ public class ArenaImpl implements Arena
|
||||
}
|
||||
|
||||
discardPlayer(p);
|
||||
|
||||
if (refund) {
|
||||
refund(p);
|
||||
}
|
||||
|
||||
endArena();
|
||||
|
||||
@ -1522,12 +1524,7 @@ public class ArenaImpl implements Arena
|
||||
|
||||
@Override
|
||||
public boolean refund(Player p) {
|
||||
if (entryFee.isEmpty()) return true;
|
||||
if (!inLobby(p)) return false;
|
||||
|
||||
for (Thing fee : entryFee) {
|
||||
fee.giveTo(p);
|
||||
}
|
||||
entryFee.forEach(fee -> fee.giveTo(p));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user