added CoreProtect as a soft depend in preperation for next step of

self-cleaning rentals.

Set rental self-cleaning for admin-only claims to start with, must be
enabled for regular players.
This commit is contained in:
Famous_Longwing 2024-02-20 14:05:32 -05:00
parent ae476fdb28
commit 051eef009f
3 changed files with 74 additions and 63 deletions

View File

@ -3,7 +3,7 @@ main: me.EtienneDx.RealEstate.RealEstate
version: ${project.version} version: ${project.version}
authors: [EtienneDx, DmitryRendov, FamousLongwing] authors: [EtienneDx, DmitryRendov, FamousLongwing]
depend: [Vault, GriefPrevention] depend: [Vault, GriefPrevention]
softdepend: [WorldEdit] softdepend: [WorldEdit, CoreProtect]
api-version: "1.20" api-version: "1.20"
commands: commands:

View File

@ -103,6 +103,11 @@ public class Config extends AnnotationConfig
public String languageFile = "en.yml"; public String languageFile = "en.yml";
@ConfigField(name="RealEstate.Settings.UseWorldEdit", comment="This setting specifies whether we should restore rental areas to the state it was in before the are was rented") @ConfigField(name="RealEstate.Settings.UseWorldEdit", comment="This setting specifies whether we should restore rental areas to the state it was in before the are was rented")
public boolean RestoreRentalState=false; //this will destroy whatever was added during rental period to start with, will default to true once I save the items as rental period ends. public boolean RestoreRentalState=false; //this will destroy whatever was added during rental period to start with, will default to true once I save the items as rental period ends.
@ConfigField(name="RealEstate.Settings.RestoreAdminClaimsOnly",comment="This setting will let us know if the rental areas should only be restored via WorldEdit if it is an admin claim, if true we will restore only admin claims, false will restore all claims (provided it is enabled by the previous setting)")
public boolean RestoreAdminOnly=true;
public Config() public Config()
{ {
this.pdf = RealEstate.instance.getDescription(); this.pdf = RealEstate.instance.getDescription();

View File

@ -77,6 +77,8 @@ public class ClaimRent extends BoughtTransaction
this.duration = duration; this.duration = duration;
this.maxPeriod = RealEstate.instance.config.cfgEnableRentPeriod ? rentPeriods : 1; this.maxPeriod = RealEstate.instance.config.cfgEnableRentPeriod ? rentPeriods : 1;
this.buildTrust = buildTrust; this.buildTrust = buildTrust;
if((claim.isAdminClaim()&&RealEstate.instance.config.RestoreAdminOnly)|| !RealEstate.instance.config.RestoreAdminOnly) //if we are in an admin claim *and* admin only is selected, or if admin only is false
{
//if worldedit saving is requested, here's where i think... to do it.. //if worldedit saving is requested, here's where i think... to do it..
if(RealEstate.instance.getServer().getPluginManager().getPlugin("WorldEdit")!=null) //is world edit installed? if(RealEstate.instance.getServer().getPluginManager().getPlugin("WorldEdit")!=null) //is world edit installed?
{ {
@ -113,6 +115,7 @@ public class ClaimRent extends BoughtTransaction
} }
} }
}
@Override @Override
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
@ -233,7 +236,9 @@ public class ClaimRent extends BoughtTransaction
} }
buyer = null; buyer = null;
RealEstate.transactionsStore.saveData(); RealEstate.transactionsStore.saveData();
//if worldedit saving is requested, here's where i think... to do it.. //if worldedit saving is requested, here's where i load the saved area
if((claim.isAdminClaim()&&RealEstate.instance.config.RestoreAdminOnly)|| !RealEstate.instance.config.RestoreAdminOnly) //if we are in an admin claim *and* admin only is selected, or if admin only is false
{
if(RealEstate.instance.getServer().getPluginManager().getPlugin("WorldEdit")!=null) //is world edit installed? if(RealEstate.instance.getServer().getPluginManager().getPlugin("WorldEdit")!=null) //is world edit installed?
{ {
if(RealEstate.instance.config.RestoreRentalState)//are we configured to use it? if(RealEstate.instance.config.RestoreRentalState)//are we configured to use it?
@ -272,6 +277,7 @@ public class ClaimRent extends BoughtTransaction
} }
} }
} }
}
update(); update();
} }