mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-30 20:37:52 +01:00
Make sure to restrict the "inventory" screen closing to interworld
teleports.
This commit is contained in:
parent
2f5a726494
commit
675a6a85d8
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cc.co.evenprime.bukkit</groupId>
|
||||
<artifactId>NoCheat</artifactId>
|
||||
<version>2.20a</version>
|
||||
<version>2.20b</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>NoCheat</name>
|
||||
<properties>
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cc.co.evenprime.bukkit.nocheat.events;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
@ -32,17 +33,17 @@ public class WorkaroundsEventManager extends EventManagerImpl {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerTeleportEvent(final PlayerTeleportEvent event, final Priority priority) {
|
||||
handleTeleportation(event.getPlayer());
|
||||
handleTeleportation(event.getPlayer(), event.getTo());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerPortalEvent(final PlayerPortalEvent event, final Priority priority) {
|
||||
handleTeleportation(event.getPlayer());
|
||||
handleTeleportation(event.getPlayer(), event.getTo());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerRespawnEvent(final PlayerRespawnEvent event, final Priority priority) {
|
||||
handleTeleportation(event.getPlayer());
|
||||
handleTeleportation(event.getPlayer(), event.getRespawnLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -51,10 +52,10 @@ public class WorkaroundsEventManager extends EventManagerImpl {
|
||||
if(!event.isCancelled())
|
||||
return;
|
||||
|
||||
handleTeleportation(event.getPlayer());
|
||||
handleTeleportation(event.getPlayer(), event.getTo());
|
||||
|
||||
// Fix a common mistake that other developers make (cancelling move
|
||||
// events is crazy, rather set the target location to the from location
|
||||
// events is crazy, rather set the target location to the from location)
|
||||
if(plugin.getPlayer(event.getPlayer()).getConfiguration().debug.overrideIdiocy) {
|
||||
event.setCancelled(false);
|
||||
event.setTo(event.getFrom().clone());
|
||||
@ -69,8 +70,8 @@ public class WorkaroundsEventManager extends EventManagerImpl {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleTeleportation(final Player player) {
|
||||
if(plugin.getPlayer(player).getConfiguration().inventory.closebeforeteleports && player instanceof CraftPlayer) {
|
||||
private void handleTeleportation(final Player player, final Location to) {
|
||||
if(plugin.getPlayer(player).getConfiguration().inventory.closebeforeteleports && player instanceof CraftPlayer && to != null && !(to.getWorld().equals(player.getWorld()))) {
|
||||
((CraftPlayer) player).getHandle().closeInventory();
|
||||
}
|
||||
plugin.clearCriticalData(player.getName());
|
||||
|
Loading…
Reference in New Issue
Block a user