com.sk89q.worldedit.event.extent.EditSessionEvent Java Examples
The following examples show how to use
com.sk89q.worldedit.event.extent.EditSessionEvent.
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: WorldEditHook.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
@Subscribe public void wrapForLogging(EditSessionEvent event) { event.setExtent(new AbstractDelegateExtent(event.getExtent()) { @Override public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 pos, T block) throws WorldEditException { if (block.getBlockType().getMaterial().isAir()) { World world = Bukkit.getWorld(event.getWorld().getName()); if (world != null) { Location l = new Location(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()); if (BlockStorage.hasBlockInfo(l)) { BlockStorage.clearBlockInfo(l); } } } return getExtent().setBlock(pos, block); } }); }
Example #2
Source File: WorldEditListener.java From WorldGuardExtraFlagsPlugin with MIT License | 5 votes |
@Subscribe(priority = EventHandler.Priority.VERY_EARLY) public void onEditSessionEvent(EditSessionEvent event) { Actor actor = event.getActor(); if (actor != null && actor.isPlayer()) { event.setExtent(this.plugin.getWorldGuardCommunicator().getWorldEditFlag(event.getWorld(), event.getExtent(), (Player)actor)); } }
Example #3
Source File: EditSession.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@Deprecated private AbstractDelegateExtent wrapExtent(final AbstractDelegateExtent extent, final EventBus eventBus, EditSessionEvent event, final Stage stage) { event = event.clone(stage); event.setExtent(extent); eventBus.post(event); if (event.isCancelled()) { return new NullExtent(extent, BBC.WORLDEDIT_CANCEL_REASON_MANUAL); } final Extent toReturn = event.getExtent(); if (!(toReturn instanceof AbstractDelegateExtent)) { Fawe.debug("Extent " + toReturn + " must be AbstractDelegateExtent"); return extent; } if (toReturn != extent) { String className = toReturn.getClass().getName().toLowerCase(); for (String allowed : Settings.IMP.EXTENT.ALLOWED_PLUGINS) { if (className.contains(allowed.toLowerCase())) { this.wrapped = true; return (AbstractDelegateExtent) toReturn; } } if (Settings.IMP.EXTENT.DEBUG) { Fawe.debug("&cPotentially unsafe extent blocked: " + toReturn.getClass().getName()); Fawe.debug("&8 - &7For area restrictions, it is recommended to use the FaweAPI"); Fawe.debug("&8 - &7For block logging, it is recommended to use use BlocksHub"); Fawe.debug("&8 - &7To allow this plugin add it to the FAWE `allowed-plugins` list"); Fawe.debug("&8 - &7To hide this message set `debug` to false in the FAWE config.yml"); if (toReturn.getClass().getName().contains("CoreProtect")) { Fawe.debug("Note on CoreProtect: "); Fawe.debug(" - If you disable CP's WE logger (CP config) and this still shows, please update CP"); Fawe.debug(" - Use BlocksHub and set `debug` false in the FAWE config"); } } } return extent; }
Example #4
Source File: PlotWorldEditListener.java From PlotMe-Core with GNU General Public License v3.0 | 5 votes |
@Subscribe(priority = EventHandler.Priority.VERY_EARLY) public void worldEditListener(EditSessionEvent event) { Actor actor = event.getActor(); if (event.getWorld() == null) { return; } World world1 = PlotMe_CorePlugin.getInstance().getServer().getWorld(event.getWorld().getName()); BukkitWorld adapt = BukkitUtil.adapt(world1); if (PlotMeCoreManager.getInstance().isPlotWorld(adapt)) { if (actor != null && actor.isPlayer()) { event.setExtent(new PlotMeWorldEdit(api, event.getExtent(), event.getActor())); } } }
Example #5
Source File: EditSession.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Deprecated public EditSession(@Nonnull World world, @Nullable FaweQueue queue, @Nullable FawePlayer player, @Nullable FaweLimit limit, @Nullable FaweChangeSet changeSet, @Nullable RegionWrapper[] allowedRegions, @Nullable Boolean autoQueue, @Nullable Boolean fastmode, @Nullable Boolean checkMemory, @Nullable Boolean combineStages, @Nullable BlockBag blockBag, @Nullable EventBus bus, @Nullable EditSessionEvent event) { this(null, world, queue, player, limit, changeSet, allowedRegions, autoQueue, fastmode, checkMemory, combineStages, blockBag, bus, event); }
Example #6
Source File: EditSession.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Deprecated public EditSession(@Nullable String worldName, @Nullable World world, @Nullable FaweQueue queue, @Nullable FawePlayer player, @Nullable FaweLimit limit, @Nullable FaweChangeSet changeSet, @Nullable RegionWrapper[] allowedRegions, @Nullable Boolean autoQueue, @Nullable Boolean fastmode, @Nullable Boolean checkMemory, @Nullable Boolean combineStages, @Nullable BlockBag blockBag, @Nullable EventBus bus, @Nullable EditSessionEvent event) { this(worldName, world, queue, player, limit, changeSet, (Region[]) allowedRegions, autoQueue, fastmode, checkMemory, combineStages, blockBag, bus, event); }
Example #7
Source File: EditSession.java From FastAsyncWorldedit with GNU General Public License v3.0 | 2 votes |
/** * Create a new instance. * * @param world a world * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit * @param blockBag the block bag to set, or null to use none * @deprecated use {@link WorldEdit#getEditSessionFactory()} to create {@link EditSession}s */ @Deprecated public EditSession(final LocalWorld world, final int maxBlocks, @Nullable final BlockBag blockBag) { this(WorldEdit.getInstance().getEventBus(), world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null)); }
Example #8
Source File: EditSession.java From FastAsyncWorldedit with GNU General Public License v3.0 | 2 votes |
/** * Construct the object with a maximum number of blocks and a block bag. * * @param eventBus the event bus * @param world the world * @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit * @param blockBag an optional {@link BlockBag} to use, otherwise null * @param event the event to call with the extent */ public EditSession(final EventBus eventBus, World world, final int maxBlocks, @Nullable final BlockBag blockBag, EditSessionEvent event) { this(world, null, null, null, null, null, true, null, null, null, blockBag, eventBus, event); }