mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2025-02-18 02:11:23 +01:00
Fix player-deny-flight not resetting on teleport.
This commit is contained in:
parent
ffcc534e35
commit
720c37b5dd
@ -932,6 +932,8 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
return;
|
||||
}
|
||||
GDCauseStackManager.getInstance().pushCause(player);
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||
playerData.optionNoFly = null; // Reset no fly option on teleports as from/to claim would be the same
|
||||
if (!GDFlags.ENTITY_TELEPORT_FROM && !GDFlags.ENTITY_TELEPORT_TO) {
|
||||
return;
|
||||
}
|
||||
@ -954,7 +956,6 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
if (type == TeleportCause.UNKNOWN && !sourceLocation.getWorld().getUID().equals(destination.getWorld().getUID())) {
|
||||
source = destination.getWorld().getEnvironment().name().toLowerCase().replace("the_", "") + "_portal";
|
||||
}
|
||||
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||
final GDClaim sourceClaim = this.dataStore.getClaimAtPlayer(playerData, player.getLocation());
|
||||
if (playerData.inPvpCombat() && GDOptions.isOptionEnabled(Options.PVP_COMBAT_TELEPORT)) {
|
||||
// Cancel event if player is unable to teleport during PvP combat
|
||||
|
@ -708,13 +708,17 @@ public void onEntityTeleport(MoveEntityEvent.Teleport event) {
|
||||
|
||||
GDTimings.ENTITY_TELEPORT_EVENT.startTimingIfSync();
|
||||
Player player = null;
|
||||
GDClaim sourceClaim = null;
|
||||
GDPlayerData playerData = null;
|
||||
GDPermissionUser user = null;
|
||||
if (entity instanceof Player) {
|
||||
player = (Player) entity;
|
||||
user = PermissionHolderCache.getInstance().getOrCreateUser(player);
|
||||
final GDPlayerData playerData = user.getInternalPlayerData();
|
||||
playerData = user.getInternalPlayerData();
|
||||
playerData.optionNoFly = null; // Reset no fly option on teleports as from/to claim would be the same
|
||||
sourceClaim = this.dataStore.getClaimAtPlayer(playerData, player.getLocation());
|
||||
// Cancel event if player is unable to teleport during PvP combat
|
||||
final boolean pvpCombatTeleport = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), player, Options.PVP_COMBAT_TELEPORT);
|
||||
final boolean pvpCombatTeleport = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), player, Options.PVP_COMBAT_TELEPORT, sourceClaim);
|
||||
if (!pvpCombatTeleport && GDOptions.isOptionEnabled(Options.PVP_COMBAT_TELEPORT)) {
|
||||
final int combatTimeRemaining = playerData.getPvpCombatTimeRemaining();
|
||||
if (combatTimeRemaining > 0) {
|
||||
@ -731,6 +735,7 @@ public void onEntityTeleport(MoveEntityEvent.Teleport event) {
|
||||
user = PermissionHolderCache.getInstance().getOrCreateUser(entity.getCreator().orElse(null));
|
||||
if (user != null && user.getOnlinePlayer() != null) {
|
||||
player = user.getOnlinePlayer();
|
||||
playerData = user.getInternalPlayerData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -752,12 +757,7 @@ public void onEntityTeleport(MoveEntityEvent.Teleport event) {
|
||||
return;
|
||||
}
|
||||
|
||||
GDClaim sourceClaim = null;
|
||||
GDPlayerData playerData = null;
|
||||
if (player != null) {
|
||||
playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
|
||||
sourceClaim = this.dataStore.getClaimAtPlayer(playerData, player.getLocation());
|
||||
} else {
|
||||
if (sourceClaim == null) {
|
||||
sourceClaim = this.dataStore.getClaimAt(sourceLocation);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user