Remove travel agent and related config option

- Removed Claims.PortalGenerationRequiresPermission

Closes #534
This commit is contained in:
RoboMWM 2019-06-09 10:33:38 -07:00
parent 7d086f2956
commit 59d9e6f556
6 changed files with 4 additions and 46 deletions

View File

@ -56,7 +56,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13.1-R0.1-SNAPSHOT</version>
<version>1.14.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Worldguard dependency-->

View File

@ -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);

View File

@ -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);

View File

@ -200,7 +200,6 @@ public enum Messages
ClaimCreationFailedOverClaimCountLimit,
CreateClaimFailOverlapRegion,
ResizeFailOverlapRegion,
NoBuildPortalPermission,
ShowNearbyClaims,
NoChatUntilMove,
SiegeImmune,

View File

@ -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());
}
}
}
}
}

View File

@ -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.