Skip to content

Commit 1be30e4

Browse files
committed
Only enable teleport protection on plugin/command caused teleport events.
1 parent 28ec7c2 commit 1be30e4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public void onPlayerTeleport(final PlayerTeleportEvent event)
405405
{
406406
user.setLastLocation();
407407
}
408-
if (teleportInvulnerability)
408+
if (teleportInvulnerability && (event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND))
409409
{
410410
user.enableInvulnerabilityAfterTeleport();
411411
}

Essentials/src/com/earth2me/essentials/Teleport.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws
110110
{
111111
teleportee.getBase().leaveVehicle();
112112
}
113-
teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, loc));
113+
teleportee.getBase().teleport(LocationUtil.getSafeDestination(teleportee, loc), cause);
114114
}
115115
else
116116
{
@@ -123,7 +123,7 @@ protected void now(IUser teleportee, ITarget target, TeleportCause cause) throws
123123
{
124124
teleportee.getBase().leaveVehicle();
125125
}
126-
teleportee.getBase().teleport(LocationUtil.getRoundedDestination(loc));
126+
teleportee.getBase().teleport(LocationUtil.getRoundedDestination(loc), cause);
127127
}
128128
}
129129

0 commit comments

Comments
 (0)