Adds increased detection and optional refunding of signs broken by non-players

This commit is contained in:
2022-03-02 14:05:20 +01:00
parent 3d83458b9c
commit c2ffe5e903
6 changed files with 133 additions and 39 deletions

View File

@@ -49,16 +49,17 @@ public final class TrackedSignManager {
* Removes a tracked sign from the manager
*
* @param signLocation <p>The location the sign was removed from</p>
* @param refund <p>Whether to perform a refund after un-tracking the sign</p>
* @throws IOException <p>If unable to save the tracked signs</p>
*/
public static void removeTrackedSign(Location signLocation) throws IOException {
public static void removeTrackedSign(Location signLocation, boolean refund) throws IOException {
if (!trackedSigns.containsKey(signLocation)) {
return;
}
TrackedSign trackedSign = trackedSigns.get(signLocation);
trackedSigns.remove(signLocation);
saveTrackedSigns();
if (!PaidSigns.getInstance().areRefundsEnabled()) {
if (!PaidSigns.getInstance().areRefundsEnabled() || !refund) {
return;
}
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(trackedSign.getPlayerId());