Remove unnecessary marking as 'to be saved'

Marking as 'to be saved' is already done when a setting change is
written to the YAML file, so it does not have to be called from the
places where settings are changed.
This commit is contained in:
Thijs Wiefferink 2015-04-28 20:38:44 +02:00
parent 0cdff5e143
commit 76ad952bb6
19 changed files with 2 additions and 40 deletions

View File

@ -163,7 +163,6 @@ public class AddCommand extends CommandAreaShop {
rent.updateRegionFlags();
// Run commands
rent.runEventCommands(RegionEvent.CREATED, false);
rent.saveRequired();
} else {
BuyRegion buy = new BuyRegion(plugin, region.getId(), finalWorld);
// Set landlord
@ -179,7 +178,6 @@ public class AddCommand extends CommandAreaShop {
buy.updateRegionFlags();
// Run commands
buy.runEventCommands(RegionEvent.CREATED, false);
buy.saveRequired();
}
}
current++;

View File

@ -94,7 +94,6 @@ public class AddfriendCommand extends CommandAreaShop {
return;
}
region.addFriend(friend.getUniqueId());
region.saveRequired();
region.updateRegionFlags();
region.updateSigns();
plugin.message(sender, "addfriend-successOther", friend.getName(), region.getName());
@ -115,7 +114,6 @@ public class AddfriendCommand extends CommandAreaShop {
return;
}
region.addFriend(friend.getUniqueId());
region.saveRequired();
region.updateRegionFlags();
region.updateSigns();
plugin.message(sender, "addfriend-success", friend.getName(), region.getName());

View File

@ -106,7 +106,6 @@ public class AddsignCommand extends CommandAreaShop {
plugin.message(sender, "addsign-successProfile", region, profile);
}
region.updateSigns();
region.saveRequired();
}
@Override

View File

@ -84,7 +84,6 @@ public class DelfriendCommand extends CommandAreaShop {
return;
}
region.deleteFriend(friend.getUniqueId());
region.saveRequired();
region.updateRegionFlags();
region.updateSigns();
plugin.message(sender, "delfriend-successOther", friend.getName(), region.getName());
@ -97,7 +96,6 @@ public class DelfriendCommand extends CommandAreaShop {
return;
}
region.deleteFriend(friend.getUniqueId());
region.saveRequired();
region.updateRegionFlags();
region.updateSigns();
plugin.message(sender, "delfriend-success", friend.getName(), region.getName());

View File

@ -65,7 +65,6 @@ public class DelsignCommand extends CommandAreaShop {
plugin.message(sender, "delsign-success", region.getName());
region.removeSign(block.getLocation());
region.updateSigns();
region.saveRequired();
}
@Override

View File

