mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-03 14:22:25 +00:00
初步兼容leaves假人
This commit is contained in:
@@ -6,6 +6,7 @@ import net.kyori.adventure.text.Component;
|
||||
import net.momirealms.craftengine.core.plugin.Plugin;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -13,8 +14,16 @@ import java.util.UUID;
|
||||
public interface NetWorkUser {
|
||||
boolean isOnline();
|
||||
|
||||
// 对假人来说会null
|
||||
@Nullable
|
||||
Channel nettyChannel();
|
||||
|
||||
// 对假人来说会null
|
||||
@Nullable
|
||||
ChannelHandler connection();
|
||||
|
||||
boolean isFakePlayer();
|
||||
|
||||
Plugin plugin();
|
||||
|
||||
String name();
|
||||
@@ -49,8 +58,6 @@ public interface NetWorkUser {
|
||||
|
||||
Object platformPlayer();
|
||||
|
||||
ChannelHandler connection();
|
||||
|
||||
Map<Integer, EntityPacketHandler> entityPacketHandlers();
|
||||
|
||||
boolean clientModEnabled();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class VersionHelper {
|
||||
private static final boolean mojmap;
|
||||
private static final boolean folia;
|
||||
private static final boolean paper;
|
||||
|
||||
private static final boolean leaves;
|
||||
private static final boolean v1_20;
|
||||
private static final boolean v1_20_1;
|
||||
private static final boolean v1_20_2;
|
||||
@@ -77,6 +77,7 @@ public class VersionHelper {
|
||||
mojmap = checkMojMap();
|
||||
folia = checkFolia();
|
||||
paper = checkPaper();
|
||||
leaves = checkLeaves();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to init VersionHelper", e);
|
||||
}
|
||||
@@ -150,6 +151,15 @@ public class VersionHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean checkLeaves() {
|
||||
try {
|
||||
Class.forName("org.leavesmc.leaves.bot.ServerBot");
|
||||
return true;
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isFolia() {
|
||||
return folia;
|
||||
}
|
||||
@@ -158,6 +168,10 @@ public class VersionHelper {
|
||||
return paper;
|
||||
}
|
||||
|
||||
public static boolean isLeaves() {
|
||||
return leaves;
|
||||
}
|
||||
|
||||
public static boolean isMojmap() {
|
||||
return mojmap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user