3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Remove unused scoreboard API

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-02 18:07:31 -04:00
Ursprung ff0f83b375
Commit db1b19dcd6
7 geänderte Dateien mit 11 neuen und 249 gelöschten Zeilen

Datei anzeigen

@ -1,59 +0,0 @@
package com.velocitypowered.proxy.data.scoreboard;
import net.kyori.text.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Objective {
private final String id;
private Component displayName;
private ObjectiveMode type;
private final List<Team> teams = new ArrayList<>();
private final Map<String, Score> scores = new HashMap<>();
public Objective(String id) {
this.id = id;
}
public String getId() {
return id;
}
public Component getDisplayName() {
return displayName;
}
public void setDisplayName(Component displayName) {
this.displayName = displayName;
}
public ObjectiveMode getType() {
return type;
}
public void setType(ObjectiveMode type) {
this.type = type;
}
public List<Team> getTeams() {
return teams;
}
public Map<String, Score> getScores() {
return scores;
}
@Override
public String toString() {
return "Objective{" +
"id='" + id + '\'' +
", displayName='" + displayName + '\'' +
", type='" + type + '\'' +
", teams=" + teams +
", scores=" + scores +
'}';
}
}

Datei anzeigen

@ -1,6 +0,0 @@
package com.velocitypowered.proxy.data.scoreboard;
public enum ObjectiveMode {
INTEGER,
HEARTS
}

Datei anzeigen

@ -1,43 +0,0 @@
package com.velocitypowered.proxy.data.scoreboard;
import java.util.Objects;
public class Score {
private final String target;
private final int value;
public Score(String target, int value) {
this.target = target;
this.value = value;
}
public String getTarget() {
return target;
}
public int getValue() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Score score = (Score) o;
return value == score.value &&
Objects.equals(target, score.target);
}
@Override
public int hashCode() {
return Objects.hash(target, value);
}
@Override
public String toString() {
return "Score{" +
"target='" + target + '\'' +
", value=" + value +
'}';
}
}

Datei anzeigen

@ -1,45 +0,0 @@
package com.velocitypowered.proxy.data.scoreboard;
import java.util.HashMap;
import java.util.Map;
public class Scoreboard {
private String displayName;
private byte position;
private final Map<String, Objective> objectives = new HashMap<>();
private final Map<String, Team> teams = new HashMap<>();
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public byte getPosition() {
return position;
}
public void setPosition(byte position) {
this.position = position;
}
public Map<String, Objective> getObjectives() {
return objectives;
}
public Map<String, Team> getTeams() {
return teams;
}
@Override
public String toString() {
return "Scoreboard{" +
"displayName='" + displayName + '\'' +
", position=" + position +
", objectives=" + objectives +
", teams=" + teams +
'}';
}
}

Datei anzeigen

@ -1,89 +0,0 @@
package com.velocitypowered.proxy.data.scoreboard;
import java.util.Collection;
import java.util.HashSet;
public class Team {
private final String id;
private String prefix;
private String suffix;
private byte flags;
private String nameTagVisibility;
private String collision;
private byte color;
private final Collection<String> players = new HashSet<>();
public Team(String id) {
this.id = id;
}
public String getId() {
return id;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getSuffix() {
return suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public byte getFlags() {
return flags;
}
public void setFlags(byte flags) {
this.flags = flags;
}
public String getNameTagVisibility() {
return nameTagVisibility;
}
public void setNameTagVisibility(String nameTagVisibility) {
this.nameTagVisibility = nameTagVisibility;
}
public String getCollision() {
return collision;
}
public void setCollision(String collision) {
this.collision = collision;
}
public byte getColor() {
return color;
}
public void setColor(byte color) {
this.color = color;
}
public Collection<String> getPlayers() {
return players;
}
@Override
public String toString() {
return "Team{" +
"id='" + id + '\'' +
", prefix='" + prefix + '\'' +
", suffix='" + suffix + '\'' +
", flags=" + flags +
", nameTagVisibility='" + nameTagVisibility + '\'' +
", collision='" + collision + '\'' +
", color=" + color +
", players=" + players +
'}';
}
}

Datei anzeigen

@ -1,6 +1,5 @@
package com.velocitypowered.proxy.protocol.packet; package com.velocitypowered.proxy.protocol.packet;
import com.velocitypowered.proxy.data.scoreboard.ObjectiveMode;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.ProtocolConstants; import com.velocitypowered.proxy.protocol.ProtocolConstants;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils;
@ -86,4 +85,9 @@ public class ScoreboardObjective implements MinecraftPacket {
} }
} }
} }
public enum ObjectiveMode {
INTEGER,
HEARTS
}
} }

Datei anzeigen

@ -1,22 +1,22 @@
package com.velocitypowered.proxy.protocol.util; package com.velocitypowered.proxy.protocol.util;
import com.velocitypowered.proxy.data.scoreboard.ObjectiveMode; import com.velocitypowered.proxy.protocol.packet.ScoreboardObjective;
public class ScoreboardProtocolUtil { public class ScoreboardProtocolUtil {
private ScoreboardProtocolUtil() { private ScoreboardProtocolUtil() {
throw new AssertionError(); throw new AssertionError();
} }
public static ObjectiveMode getMode(String mode) { public static ScoreboardObjective.ObjectiveMode getMode(String mode) {
return ObjectiveMode.valueOf(mode.toUpperCase()); return ScoreboardObjective.ObjectiveMode.valueOf(mode.toUpperCase());
} }
public static ObjectiveMode getMode(int enumVal) { public static ScoreboardObjective.ObjectiveMode getMode(int enumVal) {
switch (enumVal) { switch (enumVal) {
case 0: case 0:
return ObjectiveMode.INTEGER; return ScoreboardObjective.ObjectiveMode.INTEGER;
case 1: case 1:
return ObjectiveMode.HEARTS; return ScoreboardObjective.ObjectiveMode.HEARTS;
default: default:
throw new IllegalStateException("Unknown mode " + enumVal); throw new IllegalStateException("Unknown mode " + enumVal);
} }