geforkt von Mirrors/FastAsyncWorldEdit
Added shims for old EditSession constructors.
Dieser Commit ist enthalten in:
Ursprung
fb4eb61763
Commit
144302a487
@ -121,6 +121,23 @@ public class EditSession implements Extent {
|
||||
@SuppressWarnings("deprecation")
|
||||
private Mask oldMask;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link WorldEdit#getEditSessionFactory()} to create {@link EditSession}s
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public EditSession(LocalWorld world, int maxBlocks) {
|
||||
this(world, maxBlocks, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link WorldEdit#getEditSessionFactory()} to create {@link EditSession}s
|
||||
*/
|
||||
@Deprecated
|
||||
public EditSession(LocalWorld world, int maxBlocks, @Nullable BlockBag blockBag) {
|
||||
this(WorldEdit.getInstance().getEventBus(), world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct the object with a maximum number of blocks and a block bag.
|
||||
*
|
||||
@ -130,7 +147,7 @@ public class EditSession implements Extent {
|
||||
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
||||
* @param event the event to call with the extent
|
||||
*/
|
||||
public EditSession(EventBus eventBus, LocalWorld world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) {
|
||||
EditSession(EventBus eventBus, LocalWorld world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) {
|
||||
checkNotNull(eventBus);
|
||||
checkNotNull(world);
|
||||
checkArgument(maxBlocks >= -1, "maxBlocks >= -1 required");
|
||||
|
@ -21,11 +21,18 @@ package com.sk89q.worldedit;
|
||||
|
||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* @deprecated To wrap {@link EditSession}s, please hook into {@link EditSessionEvent}
|
||||
* Creates new {@link EditSession}s. To get an instance of this factory,
|
||||
* use {@link WorldEdit#getEditSessionFactory()}.
|
||||
* </p>
|
||||
* It is no longer possible to replace the instance of this in WorldEdit
|
||||
* with a custom one. Use {@link EditSessionEvent} to override
|
||||
* the creation of {@link EditSession}s.
|
||||
*/
|
||||
@Deprecated
|
||||
public class EditSessionFactory {
|
||||
|
||||
/**
|
||||
@ -72,4 +79,42 @@ public class EditSessionFactory {
|
||||
throw new IllegalArgumentException("This class is being removed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal factory for {@link EditSession}s.
|
||||
*/
|
||||
static final class EditSessionFactoryImpl extends EditSessionFactory {
|
||||
|
||||
private final EventBus eventBus;
|
||||
|
||||
/**
|
||||
* Create a new factory.
|
||||
*
|
||||
* @param eventBus the event bus
|
||||
*/
|
||||
public EditSessionFactoryImpl(EventBus eventBus) {
|
||||
checkNotNull(eventBus);
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks) {
|
||||
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, null, maxBlocks, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, LocalPlayer player) {
|
||||
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, player, maxBlocks, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag) {
|
||||
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
||||
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ import com.sk89q.worldedit.extension.registry.PatternRegistry;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
import com.sk89q.worldedit.function.pattern.Patterns;
|
||||
import com.sk89q.worldedit.internal.InternalEditSessionFactory;
|
||||
import com.sk89q.worldedit.masks.Mask;
|
||||
import com.sk89q.worldedit.patterns.Pattern;
|
||||
import com.sk89q.worldedit.regions.RegionSelector;
|
||||
@ -74,7 +73,7 @@ public class WorldEdit {
|
||||
private final LocalConfiguration config;
|
||||
private final CommandsManager<LocalPlayer> commands;
|
||||
private final EventBus eventBus = new EventBus();
|
||||
private final EditSessionFactory editSessionFactory = new InternalEditSessionFactory(eventBus);
|
||||
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
|
||||
private final SessionManager sessions = new SessionManager(this);
|
||||
|
||||
private final BlockRegistry blockRegistry = new BlockRegistry(this);
|
||||
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.internal;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.EditSessionFactory;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Internal factory for {@link EditSession}s.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public final class InternalEditSessionFactory extends EditSessionFactory {
|
||||
|
||||
private final EventBus eventBus;
|
||||
|
||||
/**
|
||||
* Create a new factory.
|
||||
*
|
||||
* @param eventBus the event bus
|
||||
*/
|
||||
public InternalEditSessionFactory(EventBus eventBus) {
|
||||
checkNotNull(eventBus);
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks) {
|
||||
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, null, maxBlocks, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, LocalPlayer player) {
|
||||
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, player, maxBlocks, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag) {
|
||||
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
||||
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null));
|
||||
}
|
||||
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren