Repository navigation
Expand file tree
/
Copy pathScoreboardStatus.java
More file actions
112 lines (101 loc) · 2.59 KB
/
Copy pathScoreboardStatus.java
File metadata and controls
112 lines (101 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package utils;
/**
* Scoreboard management class
* @author Mark Denihan
*
*/
public class ScoreboardStatus
{
private static boolean scoreboardEnabled = true;
private static String scoreboardClass = new String();
private static boolean adminOnlyScoreboard = false;
private static boolean classSpecificScoreboard = false;
/**
* Returns if user is authorised to see scoreboard currenly.
* @param userRole Must be player or admin
* @return
*/
public static boolean canSeeScoreboard (String userRole)
{
boolean authorised = true;
if(adminOnlyScoreboard)
authorised = userRole.equalsIgnoreCase("admin");
return authorised && scoreboardEnabled;
}
/**
* Disables scoreboard functions
*/
public static void disableScoreboard()
{
scoreboardEnabled = false;
adminOnlyScoreboard = false;
scoreboardClass = new String();
classSpecificScoreboard = false;
}
/**
* Used to tell if the current scoreboard config is set to Class Specific
* @return Boolean Value
*/
public static boolean getClassSpecificScoreboard()
{
return classSpecificScoreboard;
}
public static String getScoreboardClass()
{
return scoreboardClass;
}
/**
* Is the scoreboard configured to be displayed?
* @return
*/
public static boolean isScoreboardEnabled()
{
return scoreboardEnabled;
}
/**
* Sets the scoreboard to be admin only
*/
public static void setScoreboardAdminOnly()
{
adminOnlyScoreboard = true;
}
/**
* Enables public Scoreboard based on scores from specific class
* @param theClass Class to base the Scoreboard on
*/
public static void setScoreboardClass(String theClass)
{
scoreboardClass = theClass;
scoreboardEnabled = true;
adminOnlyScoreboard = false;
classSpecificScoreboard = false;
}
/**
* Sets the scoreboard to show users the score from their class only
*/
public static void setScoreboardClassSpecific()
{
scoreboardEnabled = true;
scoreboardClass = new String();
adminOnlyScoreboard = false;
classSpecificScoreboard = true;
}
/**
* Method to know if user is running a class specific scoreboard or not
* @return True if class specific scoreboard is enabled. Otherwise False
*/
public static boolean isClassSpecificScoreboard ()
{
return classSpecificScoreboard;
}
/**
* Sets scoreboard to list all players regardless of class
*/
public static void setScoreboeardOpen()
{
scoreboardEnabled = true;
scoreboardClass = new String();
adminOnlyScoreboard = false;
classSpecificScoreboard = false;
}
}