Created AbstractPlatform and deprecated ServerInterface.

This commit is contained in:
sk89q 2014-04-04 21:15:37 -07:00
parent 52b828ae17
commit d4c910a012
3 changed files with 65 additions and 29 deletions

View File

@ -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<LocalWorld> getWorlds() {
return Collections.emptyList();
}
@Override
@Deprecated
public void onCommandRegistration(List<Command> commands) {
// Do nothing :)
}
@Override
public void onCommandRegistration(List<Command> commands, CommandsManager<LocalPlayer> manager) {
onCommandRegistration(commands);
}
@Deprecated
public abstract class ServerInterface extends AbstractPlatform {
}

View File

@ -0,0 +1,56 @@
/*
* 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.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<LocalWorld> getWorlds() {
return Collections.emptyList();
}
@Override
@Deprecated
public void onCommandRegistration(List<Command> commands) {
// Do nothing :)
}
@Override
public void onCommandRegistration(List<Command> commands, CommandsManager<LocalPlayer> manager) {
onCommandRegistration(commands);
}
}

View File

@ -30,6 +30,9 @@ import java.util.List;
/**
* Represents a platform that WorldEdit has been implemented for.
* </p>
* It is strongly recommended that implementations extend from
* {@link AbstractPlatform}.
*/
public interface Platform {