From 0e6d7bf11f3e5bcac89421f14c3b8afa9ad2dc7e Mon Sep 17 00:00:00 2001 From: ryanhamshire Date: Thu, 16 Jun 2016 11:11:47 -0700 Subject: [PATCH] Fixed /trapped overriding in the nether. Now other plugins can override the destination even in nether worlds. --- src/me/ryanhamshire/GriefPrevention/DataStore.java | 2 +- .../GriefPrevention/GriefPrevention.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/me/ryanhamshire/GriefPrevention/DataStore.java b/src/me/ryanhamshire/GriefPrevention/DataStore.java index 383c617..cb35497 100644 --- a/src/me/ryanhamshire/GriefPrevention/DataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DataStore.java @@ -1534,7 +1534,7 @@ public abstract class DataStore this.addDefault(defaults, Messages.NoBuildOutsideClaims, "You can't build here unless you claim some land first.", null); this.addDefault(defaults, Messages.PlayerOfflineTime, " Last login: {0} days ago.", "0: number of full days since last login"); this.addDefault(defaults, Messages.BuildingOutsideClaims, "Other players can build here, too. Consider creating a land claim to protect your work!", null); - this.addDefault(defaults, Messages.TrappedWontWorkHere, "Sorry, unable to find a safe location to teleport you to. Contact an admin, or consider /kill if you don't want to wait.", null); + this.addDefault(defaults, Messages.TrappedWontWorkHere, "Sorry, unable to find a safe location to teleport you to. Contact an admin.", null); this.addDefault(defaults, Messages.CommandBannedInPvP, "You can't use that command while in PvP combat.", null); this.addDefault(defaults, Messages.UnclaimCleanupWarning, "The land you've unclaimed may be changed by other players or cleaned up by administrators. If you've built something there you want to keep, you should reclaim it.", null); this.addDefault(defaults, Messages.BuySellNotConfigured, "Sorry, buying anhd selling claim blocks is disabled.", null); diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index dcdcf1f..54d5436 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -2307,19 +2307,19 @@ public class GriefPrevention extends JavaPlugin return true; } + //rescue destination may be set by GPFlags or other plugin, ask to find out + SaveTrappedPlayerEvent event = new SaveTrappedPlayerEvent(claim); + Bukkit.getPluginManager().callEvent(event); + //if the player is in the nether or end, he's screwed (there's no way to programmatically find a safe place for him) - if(player.getWorld().getEnvironment() != Environment.NORMAL) + if(player.getWorld().getEnvironment() != Environment.NORMAL && event.getDestination() == null) { GriefPrevention.sendMessage(player, TextMode.Err, Messages.TrappedWontWorkHere); return true; } - //rescue destination may be set by GPFlags, ask to find out - SaveTrappedPlayerEvent event = new SaveTrappedPlayerEvent(claim); - Bukkit.getPluginManager().callEvent(event); - //if the player is in an administrative claim, he should contact an admin - if(claim.isAdminClaim() && event.getDestination() != null) + if(claim.isAdminClaim() && event.getDestination() == null) { GriefPrevention.sendMessage(player, TextMode.Err, Messages.TrappedWontWorkHere); return true;