geforkt von Mirrors/FastAsyncWorldEdit
Remove legacy ServerInterface
Dieser Commit ist enthalten in:
Ursprung
e2608bc0c9
Commit
5f5a1797ad
@ -79,7 +79,6 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public BukkitWorld(World world) {
|
public BukkitWorld(World world) {
|
||||||
this.worldRef = new WeakReference<>(world);
|
this.worldRef = new WeakReference<>(world);
|
||||||
}
|
}
|
||||||
|
@ -62,22 +62,6 @@ public class LazyBlock extends BaseBlock {
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new lazy block.
|
|
||||||
*
|
|
||||||
* @param type the block type
|
|
||||||
* @param extent the extent to later load the full block data from
|
|
||||||
* @param position the position to later load the full block data from
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public LazyBlock(int type, Extent extent, Vector position) {
|
|
||||||
super(type);
|
|
||||||
checkNotNull(extent);
|
|
||||||
checkNotNull(position);
|
|
||||||
this.extent = extent;
|
|
||||||
this.position = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new lazy block.
|
* Create a new lazy block.
|
||||||
*
|
*
|
||||||
|
@ -1,33 +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 Lesser 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 Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.extension.platform.AbstractPlatform;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A legacy abstract class that is to be replaced with {@link Platform}.
|
|
||||||
* Extend {@link AbstractPlatform} instead.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link Platform} wherever possible
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public abstract class ServerInterface extends AbstractPlatform {
|
|
||||||
}
|
|
@ -35,6 +35,7 @@ import com.sk89q.worldedit.extension.factory.ItemFactory;
|
|||||||
import com.sk89q.worldedit.extension.factory.MaskFactory;
|
import com.sk89q.worldedit.extension.factory.MaskFactory;
|
||||||
import com.sk89q.worldedit.extension.factory.PatternFactory;
|
import com.sk89q.worldedit.extension.factory.PatternFactory;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Capability;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
@ -601,7 +602,8 @@ public class WorldEdit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LocalSession session = getSessionManager().get(player);
|
LocalSession session = getSessionManager().get(player);
|
||||||
CraftScriptContext scriptContext = new CraftScriptContext(this, getServer(), getConfiguration(), session, player, args);
|
CraftScriptContext scriptContext = new CraftScriptContext(this, getPlatformManager().queryCapability(Capability.USER_COMMANDS),
|
||||||
|
getConfiguration(), session, player, args);
|
||||||
|
|
||||||
CraftScriptEngine engine;
|
CraftScriptEngine engine;
|
||||||
|
|
||||||
@ -649,15 +651,6 @@ public class WorldEdit {
|
|||||||
return getPlatformManager().getConfiguration();
|
return getPlatformManager().getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the server interface.
|
|
||||||
*
|
|
||||||
* @return the server interface
|
|
||||||
*/
|
|
||||||
public ServerInterface getServer() {
|
|
||||||
return getPlatformManager().getServerInterface();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a factory for {@link EditSession}s.
|
* Get a factory for {@link EditSession}s.
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ public class WorldEditCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.reload")
|
@CommandPermissions("worldedit.reload")
|
||||||
public void reload(Actor actor) throws WorldEditException {
|
public void reload(Actor actor) throws WorldEditException {
|
||||||
we.getServer().reload();
|
we.getPlatformManager().queryCapability(Capability.CONFIGURATION).reload();
|
||||||
we.getEventBus().post(new ConfigurationLoadEvent(we.getPlatformManager().queryCapability(Capability.CONFIGURATION).getConfiguration()));
|
we.getEventBus().post(new ConfigurationLoadEvent(we.getPlatformManager().queryCapability(Capability.CONFIGURATION).getConfiguration()));
|
||||||
actor.print("Configuration reloaded!");
|
actor.print("Configuration reloaded!");
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
|||||||
import com.sk89q.worldedit.extension.input.NoMatchException;
|
import com.sk89q.worldedit.extension.input.NoMatchException;
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Capability;
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -153,12 +154,12 @@ class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
blockType = BlockType.lookup(testId);
|
blockType = BlockType.lookup(testId);
|
||||||
if (blockType == null) {
|
if (blockType == null) {
|
||||||
int t = worldEdit.getServer().resolveItem(testId);
|
int t = worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).resolveItem(testId);
|
||||||
if (t >= 0) {
|
if (t >= 0) {
|
||||||
blockType = BlockType.fromID(t); // Could be null
|
blockType = BlockType.fromID(t); // Could be null
|
||||||
blockId = t;
|
blockId = t;
|
||||||
} else if (blockLocator.length == 2) { // Block IDs in MC 1.7 and above use mod:name
|
} else if (blockLocator.length == 2) { // Block IDs in MC 1.7 and above use mod:name
|
||||||
t = worldEdit.getServer().resolveItem(blockAndExtraData[0]);
|
t = worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).resolveItem(blockAndExtraData[0]);
|
||||||
if (t >= 0) {
|
if (t >= 0) {
|
||||||
blockType = BlockType.fromID(t); // Could be null
|
blockType = BlockType.fromID(t); // Could be null
|
||||||
blockId = t;
|
blockId = t;
|
||||||
@ -306,7 +307,7 @@ class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!worldEdit.getServer().isValidMobType(mobName)) {
|
if (!worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).isValidMobType(mobName)) {
|
||||||
throw new NoMatchException("Unknown mob type '" + mobName + "'");
|
throw new NoMatchException("Unknown mob type '" + mobName + "'");
|
||||||
}
|
}
|
||||||
return new MobSpawnerBlock(data, mobName);
|
return new MobSpawnerBlock(data, mobName);
|
||||||
|
@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.ServerInterface;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.command.tool.BlockTool;
|
import com.sk89q.worldedit.command.tool.BlockTool;
|
||||||
@ -39,7 +38,6 @@ import com.sk89q.worldedit.event.platform.PlatformInitializeEvent;
|
|||||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||||
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
import com.sk89q.worldedit.extension.platform.permission.ActorSelectorLimits;
|
||||||
import com.sk89q.worldedit.internal.ServerInterfaceAdapter;
|
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
@ -286,16 +284,6 @@ public class PlatformManager {
|
|||||||
return queryCapability(Capability.CONFIGURATION).getConfiguration();
|
return queryCapability(Capability.CONFIGURATION).getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a legacy {@link ServerInterface}.
|
|
||||||
*
|
|
||||||
* @return a {@link ServerInterface}
|
|
||||||
* @throws IllegalStateException if no platform has been registered
|
|
||||||
*/
|
|
||||||
public ServerInterface getServerInterface() throws IllegalStateException {
|
|
||||||
return ServerInterfaceAdapter.adapt(queryCapability(Capability.USER_COMMANDS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handlePlatformReady(PlatformReadyEvent event) {
|
public void handlePlatformReady(PlatformReadyEvent event) {
|
||||||
choosePreferred();
|
choosePreferred();
|
||||||
|
@ -1,135 +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 Lesser 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 Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.internal;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
|
||||||
import com.sk89q.worldedit.ServerInterface;
|
|
||||||
import com.sk89q.worldedit.entity.Player;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Preference;
|
|
||||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapts {@link Platform}s into the legacy {@link ServerInterface}.
|
|
||||||
*/
|
|
||||||
public class ServerInterfaceAdapter extends ServerInterface {
|
|
||||||
|
|
||||||
private final Platform platform;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new adapter.
|
|
||||||
*
|
|
||||||
* @param platform the platform
|
|
||||||
*/
|
|
||||||
private ServerInterfaceAdapter(Platform platform) {
|
|
||||||
checkNotNull(platform);
|
|
||||||
this.platform = platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int resolveItem(String name) {
|
|
||||||
return platform.resolveItem(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidMobType(String type) {
|
|
||||||
return platform.isValidMobType(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reload() {
|
|
||||||
platform.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int schedule(long delay, long period, Runnable task) {
|
|
||||||
return platform.schedule(delay, period, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<? extends World> getWorlds() {
|
|
||||||
return platform.getWorlds();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public Player matchPlayer(Player player) {
|
|
||||||
return platform.matchPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public World matchWorld(World world) {
|
|
||||||
return platform.matchWorld(world);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerCommands(Dispatcher dispatcher) {
|
|
||||||
platform.registerCommands(dispatcher);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerGameHooks() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalConfiguration getConfiguration() {
|
|
||||||
return platform.getConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion() {
|
|
||||||
return platform.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPlatformName() {
|
|
||||||
return platform.getPlatformName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPlatformVersion() {
|
|
||||||
return platform.getPlatformVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Capability, Preference> getCapabilities() {
|
|
||||||
return platform.getCapabilities();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adapt an {@link Platform} instance into a {@link ServerInterface}.
|
|
||||||
*
|
|
||||||
* @param platform the platform
|
|
||||||
* @return the server interface
|
|
||||||
*/
|
|
||||||
public static ServerInterface adapt(Platform platform) {
|
|
||||||
return new ServerInterfaceAdapter(platform);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -50,6 +50,7 @@ import org.spongepowered.api.event.game.state.GamePostInitializationEvent;
|
|||||||
import org.spongepowered.api.event.game.state.GamePreInitializationEvent;
|
import org.spongepowered.api.event.game.state.GamePreInitializationEvent;
|
||||||
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
|
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
|
||||||
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
|
||||||
|
import org.spongepowered.api.item.ItemType;
|
||||||
import org.spongepowered.api.item.inventory.ItemStack;
|
import org.spongepowered.api.item.inventory.ItemStack;
|
||||||
import org.spongepowered.api.plugin.Plugin;
|
import org.spongepowered.api.plugin.Plugin;
|
||||||
import org.spongepowered.api.plugin.PluginContainer;
|
import org.spongepowered.api.plugin.PluginContainer;
|
||||||
@ -132,9 +133,14 @@ public class SpongeWorldEdit {
|
|||||||
this.provider = new SpongePermissionsProvider();
|
this.provider = new SpongePermissionsProvider();
|
||||||
|
|
||||||
for (BlockType blockType : Sponge.getRegistry().getAllOf(BlockType.class)) {
|
for (BlockType blockType : Sponge.getRegistry().getAllOf(BlockType.class)) {
|
||||||
|
// TODO Handle blockstate stuff
|
||||||
com.sk89q.worldedit.blocks.type.BlockTypes.registerBlock(new com.sk89q.worldedit.blocks.type.BlockType(blockType.getId()));
|
com.sk89q.worldedit.blocks.type.BlockTypes.registerBlock(new com.sk89q.worldedit.blocks.type.BlockType(blockType.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (ItemType itemType : Sponge.getRegistry().getAllOf(ItemType.class)) {
|
||||||
|
com.sk89q.worldedit.blocks.type.ItemTypes.registerItem(new com.sk89q.worldedit.blocks.type.ItemType(itemType.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren