diff --git a/.gitignore b/.gitignore index 7811c69..20dce2f 100644 --- a/.gitignore +++ b/.gitignore @@ -115,3 +115,5 @@ run/ */target/* + +.paper-nms \ No newline at end of file diff --git a/Main/pom.xml b/Main/pom.xml index 04b8635..eb15103 100644 --- a/Main/pom.xml +++ b/Main/pom.xml @@ -12,8 +12,8 @@ Main - 16 - 16 + 17 + 17 @@ -31,7 +31,7 @@ jitpack.io - https://jitpack.io + file://${project.basedir}/ @@ -40,7 +40,15 @@ org.spigotmc spigot-api - 1.19-R0.1-SNAPSHOT + 1.19.4-R0.1-SNAPSHOT + provided + + + + org.spigotmc + spigot + 1.19.4-R0.1-SNAPSHOT + remapped-mojang provided @@ -55,9 +63,9 @@ res Residence - 5.1.0.0 + 5.1.1.1 system - ${project.basedir}/libs/Residence5.1.0.0.jar + ${project.basedir}/libs/Residence5.1.1.1.jar @@ -83,43 +91,6 @@ 2.2.1 compile - - - - com.github.nutt1101 - v1_16 - 1.1.4 - jar - compile - true - - - - com.github.nutt1101 - v1_17 - 1.1.4 - jar - compile - true - - - - com.github.nutt1101 - v1_18 - 1.1.4 - jar - compile - true - - - - com.github.nutt1101 - v1_19 - 1.1.6 - jar - compile - true - @@ -140,6 +111,39 @@ + + net.md-5 + specialsource-maven-plugin + 1.2.2 + + + package + + remap + + remap-obf + + org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:txt:maps-mojang + true + org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-mojang + true + remapped-obf + + + + package + + remap + + remap-spigot + + ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar + org.spigotmc:minecraft-server:1.19-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.19-R0.1-SNAPSHOT:jar:remapped-obf + + + + diff --git a/Main/src/main/java/com/github/nutt1101/HeadDrop.java b/Main/src/main/java/com/github/nutt1101/HeadDrop.java index 1537299..16c6cda 100644 --- a/Main/src/main/java/com/github/nutt1101/HeadDrop.java +++ b/Main/src/main/java/com/github/nutt1101/HeadDrop.java @@ -72,9 +72,6 @@ public ItemStack getEntityHead(Entity hitEntity , Player player) { switch (CatchBall.getRealServerVersion()) { case "v1_19" -> headMeta = NBT_v1_19.saveEntityNBT(plugin, hitEntity, headMeta); - case "v1_18" -> headMeta = NBT_v1_18.saveEntityNBT(plugin, hitEntity, headMeta); - case "v1_17" -> headMeta = NBT_v1_17.saveEntityNBT(plugin, hitEntity, headMeta); - case "v1_16" -> headMeta = NBT_v1_16.saveEntityNBT(plugin, hitEntity, headMeta); default -> { plugin.getLogger().log(Level.WARNING, "Save entity NBT error."); } diff --git a/v1_19/src/main/java/com/github/nutt1101/NBT_v1_19.java b/Main/src/main/java/com/github/nutt1101/NBT_v1_19.java similarity index 100% rename from v1_19/src/main/java/com/github/nutt1101/NBT_v1_19.java rename to Main/src/main/java/com/github/nutt1101/NBT_v1_19.java diff --git a/Main/src/main/java/com/github/nutt1101/event/HitEvent.java b/Main/src/main/java/com/github/nutt1101/event/HitEvent.java index e0de191..3421466 100644 --- a/Main/src/main/java/com/github/nutt1101/event/HitEvent.java +++ b/Main/src/main/java/com/github/nutt1101/event/HitEvent.java @@ -260,9 +260,6 @@ public String getIsCustomEntity(Entity hitEntity) { switch (CatchBall.getRealServerVersion()) { case "v1_19" -> checkCustom = NBT_v1_19.isCustomEntity(hitEntity); - case "v1_18" -> checkCustom = NBT_v1_18.isCustomEntity(hitEntity); - case "v1_17" -> checkCustom = NBT_v1_17.isCustomEntity(hitEntity); - case "v1_16" -> checkCustom = NBT_v1_16.isCustomEntity(hitEntity); default -> { plugin.getLogger().log(Level.INFO, "can not check entity if it not a entity."); } diff --git a/Main/src/main/java/com/github/nutt1101/event/SkullClick.java b/Main/src/main/java/com/github/nutt1101/event/SkullClick.java index 597ca4e..b2a0bf8 100644 --- a/Main/src/main/java/com/github/nutt1101/event/SkullClick.java +++ b/Main/src/main/java/com/github/nutt1101/event/SkullClick.java @@ -73,9 +73,6 @@ public void skullClick(PlayerInteractEvent event) { switch (CatchBall.getRealServerVersion()) { case "v1_19" -> NBT_v1_19.loadEntityNBT(plugin, entity, data); - case "v1_18" -> NBT_v1_18.loadEntityNBT(plugin, entity, data); - case "v1_17" -> NBT_v1_17.loadEntityNBT(plugin, entity, data); - case "v1_16" -> NBT_v1_16.loadEntityNBT(plugin, entity, data); default -> { plugin.getLogger().log(Level.INFO, "can not load nbt from skull."); } diff --git a/Main/src/main/resources/paper-plugin.yml b/Main/src/main/resources/paper-plugin.yml new file mode 100644 index 0000000..72c7b3d --- /dev/null +++ b/Main/src/main/resources/paper-plugin.yml @@ -0,0 +1,19 @@ +name: CatchBall +main: com.github.nutt1101.CatchBall +author: NUTT1101 +description: "§bA plugin that make entity to be catchable.\n§dContact Me: https://discord.link/nuttPluginClub" +version: "1.1.6" +api-version: 1.13 +softdepend: + - Residence + - MythicMobs + - GriefPrevention +permissions: + catchball.op: + default: op + catchball.use: + default: true +commands: + ctb: + description: "Command Help : /ctb" + \ No newline at end of file diff --git a/v1_19/pom.xml b/com/github/nutt1101/v1_19/1.1.6/v1_19-1.1.6.pom similarity index 95% rename from v1_19/pom.xml rename to com/github/nutt1101/v1_19/1.1.6/v1_19-1.1.6.pom index e48061c..97654f2 100644 --- a/v1_19/pom.xml +++ b/com/github/nutt1101/v1_19/1.1.6/v1_19-1.1.6.pom @@ -12,8 +12,8 @@ v1_19 - 16 - 16 + 17 + 17 diff --git a/pom.xml b/pom.xml index 85b093f..399672b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,10 +10,6 @@ 1.1.6 - v1_16 - v1_17 - v1_18 - v1_19 Main @@ -22,7 +18,7 @@ CatchBall - 1.8 + 17 UTF-8 diff --git a/v1_16/pom.xml b/v1_16/pom.xml deleted file mode 100644 index 31ec883..0000000 --- a/v1_16/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - CatchBall - com.github.nutt1101 - 1.1.4 - - 4.0.0 - - v1_16 - - - 16 - 16 - - - - - org.spigotmc - spigot - 1.16.5-R0.1-SNAPSHOT - provided - - - - \ No newline at end of file diff --git a/v1_16/src/main/java/com/github/nutt1101/NBT_v1_16.java b/v1_16/src/main/java/com/github/nutt1101/NBT_v1_16.java deleted file mode 100644 index 31aa1db..0000000 --- a/v1_16/src/main/java/com/github/nutt1101/NBT_v1_16.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.github.nutt1101; - -import net.minecraft.server.v1_16_R3.MojangsonParser; -import net.minecraft.server.v1_16_R3.NBTTagCompound; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; -import org.bukkit.plugin.Plugin; - - -public class NBT_v1_16 { - - public static ItemMeta saveEntityNBT(Plugin plugin, Entity hitEntity, ItemMeta headMeta) { - net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) hitEntity).getHandle(); - NBTTagCompound nbtTagCompound = new NBTTagCompound(); - headMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "entity"), PersistentDataType.STRING, nmsEntity.save(nbtTagCompound).toString()); - headMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "entityType"), PersistentDataType.STRING, hitEntity.getType().toString()); - return headMeta; - } - - public static void loadEntityNBT(Plugin plugin, Entity entity, PersistentDataContainer data) { - net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle(); - try { - NBTTagCompound nbt = MojangsonParser.parse(data.get(new NamespacedKey(plugin, "entity"), PersistentDataType.STRING)); - nmsEntity.load(nbt); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static String isCustomEntity(Entity hitEntity) { - net.minecraft.server.v1_16_R3.Entity nmsEntity = ((CraftEntity) hitEntity).getHandle(); - return nmsEntity.save(new NBTTagCompound()).getString("Paper.SpawnReason"); - } -} diff --git a/v1_17/pom.xml b/v1_17/pom.xml deleted file mode 100644 index 9647d89..0000000 --- a/v1_17/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - CatchBall - com.github.nutt1101 - 1.1.4 - - 4.0.0 - - v1_17 - - - 16 - 16 - - - - - org.spigotmc - spigot - 1.17.1-R0.1-SNAPSHOT - remapped-mojang - provided - - - - - - - net.md-5 - specialsource-maven-plugin - 1.2.2 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.17.1-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - \ No newline at end of file diff --git a/v1_17/src/main/java/com/github/nutt1101/NBT_v1_17.java b/v1_17/src/main/java/com/github/nutt1101/NBT_v1_17.java deleted file mode 100644 index b96581f..0000000 --- a/v1_17/src/main/java/com/github/nutt1101/NBT_v1_17.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.nutt1101; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.TagParser; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; -import org.bukkit.plugin.Plugin; - - -public class NBT_v1_17 { - public static ItemMeta saveEntityNBT(Plugin plugin, Entity hitEntity, ItemMeta headMeta) { - net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) hitEntity).getHandle(); - headMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "entity"), PersistentDataType.STRING, nmsEntity.saveWithoutId(new CompoundTag()).toString()); - headMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "entityType"), PersistentDataType.STRING, hitEntity.getType().toString()); - return headMeta; - } - public static void loadEntityNBT(Plugin plugin, Entity entity, PersistentDataContainer data) { - net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) entity).getHandle(); - try { - CompoundTag nbt = TagParser.parseTag(data.get(new NamespacedKey(plugin, "entity"), PersistentDataType.STRING)); - nmsEntity.load(nbt); - } catch (Exception e) { - e.printStackTrace(); - } - } - public static String isCustomEntity(Entity hitEntity) { - net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) hitEntity).getHandle(); - return nmsEntity.saveWithoutId(new CompoundTag()).getString("Paper.SpawnReason"); - } -} diff --git a/v1_18/pom.xml b/v1_18/pom.xml deleted file mode 100644 index c98a048..0000000 --- a/v1_18/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - CatchBall - com.github.nutt1101 - 1.1.4 - - 4.0.0 - - v1_18 - - - 16 - 16 - - - - - org.spigotmc - spigot - 1.18.2-R0.1-SNAPSHOT - remapped-mojang - provided - - - - - - - net.md-5 - specialsource-maven-plugin - 1.2.2 - - - package - - remap - - remap-obf - - org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:txt:maps-mojang - true - org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-mojang - true - remapped-obf - - - - package - - remap - - remap-spigot - - ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-obf - - - - - - - - \ No newline at end of file diff --git a/v1_18/src/main/java/com/github/nutt1101/NBT_v1_18.java b/v1_18/src/main/java/com/github/nutt1101/NBT_v1_18.java deleted file mode 100644 index 63e1ec4..0000000 --- a/v1_18/src/main/java/com/github/nutt1101/NBT_v1_18.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.nutt1101; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.TagParser; -import org.bukkit.NamespacedKey; -import org.bukkit.craftbukkit.v1_18_R2.entity.CraftEntity; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; -import org.bukkit.plugin.Plugin; - - -public class NBT_v1_18 { - public static ItemMeta saveEntityNBT(Plugin plugin, Entity hitEntity, ItemMeta headMeta) { - net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) hitEntity).getHandle(); - headMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "entity"), PersistentDataType.STRING, nmsEntity.saveWithoutId(new CompoundTag()).toString()); - headMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "entityType"), PersistentDataType.STRING, hitEntity.getType().toString()); - return headMeta; - } - public static void loadEntityNBT(Plugin plugin, Entity entity, PersistentDataContainer data) { - net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) entity).getHandle(); - try { - CompoundTag nbt = TagParser.parseTag(data.get(new NamespacedKey(plugin, "entity"), PersistentDataType.STRING)); - nmsEntity.load(nbt); - } catch (Exception e) { - e.printStackTrace(); - } - } - public static String isCustomEntity(Entity hitEntity) { - net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) hitEntity).getHandle(); - return nmsEntity.saveWithoutId(new CompoundTag()).getString("Paper.SpawnReason"); - } -}