Fix SWScoreboard <= 1.12, Remove todos
Dieser Commit ist enthalten in:
Ursprung
ef2553e6ac
Commit
2b1e7c3322
@ -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{
|
||||
|
@ -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{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren