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