Plex-FAWE/src/forge/java/com/sk89q/worldedit/forge/WECUIPacketHandler.java
davboecki bd98e98698 Update Forge implementation and added build script.
Including:
* Update to new MCP names
* Adding of an build script (see maven 'forge' profile)
* Adding of an regeneration code
* Simplifying of the command registration
* Added command usage description to avoid empty help pages
* Added missing raw information
* Used a WeakReference as world reference to avoid keeping a world in memory
* Added mcmod.info
* Fixed player orientation
* Fixed printRaw not splitting the message correct
2013-09-29 23:48:11 -04:00

29 lines
1000 B
Java

package com.sk89q.worldedit.forge;
import java.nio.charset.Charset;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import com.sk89q.worldedit.LocalSession;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
public class WECUIPacketHandler implements IPacketHandler {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
if (player instanceof EntityPlayerMP) {
LocalSession session = WorldEditMod.inst.getSession((EntityPlayerMP) player);
if (session.hasCUISupport()) {
return;
}
String text = new String(packet.data, UTF_8_CHARSET);
session.handleCUIInitializationMessage(text);
}
}
}