No longer replace the nice [keywords] with their e.g. ugly %3$.1f

counterparts in the config file.
This commit is contained in:
Evenprime 2011-06-18 18:15:05 +02:00
parent fda8ae4c06
commit 65ed8d4da6
3 changed files with 18 additions and 16 deletions

View File

@ -720,8 +720,17 @@ public class MovingCheck extends Check {
waterElevators = config.getBooleanValue("moving.waterelevators"); waterElevators = config.getBooleanValue("moving.waterelevators");
logMessage = config.getStringValue("moving.logmessage"); logMessage = config.getStringValue("moving.logmessage").
summaryMessage = config.getStringValue("moving.summarymessage"); replace("[player]", "%1$s").
replace("[world]", "%2$s").
replace("[from]", "(%4$.1f, %5$.1f, %6$.1f)").
replace("[to]", "(%7$.1f, %8$.1f, %9$.1f)").
replace("[distance]", "(%10$.1f, %11$.1f, %12$.1f)");
summaryMessage = config.getStringValue("moving.summarymessage").
replace("[timeframe]", "%2$d").
replace("[player]", "%1$s").
replace("[violations]", "(%3$d,%4$d,%5$d)");
actions = new Action[3][]; actions = new Action[3][];

View File

@ -172,7 +172,8 @@ public class SpeedhackCheck extends Check {
limits[1] = config.getIntegerValue("speedhack.limits.med"); limits[1] = config.getIntegerValue("speedhack.limits.med");
limits[2] = config.getIntegerValue("speedhack.limits.high"); limits[2] = config.getIntegerValue("speedhack.limits.high");
logMessage = config.getStringValue("speedhack.logmessage"); logMessage = config.getStringValue("speedhack.logmessage").
replace("[player]", "%1$s").replace("[events]", "%2$d").replace("[limit]", "%3$d");
actions = new Action[3][]; actions = new Action[3][];

View File

@ -62,7 +62,7 @@ public class NoCheatConfiguration {
try { try {
yamlContent = (Map<String, Object>) SimpleYaml.read(configurationFile); yamlContent = (Map<String, Object>) SimpleYaml.read(configurationFile);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); System.out.println("Couldn't use existing nocheat.yml, creating a new file.");
yamlContent = new HashMap<String, Object>(); yamlContent = new HashMap<String, Object>();
} }
@ -114,8 +114,7 @@ public class NoCheatConfiguration {
root.add(speedhackNode); root.add(speedhackNode);
speedhackNode.add(new LongStringOption("logmessage", speedhackNode.getFullIdentifier(), speedhackNode.add(new LongStringOption("logmessage", speedhackNode.getFullIdentifier(),
SimpleYaml.getString("speedhack.logmessage", "[player] sent [events] move events, but only [limit] were allowed. Speedhack?", yamlContent). SimpleYaml.getString("speedhack.logmessage", "[player] sent [events] move events, but only [limit] were allowed. Speedhack?", yamlContent)));
replace("[player]", "%1$s").replace("[events]", "%2$d").replace("[limit]", "%3$d")));
speedhackNode.add(new BooleanOption("checkops", speedhackNode.getFullIdentifier(), speedhackNode.add(new BooleanOption("checkops", speedhackNode.getFullIdentifier(),
SimpleYaml.getBoolean("speedhack.checkops", false, yamlContent))); SimpleYaml.getBoolean("speedhack.checkops", false, yamlContent)));
@ -153,18 +152,11 @@ public class NoCheatConfiguration {
root.add(movingNode); root.add(movingNode);
movingNode.add(new LongStringOption("logmessage", movingNode.getFullIdentifier(), movingNode.add(new LongStringOption("logmessage", movingNode.getFullIdentifier(),
SimpleYaml.getString("moving.logmessage", "Moving violation: [player] from [world] [from] to [to] distance [distance]", yamlContent). SimpleYaml.getString("moving.logmessage", "Moving violation: [player] from [world] [from] to [to] distance [distance]", yamlContent)));
replace("[player]", "%1$s").
replace("[world]", "%2$s").
replace("[from]", "(%4$.1f, %5$.1f, %6$.1f)").
replace("[to]", "(%7$.1f, %8$.1f, %9$.1f)").
replace("[distance]", "(%10$.1f, %11$.1f, %12$.1f)")));
movingNode.add(new LongStringOption("summarymessage", movingNode.getFullIdentifier(), movingNode.add(new LongStringOption("summarymessage", movingNode.getFullIdentifier(),
SimpleYaml.getString("moving.summarymessage", "Moving summary of last ~[timeframe] seconds: [player] total Violations: [violations]", yamlContent). SimpleYaml.getString("moving.summarymessage", "Moving summary of last ~[timeframe] seconds: [player] total Violations: [violations]", yamlContent)));
replace("[timeframe]", "%2$d").
replace("[player]", "%1$s").
replace("[violations]", "(%3$d,%4$d,%5$d)")));
movingNode.add(new BooleanOption("allowflying", movingNode.getFullIdentifier(), movingNode.add(new BooleanOption("allowflying", movingNode.getFullIdentifier(),
SimpleYaml.getBoolean("moving.allowflying", false, yamlContent))); SimpleYaml.getBoolean("moving.allowflying", false, yamlContent)));
movingNode.add(new BooleanOption("allowfakesneak", movingNode.getFullIdentifier(), movingNode.add(new BooleanOption("allowfakesneak", movingNode.getFullIdentifier(),