From 59d9e6f55653f9340bad0fe94df6ded8ee6ebc64 Mon Sep 17 00:00:00 2001 From: RoboMWM Date: Sun, 9 Jun 2019 10:33:38 -0700 Subject: [PATCH] Remove travel agent and related config option - Removed Claims.PortalGenerationRequiresPermission Closes #534 --- pom.xml | 2 +- .../GriefPrevention/DataStore.java | 1 - .../GriefPrevention/GriefPrevention.java | 3 -- .../GriefPrevention/Messages.java | 1 - .../GriefPrevention/PlayerEventHandler.java | 37 ------------------- src/main/resources/plugin.yml | 6 +-- 6 files changed, 4 insertions(+), 46 deletions(-) diff --git a/pom.xml b/pom.xml index 38d4748..01e07b6 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ org.bukkit bukkit - 1.13.1-R0.1-SNAPSHOT + 1.14.2-R0.1-SNAPSHOT provided diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java b/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java index 5b862a0..24e25c2 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java @@ -1623,7 +1623,6 @@ public abstract class DataStore this.addDefault(defaults, Messages.ClaimCreationFailedOverClaimCountLimit, "You've reached your limit on land claims. Use /AbandonClaim to remove one before creating another.", null); this.addDefault(defaults, Messages.CreateClaimFailOverlapRegion, "You can't claim all of this because you're not allowed to build here.", null); this.addDefault(defaults, Messages.ResizeFailOverlapRegion, "You don't have permission to build there, so you can't claim that area.", null); - this.addDefault(defaults, Messages.NoBuildPortalPermission, "You can't use this portal because you don't have {0}'s permission to build an exit portal in the destination land claim.", "0: Destination land claim owner's name."); this.addDefault(defaults, Messages.ShowNearbyClaims, "Found {0} land claims.", "0: Number of claims found."); this.addDefault(defaults, Messages.NoChatUntilMove, "Sorry, but you have to move a little more before you can chat. We get lots of spam bots here. :)", null); this.addDefault(defaults, Messages.SiegeImmune, "That player is immune to /siege.", null); diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java index 664f5fb..9b34425 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -103,7 +103,6 @@ public class GriefPrevention extends JavaPlugin public boolean config_claims_enderPearlsRequireAccessTrust; //whether teleporting into a claim with a pearl requires access trust public int config_claims_maxClaimsPerPlayer; //maximum number of claims per player public boolean config_claims_respectWorldGuard; //whether claim creations requires WG build permission in creation area - public boolean config_claims_portalsRequirePermission; //whether nether portals require permission to generate. defaults to off for performance reasons public boolean config_claims_villagerTradingRequiresTrust; //whether trading with a claimed villager requires permission public int config_claims_initialBlocks; //the number of claim blocks a new player starts with @@ -580,7 +579,6 @@ public class GriefPrevention extends JavaPlugin this.config_claims_maxClaimsPerPlayer = config.getInt("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", 0); this.config_claims_respectWorldGuard = config.getBoolean("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", true); - this.config_claims_portalsRequirePermission = config.getBoolean("GriefPrevention.Claims.PortalGenerationRequiresPermission", false); this.config_claims_villagerTradingRequiresTrust = config.getBoolean("GriefPrevention.Claims.VillagerTradingRequiresPermission", true); String accessTrustSlashCommands = config.getString("GriefPrevention.Claims.CommandsRequiringAccessTrust", "/sethome"); this.config_claims_supplyPlayerManual = config.getBoolean("GriefPrevention.Claims.DeliverManuals", true); @@ -832,7 +830,6 @@ public class GriefPrevention extends JavaPlugin outConfig.set("GriefPrevention.Claims.AllowTrappedInAdminClaims", this.config_claims_allowTrappedInAdminClaims); outConfig.set("GriefPrevention.Claims.MaximumNumberOfClaimsPerPlayer", this.config_claims_maxClaimsPerPlayer); outConfig.set("GriefPrevention.Claims.CreationRequiresWorldGuardBuildPermission", this.config_claims_respectWorldGuard); - outConfig.set("GriefPrevention.Claims.PortalGenerationRequiresPermission", this.config_claims_portalsRequirePermission); outConfig.set("GriefPrevention.Claims.VillagerTradingRequiresPermission", this.config_claims_villagerTradingRequiresTrust); outConfig.set("GriefPrevention.Claims.CommandsRequiringAccessTrust", accessTrustSlashCommands); outConfig.set("GriefPrevention.Claims.DeliverManuals", config_claims_supplyPlayerManual); diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/Messages.java b/src/main/java/me/ryanhamshire/GriefPrevention/Messages.java index 111ce68..df2446f 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/Messages.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/Messages.java @@ -200,7 +200,6 @@ public enum Messages ClaimCreationFailedOverClaimCountLimit, CreateClaimFailOverlapRegion, ResizeFailOverlapRegion, - NoBuildPortalPermission, ShowNearbyClaims, NoChatUntilMove, SiegeImmune, diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java b/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java index 96fb367..b90f585 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/PlayerEventHandler.java @@ -27,7 +27,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.Tag; -import org.bukkit.TravelAgent; import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.block.Block; @@ -1059,42 +1058,6 @@ class PlayerEventHandler implements Listener //don't track in worlds where claims are not enabled if(!instance.claimsEnabledForWorld(event.getTo().getWorld())) return; - - //FEATURE: if the player teleporting doesn't have permission to build a nether portal and none already exists at the destination, cancel the teleportation - if(instance.config_claims_portalsRequirePermission) - { - Location destination = event.getTo(); - if(event.useTravelAgent()) - { - if(event.getPortalTravelAgent().getCanCreatePortal()) - { - //hypothetically find where the portal would be created if it were - //this is VERY expensive for the cpu, so this feature is off by default - TravelAgent agent = event.getPortalTravelAgent(); - agent.setCanCreatePortal(false); - destination = agent.findOrCreate(destination); - agent.setCanCreatePortal(true); - } - else - { - //if not able to create a portal, we don't have to do anything here - return; - } - } - - //if creating a new portal - if(destination.getBlock().getType() != Material.NETHER_PORTAL) - { - //check for a land claim and the player's permission that land claim - Claim claim = this.dataStore.getClaimAt(destination, false, null); - if(claim != null && claim.allowBuild(player, Material.NETHER_PORTAL) != null) - { - //cancel and inform about the reason - event.setCancelled(true); - instance.sendMessage(player, TextMode.Err, Messages.NoBuildPortalPermission, claim.getOwnerName()); - } - } - } } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d907c96..0f95ad2 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,10 +1,10 @@ name: GriefPrevention main: me.ryanhamshire.GriefPrevention.GriefPrevention -softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter, TheUnderground, WorldGuard, WorldEdit, RoyalCommands, MultiWorld, Denizen, Hyperconomy] -dev-url: http://dev.bukkit.org/server-mods/grief-prevention +softdepend: [Vault, Multiverse-Core, My_Worlds, MystCraft, Transporter, TheUnderground, WorldGuard, WorldEdit, RoyalCommands, MultiWorld, Denizen, Hyperconomy] +dev-url: https://dev.bukkit.org/projects/grief-prevention loadbefore: [TheUnderground] version: '${project.version}' -api-version: 1.13 +api-version: '1.14' commands: abandonclaim: description: Deletes a claim.