@ -85,14 +85,12 @@ public class ResellCommand extends CommandAreaShop {
}
if(sender.hasPermission("areashop.resellall")) {
buy.enableReselling(price);
buy.saveRequired();
plugin.message(sender, "resell-success", buy);
buy.updateSigns();
buy.updateRegionFlags();
} else if(sender.hasPermission("areashop.resell") && sender instanceof Player) {
if(buy.isOwner((Player)sender)) {
buy.enableReselling(price);
buy.saveRequired();
plugin.message(sender, "resell-success", buy);
buy.updateSigns();
buy.updateRegionFlags();

View File

@ -78,7 +78,6 @@ public class SetdurationCommand extends CommandAreaShop {
rent.setDuration(null);
rent.updateRegionFlags();
rent.updateSigns();
rent.saveRequired();
return;
}
try {
@ -94,7 +93,6 @@ public class SetdurationCommand extends CommandAreaShop {
rent.setDuration(args[1]+" "+args[2]);
rent.updateRegionFlags();
rent.updateSigns();
rent.saveRequired();
plugin.message(sender, "setduration-success", rent.getName(), rent.getDurationString());
}

View File

@ -100,7 +100,6 @@ public class SetownerCommand extends CommandAreaShop {
calendar.setTimeInMillis(rent.getRentedUntil() + rent.getDuration());
rent.setRentedUntil(calendar.getTimeInMillis());
rent.setRenter(uuid);
rent.saveRequired();
plugin.message(sender, "setowner-succesRentExtend", region);
rent.updateRegionFlags();
rent.updateSigns();
@ -114,7 +113,6 @@ public class SetownerCommand extends CommandAreaShop {
calendar.setTimeInMillis(current + rent.getDuration());
rent.setRentedUntil(calendar.getTimeInMillis());
rent.setRenter(uuid);
rent.saveRequired();
plugin.message(sender, "setowner-succesRent", region);
rent.updateRegionFlags();
rent.updateSigns();
@ -125,7 +123,6 @@ public class SetownerCommand extends CommandAreaShop {
if(region.isBuyRegion()) {
BuyRegion buy = (BuyRegion)region;
buy.setBuyer(uuid);
buy.saveRequired();
plugin.message(sender, "setowner-succesBuy", region);
buy.updateRegionFlags();
buy.updateSigns();

View File

@ -80,7 +80,6 @@ public class SetpriceCommand extends CommandAreaShop {
plugin.message(sender, "setprice-successRemoved", region);
region.updateSigns();
region.updateRegionFlags();
region.saveRequired();
return;
}
double price = 0.0;
@ -100,7 +99,6 @@ public class SetpriceCommand extends CommandAreaShop {
}
region.updateSigns();
region.updateRegionFlags();
region.saveRequired();
}
@Override

View File

@ -60,7 +60,6 @@ public class SetrestoreCommand extends CommandAreaShop {
} else {
plugin.message(sender, "setrestore-success", region.getName(), valueString);
}
region.saveRequired();
}
@Override

View File

@ -170,7 +170,6 @@ public class StackCommand extends CommandAreaShop {
rent.handleSchematicEvent(RegionEvent.CREATED);
rent.updateRegionFlags();
rent.runEventCommands(RegionEvent.CREATED, false);
rent.saveRequired();
} else {
BuyRegion buy = new BuyRegion(plugin, region.getId(), selection.getWorld());
if(finalGroup != null) {
@ -181,7 +180,6 @@ public class StackCommand extends CommandAreaShop {
buy.handleSchematicEvent(RegionEvent.CREATED);
buy.updateRegionFlags();
buy.runEventCommands(RegionEvent.CREATED, false);
buy.saveRequired();
}
current++;
}

View File

@ -74,14 +74,12 @@ public class StopresellCommand extends CommandAreaShop {
}
if(sender.hasPermission("areashop.stopresellall")) {
buy.disableReselling();
buy.saveRequired();
plugin.message(sender, "stopresell-success", buy);
buy.updateSigns();
buy.updateRegionFlags();
} else if(sender.hasPermission("areashop.stopresell") && sender instanceof Player) {
if(buy.isOwner((Player)sender)) {
buy.disableReselling();
buy.saveRequired();
plugin.message(sender, "stopresell-success", buy);
buy.updateSigns();
buy.updateRegionFlags();

View File

@ -92,14 +92,12 @@ public final class PlayerLoginListener implements Listener {
if(region.isBuyRegion()) {
if(!player.getName().equals(region.getStringSetting("buy.buyerName"))) {
region.setSetting("buy.buyerName", player.getName());
region.saveRequired();
region.updateRegionFlags();
region.updateSigns();
}
} else if(region.isRentRegion()) {
if(!player.getName().equals(region.getStringSetting("rent.renterName"))) {
region.setSetting("rent.renterName", player.getName());
region.saveRequired();
region.updateRegionFlags();
region.updateSigns();
}

View File

@ -173,7 +173,6 @@ public final class SignChangeListener implements Listener {
plugin.message(player, "setup-rentSuccess", rent.getName());
// Run commands
rent.runEventCommands(RegionEvent.CREATED, false);
rent.saveRequired();
}
} else if (event.getLine(0).contains(plugin.getConfig().getString("signTags.buy"))) {
// Check for permission
@ -284,7 +283,6 @@ public final class SignChangeListener implements Listener {
// Run commands
buy.runEventCommands(RegionEvent.CREATED, false);
buy.saveRequired();
}
} else if(event.getLine(0).contains(plugin.getConfig().getString("signTags.add"))) {
// Check for permission
@ -325,7 +323,6 @@ public final class SignChangeListener implements Listener {
region.addSign(event.getBlock().getLocation(), event.getBlock().getType(), sign.getFacing(), thirdLine);
plugin.message(player, "addsign-successProfile", region, thirdLine);
}
region.saveRequired();
// Update the sign later because this event will do it first
final GeneralRegion regionUpdate = region;

View File

@ -228,6 +228,7 @@ public class FileManager {
return;
}
regions.put(rent.getName().toLowerCase(), rent);
rent.saveRequired();
}
/**
@ -241,6 +242,7 @@ public class FileManager {
return;
}
regions.put(buy.getName().toLowerCase(), buy);
buy.saveRequired();
}
/**

View File

@ -189,7 +189,6 @@ public class SignLinkerManager implements Listener {
plugin.message(linker, "addsign-successProfile", region, profile);
}
region.updateSigns();
region.saveRequired();
reset();
plugin.message(linker, "linksigns-next");

View File

@ -331,8 +331,6 @@ public class BuyRegion extends GeneralRegion {
plugin.message(player, "buy-successSeller", getName(), getPlayerName(), resellPrice);
}
AreaShop.debug(player.getName() + " has bought region " + getName() + " for " + getFormattedPrice() + " from " + oldOwnerPlayer.getName());
this.saveRequired();
// Run commands
this.runEventCommands(RegionEvent.RESELL, false);
} else {
@ -366,7 +364,6 @@ public class BuyRegion extends GeneralRegion {
// Send message to the player
plugin.message(player, "buy-succes", getName());
this.saveRequired();
// Run commands
this.runEventCommands(RegionEvent.BOUGHT, false);
}
@ -434,8 +431,6 @@ public class BuyRegion extends GeneralRegion {
setBuyer(null);
updateSigns();
this.saveRequired();
// Run commands
this.runEventCommands(RegionEvent.SOLD, false);
}

View File

@ -810,11 +810,9 @@ public abstract class GeneralRegion implements GeneralRegionInterface {
org.bukkit.material.Sign signData = (org.bukkit.material.Sign)signState.getData();
if(!config.isString("general.signs." + sign + ".signType")) {
setSetting("general.signs." + sign + ".signType", signState.getType().toString());
this.saveRequired();
}
if(!config.isString("general.signs." + sign + ".facing")) {
setSetting("general.signs." + sign + ".facing", signData.getFacing().toString());
this.saveRequired();
}
// Apply replacements and color and then set it on the sign
for(int i=0; i<signLines.length; i++) {
@ -1168,7 +1166,6 @@ public abstract class GeneralRegion implements GeneralRegionInterface {
} else {
setSetting("general.teleportLocation", Utils.locationToConfig(location, true));
}
this.saveRequired();
}

View File

@ -563,8 +563,6 @@ public class RentRegion extends GeneralRegion {
plugin.message(player, "rent-rented", getName(), dateFull.format(calendar.getTime()));
plugin.message(player, "rent-extend");
}
this.saveRequired();
if(!extend) {
// Run commands
this.runEventCommands(RegionEvent.RENTED, false);
@ -629,8 +627,6 @@ public class RentRegion extends GeneralRegion {
setTimesExtended(-1);
updateSigns();
this.saveRequired();
// Run commands
this.runEventCommands(RegionEvent.UNRENTED, false);
}