Skip to content

Commit aea80fc

Browse files
[+] Added copy right to each file.
[!] Added color to the tab completer. [+] Added colored Command Menu. [~] Improved README.md
1 parent e0fefc2 commit aea80fc

File tree

18 files changed

+108
-60
lines changed

18 files changed

+108
-60
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
## Screenshots:
6161
### Running on Windows server 2019:
6262
<p align="center">
63-
<img src="assets/dolphinbot1.png">
63+
<img src="assets/dev2.png">
6464
</p>
6565

6666
## Introduction:
@@ -281,14 +281,14 @@ each profile name, should be split with ";".
281281
Every single config option is equilibrium to option that defined by command line, and all config value including
282282
unrecognized option will be parsed, so you can add your customize config options.
283283
An example for configuring this file:
284-
```json
285-
{
286-
"server": "2b2t.xin",
287-
"port": 25565,
284+
```json
285+
{
286+
"server": "2b2t.xin",
287+
"port": 25565,
288288
"auto-reconnect": true,
289289
"packet-filter-delay": 0,
290290
"msg-send-delay": 0,
291-
"max-chunk-view": 12,
291+
"max-chunk-view": 12,
292292
"anti-AFK": true,
293293
"language": "zh",
294294
"connect-timing-out": 2000,
@@ -301,7 +301,7 @@ each profile name, should be split with ";".
301301
"enable-skin-recorder": false
302302
}
303303
}
304-
```
304+
```
305305
### Config Options:
306306
307307
| Config | Description |
File renamed without changes.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<groupId>org.angellock.impl</groupId>
2424
<artifactId>DolphinBot</artifactId>
25-
<version>1.3.0-RELEASE-full</version>
25+
<version>1.3.1-RELEASE-full</version>
2626
<packaging>
2727
jar
2828
</packaging>

