Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-12 22:20:08 +01:00
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) {
|
||||
LocalSession session = plugin.getSession(player);
|
||||
String text = new String(message, UTF_8_CHARSET);
|
||||
session.handleCUIInitializationMessage(text);
|
||||
session.describeCUI(plugin.wrapPlayer(player));
|
||||
final BukkitPlayer actor = plugin.wrapPlayer(player);
|
||||
session.handleCUIInitializationMessage(text, actor);
|
||||
session.describeCUI(actor);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -782,9 +782,9 @@ public class LocalSession {
|
||||
*
|
||||
* @param text the message
|
||||
*/
|
||||
public void handleCUIInitializationMessage(String text) {
|
||||
public void handleCUIInitializationMessage(String text, Actor actor) {
|
||||
checkNotNull(text);
|
||||
if (this.failedCuiAttempts > 3) {
|
||||
if (this.hasCUISupport || this.failedCuiAttempts > 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -794,13 +794,18 @@ public class LocalSession {
|
||||
this.failedCuiAttempts ++;
|
||||
return;
|
||||
}
|
||||
setCUISupport(true);
|
||||
|
||||
int version;
|
||||
try {
|
||||
setCUIVersion(Integer.parseInt(split[1]));
|
||||
version = Integer.parseInt(split[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
WorldEdit.logger.warn("Error while reading CUI init message: " + e.getMessage());
|
||||
this.failedCuiAttempts ++;
|
||||
return;
|
||||
}
|
||||
setCUISupport(true);
|
||||
setCUIVersion(version);
|
||||
dispatchCUISelection(actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit.forge.net.handler;
|
||||
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.forge.ForgePlayer;
|
||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@ -62,8 +63,9 @@ public final class WECUIPacketHandler {
|
||||
}
|
||||
|
||||
String text = event.getPayload().toString(UTF_8_CHARSET);
|
||||
session.handleCUIInitializationMessage(text);
|
||||
session.describeCUI(adaptPlayer(player));
|
||||
final ForgePlayer actor = adaptPlayer(player);
|
||||
session.handleCUIInitializationMessage(text, actor);
|
||||
session.describeCUI(actor);
|
||||
}
|
||||
|
||||
public static void callProcessPacket(ClientCustomPayloadEvent event) {
|
||||
|
@ -57,8 +57,10 @@ public class CUIChannelHandler implements RawDataListener {
|
||||
return;
|
||||
}
|
||||
|
||||
session.handleCUIInitializationMessage(new String(data.readBytes(data.available()), StandardCharsets.UTF_8));
|
||||
session.describeCUI(SpongeWorldEdit.inst().wrapPlayer(player));
|
||||
final SpongePlayer actor = 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