From d4c910a012d3bac5ea766f834efadafc0fcacbf3 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 4 Apr 2014 21:15:37 -0700 Subject: [PATCH] Created AbstractPlatform and deprecated ServerInterface. --- .../com/sk89q/worldedit/ServerInterface.java | 35 ++---------- .../extension/platform/AbstractPlatform.java | 56 +++++++++++++++++++ .../extension/platform/Platform.java | 3 + 3 files changed, 65 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlatform.java diff --git a/src/main/java/com/sk89q/worldedit/ServerInterface.java b/src/main/java/com/sk89q/worldedit/ServerInterface.java index bc6d4610b..8012fce15 100644 --- a/src/main/java/com/sk89q/worldedit/ServerInterface.java +++ b/src/main/java/com/sk89q/worldedit/ServerInterface.java @@ -19,38 +19,15 @@ package com.sk89q.worldedit; -import com.sk89q.minecraft.util.commands.Command; -import com.sk89q.minecraft.util.commands.CommandsManager; +import com.sk89q.worldedit.extension.platform.AbstractPlatform; import com.sk89q.worldedit.extension.platform.Platform; -import java.util.Collections; -import java.util.List; - /** + * A legacy abstract class that is to be replaced with {@link Platform}. + * Extend {@link AbstractPlatform} instead. * - * @author sk89q + * @deprecated Use {@link Platform} wherever possible */ -public abstract class ServerInterface implements Platform { - - @Override - public int schedule(long delay, long period, Runnable task) { - return -1; - } - - @Override - public List getWorlds() { - return Collections.emptyList(); - } - - @Override - @Deprecated - public void onCommandRegistration(List commands) { - // Do nothing :) - } - - @Override - public void onCommandRegistration(List commands, CommandsManager manager) { - onCommandRegistration(commands); - } - +@Deprecated +public abstract class ServerInterface extends AbstractPlatform { } diff --git a/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlatform.java b/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlatform.java new file mode 100644 index 000000000..98a330a59 --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlatform.java @@ -0,0 +1,56 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * 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 . + */ + +package com.sk89q.worldedit.extension.platform; + +import com.sk89q.minecraft.util.commands.Command; +import com.sk89q.minecraft.util.commands.CommandsManager; +import com.sk89q.worldedit.LocalPlayer; +import com.sk89q.worldedit.LocalWorld; + +import java.util.Collections; +import java.util.List; + +/** + * An abstract implementation of {@link Platform}. + */ +public abstract class AbstractPlatform implements Platform { + + @Override + public int schedule(long delay, long period, Runnable task) { + return -1; + } + + @Override + public List getWorlds() { + return Collections.emptyList(); + } + + @Override + @Deprecated + public void onCommandRegistration(List commands) { + // Do nothing :) + } + + @Override + public void onCommandRegistration(List commands, CommandsManager manager) { + onCommandRegistration(commands); + } + +} diff --git a/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java b/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java index 6e4f65945..0a784ade2 100644 --- a/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java +++ b/src/main/java/com/sk89q/worldedit/extension/platform/Platform.java @@ -30,6 +30,9 @@ import java.util.List; /** * Represents a platform that WorldEdit has been implemented for. + *

+ * It is strongly recommended that implementations extend from + * {@link AbstractPlatform}. */ public interface Platform {