3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 23:30:26 +01:00

Initial scoreboard objects

We need to make these nicer, but for internal use they're fine.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-07-30 16:36:15 -04:00
Ursprung dde6560a5a
Commit bc1dc457e7
4 geänderte Dateien mit 224 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,49 @@
package com.velocitypowered.proxy.data.scoreboard;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Objective {
private final String id;
private String displayName;
private String 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 String getDisplayName() {
return displayName;
}
public String getType() {
return 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

@ -0,0 +1,43 @@
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

@ -0,0 +1,43 @@
package com.velocitypowered.proxy.data.scoreboard;
import java.util.ArrayList;
import java.util.List;
public class Scoreboard {
private String name;
private byte position;
private final List<Objective> objectives = new ArrayList<>();
public Scoreboard() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public byte getPosition() {
return position;
}
public void setPosition(byte position) {
this.position = position;
}
public List<Objective> getObjectives() {
return objectives;
}
@Override
public String toString() {
return "Scoreboard{" +
"name='" + name + '\'' +
", position=" + position +
", objectives=" + objectives +
'}';
}
}

Datei anzeigen

@ -0,0 +1,89 @@
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 +
'}';
}
}