Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'com.springwater.easybot'
version = '2.1.2'
version = '2.1.3'

repositories {
mavenCentral()
Expand Down Expand Up @@ -60,7 +60,7 @@ tasks.build.dependsOn(tasks.shadowJar)

dependencies {
compileOnly "org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT"
implementation 'com.springwater.easybot:easybot-bridge:1.5'
implementation 'com.springwater.easybot:easybot-bridge:1.7-rc.1'
implementation 'org.javassist:javassist:3.28.0-GA'
implementation 'bot.inker.acj:runtime:1.5'
implementation 'org.reflections:reflections:0.10.2'
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/com/springwater/easybot/Easybot.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,23 +292,6 @@ public void runTask(Runnable task) {
}
}

@EventHandler
public void onServerStarted(ServerLoadEvent event) {
if (event.getType() == ServerLoadEvent.LoadType.STARTUP) {
boolean useNativeRcon = getConfig().getBoolean("adapter.native_rcon.use_native_rcon", false);
if (!useNativeRcon) return;
Thread rconThread = new Thread(() -> {
try {
getLogger().info("10s后启动原生RCON,请耐心等待!");
Thread.sleep(10000);
} catch (InterruptedException ignored) {
}
restartNativeRcon();
}, "EasyBot-Rcon-Thread");
rconThread.start();
}
}

private void restartNativeRcon() {
try {
boolean useNativeRcon = getConfig().getBoolean("adapter.native_rcon.use_native_rcon", false);
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/springwater/easybot/api/CommandApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public CommandApi() throws IllegalAccessException {
if (useNativeRcon) {
nativeRcon = new NativeRcon();
Easybot.instance.getLogger().info("命令接口初始化成功 [原生RCON接口]");
startNativeRcon();
return;
}

Expand Down Expand Up @@ -63,8 +64,13 @@ private static Class<?> getRconConsoleSourceClassPath() throws ClassNotFoundExce
throw new ClassNotFoundException("Can not find RconConsoleSource class path");
}

public void startNativeRcon() throws AuthenticationException, IOException {
nativeRcon.start();
public void startNativeRcon() {
new Thread(() -> {
try {
nativeRcon.start();
} catch (Exception ignored) {
}
}).start();
}

public void closeNativeRcon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void onPlayerLogin(AsyncPlayerPreLoginEvent event) {
if(FakePlayerUtils.isFake(event.getName())) return;
String ip = event.getAddress().getHostAddress();
String name = GeyserUtils.getName(event.getUniqueId());
if (name == null) name = event.getPlayerProfile().getName();
if (name == null) name = event.getName();
Easybot.getClient().reportPlayer(name, GeyserUtils.getUuid(event.getUniqueId()).toString(), ip);
PlayerLoginResultPacket result = Easybot.getClient().login(
name,
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/com/springwater/easybot/utils/ItemsAdderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,22 @@ public static boolean isItemsAdderInstalled() {
}

public static boolean isQFacesInstalled() {
if(!isItemsAdderInstalled()){
try {
if (!isItemsAdderInstalled()) {
return false;
}
return new FontImageWrapper("qqnt_sysface_res:qface_0").exists();
} catch (Exception ignored) {
return false;
}
return new FontImageWrapper("qqnt_sysface_res:qface_0").exists();
}

public static String getFace(int faceId) {
if(!isQFacesInstalled()){
if (!isQFacesInstalled()) {
return "";
}
FontImageWrapper warper = new FontImageWrapper("qqnt_sysface_res:qface_" + faceId);
if(!warper.exists()){
if (!warper.exists()) {
return null;
}
return warper.getString();
Expand Down