|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectme.armar.plugins.autorank.warningmanager.WarningManager
public class WarningManager
This class handles all warning message that are displayed when something is wrong with Autorank. Instead of disabling Autorank, it should display warnings when an admin joins.
Warnings will be stored in a list. Every warning will have its own priority. Whenever an player joins that has the permission 'autorank.warning.notice', the warning manager will grab the warning with the highest priority and show it to the player. This way the admin knows something is up and he has to fix it.
The highest priority warning will be saved as a message so it doesn't have to be recalculated every time someone joins. It will be determined when the first player that has the correct permission joins.
The priority level goes from 1 to 10, with 1 being the lowest priority and thus no need for attention, and 10 the highest, which represents critical failures.
The warning message is stored as a string including the priority level. The warnings list stores the strings in no particular
order. The full string can be: "AdvancedConfig.yml contains incorrect groups!>10". The '>' identifier splits the real warning message
and the priority. If this identifier is not found, the priority will be set to 1.
NOTE:
Warnings cannot be unregistered. The only way to remove the warnings is to fix them so they don't ever get registered.
| Field Summary | |
|---|---|
private java.lang.String |
highestPriorityWarn
|
private java.util.List<java.lang.String> |
warnings
|
| Constructor Summary | |
|---|---|
WarningManager()
|
|
| Method Summary | |
|---|---|
private java.lang.String |
findHighestPriorityWarning()
|
private java.lang.String |
findMessage(java.lang.String warning)
|
private int |
findPriority(java.lang.String warning)
|
java.lang.String |
getHighestWarning()
Returns warning with the highest priority level. |
void |
registerWarning(java.lang.String message,
int priority)
Register a new warning. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String highestPriorityWarn
private java.util.List<java.lang.String> warnings
| Constructor Detail |
|---|
public WarningManager()
| Method Detail |
|---|
public void registerWarning(java.lang.String message,
int priority)
message - Warning message descriptionpriority - Priority level (1 - 10).public java.lang.String getHighestWarning()
private java.lang.String findHighestPriorityWarning()
private int findPriority(java.lang.String warning)
private java.lang.String findMessage(java.lang.String warning)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||