src/main/java/org/angellock/impl/EnumSystemEvents.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ public enum EnumSystemEvents {
4747
PLUGIN_LOAD_TERMINAL_COMMANDS("plugin.load.terminal.command"),
4848
PLUGIN_LOAD_COMPLETE("plugin.load.complete"),
4949
PLAYER_INFO_CRACKED("info.cracked"),
50-
PLAYER_INFO_ONLINE("info.online");
50+
PLAYER_INFO_ONLINE("info.online"),
51+
CHAT_COMMAND_DETECTED("chat.command.detected"),
52+
PROXY_CONFIG_INVALID("proxy.config.invalid"),
53+
DOLPHIN_BOTS_LOAD("dolphin.bot.load"),
54+
PROXY_CONFIG_LOAD("proxy.config.load"),
55+
CONFIG_FILE_LOADED("bot.config.file.loaded"),
56+
COMMANDLINE_LOADED("commandline.enabled");
5157

5258
private final String spaceName;
5359

src/main/java/org/angellock/impl/Start.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.angellock.impl.managers.BotManager;
2525
import org.angellock.impl.managers.ConfigManager;
2626
import org.angellock.impl.util.ConsoleTokens;
27+
import org.angellock.impl.util.TranslatableUtil;
2728
import org.angellock.impl.win32terminal.AnsiEscapes;
2829
import org.jetbrains.annotations.Nullable;
2930
import org.jline.reader.LineReader;
@@ -95,7 +96,7 @@ public static void main(String[] args) {
9596
} else {
9697
AnsiEscapes.printArt(ARCHIVE_VERSION);
9798
config.printConfigSpec();
98-
log.info(ConsoleTokens.colorizeText("&8Loading bots..."));
99+
log.info(TranslatableUtil.getFormattedMessage(EnumSystemEvents.DOLPHIN_BOTS_LOAD));
99100
botManager.startAll();
100101
}
101102

@@ -104,23 +105,24 @@ public static void main(String[] args) {
104105
private static void getTerminal(AbstractRobot dolphinBot) {
105106
LineReader reader = AnsiEscapes.getReader();
106107
terminalInput = new Thread(() -> {
107-
try {
108-
while (true) {
108+
while (true) {
109+
try {
109110
String s = reader.readLine(ConsoleTokens.colorizeText("&lTerminal>&b"));
110111
ChatMessageManager messageManager = dolphinBot.getMessageManager();
111112
if (messageManager != null) {
112113
dolphinBot.getMessageManager().putMessage(s);
113114
}
115+
} catch (UserInterruptException w) {
116+
if (exit) {
117+
System.exit(0);
118+
} else {
119+
log.warn("To exit DolphinBot, press Ctrl + C again.");
120+
exit = true;
121+
}
122+
} catch (Throwable e) {
123+
e.printStackTrace();
124+
log.info(ConsoleTokens.colorizeText("&8Failed to send message: &7{}"), e.getMessage());
114125
}
115-
} catch (UserInterruptException w) {
116-
if (exit){
117-
System.exit(0);
118-
} else {
119-
log.warn("To exit DolphinBot, press Ctrl + C again.");
120-
exit = true;
121-
}
122-
} catch (Throwable e) {
123-
log.info(ConsoleTokens.colorizeText("&8Failed to send message: &7{}"), e.getLocalizedMessage());
124126
}
125127
});
126128
terminalInput.start();

src/main/java/org/angellock/impl/commands/CommandSpec.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
import lombok.Getter;
2020
import org.angellock.impl.AbstractRobot;
21+
import org.angellock.impl.EnumSystemEvents;
2122
import org.angellock.impl.util.ConsoleTokens;
23+
import org.angellock.impl.util.TranslatableUtil;
2224
import org.jetbrains.annotations.Nullable;
2325
import org.slf4j.Logger;
2426
import org.slf4j.LoggerFactory;
@@ -47,7 +49,7 @@ public void register(Command command){
4749

4850
public void executeCommand(CommandResponse response) {
4951
if (response != null) {
50-
log.info("CommandList: {}, sender: {}", Arrays.toString(response.getCommandList()), response.getSender());
52+
log.info(TranslatableUtil.getFormattedMessage(EnumSystemEvents.CHAT_COMMAND_DETECTED, Arrays.toString(response.getCommandList()), response.getSender()));
5153
Command cmd = this.getCommand(response.getCommandList()[0]);
5254
if (cmd != null) {
5355
boolean success = cmd.activate(response, bot);

src/main/java/org/angellock/impl/commands/dolphin/completers/LoadPluginCompleter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public List<String> complete(String[] cmdList) {
3838
List<String> list = new ArrayList<>();
3939
if (cmdList[0].equalsIgnoreCase("load")) {
4040
for (String plugin : plugins) {
41-
if (plugin.contains(cmdList[1])) {
41+
if (cmdList.length == 1 || plugin.contains(cmdList[1])) {
4242
list.add(plugin);
4343
}
4444
}

src/main/java/org/angellock/impl/dolphin/DolphinWindow.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* DolphinBot - https://github.com/NeonAngelThreads/DolphinBot
3+
* Copyright (C) 2025 NeonAngelThreads (https://github.com/NeonAngelThreads)
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6+
* License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any
7+
* later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10+
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
11+
* License for more details. You should have received a copy of the GNU General Public License along with this
12+
* program. If not, see <https://www.gnu.org/licenses/>.
13+
*
14+
* https://space.bilibili.com/386644641
15+
*/
16+
117
package org.angellock.impl.dolphin;
218

319
import javax.swing.*;

src/main/java/org/angellock/impl/dolphin/GUIWindowManager.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* DolphinBot - https://github.com/NeonAngelThreads/DolphinBot
3+
* Copyright (C) 2025 NeonAngelThreads (https://github.com/NeonAngelThreads)
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6+
* License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any
7+
* later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10+
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
11+
* License for more details. You should have received a copy of the GNU General Public License along with this
12+
* program. If not, see <https://www.gnu.org/licenses/>.
13+
*
14+
* https://space.bilibili.com/386644641
15+
*/
16+
117
package org.angellock.impl.dolphin;
218

319
import org.angellock.impl.Start;

src/main/java/org/angellock/impl/managers/BotManager.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import com.google.gson.Gson;
2020
import com.google.gson.GsonBuilder;
2121
import com.google.gson.JsonElement;
22+
import lombok.Getter;
2223
import org.angellock.impl.AbstractRobot;
24+
import org.angellock.impl.EnumSystemEvents;
2325
import org.angellock.impl.RobotPlayer;
2426
import org.angellock.impl.extensions.Plugins;
2527
import org.angellock.impl.plugin.AbstractPlugin;
@@ -41,6 +43,7 @@
4143
public class BotManager extends ResourceHelper {
4244
private static final Logger log = LoggerFactory.getLogger("BotManager");
4345
private static final Map<String, RobotPlayer> bots = new HashMap<>();
46+
@Getter
4447
private static final TranslatableUtil systemEventLogger = new TranslatableUtil();
4548
private final Gson gson = new GsonBuilder()
4649
.serializeNulls()
@@ -67,10 +70,6 @@ public BotManager globalPluginManager(@Nullable File pluginDir) {
6770
return this;
6871
}
6972

70-
public static TranslatableUtil getSystemEventLogger() {
71-
return systemEventLogger;
72-
}
73-
7473
public String[] escapeArrayCommandLine(String option) {
7574
if (option != null) {
7675
return option.replaceAll("\"", "").split(";");
@@ -125,15 +124,15 @@ private void registerBot(Map<String, JsonElement> profiles, String name) {
125124
if (proxySetting != null && proxySetting.isEnabled()) {
126125
ProxyObject.Info info = proxySetting.getInfo();
127126
if (info.isValid()) {
128-
log.info(ConsoleTokens.colorizeText("&bProxy setting Enabled: {}"), info);
127+
log.info(TranslatableUtil.getFormattedMessage(EnumSystemEvents.PROXY_CONFIG_LOAD, info));
129128

130129
proxyInfo = new ProxyInfo(info.getType(),
131130
new InetSocketAddress(info.getAddress(), info.getPort()),
132131
info.getUsername(),
133132
info.getPassword()
134133
);
135134
} else {
136-
log.info(ConsoleTokens.colorizeText("&4The Proxy setting invalid: &c&n&o{}"), info);
135+
log.info(TranslatableUtil.getFormattedMessage(EnumSystemEvents.PROXY_CONFIG_INVALID, info));
137136
}
138137
}
139138

0 commit comments

Comments
 (0)