mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2025-06-02 16:03:50 -04:00
14w08a
This commit is contained in:
parent
0eaf5dc774
commit
4abc1e4302
6 changed files with 43 additions and 13 deletions
README.mdpom.xml
src/main/java/ch/spacebase/mc/protocol
|
@ -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.
|
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>
|
<b>License</b>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>ch.spacebase</groupId>
|
<groupId>ch.spacebase</groupId>
|
||||||
<artifactId>mcprotocollib</artifactId>
|
<artifactId>mcprotocollib</artifactId>
|
||||||
<version>14w06b-SNAPSHOT</version>
|
<version>14w08a-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>MCProtocolLib</name>
|
<name>MCProtocolLib</name>
|
||||||
|
|
|
@ -3,8 +3,8 @@ package ch.spacebase.mc.protocol;
|
||||||
public class ProtocolConstants {
|
public class ProtocolConstants {
|
||||||
|
|
||||||
// General Constants
|
// General Constants
|
||||||
public static final String GAME_VERSION = "14w07a";
|
public static final String GAME_VERSION = "14w08a";
|
||||||
public static final int PROTOCOL_VERSION = 11;
|
public static final int PROTOCOL_VERSION = 12;
|
||||||
|
|
||||||
// General Key Constants
|
// General Key Constants
|
||||||
public static final String PROFILE_KEY = "profile";
|
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.FriendlyFire;
|
||||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.NameTagVisibility;
|
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.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.ScoreboardAction;
|
||||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ScoreboardPosition;
|
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ScoreboardPosition;
|
||||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.TeamAction;
|
import ch.spacebase.mc.protocol.data.game.values.scoreboard.TeamAction;
|
||||||
|
@ -801,6 +802,9 @@ public class MagicValues {
|
||||||
register(TeamColor.LIGHT_PURPLE, 13);
|
register(TeamColor.LIGHT_PURPLE, 13);
|
||||||
register(TeamColor.YELLOW, 14);
|
register(TeamColor.YELLOW, 14);
|
||||||
register(TeamColor.WHITE, 15);
|
register(TeamColor.WHITE, 15);
|
||||||
|
|
||||||
|
register(ScoreType.INTEGER, "integer");
|
||||||
|
register(ScoreType.HEARTS, "hearts");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(Enum<?> key, Object value) {
|
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.MagicValues;
|
||||||
import ch.spacebase.mc.protocol.data.game.values.scoreboard.ObjectiveAction;
|
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.NetInput;
|
||||||
import ch.spacebase.packetlib.io.NetOutput;
|
import ch.spacebase.packetlib.io.NetOutput;
|
||||||
import ch.spacebase.packetlib.packet.Packet;
|
import ch.spacebase.packetlib.packet.Packet;
|
||||||
|
@ -11,43 +12,60 @@ import ch.spacebase.packetlib.packet.Packet;
|
||||||
public class ServerScoreboardObjectivePacket implements Packet {
|
public class ServerScoreboardObjectivePacket implements Packet {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String displayName;
|
|
||||||
private ObjectiveAction action;
|
private ObjectiveAction action;
|
||||||
|
private String displayName;
|
||||||
|
private ScoreType type;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private ServerScoreboardObjectivePacket() {
|
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.name = name;
|
||||||
this.displayName = displayName;
|
|
||||||
this.action = action;
|
this.action = action;
|
||||||
|
this.displayName = displayName;
|
||||||
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName() {
|
|
||||||
return this.displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectiveAction getAction() {
|
public ObjectiveAction getAction() {
|
||||||
return this.action;
|
return this.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
return this.displayName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
this.name = in.readString();
|
this.name = in.readString();
|
||||||
this.displayName = in.readString();
|
|
||||||
this.action = MagicValues.key(ObjectiveAction.class, in.readByte());
|
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
|
@Override
|
||||||
public void write(NetOutput out) throws IOException {
|
public void write(NetOutput out) throws IOException {
|
||||||
out.writeString(this.name);
|
out.writeString(this.name);
|
||||||
out.writeString(this.displayName);
|
|
||||||
out.writeByte(MagicValues.value(Integer.class, this.action));
|
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
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue