ScorePlayerTeam .java

net.minecraft.scoreboard.ScorePlayerTeam (class, 185 lines): extends Team. members: setSeeFriendlyInvisiblesEnabled, setDeathMessageVisibility, chatFormat.

net.minecraft.scoreboardclass185 linescommonextends Team4.5 KB

API Surface (22)

String getRegisteredName()
String getTeamName()
void setTeamName(String name)
Collection<String> getMembershipCollection()
String getColorPrefix()
void setNamePrefix(String prefix)
String getColorSuffix()
void setNameSuffix(String suffix)
String formatString(String input)
String formatPlayerName(Team p_96667_0_, String p_96667_1_)
boolean getAllowFriendlyFire()
void setAllowFriendlyFire(boolean friendlyFire)
boolean getSeeFriendlyInvisiblesEnabled()
void setSeeFriendlyInvisiblesEnabled(boolean friendlyInvisibles)
Team.EnumVisible getNameTagVisibility()
Team.EnumVisible getDeathMessageVisibility()
void setNameTagVisibility(Team.EnumVisible p_178772_1_)
void setDeathMessageVisibility(Team.EnumVisible p_178773_1_)
int func_98299_i()
void func_98298_a(int p_98298_1_)
void setChatFormat(EnumChatFormatting p_178774_1_)
EnumChatFormatting getChatFormat()

Fields & Constants (11)

theScoreboard
registeredName
membershipSet
teamNameSPT
namePrefixSPT
colorSuffix
allowFriendlyFire
canSeeFriendlyInvisibles
nameTagVisibility
deathMessageVisibility
chatFormat

String literals (2)

"Name cannot be null"
"Prefix cannot be null"

Code Graph: Dependencies (3)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ScorePlayerTeam.java185 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.scoreboard;
2
3
import com.google.common.collect.Sets;
4
import java.util.Collection;
5
import java.util.Set;
6
import net.minecraft.util.EnumChatFormatting;
7
8
public class ScorePlayerTeam extends Team
9
{
10
    private final Scoreboard theScoreboard;
11
    private final String registeredName;
12
    private final Set<String> membershipSet = Sets.<String>newHashSet();
13
    private String teamNameSPT;
14
    private String namePrefixSPT = "";
15
    private String colorSuffix = "";
16
    private boolean allowFriendlyFire = true;
17
    private boolean canSeeFriendlyInvisibles = true;
18
    private Team.EnumVisible nameTagVisibility = Team.EnumVisible.ALWAYS;
19
    private Team.EnumVisible deathMessageVisibility = Team.EnumVisible.ALWAYS;
20
    private EnumChatFormatting chatFormat = EnumChatFormatting.RESET;
21
22
    public ScorePlayerTeam(Scoreboard theScoreboardIn, String name)
23
    {
24
        this.theScoreboard = theScoreboardIn;
25
        this.registeredName = name;
26
        this.teamNameSPT = name;
27
    }
28
29
    /**
30
     * Retrieve the name by which this team is registered in the scoreboard
31
     */
32
    public String getRegisteredName()
33
    {
34
        return this.registeredName;
35
    }
36
37
    public String getTeamName()
38
    {
39
        return this.teamNameSPT;
40
    }
41
42
    public void setTeamName(String name)
43
    {
44
        if (name == null)
45
        {
46
            throw new IllegalArgumentException("Name cannot be null");
47
        }
48
        else
49
        {
50
            this.teamNameSPT = name;
51
            this.theScoreboard.sendTeamUpdate(this);
52
        }
53
    }
54
55
    public Collection<String> getMembershipCollection()
56
    {
57
        return this.membershipSet;
58
    }
59
60
    /**
61
     * Returns the color prefix for the player's team name
62
     */
63
    public String getColorPrefix()
64
    {
65
        return this.namePrefixSPT;
66
    }
67
68
    public void setNamePrefix(String prefix)
69
    {
70
        if (prefix == null)
71
        {
72
            throw new IllegalArgumentException("Prefix cannot be null");
73
        }
74
        else
75
        {
76
            this.namePrefixSPT = prefix;
77
            this.theScoreboard.sendTeamUpdate(this);
78
        }
79
    }
80
81
    /**
82
     * Returns the color suffix for the player's team name
83
     */
84
    public String getColorSuffix()
85
    {
86
        return this.colorSuffix;
87
    }
88
89
    public void setNameSuffix(String suffix)
90
    {
91
        this.colorSuffix = suffix;
92
        this.theScoreboard.sendTeamUpdate(this);
93
    }
94
95
    public String formatString(String input)
96
    {
97
        return this.getColorPrefix() + input + this.getColorSuffix();
98
    }
99
100
    /**
101
     * Returns the player name including the color prefixes and suffixes
102
     */
103
    public static String formatPlayerName(Team p_96667_0_, String p_96667_1_)
104
    {
105
        return p_96667_0_ == null ? p_96667_1_ : p_96667_0_.formatString(p_96667_1_);
106
    }
107
108
    public boolean getAllowFriendlyFire()
109
    {
110
        return this.allowFriendlyFire;
111
    }
112
113
    public void setAllowFriendlyFire(boolean friendlyFire)
114
    {
115
        this.allowFriendlyFire = friendlyFire;
116
        this.theScoreboard.sendTeamUpdate(this);
117
    }
118
119
    public boolean getSeeFriendlyInvisiblesEnabled()
120
    {
121
        return this.canSeeFriendlyInvisibles;
122
    }
123
124
    public void setSeeFriendlyInvisiblesEnabled(boolean friendlyInvisibles)
125
    {
126
        this.canSeeFriendlyInvisibles = friendlyInvisibles;
127
        this.theScoreboard.sendTeamUpdate(this);
128
    }
129
130
    public Team.EnumVisible getNameTagVisibility()
131
    {
132
        return this.nameTagVisibility;
133
    }
134
135
    public Team.EnumVisible getDeathMessageVisibility()
136
    {
137
        return this.deathMessageVisibility;
138
    }
139
140
    public void setNameTagVisibility(Team.EnumVisible p_178772_1_)
141
    {
142
        this.nameTagVisibility = p_178772_1_;
143
        this.theScoreboard.sendTeamUpdate(this);
144
    }
145
146
    public void setDeathMessageVisibility(Team.EnumVisible p_178773_1_)
147
    {
148
        this.deathMessageVisibility = p_178773_1_;
149
        this.theScoreboard.sendTeamUpdate(this);
150
    }
151
152
    public int func_98299_i()
153
    {
154
        int i = 0;
155
156
        if (this.getAllowFriendlyFire())
157
        {
158
            i |= 1;
159
        }
160
161
        if (this.getSeeFriendlyInvisiblesEnabled())
162
        {
163
            i |= 2;
164
        }
165
166
        return i;
167
    }
168
169
    public void func_98298_a(int p_98298_1_)
170
    {
171
        this.setAllowFriendlyFire((p_98298_1_ & 1) > 0);
172
        this.setSeeFriendlyInvisiblesEnabled((p_98298_1_ & 2) > 0);
173
    }
174
175
    public void setChatFormat(EnumChatFormatting p_178774_1_)
176
    {
177
        this.chatFormat = p_178774_1_;
178
    }
179
180
    public EnumChatFormatting getChatFormat()
181
    {
182
        return this.chatFormat;
183
    }
184
}
185

Deobfuscated MCP 1.8.9 source of ScorePlayerTeam from Marcelektro/MavenMCP-1.8.9 (net/minecraft/scoreboard/ScorePlayerTeam.java), stored verbatim.