Since our game profiles don't support texture property reading we're going to make login success packet unsendable. (Which means packetevents plugins can't send it using our API, please update to 2.0 if you need this feature)
This commit is contained in:
1 parent
d5d4a9bffc
commit
8809088b66
2 files changed
+4
-25
No files matched your search
@@ -52,7 +52,7 @@ public class PacketEventsPlugin extends JavaPlugin {
|
||||
if (event.getPacketId() == PacketType.Play.Client.USE_ENTITY) {
|
||||
System.out.println("Yes");
|
||||
ItemStack stack = new ItemStack(Material.STICK);
|
||||
WrappedPacketOutSetSlot setSlot = new WrappedPacketOutSetSlot(0, 2, stack);
|
||||
WrappedPacketOutSetSlot setSlot = new WrappedPacketOutSetSlot(0, 37, stack);
|
||||
PacketEvents.get().getPlayerUtils().sendPacket(event.getPlayer(), setSlot);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-24
@@ -28,28 +28,14 @@ import io.github.retrooper.packetevents.utils.nms.NMSUtils;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
public class WrappedPacketLoginOutSuccess extends WrappedPacket implements SendableWrapper {
|
||||
private static Constructor<?> packetConstructor;
|
||||
public class WrappedPacketLoginOutSuccess extends WrappedPacket {
|
||||
private WrappedGameProfile wrappedGameProfile;
|
||||
|
||||
public WrappedPacketLoginOutSuccess(final NMSPacket packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
public WrappedPacketLoginOutSuccess(final WrappedGameProfile wrappedGameProfile) {
|
||||
this.wrappedGameProfile = wrappedGameProfile;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void load() {
|
||||
try {
|
||||
packetConstructor = PacketTypeClasses.Login.Server.SUCCESS.getConstructors()[1];
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Support property reading in wrapped game profile
|
||||
//TODO Support property reading in wrapped game profile(NECESSARY IN 1.19!, PLEASE UPDATE TO 2.0 PACKETEVENTS)
|
||||
public WrappedGameProfile getGameProfile() {
|
||||
if (packet != null) {
|
||||
return GameProfileUtil.getWrappedGameProfile(readObject(0, NMSUtils.gameProfileClass));
|
||||
@@ -58,7 +44,7 @@ public class WrappedPacketLoginOutSuccess extends WrappedPacket implements Senda
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Support writing property in wrapped game profile
|
||||
//TODO Support writing property in wrapped game profile(NECESSARY IN 1.19!, PLEASE UPDATE TO 2.0 PACKETEVENTS)
|
||||
public void setGameProfile(final WrappedGameProfile wrappedGameProfile) {
|
||||
if (packet != null) {
|
||||
final Object gameProfile = GameProfileUtil.getGameProfile(wrappedGameProfile.getId(), wrappedGameProfile.getName());
|
||||
@@ -68,13 +54,6 @@ public class WrappedPacketLoginOutSuccess extends WrappedPacket implements Senda
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asNMSPacket() throws Exception {
|
||||
WrappedGameProfile gp = getGameProfile();
|
||||
//TODO Support writing property in wrapped game profile
|
||||
return packetConstructor.newInstance(GameProfileUtil.getGameProfile(gp.getId(), gp.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported() {
|
||||
return PacketTypeClasses.Login.Server.SUCCESS != null;
|
||||
|
||||
Reference in new issue
Block a user