Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
casperwtf committed Feb 22, 2024
1 parent c697d3e commit 00701e1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ public HashMap<UUID, Integer> getContribution(){
}

@Override
public synchronized boolean isToSave() {
public boolean isToSave() {
return toSave;
}

@Override
public synchronized void setToSave(boolean toSave) {
public void setToSave(boolean toSave) {
this.toSave = toSave;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void unClaim(Player player){
}
}

CrashClaim.getPlugin().getDataManager().deleteClaim(claim);
CrashClaim.getPlugin().getDataManager().deleteClaimAsync(claim);
VisualGroup group = visualizationManager.fetchVisualGroup(player, false);
if (group != null){
group.removeAllVisuals();
Expand Down Expand Up @@ -102,7 +102,7 @@ public void unClaimAll(Player player){
}
}

CrashClaim.getPlugin().getDataManager().deleteClaim(claim);
CrashClaim.getPlugin().getDataManager().deleteClaimAsync(claim);
VisualGroup group = visualizationManager.fetchVisualGroup(player, false);
if (group != null) {
group.removeAllVisuals();
Expand Down Expand Up @@ -132,14 +132,14 @@ public void unClaimAll(Player player, @Flags("other") OfflinePlayer otherPlayer)
for (Claim claim : claims) {
// Admin Command no need for permission checks

CrashClaim.getPlugin().getDataManager().deleteClaim(claim);
CrashClaim.getPlugin().getDataManager().deleteClaimAsync(claim);
VisualGroup group = visualizationManager.fetchVisualGroup(player, false);
if (group != null) {
group.removeAllVisuals();
}

if (otherPlayer.isOnline()){
CrashClaim.getPlugin().getDataManager().deleteClaim(claim);
if (otherPlayer.isOnline()) {
CrashClaim.getPlugin().getDataManager().deleteClaimAsync(claim);
VisualGroup group2 = visualizationManager.fetchVisualGroup(otherPlayer.getPlayer(), false);
if (group2 != null) {
group2.removeAllVisuals();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ private boolean addClaim(Claim claim){ //Should not be called from anywhere else
return true;
}

public synchronized void deleteClaim(Claim claim){
public void deleteClaim(Claim claim){
if (claim.isDeleted()){
return;
}
Expand Down Expand Up @@ -425,15 +425,19 @@ public synchronized void deleteClaim(Claim claim){
}
}

public synchronized void deleteSubClaimWithoutSave(SubClaim subClaim){
public void deleteClaimAsync(Claim claim) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> deleteClaim(claim));
}

public void deleteSubClaimWithoutSave(SubClaim subClaim){
Claim parent = subClaim.getParent();
parent.removeSubClaim(subClaim.getId());
}

public synchronized void deleteSubClaim(SubClaim subClaim){
public void deleteSubClaim(SubClaim subClaim){
Claim parent = subClaim.getParent();
parent.removeSubClaim(subClaim.getId());
saveClaim(parent);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> saveClaim(parent));
}

public void loadChunksForClaim(Claim claim){
Expand Down Expand Up @@ -563,7 +567,7 @@ public void preLoadChunk(UUID world, long seed){
}
}

public synchronized void saveClaim(Claim claim){
public void saveClaim(Claim claim){
if (claim.isDeleted()){
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void onClick(InventoryClickEvent event, String rawItemName) {
(player, aBoolean) -> {
if (aBoolean) {
if (helper.hasPermission(claim, getPlayer().getUniqueId(), PermissionRoute.MODIFY_PERMISSIONS)) {
CrashClaim.getPlugin().getDataManager().deleteClaim(claim);
CrashClaim.getPlugin().getDataManager().deleteClaimAsync(claim);
} else {
player.spigot().sendMessage(Localization.MENU__GENERAL__INSUFFICIENT_PERMISSION.getMessage(player));
}
Expand Down

0 comments on commit 00701e1

Please sign in to comment.