geforkt von Mirrors/FastAsyncWorldEdit
Don't require command for CUI init.
Dieser Commit ist enthalten in:
Ursprung
ec3648e521
Commit
6ad274677f
@ -41,8 +41,9 @@ public class CUIChannelListener implements PluginMessageListener {
|
|||||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
LocalSession session = plugin.getSession(player);
|
LocalSession session = plugin.getSession(player);
|
||||||
String text = new String(message, UTF_8_CHARSET);
|
String text = new String(message, UTF_8_CHARSET);
|
||||||
session.handleCUIInitializationMessage(text);
|
final BukkitPlayer actor = plugin.wrapPlayer(player);
|
||||||
session.describeCUI(plugin.wrapPlayer(player));
|
session.handleCUIInitializationMessage(text, actor);
|
||||||
|
session.describeCUI(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -782,9 +782,9 @@ public class LocalSession {
|
|||||||
*
|
*
|
||||||
* @param text the message
|
* @param text the message
|
||||||
*/
|
*/
|
||||||
public void handleCUIInitializationMessage(String text) {
|
public void handleCUIInitializationMessage(String text, Actor actor) {
|
||||||
checkNotNull(text);
|
checkNotNull(text);
|
||||||
if (this.failedCuiAttempts > 3) {
|
if (this.hasCUISupport || this.failedCuiAttempts > 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,13 +794,18 @@ public class LocalSession {
|
|||||||
this.failedCuiAttempts ++;
|
this.failedCuiAttempts ++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setCUISupport(true);
|
|
||||||
|
int version;
|
||||||
try {
|
try {
|
||||||
setCUIVersion(Integer.parseInt(split[1]));
|
version = Integer.parseInt(split[1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
WorldEdit.logger.warn("Error while reading CUI init message: " + e.getMessage());
|
WorldEdit.logger.warn("Error while reading CUI init message: " + e.getMessage());
|
||||||
this.failedCuiAttempts ++;
|
this.failedCuiAttempts ++;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
setCUISupport(true);
|
||||||
|
setCUIVersion(version);
|
||||||
|
dispatchCUISelection(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.forge.net.handler;
|
package com.sk89q.worldedit.forge.net.handler;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.forge.ForgePlayer;
|
||||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
@ -62,8 +63,9 @@ public final class WECUIPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String text = event.getPayload().toString(UTF_8_CHARSET);
|
String text = event.getPayload().toString(UTF_8_CHARSET);
|
||||||
session.handleCUIInitializationMessage(text);
|
final ForgePlayer actor = adaptPlayer(player);
|
||||||
session.describeCUI(adaptPlayer(player));
|
session.handleCUIInitializationMessage(text, actor);
|
||||||
|
session.describeCUI(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void callProcessPacket(ClientCustomPayloadEvent event) {
|
public static void callProcessPacket(ClientCustomPayloadEvent event) {
|
||||||
|
@ -57,8 +57,10 @@ public class CUIChannelHandler implements RawDataListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.handleCUIInitializationMessage(new String(data.readBytes(data.available()), StandardCharsets.UTF_8));
|
final SpongePlayer actor = SpongeWorldEdit.inst().wrapPlayer(player);
|
||||||
session.describeCUI(SpongeWorldEdit.inst().wrapPlayer(player));
|
session.handleCUIInitializationMessage(new String(data.readBytes(data.available()), StandardCharsets.UTF_8),
|
||||||
|
actor);
|
||||||
|
session.describeCUI(actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren