mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-11-14 19:34:58 -05:00
14w08a
This commit is contained in:
parent
0eaf5dc774
commit
4abc1e4302
6 changed files with 43 additions and 13 deletions
|
@ -20,7 +20,7 @@ See example/ch/spacebase/mc/protocol/test/Test.java
|
|||
--------
|
||||
|
||||
MCProtocolLib uses Maven to manage dependencies. Simply run 'mvn clean install' in the source's directory.
|
||||
You can also download a build <b>[here](http://build.spacebase.ch/job/MCProtocolLib14w06b/)</b>.
|
||||
You can also download a build <b>[here](http://build.spacebase.ch/job/MCProtocolLib14w08a/)</b>.
|
||||
|
||||
|
||||
<b>License</b>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.spacebase</groupId>
|
||||
<artifactId>mcprotocollib</artifactId>
|
||||
<version>14w06b-SNAPSHOT</version>
|
||||
<version>14w08a-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MCProtocolLib</name>
|
||||
|
|
|
@ -3,8 +3,8 @@ package ch.spacebase.mc.protocol;
|
|||
public class ProtocolConstants {
|
||||
|
||||
// General Constants
|
||||
public static final String GAME_VERSION = "14w07a";
|
||||
public static final int PROTOCOL_VERSION = 11;
|
||||
public static final String GAME_VERSION = "14w08a";
|
||||
public static final int PROTOCOL_VERSION = 12;
|
||||
|
||||
// General Key Constants
|
||||
public static final String PROFILE_KEY = "profile";
|
||||
|
|
|
@ -27,6 +27,7 @@ import ch.spacebase.mc.protocol.data.game.values.entity.player.PositionElement;
|
|||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.FriendlyFire;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.NameTagVisibility;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ObjectiveAction;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ScoreType;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ScoreboardAction;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ScoreboardPosition;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.TeamAction;
|
||||
|
@ -801,6 +802,9 @@ public class MagicValues {
|
|||
register(TeamColor.LIGHT_PURPLE, 13);
|
||||
register(TeamColor.YELLOW, 14);
|
||||
register(TeamColor.WHITE, 15);
|
||||
|
||||
register(ScoreType.INTEGER, "integer");
|
||||
register(ScoreType.HEARTS, "hearts");
|
||||
}
|
||||
|
||||
private static void register(Enum<?> key, Object value) {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package ch.spacebase.mc.protocol.data.game.values.scoreboard;
|
||||
|
||||
public enum ScoreType {
|
||||
|
||||
INTEGER,
|
||||
HEARTS;
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
|
||||
import ch.spacebase.mc.protocol.data.game.values.MagicValues;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ObjectiveAction;
|
||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ScoreType;
|
||||
import ch.spacebase.packetlib.io.NetInput;
|
||||
import ch.spacebase.packetlib.io.NetOutput;
|
||||
import ch.spacebase.packetlib.packet.Packet;
|
||||
|
@ -11,43 +12,60 @@ import ch.spacebase.packetlib.packet.Packet;
|
|||
public class ServerScoreboardObjectivePacket implements Packet {
|
||||
|
||||
private String name;
|
||||
private String displayName;
|
||||
private ObjectiveAction action;
|
||||
private String displayName;
|
||||
private ScoreType type;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ServerScoreboardObjectivePacket() {
|
||||
}
|
||||
|
||||
public ServerScoreboardObjectivePacket(String name, String displayName, ObjectiveAction action) {
|
||||
public ServerScoreboardObjectivePacket(String name) {
|
||||
this.name = name;
|
||||
this.action = ObjectiveAction.REMOVE;
|
||||
}
|
||||
|
||||
public ServerScoreboardObjectivePacket(String name, ObjectiveAction action, String displayName, ScoreType type) {
|
||||
if(action != ObjectiveAction.ADD && action != ObjectiveAction.UPDATE) {
|
||||
throw new IllegalArgumentException("(name, action, displayName) constructor only valid for adding and updating objectives.");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.displayName = displayName;
|
||||
this.action = action;
|
||||
this.displayName = displayName;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public ObjectiveAction getAction() {
|
||||
return this.action;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(NetInput in) throws IOException {
|
||||
this.name = in.readString();
|
||||
this.displayName = in.readString();
|
||||
this.action = MagicValues.key(ObjectiveAction.class, in.readByte());
|
||||
if(this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) {
|
||||
this.displayName = in.readString();
|
||||
this.type = MagicValues.key(ScoreType.class, in.readString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(NetOutput out) throws IOException {
|
||||
out.writeString(this.name);
|
||||
out.writeString(this.displayName);
|
||||
out.writeByte(MagicValues.value(Integer.class, this.action));
|
||||
if(this.action == ObjectiveAction.ADD || this.action == ObjectiveAction.UPDATE) {
|
||||
out.writeString(this.displayName);
|
||||
out.writeString(MagicValues.value(String.class, this.type));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue