}
this.stateFailure(player.getDisplayName(), d.getName());
}
boolean scriptPortal(Player player, MVDestination d, MVPortal portal, PortalPlayerSession ps) {
Buscript buscript = plugin.getCore().getScriptAPI();
File handlerScript = new File(buscript.getScriptFolder(), portal.getHandlerScript());
if (handlerScript.exists()) {
TravelAgent agent = new MVTravelAgent(this.plugin.getCore(), d, player);
buscript.getGlobalScope().put("portal", buscript.getGlobalScope(), portal);
buscript.getGlobalScope().put("player", buscript.getGlobalScope(), player);
buscript.getGlobalScope().put("travelAgent", buscript.getGlobalScope(), agent);
buscript.getGlobalScope().put("allowPortal", buscript.getGlobalScope(), true);
buscript.getGlobalScope().put("portalSession", buscript.getGlobalScope(), ps);
buscript.executeScript(handlerScript, player.getName());
buscript.getGlobalScope().put("portal", buscript.getGlobalScope(), null);
buscript.getGlobalScope().put("player", buscript.getGlobalScope(), null);
buscript.getGlobalScope().put("travelAgent", buscript.getGlobalScope(), null);
buscript.getGlobalScope().put("portalSession", buscript.getGlobalScope(), null);
Object allowObject = buscript.getGlobalScope().get("allowPortal", buscript.getGlobalScope());
buscript.getGlobalScope().put("allowPortal", buscript.getGlobalScope(), null);
if (allowObject instanceof Boolean) {
if (((Boolean) allowObject)) {
MVPortalEvent portalEvent = new MVPortalEvent(d, player, agent, portal);
this.plugin.getServer().getPluginManager().callEvent(portalEvent);
if (!portalEvent.isCancelled()) {