Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ghost_chu committed 2021-07-14 22:35:55 +08:00
commit b259690c08
6 files changed
+57 -73

No files matched your search

@@ -1864,6 +1864,10 @@ public class QuickShop extends JavaPlugin {
getConfig().set("integration.griefprevention.delete-on-claim-expired", false);
getConfig().set("config-version", ++selectedVersion);
}
if (selectedVersion == 134) {
getConfig().set("integration.griefprevention.delete-on-claim-resized", false);
getConfig().set("config-version", ++selectedVersion);
}
if (getConfig().getInt("matcher.work-type") != 0 && GameVersion.get(ReflectFactory.getServerVersion()).name().contains("1_16")) {
@@ -23,6 +23,7 @@ import me.ryanhamshire.GriefPrevention.Claim;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import me.ryanhamshire.GriefPrevention.events.ClaimDeletedEvent;
import me.ryanhamshire.GriefPrevention.events.ClaimExpirationEvent;
import me.ryanhamshire.GriefPrevention.events.ClaimModifiedEvent;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -36,7 +37,6 @@ import org.maxgamer.quickshop.integration.IntegrateStage;
import org.maxgamer.quickshop.integration.IntegrationStage;
import org.maxgamer.quickshop.integration.QSIntegratedPlugin;
import org.maxgamer.quickshop.shop.Shop;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -48,16 +48,18 @@ public class GriefPreventionIntegration extends QSIntegratedPlugin {
private final List<Flag> tradeLimits = new ArrayList<>(3);
private final boolean whiteList;
private final boolean deleteOnUntrusted;
private final boolean deleteOnUnClaim;
private final boolean deleteOnUnclaim;
private final boolean deleteOnClaimExpired;
private final boolean deleteOnClaimResized;
public GriefPreventionIntegration(QuickShop plugin) {
super(plugin);
ConfigurationSection configurationSection = plugin.getConfig();
this.whiteList = configurationSection.getBoolean("integration.griefprevention.whitelist-mode");
deleteOnUntrusted = configurationSection.getBoolean("integration.griefprevention.delete-on-untrusted");
deleteOnUnClaim = configurationSection.getBoolean("integration.griefprevention.delete-on-unclaim");
deleteOnUnclaim = configurationSection.getBoolean("integration.griefprevention.delete-on-unclaim");
deleteOnClaimExpired = configurationSection.getBoolean("integration.griefprevention.delete-on-claim-expired");
deleteOnClaimResized = configurationSection.getBoolean("integration.griefprevention.delete-on-claim-resized");
createLimits.addAll(toFlags(configurationSection.getStringList("integration.griefprevention.create")));
tradeLimits.addAll(toFlags(configurationSection.getStringList("integration.griefprevention.trade")));
}
@@ -105,39 +107,32 @@ public class GriefPreventionIntegration extends QSIntegratedPlugin {
return true;
}
@EventHandler(ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUntrusted(me.ryanhamshire.GriefPrevention.events.TrustChangedEvent event) {
if (!deleteOnUntrusted) {
return;
}
if (event.isGiven()) {
return;
}
for (Claim claim : event.getClaims()) {
for (Chunk chunk : claim.getChunks()) {
Map<Location, Shop> shops = plugin.getShopManager().getShops(chunk);
if (shops != null) {
for (Shop shop : shops.values()) {
if (shop.getOwner().equals(claim.getOwnerID())) {
return;
}
//https://github.com/TechFortress/GriefPrevention/blob/e63d1d9e513f48aa0aaa81f154de01626248b7fe/src/main/java/me/ryanhamshire/GriefPrevention/events/TrustChangedEvent.java#L104
if (event.getIdentifier().equals(shop.getOwner().toString())) { //Single
plugin.log("[SHOP DELETE] GP Integration: Single delete #" + event.getIdentifier());
shop.delete();
return;
}
if (!shop.getOwner().equals(claim.getOwnerID())) {
if (event.getIdentifier().contains(shop.getOwner().toString())) { //Group
plugin.log("[SHOP DELETE] GP Integration: Group delete #" + event.getIdentifier());
shop.delete();
return;
}
if ("all".equals(event.getIdentifier()) || "public".equals(event.getIdentifier())) { //All
plugin.log("[SHOP DELETE] GP Integration: All/Public delete #" + event.getIdentifier());
shop.delete();
return;
Claim shopClaim = griefPrevention.dataStore.getClaimAt(shop.getLocation(), true, false, null);
if(shopClaim != null && shopClaim.getID() == claim.getID()) {
if(event.getIdentifier().equals(shop.getOwner().toString())) {
plugin.log("[SHOP DELETE] GP Integration: Single delete #" + event.getIdentifier());
shop.delete();
} else if(event.getIdentifier().contains(shop.getOwner().toString())) {
plugin.log("[SHOP DELETE] GP Integration: Group delete #" + event.getIdentifier());
shop.delete();
} else if("all".equals(event.getIdentifier()) || "public".equals(event.getIdentifier())) {
plugin.log("[SHOP DELETE] GP Integration: All/Public delete #" + event.getIdentifier());
shop.delete();
}
}
}
}
}
@@ -146,45 +141,46 @@ public class GriefPreventionIntegration extends QSIntegratedPlugin {
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUnclaimed(ClaimDeletedEvent event) {
if (!deleteOnUnClaim) {
public void onClaimUnclaimed(ClaimDeletedEvent event) {
onUnclaimOrExpiredHelper(event.getClaim(), deleteOnUnclaim);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onClaimExpired(ClaimExpirationEvent event) {
onUnclaimOrExpiredHelper(event.getClaim(), deleteOnClaimExpired);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onClaimResized(ClaimModifiedEvent event) {
if (!deleteOnClaimResized) {
return;
}
Claim claim = event.getClaim();
if (event.getClaim().getOwnerID() == null) {
return;
}
for (Chunk chunk : claim.getChunks()) {
Claim oldClaim = event.getFrom();
Claim newClaim = event.getTo();
for (Chunk chunk : oldClaim.getChunks()) {
Map<Location, Shop> shops = plugin.getShopManager().getShops(chunk);
if (shops != null && !shops.isEmpty()) {
if (shops != null) {
for (Shop shop : shops.values()) {
if (griefPrevention.dataStore.getClaimAt(shop.getLocation(), true, true, null) == null) {
if (event.getClaim().getOwnerID().equals(shop.getOwner())) {
shop.delete();
}
if (oldClaim.contains(shop.getLocation(), true, false) && !newClaim.contains(shop.getLocation(), true, false)) {
plugin.log("[SHOP DELETE] GP Integration: Single delete (Resized) #" + shop.getOwner());
shop.delete();
}
}
}
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onUnclaimed(ClaimExpirationEvent event) {
if (!deleteOnClaimExpired) {
private void onUnclaimOrExpiredHelper(Claim claim, boolean configSectionBoolean) {
if (!configSectionBoolean) {
return;
}
if (event.getClaim().getOwnerID() == null) {
return;
}
Claim claim = event.getClaim();
for (Chunk chunk : claim.getChunks()) {
Map<Location, Shop> shops = plugin.getShopManager().getShops(chunk);
if (shops != null && !shops.isEmpty()) {
if (shops != null) {
for (Shop shop : shops.values()) {
if (griefPrevention.dataStore.getClaimAt(shop.getLocation(), true, true, null) == null) {
if (event.getClaim().getOwnerID().equals(shop.getOwner())) {
shop.delete();
}
if (claim.contains(shop.getLocation(), true, false)) {
plugin.log("[SHOP DELETE] GP Integration: Single delete (Unclaimed/Expired) #" + shop.getOwner());
shop.delete();
}
}
}
+4 -2
View File
@@ -22,7 +22,7 @@
# TO EDIT QUICKSHOP'S CONFIGURATION, USE THE "config.yml" FILE!
#Do not touch this if you don't know what you're doing!
config-version: 134
config-version: 135
#Select the language you want to use, (e.g de), use only supported language codes from the list below.
#If you use a not existant/not supported language, then QuickShop will use en_US.
@@ -694,9 +694,11 @@ integration:
#Should QuickShop delete shops if the shop owner has been untrusted on the claim?
delete-on-untrusted: true
#Should QuickShop delete shops if claim has been deleted?
delete-on-unclaim: false
delete-on-unclaim: true
#Should QuickShop delete shops if claim has been expired?
delete-on-claim-expired: true
#Should QuickShop delete shops if claim has been resized (claim has become smaller and the shop is now outside claim)?
delete-on-claim-resized: true
#Residence Integration
residence:
enable: false
+1 -1
View File
@@ -1,5 +1,5 @@
{
"_comment": "Hi translator! If you editing this from Github or from code sources, you should go https://crowdin.com/project/quickshop-reremake",
"_comment": "Hej oversætter! Hvis du redigerer dette fra Github eller fra kodekilder, bør du gå https://crowdin.com/project/quickshop-reremake",
"file-test": "This is a test textfile. We use it to test if the messages.json is broken. You can fill it with any easter eggs you like here :)",
"translation-author": "Oversættere: Ghost_chu, Andre_601, notashelf",
"translation-version": "Supportversion: Reremake",