Added WECUI protocol version support. Eventually, this will disable WECUI until the user updates, but not yet.

This commit is contained in:
zml2008 2011-12-27 14:02:02 -08:00
parent 72b2c90c19
commit 8cdfd65218
2 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.cui.CUIEvent;
public class WorldEditCommands {
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
@ -78,10 +79,13 @@ public class WorldEditCommands {
usage = "",
desc = "Complete CUI handshake",
min = 0,
max = 0
max = 1
)
public void cui(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
if (args.getInteger(0, -1) < CUIEvent.MIN_PROTOCOL) {
player.printError("You are using an outdated version of WorldEdit CUI! The CUI may have reduced functionality until you update.");
}
session.setCUISupport(true);
session.dispatchCUISetup(player);
}

View File

@ -20,6 +20,10 @@
package com.sk89q.worldedit.cui;
public interface CUIEvent {
// The required protocol versions for communicating with the CUI
public static final int MIN_PROTOCOL = 0, CURRENT_PROTOCOL = 0;
public String getTypeId();
public String[] getParameters();