Improves CUI support.

1. Allows CUI handshake package to overwrite protocol version.
2. Sends the current selection on handshake.
3. Removed redundant SelectionShapeEvents.

Conflicts:
	src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java
	src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java
Dieser Commit ist enthalten in:
sk89q 2014-05-01 17:29:51 -07:00
Commit 8d6f5bf335
4 geänderte Dateien mit 1 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -40,11 +40,8 @@ public class CUIChannelListener implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
LocalSession session = plugin.getSession(player);
if (session.hasCUISupport()) { // Already initialized
return;
}
String text = new String(message, UTF_8_CHARSET);
session.handleCUIInitializationMessage(text);
session.describeCUI(plugin.wrapPlayer(player));
}
}

Datei anzeigen

@ -625,10 +625,6 @@ public class LocalSession {
}
public void handleCUIInitializationMessage(String text) {
if (hasCUISupport()) {
return;
}
String[] split = text.split("\\|");
if (split.length > 1 && split[0].equalsIgnoreCase("v")) { // enough fields and right message
setCUISupport(true);

Datei anzeigen

@ -206,8 +206,6 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
Collection<Vector> vertices = region.getVertices();
Collection<Triangle> triangles = region.getTriangles();
player.dispatchCUIEvent(new SelectionShapeEvent(getTypeID()));
Map<Vector, Integer> vertexIds = new HashMap<Vector, Integer>(vertices.size());
int lastVertexId = -1;
for (Vector vertex : vertices) {
@ -234,8 +232,6 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
if (isDefined()) {
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
} else {
session.dispatchCUIEvent(player, new SelectionShapeEvent(getLegacyTypeID()));
}
}

Datei anzeigen

@ -237,8 +237,6 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder
if (isDefined()) {
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
} else {
session.dispatchCUIEvent(player, new SelectionShapeEvent(getLegacyTypeID()));
}
}