Compare commits
10
Commits
2dcfae9ea2
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03936f6d71 | ||
|
|
9613e0333c | ||
|
|
88bc3867d5 | ||
|
|
41fc82ae6a | ||
|
|
700c4a4297 | ||
|
|
05e6cc32db | ||
|
|
330ac71a2e | ||
|
|
4f41401964 | ||
|
|
6a4eb12597 | ||
|
|
e1f775bf40 |
@@ -6,6 +6,9 @@ on:
|
|||||||
- main
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'README*.md'
|
- 'README*.md'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -14,13 +17,16 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up JDK 21
|
- name: Set up JDK 25
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '21'
|
java-version: '25'
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: maven
|
cache: maven
|
||||||
|
|
||||||
|
- name: Install the dependency
|
||||||
|
run: mvn install:install-file -DgroupId=me.clip -DartifactId=placeholderapi -Dversion=2.11.2 -Dpackaging=jar -Dfile=lib/placeholderapi-2.11.2.jar
|
||||||
|
|
||||||
- name: Build with Maven
|
- name: Build with Maven
|
||||||
run: mvn -B package --file pom.xml
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
@@ -39,6 +45,7 @@ jobs:
|
|||||||
run: echo "PROJECT_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)" >> $GITHUB_ENV
|
run: echo "PROJECT_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
env:
|
env:
|
||||||
@@ -46,7 +53,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag_name: v${{ env.PROJECT_VERSION }}
|
tag_name: v${{ env.PROJECT_VERSION }}
|
||||||
release_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}
|
release_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}
|
||||||
|
|
||||||
- name: Upload Artifact to GitHub Release
|
- name: Upload Artifact to GitHub Release
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -55,5 +64,3 @@ jobs:
|
|||||||
asset_path: ./target/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}.jar
|
asset_path: ./target/${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}.jar
|
||||||
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}.jar
|
asset_name: ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}.jar
|
||||||
asset_content_type: application/java-archive
|
asset_content_type: application/java-archive
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
target
|
||||||
|
.idea
|
||||||
@@ -34,3 +34,5 @@ Thank you all for your attention and support!
|
|||||||
The JAR files in the `lib` directory have been processed, with their method bodies removed to mitigate infringement risks.
|
The JAR files in the `lib` directory have been processed, with their method bodies removed to mitigate infringement risks.
|
||||||
|
|
||||||
> 已对 `lib` 目录下的 Jar 包进行处理,已移除方法体以避免侵权风险。
|
> 已对 `lib` 目录下的 Jar 包进行处理,已移除方法体以避免侵权风险。
|
||||||
|
|
||||||
|
[How to obtain the original JAR?](https://www.spigotmc.org/wiki/buildtools/)
|
||||||
|
|||||||
Binary file not shown.
@@ -6,13 +6,13 @@
|
|||||||
|
|
||||||
<groupId>pers.xanadu</groupId>
|
<groupId>pers.xanadu</groupId>
|
||||||
<artifactId>EnderDragon</artifactId>
|
<artifactId>EnderDragon</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>2.5.9-tss3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>EnderDragon</name>
|
<name>EnderDragon</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>25</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -21,16 +21,22 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.14.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>8</source>
|
<release>${java.version}</release>
|
||||||
<target>8</target>
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.46</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.4</version>
|
<version>3.6.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -148,6 +154,10 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>papermc</id>
|
||||||
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigotmc-repo</id>
|
<id>spigotmc-repo</id>
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
@@ -179,16 +189,15 @@
|
|||||||
<!-- <scope>provided</scope>-->
|
<!-- <scope>provided</scope>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc1.20.6</groupId>
|
<groupId>io.papermc.paper</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.20.6-R0.1</version>
|
<version>26.2.build.112-stable</version>
|
||||||
<scope>system</scope>
|
<scope>provided</scope>
|
||||||
<systemPath>${basedir}/lib/spigot-api-1.20.6-R0.1-20240613.152322-4-shaded.jar</systemPath>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.clip</groupId>
|
<groupId>me.clip</groupId>
|
||||||
<artifactId>placeholderapi</artifactId>
|
<artifactId>placeholderapi</artifactId>
|
||||||
<version>2.11.2</version>
|
<version>2.11.6</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<!-- <systemPath>${basedir}/lib/PlaceholderAPI-2.11.2.jar</systemPath>-->
|
<!-- <systemPath>${basedir}/lib/PlaceholderAPI-2.11.2.jar</systemPath>-->
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -222,13 +231,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.groovy</groupId>
|
<groupId>org.apache.groovy</groupId>
|
||||||
<artifactId>groovy</artifactId>
|
<artifactId>groovy</artifactId>
|
||||||
<version>4.0.18</version>
|
<version>4.0.32</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.30</version>
|
<version>1.18.46</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -99,16 +99,13 @@ public class DragonDeathListener implements Listener {
|
|||||||
private static void handleSpecialLoot(final MyDragon myDragon, final EnderDragon dragon){
|
private static void handleSpecialLoot(final MyDragon myDragon, final EnderDragon dragon){
|
||||||
List<Pair<String,Double>> list = DamageManager.getDamageList(dragon.getUniqueId());
|
List<Pair<String,Double>> list = DamageManager.getDamageList(dragon.getUniqueId());
|
||||||
list.sort(DamageManager::sortByDamage);
|
list.sort(DamageManager::sortByDamage);
|
||||||
Set<String> online_players = new HashSet<>();
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> online_players.add(player.getName()));
|
|
||||||
List<SpecialLoot> participants = myDragon.lootMap.get(0);
|
List<SpecialLoot> participants = myDragon.lootMap.get(0);
|
||||||
|
// 是否给所有参与者发奖励
|
||||||
boolean tag = participants != null;
|
boolean tag = participants != null;
|
||||||
int size = list.size();
|
int size = list.size();
|
||||||
for(int i=0;i<size;i++){
|
for(int i=0;i<size;i++){
|
||||||
Pair<String,Double> pair = list.get(i);
|
Pair<String,Double> pair = list.get(i);
|
||||||
String name = pair.first;
|
String name = pair.first;
|
||||||
//玩家不在线
|
|
||||||
if(!online_players.contains(name)) continue;
|
|
||||||
String damage = String.format("%.2f",pair.second);
|
String damage = String.format("%.2f",pair.second);
|
||||||
//所有参与者
|
//所有参与者
|
||||||
if(tag) participants.forEach(loot -> loot.accept(name,damage));
|
if(tag) participants.forEach(loot -> loot.accept(name,damage));
|
||||||
|
|||||||
@@ -73,15 +73,15 @@ public class DragonSpawnListener implements Listener {
|
|||||||
Lang.broadcastMSG(str.replaceAll("%times%",String.valueOf(times)));
|
Lang.broadcastMSG(str.replaceAll("%times%",String.valueOf(times)));
|
||||||
}
|
}
|
||||||
dragon.setCustomName(myDragon.display_name);
|
dragon.setCustomName(myDragon.display_name);
|
||||||
setAttribute(dragon, Attribute.GENERIC_MAX_HEALTH, myDragon.max_health);
|
setAttribute(dragon, Attribute.MAX_HEALTH, myDragon.max_health);
|
||||||
dragon.setHealth(myDragon.spawn_health);
|
dragon.setHealth(myDragon.spawn_health);
|
||||||
dragon.setMaximumNoDamageTicks(myDragon.no_damage_tick);
|
dragon.setMaximumNoDamageTicks(myDragon.no_damage_tick);
|
||||||
|
|
||||||
//modifyAttribute(dragon, Attribute.GENERIC_MOVEMENT_SPEED, myDragon.move_speed_modify);//
|
//modifyAttribute(dragon, Attribute.GENERIC_MOVEMENT_SPEED, myDragon.move_speed_modify);//
|
||||||
|
|
||||||
modifyAttribute(dragon, Attribute.GENERIC_ARMOR, myDragon.armor_modify);
|
modifyAttribute(dragon, Attribute.ARMOR, myDragon.armor_modify);
|
||||||
|
|
||||||
modifyAttribute(dragon, Attribute.GENERIC_ARMOR_TOUGHNESS, myDragon.armor_toughness_modify);
|
modifyAttribute(dragon, Attribute.ARMOR_TOUGHNESS, myDragon.armor_toughness_modify);
|
||||||
String color = myDragon.glow_color.toUpperCase();
|
String color = myDragon.glow_color.toUpperCase();
|
||||||
if(color.equals("NONE")) dragon.setGlowing(false);
|
if(color.equals("NONE")) dragon.setGlowing(false);
|
||||||
else setGlowingColor(dragon,getGlowColor(color));
|
else setGlowingColor(dragon,getGlowColor(color));
|
||||||
|
|||||||
@@ -281,7 +281,8 @@ public class DragonManager {
|
|||||||
SpecialLoot specialLoot;
|
SpecialLoot specialLoot;
|
||||||
if("command".equals(type)){
|
if("command".equals(type)){
|
||||||
List<String> commands = loot.getStringList("data");
|
List<String> commands = loot.getStringList("data");
|
||||||
specialLoot = (player, damage) -> handleCommandLoot(commands,player,damage);
|
boolean executeOffline = loot.getBoolean("execute-if-offline");
|
||||||
|
specialLoot = (player, damage) -> handleCommandLoot(commands,player,damage,executeOffline);
|
||||||
}
|
}
|
||||||
else if("exp".equals(type)){
|
else if("exp".equals(type)){
|
||||||
int amount = loot.getInt("data"+f.options().pathSeparator()+"amount");
|
int amount = loot.getInt("data"+f.options().pathSeparator()+"amount");
|
||||||
@@ -325,8 +326,13 @@ public class DragonManager {
|
|||||||
dragon_names.add(myDragon.unique_name);
|
dragon_names.add(myDragon.unique_name);
|
||||||
sum += edge;
|
sum += edge;
|
||||||
}
|
}
|
||||||
private static void handleCommandLoot(List<String> list, String name, String damage){
|
private static void handleCommandLoot(List<String> list, String name, String damage, boolean executeOffline){
|
||||||
if(list == null) return;
|
if(list == null) return;
|
||||||
|
|
||||||
|
Player player = Bukkit.getPlayer(name);
|
||||||
|
if (player == null && !executeOffline)
|
||||||
|
return;
|
||||||
|
|
||||||
for (String cmd : list) {
|
for (String cmd : list) {
|
||||||
if(cmd.equals("")) continue;
|
if(cmd.equals("")) continue;
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),cmd.replaceAll("%player%",name).replaceAll("%damage%",damage));
|
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(),cmd.replaceAll("%player%",name).replaceAll("%damage%",damage));
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class NMSUtil {
|
|||||||
public void init(){
|
public void init(){
|
||||||
String version = Version.getVersion();
|
String version = Version.getVersion();
|
||||||
try{
|
try{
|
||||||
this.CraftWorldClass = Class.forName("org.bukkit.craftbukkit." + version + ".CraftWorld");
|
this.CraftWorldClass = ClassResolver.obc("CraftWorld");
|
||||||
this.getNMSWord = CraftWorldClass.getDeclaredMethod("getHandle");
|
this.getNMSWord = CraftWorldClass.getDeclaredMethod("getHandle");
|
||||||
this.WorldClass = this.getNMSWord.getReturnType().getSuperclass();
|
this.WorldClass = this.getNMSWord.getReturnType().getSuperclass();
|
||||||
this.world_c_environment = CraftWorldClass.getDeclaredField("environment");
|
this.world_c_environment = CraftWorldClass.getDeclaredField("environment");
|
||||||
@@ -60,12 +60,12 @@ public class NMSUtil {
|
|||||||
this.WorldProviderClass = Class.forName("net.minecraft.server."+version+".WorldProvider");
|
this.WorldProviderClass = Class.forName("net.minecraft.server."+version+".WorldProvider");
|
||||||
//this.WorldProviderTheEndClass = Class.forName("net.minecraft.server."+version+".WorldProviderTheEnd");
|
//this.WorldProviderTheEndClass = Class.forName("net.minecraft.server."+version+".WorldProviderTheEnd");
|
||||||
}
|
}
|
||||||
this.CraftItemStackClass = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftItemStack");
|
this.CraftItemStackClass = ClassResolver.obc("inventory.CraftItemStack");
|
||||||
this.CraftMetaItemClass = Class.forName("org.bukkit.craftbukkit." + version + ".inventory.CraftMetaItem");
|
this.CraftMetaItemClass = ClassResolver.obc("inventory.CraftMetaItem");
|
||||||
this.unhandledTags = CraftMetaItemClass.getDeclaredField("unhandledTags");
|
this.unhandledTags = CraftMetaItemClass.getDeclaredField("unhandledTags");
|
||||||
unhandledTags.setAccessible(true);
|
unhandledTags.setAccessible(true);
|
||||||
this.NMSItemStackClass = CraftItemStackClass.getDeclaredField("handle").getType();
|
this.NMSItemStackClass = CraftItemStackClass.getDeclaredField("handle").getType();
|
||||||
this.CraftEntityClass = Class.forName("org.bukkit.craftbukkit."+version+".entity.CraftEntity");
|
this.CraftEntityClass = ClassResolver.obc("entity.CraftEntity");
|
||||||
init_NBTTagCompoundClass();
|
init_NBTTagCompoundClass();
|
||||||
init_NBTBaseClass();
|
init_NBTBaseClass();
|
||||||
if (!Version.isNBT_UPDATE()){
|
if (!Version.isNBT_UPDATE()){
|
||||||
@@ -83,11 +83,17 @@ public class NMSUtil {
|
|||||||
|
|
||||||
|
|
||||||
if(Version.mcMainVersion<=16) this.MojangsonParserClass = Class.forName("net.minecraft.server."+version+".MojangsonParser");
|
if(Version.mcMainVersion<=16) this.MojangsonParserClass = Class.forName("net.minecraft.server."+version+".MojangsonParser");
|
||||||
else this.MojangsonParserClass = Class.forName("net.minecraft.nbt.MojangsonParser");
|
else if (Version.mcMainVersion < 26) this.MojangsonParserClass = Class.forName("net.minecraft.nbt.MojangsonParser");
|
||||||
this.stringToCPD = MojangsonParserClass.getMethod(getMethodName(ReflectiveMethod.MojangsonParser_parse),String.class);
|
else {
|
||||||
|
// TODO: 2026/5/3 16:21
|
||||||
|
this.MojangsonParserClass = null;
|
||||||
|
}
|
||||||
|
if (this.MojangsonParserClass != null) {
|
||||||
|
this.stringToCPD = MojangsonParserClass.getMethod(getMethodName(ReflectiveMethod.MojangsonParser_parse),String.class);
|
||||||
|
}
|
||||||
|
|
||||||
if(Version.mcMainVersion>=14){
|
if(Version.mcMainVersion>=14){
|
||||||
this.CraftPersistentDataContainerClass = Class.forName("org.bukkit.craftbukkit." + version + ".persistence.CraftPersistentDataContainer");
|
this.CraftPersistentDataContainerClass = ClassResolver.obc("persistence.CraftPersistentDataContainer");
|
||||||
this.PDCtoCPD = CraftPersistentDataContainerClass.getDeclaredMethod("toTagCompound");
|
this.PDCtoCPD = CraftPersistentDataContainerClass.getDeclaredMethod("toTagCompound");
|
||||||
if (!Version.isNBT_UPDATE()){
|
if (!Version.isNBT_UPDATE()){
|
||||||
this.PersistentDataContainer_putAll = CraftPersistentDataContainerClass.getDeclaredMethod("putAll",NBTTagCompoundClass);
|
this.PersistentDataContainer_putAll = CraftPersistentDataContainerClass.getDeclaredMethod("putAll",NBTTagCompoundClass);
|
||||||
@@ -101,6 +107,44 @@ public class NMSUtil {
|
|||||||
}
|
}
|
||||||
if(Config.debug) check();
|
if(Config.debug) check();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class ClassResolver {
|
||||||
|
|
||||||
|
private static final String OBC_BASE = "org.bukkit.craftbukkit";
|
||||||
|
private static final String NMS_LEGACY_BASE = "net.minecraft.server";
|
||||||
|
private static final String NMS_MODERN_BASE = "net.minecraft";
|
||||||
|
|
||||||
|
private static final String VERSION = Version.getVersion();
|
||||||
|
|
||||||
|
private static boolean isModern() {
|
||||||
|
return Version.mcMainVersion >= 26;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Class<?> obc(String path) throws ClassNotFoundException {
|
||||||
|
String fullName;
|
||||||
|
|
||||||
|
if (isModern()) {
|
||||||
|
fullName = OBC_BASE + "." + path;
|
||||||
|
} else {
|
||||||
|
fullName = OBC_BASE + "." + VERSION + "." + path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Class.forName(fullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Class<?> nms(String path) throws ClassNotFoundException {
|
||||||
|
String fullName;
|
||||||
|
|
||||||
|
if (isModern()) {
|
||||||
|
fullName = NMS_MODERN_BASE + "." + path;
|
||||||
|
} else {
|
||||||
|
fullName = NMS_LEGACY_BASE + "." + VERSION + "." + path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Class.forName(fullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void check(){
|
public void check(){
|
||||||
try{
|
try{
|
||||||
Field[] fields = NMSUtil.class.getDeclaredFields();
|
Field[] fields = NMSUtil.class.getDeclaredFields();
|
||||||
@@ -303,7 +347,7 @@ public class NMSUtil {
|
|||||||
}
|
}
|
||||||
private void init_NBTTagCompoundClass(){
|
private void init_NBTTagCompoundClass(){
|
||||||
try{
|
try{
|
||||||
Class<?> CraftMetaBlockStateClass = Class.forName("org.bukkit.craftbukkit."+Version.getVersion()+".inventory.CraftMetaBlockState");
|
Class<?> CraftMetaBlockStateClass = ClassResolver.obc("inventory.CraftMetaBlockState");
|
||||||
Field field = CraftMetaBlockStateClass.getDeclaredField("blockEntityTag");
|
Field field = CraftMetaBlockStateClass.getDeclaredField("blockEntityTag");
|
||||||
this.NBTTagCompoundClass = field.getType();
|
this.NBTTagCompoundClass = field.getType();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.net.URLConnection;
|
|||||||
public final class UpdateChecker {
|
public final class UpdateChecker {
|
||||||
public static void checkUpdate(){
|
public static void checkUpdate(){
|
||||||
// https://github.com/iXanadu13/EnderDragon/issues/17
|
// https://github.com/iXanadu13/EnderDragon/issues/17
|
||||||
if (EnderDragon.plugin.getConfig().getBoolean("skip_update_check")) return;
|
if (EnderDragon.plugin.getConfig().getBoolean("skip_update_check", true)) return;
|
||||||
Lang.info(Lang.plugin_checking_update);
|
Lang.info(Lang.plugin_checking_update);
|
||||||
new BukkitRunnable(){
|
new BukkitRunnable(){
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ import pers.xanadu.enderdragon.nms.NMSItem.INMSItemManager;
|
|||||||
import pers.xanadu.enderdragon.nms.RespawnAnchor.IRespawnAnchorManager;
|
import pers.xanadu.enderdragon.nms.RespawnAnchor.IRespawnAnchorManager;
|
||||||
import pers.xanadu.enderdragon.nms.WorldData.IWorldDataManager;
|
import pers.xanadu.enderdragon.nms.WorldData.IWorldDataManager;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
|
||||||
|
|
||||||
public class Version {
|
public class Version {
|
||||||
public static final String setting_dragon = "2.5.4";
|
public static final String setting_dragon = "2.5.4";
|
||||||
public static final String lang = "2.2.0";
|
public static final String lang = "2.2.0";
|
||||||
@@ -26,30 +22,32 @@ public class Version {
|
|||||||
private static String version = "no version found";
|
private static String version = "no version found";
|
||||||
private static boolean isMohist = false;
|
private static boolean isMohist = false;
|
||||||
public static void init(){
|
public static void init(){
|
||||||
try {
|
String minecraftVersion = Bukkit.getMinecraftVersion();
|
||||||
version = getServer().getClass().getPackage().getName().split("\\.")[3];
|
String[] parts = minecraftVersion.split("\\.");
|
||||||
} catch (Throwable throwable) {
|
int first = Integer.parseInt(parts[0]);
|
||||||
try{
|
|
||||||
//paper 1.20.6+
|
if (first >= 26) {
|
||||||
Class<?> clazz = Class.forName("io.papermc.paper.util.MappingEnvironment");
|
// Paper 26.x no longer version-qualifies CraftBukkit packages.
|
||||||
Field LEGACY_CB_VERSION = clazz.getField("LEGACY_CB_VERSION");
|
version = minecraftVersion;
|
||||||
version = (String) LEGACY_CB_VERSION.get(null);
|
mcMainVersion = first;
|
||||||
}catch (ReflectiveOperationException e){
|
mcPatchVersion = parts.length > 1 ? Integer.parseInt(parts[1]) : 0;
|
||||||
throwable.printStackTrace();
|
} else {
|
||||||
Lang.warn("Failed to get nms-version!");
|
// Retained for the legacy implementation classes still bundled in the project.
|
||||||
Bukkit.getServer().getPluginManager().disablePlugin(EnderDragon.plugin);
|
try {
|
||||||
|
version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
||||||
|
} catch (RuntimeException ex) {
|
||||||
|
version = minecraftVersion;
|
||||||
}
|
}
|
||||||
|
mcMainVersion = parts.length > 1 ? Integer.parseInt(parts[1]) : first;
|
||||||
|
mcPatchVersion = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
|
||||||
}
|
}
|
||||||
String[] mc_version = getServer().getBukkitVersion().split("-")[0].split("\\.");
|
|
||||||
mcMainVersion = Integer.parseInt(mc_version[1]);
|
|
||||||
if(mc_version.length<=2) mcPatchVersion = 0;
|
|
||||||
else mcPatchVersion = Integer.parseInt(mc_version[2]);
|
|
||||||
Lang.info("Found version: " + version);
|
Lang.info("Found version: " + version);
|
||||||
try{
|
try{
|
||||||
Class.forName("net.minecraftforge.server.ServerMain");
|
Class.forName("net.minecraftforge.server.ServerMain");
|
||||||
isMohist = true;
|
isMohist = true;
|
||||||
}catch(ReflectiveOperationException ignored){}
|
}catch(ReflectiveOperationException ignored){}
|
||||||
NBT_UPDATE = mcMainVersion > 20 || mcMainVersion == 20 && mcPatchVersion >=5;
|
NBT_UPDATE = mcMainVersion > 20 || mcMainVersion == 20 && mcPatchVersion >= 5;
|
||||||
}
|
}
|
||||||
public static INMSItemManager getNMSItemManager(){
|
public static INMSItemManager getNMSItemManager(){
|
||||||
switch (version){
|
switch (version){
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
name: EnderDragon
|
name: EnderDragon
|
||||||
version: 2.5.6
|
version: ${project.version}
|
||||||
main: pers.xanadu.enderdragon.EnderDragon
|
main: pers.xanadu.enderdragon.EnderDragon
|
||||||
author: Xanadu13
|
author: Xanadu13
|
||||||
api-version: 1.13
|
api-version: '26.2'
|
||||||
softdepend:
|
softdepend:
|
||||||
- MMOItems
|
- MMOItems
|
||||||
- MythicLib
|
- MythicLib
|
||||||
|
|||||||
Reference in New Issue
Block a user