org.bukkit.event.world.PortalCreateEvent Java Examples
The following examples show how to use
org.bukkit.event.world.PortalCreateEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExprPortal.java From Skript with GNU General Public License v3.0 | 5 votes |
@Override public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parser) { if (ScriptLoader.isCurrentEvent(PortalCreateEvent.class)) return true; Skript.error("The 'portal' expression may only be used in a portal creation event."); return false; }
Example #2
Source File: ExprPortal.java From Skript with GNU General Public License v3.0 | 5 votes |
@Nullable @Override protected Block[] get(Event e) { List<?> blocks = ((PortalCreateEvent) e).getBlocks(); if (USING_BLOCKSTATE) return blocks.stream() .map(block -> ((BlockState) block).getBlock()) .toArray(Block[]::new); return blocks.stream() .map(Block.class::cast) .toArray(Block[]::new); }
Example #3
Source File: ExprPortal.java From Skript with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public Iterator<Block> iterator(Event e) { List<?> blocks = ((PortalCreateEvent) e).getBlocks(); if (USING_BLOCKSTATE) return blocks.stream() .map(block -> ((BlockState) block).getBlock()) .iterator(); return (Iterator<Block>) blocks.iterator(); }
Example #4
Source File: EntityListener.java From WorldGuardExtraFlagsPlugin with MIT License | 5 votes |
@EventHandler(ignoreCancelled = true) public void onPortalCreateEvent(PortalCreateEvent event) { for(BlockState block : event.getBlocks()) { ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(block.getLocation()); if (regions.queryValue(null, Flags.NETHER_PORTALS) == State.DENY) { event.setCancelled(true); break; } } }
Example #5
Source File: EntityListener.java From WorldGuardExtraFlagsPlugin with MIT License | 5 votes |
@EventHandler(ignoreCancelled = true) public void onPortalCreateEvent(PortalCreateEvent event) { for(Block block : event.getBlocks()) { //Unable to get the player who created it.... ApplicableRegionSet regions = this.plugin.getWorldGuardCommunicator().getRegionContainer().createQuery().getApplicableRegions(block.getLocation()); if (regions.queryValue(null, Flags.NETHER_PORTALS) == State.DENY) { event.setCancelled(true); break; } } }
Example #6
Source File: PlayerListener.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPortalCreate(PortalCreateEvent e) { RedProtect.get().getVersionHelper().getPortalLocations(e).forEach(l -> { Region r = RedProtect.get().rm.getTopRegion(l); if (r != null && !r.canCreatePortal()) { e.setCancelled(true); } }); }
Example #7
Source File: EventFilterMatchModule.java From PGM with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPortalCreate(final PortalCreateEvent event) { cancelAlways(event, event.getWorld()); }
Example #8
Source File: EventFilterMatchModule.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPortalCreate(final PortalCreateEvent event) { cancelAlways(event, event.getWorld()); }
Example #9
Source File: VersionHelper18.java From RedProtect with GNU General Public License v3.0 | 4 votes |
public Set<Location> getPortalLocations(PortalCreateEvent e) { return e.getBlocks().stream().map(Block::getLocation).collect(Collectors.toSet()); }
Example #10
Source File: VersionHelper112.java From RedProtect with GNU General Public License v3.0 | 4 votes |
public Set<Location> getPortalLocations(PortalCreateEvent e) { return e.getBlocks().stream().map(Block::getLocation).collect(Collectors.toSet()); }
Example #11
Source File: VersionHelperLatest.java From RedProtect with GNU General Public License v3.0 | 4 votes |
public Set<Location> getPortalLocations(PortalCreateEvent e) { return e.getBlocks().stream().map(BlockState::getLocation).collect(Collectors.toSet()); }
Example #12
Source File: VersionHelper113.java From RedProtect with GNU General Public License v3.0 | 4 votes |
public Set<Location> getPortalLocations(PortalCreateEvent e) { return e.getBlocks().stream().map(Block::getLocation).collect(Collectors.toSet()); }
Example #13
Source File: PlayerListener.java From civcraft with GNU General Public License v2.0 | 4 votes |
@EventHandler(priority = EventPriority.HIGHEST) public void onPortalCreate(PortalCreateEvent event) { event.setCancelled(true); }
Example #14
Source File: VersionHelper.java From RedProtect with GNU General Public License v3.0 | votes |
Set<Location> getPortalLocations(PortalCreateEvent e);