mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 13:57:49 +01:00
Small adjustments for logging.
This commit is contained in:
parent
aecf3a6f1f
commit
4a26f741df
@ -59,13 +59,20 @@ public abstract class ActionWithParameters extends Action {
|
||||
*/
|
||||
protected String getMessage(final ViolationData violationData) {
|
||||
// Should be big enough most of the time.
|
||||
final StringBuilder log = new StringBuilder(100);
|
||||
final StringBuilder log = new StringBuilder(150);
|
||||
|
||||
for (final Object part : messageParts)
|
||||
if (part instanceof String)
|
||||
log.append((String) part);
|
||||
else
|
||||
log.append(violationData.getParameter((ParameterName) part));
|
||||
else if (part == null) log.append("[???]");
|
||||
else{
|
||||
try{
|
||||
log.append(violationData.getParameter((ParameterName) part));
|
||||
}
|
||||
catch (Exception e){
|
||||
log.append(part.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return log.toString();
|
||||
}
|
||||
@ -89,7 +96,7 @@ public abstract class ActionWithParameters extends Action {
|
||||
if (parts2.length != 2)
|
||||
messageParts.add(message);
|
||||
else {
|
||||
final ParameterName w = ParameterName.get(parts2[0]);
|
||||
final ParameterName w = ParameterName.get(parts2[0].toLowerCase());
|
||||
|
||||
if (w != null) {
|
||||
// Found an existing wildcard inbetween the braces.
|
||||
|
@ -131,13 +131,14 @@ public class ViolationData {
|
||||
* @return Will always return some string, if not set: "<?PARAMETERNAME>".
|
||||
*/
|
||||
public String getParameter(final ParameterName parameterName){
|
||||
if (parameterName == null) return "<???>";
|
||||
switch (parameterName) {
|
||||
case CHECK:
|
||||
return check.getClass().getSimpleName();
|
||||
case PLAYER:
|
||||
return player.getName();
|
||||
case VIOLATIONS:
|
||||
return String.valueOf(Math.round(vL));
|
||||
return String.valueOf((long) Math.round(vL));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user