mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-26 19:18:53 +01:00
Prevent NPE in portal code.
Fixes WORLDGUARD-3516
This commit is contained in:
parent
fc0be7db09
commit
c9eaec0ae8
@ -372,15 +372,15 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
|
||||
public void onPlayerPortal(PlayerPortalEvent event) {
|
||||
if (event.getTo() == null) { // apparently this counts as a cancelled event, implementation specific though
|
||||
return;
|
||||
}
|
||||
ConfigurationManager cfg = plugin.getGlobalStateManager();
|
||||
WorldConfiguration wcfg = cfg.get(event.getTo().getWorld());
|
||||
if (!wcfg.regionNetherPortalProtection) return;
|
||||
if (event.getCause() != TeleportCause.NETHER_PORTAL) {
|
||||
return;
|
||||
}
|
||||
if (event.getTo() == null) { // apparently this counts as a cancelled event, implementation specific though
|
||||
return;
|
||||
}
|
||||
if (!event.useTravelAgent()) { // either end travel (even though we checked cause) or another plugin is fucking with us, shouldn't create a portal though
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user