Skip to content

Commit

Permalink
Implement commands packet, fix particles
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulloy2 committed Aug 25, 2018
1 parent 84d4c3d commit 21a1f1b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.mojang.brigadier.tree.RootCommandNode;

public class WrapperPlayServerCommands extends AbstractPacket {

Expand All @@ -33,8 +34,16 @@ public WrapperPlayServerCommands() {
public WrapperPlayServerCommands(PacketContainer packet) {
super(packet, TYPE);
}

// Cannot find type for a
// Cannot find type for a
// Cannot find type for a

/**
* Mojang's brigadier library isn't versioned inside craftbukkit,
* so it should be safe to use here.
*/
public RootCommandNode getRoot() {
return (RootCommandNode) handle.getModifier().read(0);
}

public void setRoot(RootCommandNode node) {
handle.getModifier().write(0, node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.EnumWrappers.Particle;
import com.comphenix.protocol.wrappers.WrappedParticle;

public class WrapperPlayServerWorldParticles extends AbstractPacket {
public static final PacketType TYPE =
Expand All @@ -36,21 +36,21 @@ public WrapperPlayServerWorldParticles(PacketContainer packet) {
}

/**
* Retrieve Particle type.
* Retrieve the particle.
*
* @return The current Particle type
* @return The current particle
*/
public Particle getParticleType() {
return handle.getParticles().read(0);
public WrappedParticle getParticle() {
return handle.getNewParticles().read(0);
}

/**
* Set Particle type.
* Set the particle.
*
* @param value - new value.
*/
public void setParticleType(Particle value) {
handle.getParticles().write(0, value);
public void setParticleType(WrappedParticle value) {
handle.getNewParticles().write(0, value);
}

/**
Expand Down

0 comments on commit 21a1f1b

Please sign in to comment.