added full multiversion support
Dieser Commit ist enthalten in:
Ursprung
ec2a0345aa
Commit
39c6d04daf
44
SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java
Normale Datei
44
SpigotCore_12/src/de/steamwar/scoreboard/SWScoreboard_12.java
Normale Datei
@ -0,0 +1,44 @@
|
|||||||
|
package de.steamwar.scoreboard;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
|
||||||
|
public class SWScoreboard_12 {
|
||||||
|
|
||||||
|
private SWScoreboard_12() {}
|
||||||
|
|
||||||
|
static PacketContainer getRemovePacket() {
|
||||||
|
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
|
remove.getStrings().write(0, "AAA");
|
||||||
|
remove.getBytes().write(0, (byte) 1);
|
||||||
|
return remove;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getCreatePacket(String title) {
|
||||||
|
PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
|
createpacket.getStrings().write(0, "AAA");
|
||||||
|
createpacket.getBytes().write(0, (byte) 0);
|
||||||
|
createpacket.getStrings().write(1, title);
|
||||||
|
createpacket.getStrings().write(2, "integer");
|
||||||
|
return createpacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getUpdatePacket(String content, Integer line) {
|
||||||
|
PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE);
|
||||||
|
update.getStrings().write(0, content);
|
||||||
|
update.getBytes().write(0, (byte) 0);
|
||||||
|
update.getStrings().write(1, "AAA");
|
||||||
|
update.getIntegers().write(0, line);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getDisplayPacket(String title) {
|
||||||
|
PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
|
||||||
|
display.getBytes().write(0, (byte) 1);
|
||||||
|
display.getStrings().write(0, title);
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
44
SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java
Normale Datei
44
SpigotCore_14/src/de/steamwar/scoreboard/SWScoreboard_14.java
Normale Datei
@ -0,0 +1,44 @@
|
|||||||
|
package de.steamwar.scoreboard;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
|
||||||
|
public class SWScoreboard_14 {
|
||||||
|
|
||||||
|
private SWScoreboard_14() {}
|
||||||
|
|
||||||
|
static PacketContainer getRemovePacket() {
|
||||||
|
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
|
remove.getStrings().write(0, "AAA");
|
||||||
|
remove.getBytes().write(0, (byte) 1);
|
||||||
|
return remove;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getCreatePacket(String title) {
|
||||||
|
PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
|
createpacket.getStrings().write(0, "AAA");
|
||||||
|
createpacket.getBytes().write(0, (byte) 0);
|
||||||
|
createpacket.getStrings().write(1, title);
|
||||||
|
createpacket.getIntegers().write(0, 0);
|
||||||
|
return createpacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getUpdatePacket(String content, Integer line) {
|
||||||
|
PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE);
|
||||||
|
update.getStrings().write(0, content);
|
||||||
|
update.getBytes().write(0, (byte) 0);
|
||||||
|
update.getStrings().write(1, "AAA");
|
||||||
|
update.getIntegers().write(0, line);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getDisplayPacket(String title) {
|
||||||
|
PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
|
||||||
|
display.getBytes().write(0, (byte) 1);
|
||||||
|
display.getStrings().write(0, title);
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
44
SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java
Normale Datei
44
SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard_8.java
Normale Datei
@ -0,0 +1,44 @@
|
|||||||
|
package de.steamwar.scoreboard;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
|
||||||
|
public class SWScoreboard_8 {
|
||||||
|
|
||||||
|
private SWScoreboard_8() {}
|
||||||
|
|
||||||
|
static PacketContainer getRemovePacket() {
|
||||||
|
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
|
remove.getStrings().write(0, "AAA");
|
||||||
|
remove.getBytes().write(0, (byte) 1);
|
||||||
|
return remove;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getCreatePacket(String title) {
|
||||||
|
PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||||
|
createpacket.getStrings().write(0, "AAA");
|
||||||
|
createpacket.getBytes().write(0, (byte) 0);
|
||||||
|
createpacket.getStrings().write(1, title);
|
||||||
|
createpacket.getStrings().write(2, "integer");
|
||||||
|
return createpacket;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getUpdatePacket(String content, Integer line) {
|
||||||
|
PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE);
|
||||||
|
update.getStrings().write(0, content);
|
||||||
|
update.getBytes().write(0, (byte) 0);
|
||||||
|
update.getStrings().write(1, "AAA");
|
||||||
|
update.getIntegers().write(0, line);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PacketContainer getDisplayPacket(String title) {
|
||||||
|
PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
|
||||||
|
display.getBytes().write(0, (byte) 1);
|
||||||
|
display.getStrings().write(0, title);
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package de.steamwar.scoreboard;
|
package de.steamwar.scoreboard;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
@ -23,15 +22,21 @@ public class SWScoreboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendScoreboard(Player player) {
|
private void sendScoreboard(Player player) {
|
||||||
PacketContainer remove = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
PacketContainer remove;
|
||||||
remove.getStrings().write(0, "AAA");
|
PacketContainer createpacket;
|
||||||
remove.getBytes().write(0, (byte) 1);
|
switch (Core.getVersion()) {
|
||||||
|
case 8:
|
||||||
PacketContainer createpacket = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
remove = SWScoreboard_8.getRemovePacket();
|
||||||
createpacket.getStrings().write(0, "AAA");
|
createpacket = SWScoreboard_8.getCreatePacket(this.callback.getTitle());
|
||||||
createpacket.getBytes().write(0, (byte) 0);
|
break;
|
||||||
createpacket.getStrings().write(1, this.callback.getTitle());
|
case 14:
|
||||||
createpacket.getIntegers().write(0, 0);
|
remove = SWScoreboard_14.getRemovePacket();
|
||||||
|
createpacket = SWScoreboard_14.getCreatePacket(this.callback.getTitle());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
remove = SWScoreboard_12.getRemovePacket();
|
||||||
|
createpacket = SWScoreboard_12.getCreatePacket(this.callback.getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, remove);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, remove);
|
||||||
@ -41,11 +46,18 @@ public class SWScoreboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> entry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> entry : this.callback.getData().entrySet()) {
|
||||||
PacketContainer update = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_SCORE);
|
PacketContainer update;
|
||||||
update.getStrings().write(0, entry.getKey());
|
|
||||||
update.getBytes().write(0, (byte) 0);
|
switch (Core.getVersion()) {
|
||||||
update.getStrings().write(1, "AAA");
|
case 8:
|
||||||
update.getIntegers().write(0, entry.getValue());
|
update = SWScoreboard_8.getUpdatePacket(entry.getKey(), entry.getValue());
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
update = SWScoreboard_14.getUpdatePacket(entry.getKey(), entry.getValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
update = SWScoreboard_12.getUpdatePacket(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, update);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, update);
|
||||||
@ -57,9 +69,19 @@ public class SWScoreboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
private void display(Player player) {
|
||||||
PacketContainer display = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
|
PacketContainer display;
|
||||||
display.getBytes().write(0, (byte) 1);
|
|
||||||
display.getStrings().write(0, this.callback.getTitle());
|
switch (Core.getVersion()) {
|
||||||
|
case 8:
|
||||||
|
display = SWScoreboard_8.getDisplayPacket(this.callback.getTitle());
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
display = SWScoreboard_14.getDisplayPacket(this.callback.getTitle());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
display = SWScoreboard_12.getDisplayPacket(this.callback.getTitle());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, display);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, display);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren