SteamWar/SpigotCore
Archiviert
13
0

New version dependent, ProtocolLib -> TinyProtocol, Sub 1.12 ErrorLogger #114

Manuell gemergt
Lixfel hat 6 Commits von newVersionDependentNoProtocolLib nach master 2021-09-11 21:03:46 +02:00 zusammengeführt
5 geänderte Dateien mit 20 neuen und 8 gelöschten Zeilen
Nur Änderungen aus Commit 2b1e7c3322 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -264,6 +264,15 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
scoreboardName.set(packet, chatComponentConstructor.invoke(title));
}
private static final Class<?> scoreActionEnum = Reflection.getClass("{nms}.ScoreboardServer$Action");
private static final Reflection.FieldAccessor<?> scoreAction = Reflection.getField(SWScoreboard.scoreboardScore, scoreActionEnum, 0);
private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
@Override
public void setScoreAction(Object packet) {
scoreAction.set(packet, scoreActionChange);
}
@Override
public Material getMaterial(String material) {
try{

Datei anzeigen

@ -58,12 +58,20 @@ import java.util.stream.Collectors;
public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper {
private static final Reflection.FieldAccessor<String> scoreboardName = Reflection.getField(SWScoreboard.scoreboardObjective, String.class, 1);
private static final Class<?> scoreActionEnum = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore$EnumScoreboardAction");
private static final Reflection.FieldAccessor<?> scoreAction = Reflection.getField(SWScoreboard.scoreboardScore, scoreActionEnum, 0);
private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
@Override
public void setScoreboardTitle(Object packet, String title) {
scoreboardName.set(packet, title);
}
@Override
public void setScoreAction(Object packet) {
scoreAction.set(packet, scoreActionChange);
}
@Override
public Material getMaterial(String material) {
try{

Datei anzeigen

@ -34,6 +34,7 @@ public class FlatteningWrapper {
public interface IFlatteningWrapper {
void setScoreboardTitle(Object packet, String title);
void setScoreAction(Object packet);
Material getMaterial(String material);
Material getDye(int colorCode);

Datei anzeigen

@ -45,9 +45,6 @@ public class ChunkListener {
)
return packet;
//TODO: Test ViaVersion prior or post
//TODO: Test if this can be done async?
//TODO: Nicer way: generate new and send new
CraftbukkitWrapper.impl.sendChunk(receiver, chunkX.get(packet), chunkZ.get(packet));
return null;
}

Datei anzeigen

@ -39,13 +39,10 @@ public class SWScoreboard {
private static final Reflection.FieldAccessor<?> scoreboardDisplayType = Reflection.getField(scoreboardObjective, scoreboardDisplayEnum, 0);
private static final Object displayTypeIntegers = scoreboardDisplayEnum.getEnumConstants()[0];
private static final Class<?> scoreboardScore = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore");
public static final Class<?> scoreboardScore = Reflection.getClass("{nms}.PacketPlayOutScoreboardScore");
private static final Reflection.FieldAccessor<String> scoreName = Reflection.getField(scoreboardScore, String.class, 0);
private static final Reflection.FieldAccessor<String> scoreScoreboardName = Reflection.getField(scoreboardScore, String.class, 1);
private static final Reflection.FieldAccessor<Integer> scoreValue = Reflection.getField(scoreboardScore, int.class, 0);
private static final Class<?> scoreActionEnum = Reflection.getClass("{nms}.ScoreboardServer$Action");
private static final Reflection.FieldAccessor<?> scoreAction = Reflection.getField(scoreboardScore, scoreActionEnum, 0);
private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0];
private static final HashMap<Player, ScoreboardCallback> playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map!
private static int toggle = 0; // Scoreboard 0 updates while scoreboard 1 is presenting. toggle marks the current active scoreboard
@ -116,7 +113,7 @@ public class SWScoreboard {
scoreName.set(packet, name);
scoreScoreboardName.set(packet, SIDEBAR + toggle);
scoreValue.set(packet, value);
scoreAction.set(packet, scoreActionChange);
FlatteningWrapper.impl.setScoreAction(packet);
return packet;
}
}