Skip to content

Commit 8cd18f2

Browse files
committed
style changes
1 parent 4149d06 commit 8cd18f2

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

main/java/net/ildar/wurm/BotController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ private synchronized void pauseAllBots() {
138138
} else {
139139
activeBots.forEach(Bot::setResumed);
140140
}
141-
Mod.hud.addOnscreenMessage("Robots have been " + (gPaused ? "paused!" : "resumed!"), 0, 150, 0, (byte) 1);
141+
Utils.consolePrint("All bots have been " + (gPaused ? "paused!" : "resumed!"));
142142
} else {
143-
Mod.hud.addOnscreenMessage("No bots are running!", 0, 0, 0, (byte) 1);
143+
Utils.consolePrint("No bots are running!");
144144
}
145145
}
146146

main/java/net/ildar/wurm/bot/Bot.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ public Bot() {
2727
registerInputHandler(InputKeyBase.t, this::handleTimeoutChange);
2828
registerInputHandler(InputKeyBase.off, inputs -> deactivate());
2929
registerInputHandler(InputKeyBase.info, this::handleInfoCommand);
30-
registerInputHandler(InputKeyBase.pause, inputs -> pause());
30+
registerInputHandler(InputKeyBase.pause, inputs -> togglePause());
3131
}
3232

33+
//Bot implementations must do their stuff here
3334
abstract void work() throws Exception;
3435

3536
@Override
36-
public void run() {
37+
public final void run() {
3738
try {
3839
work();
3940
} catch (InterruptedException ignored) {
@@ -55,7 +56,7 @@ public static BotRegistration getRegistration() {
5556
* Sometimes the interruption status of a thread is cleared(ignored,lost) in the bot(the bot developer should avoid that),
5657
* so we check current bot instance for presence in active bot list
5758
*/
58-
public boolean isActive() {
59+
boolean isActive() {
5960
return BotController.getInstance().isActive(this) && !isInterrupted();
6061
}
6162

@@ -65,7 +66,7 @@ synchronized void waitOnPause() throws InterruptedException {
6566
}
6667
}
6768

68-
private void pause() {
69+
private void togglePause() {
6970
if (paused) {
7071
this.setResumed();
7172
} else {
@@ -132,7 +133,7 @@ void printInputKeyUsageString(InputKey inputKey) {
132133
*
133134
* @param data console input
134135
*/
135-
final public void handleInput(String[] data) {
136+
public void handleInput(String[] data) {
136137
if (data == null || data.length == 0)
137138
return;
138139
InputHandler inputHandler = getInputHandler(data[0]);
@@ -174,7 +175,7 @@ private void handleTimeoutChange(String[] input) {
174175
}
175176
}
176177

177-
protected void setTimeout(int timeout) {
178+
final void setTimeout(int timeout) {
178179
if (timeout < 100) {
179180
Utils.consolePrint("Too small timeout!");
180181
timeout = 100;
@@ -186,7 +187,7 @@ protected void setTimeout(int timeout) {
186187
/**
187188
* The enumeration type of the key must have a usage and description string fields for each item
188189
*/
189-
void registerInputHandler(InputKey key, InputHandler inputHandler) {
190+
final void registerInputHandler(InputKey key, InputHandler inputHandler) {
190191
InputKey oldKey = getInputKey(key.getName());
191192
if (oldKey != null)
192193
inputHandlers.remove(oldKey);
@@ -223,7 +224,7 @@ private enum InputKeyBase implements InputKey {
223224
"timeout(in milliseconds)"),
224225
off("Deactivate the bot",
225226
""),
226-
pause("Pausing the bot. Assign a hotkey for it (e.m. 'bind p \"bot pause\"') for more convenience.",
227+
pause("Pause/resume the bot",
227228
""),
228229
info("Get information about configuration key",
229230
"key");

0 commit comments

Comments
 (0)