feat: 1.21.4 support

This commit is contained in:
ShermansWorld committed 2025-03-22 00:53:35 -04:00
1 parent 4d144e3c9e
commit 21f3aa780f
11 files changed
+104 -22

No files matched your search

+4 -4
View File
@@ -15,7 +15,7 @@ val mainPackage = "${project.group}.${project.name.lowercase()}"
applyCustomVersion()
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17)) // Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 8 installed for example.
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) // Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 8 installed for example.
withJavadocJar()
withSourcesJar()
}
@@ -49,7 +49,7 @@ tasks {
compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
options.release.set(21)
options.compilerArgs.addAll(arrayListOf("-Xlint:all", "-Xlint:-processing", "-Xdiags:verbose"))
}
@@ -110,9 +110,9 @@ bukkit { // Options: https://github.com/Minecrell/plugin-yml#bukkit
prefix = project.name
version = "${project.version}"
description = "${project.description}"
authors = listOf("ShermansWorld", "C_Corp2002", "TheCrunchy")
authors = listOf("ShermansWorld", "C_Corp2002")
contributors = listOf("darksaid98")
apiVersion = "1.20"
apiVersion = "1.21"
// Misc properties
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD // STARTUP or POSTWORLD
+1 -1
View File
@@ -3,5 +3,5 @@ org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048M
group=com.github.alathra
version=1.1.0
version=1.2.0
description=
+2 -2
View File
@@ -3,11 +3,11 @@
[libraries]
# Core dependencies
annotations = "org.jetbrains:annotations:26.0.1"
paper-api = "io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT"
paper-api = "io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT"
# API dependencies
colorparser = "com.github.milkdrinkers:colorparser:2.0.3"
commandapi-shade = "dev.jorel:commandapi-bukkit-shade:9.6.1"
commandapi-shade = "dev.jorel:commandapi-bukkit-shade:9.7.0"
[bundles]
@@ -1,7 +1,29 @@
package com.github.alathra.siegeengines;
import com.github.alathra.siegeengines.config.Config;
import com.github.alathra.siegeengines.data.SiegeEnginesData;
import com.github.alathra.siegeengines.listeners.PlayerHandler;
import com.github.alathra.siegeengines.projectile.ExplosiveProjectile;
import com.github.alathra.siegeengines.util.GeneralUtil;
import com.github.alathra.siegeengines.util.SiegeEnginesUtil;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.damage.DamageSource;
import org.bukkit.damage.DamageType;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public class SiegeEngineAmmoHolder {
@@ -23,7 +23,7 @@ public class SiegeEngines extends JavaPlugin {
public static MetadataValueAdapter metadata;
public static final Random random = new Random();
// model id, defined seige engine types
// model id, defined siege engine types
public static final HashMap<Integer, SiegeEngine> definedSiegeEngines = new HashMap<>();
// SiegeEngine entity, SiegeEngine object
public static final HashMap<UUID, SiegeEngine> activeSiegeEngines = new HashMap<>();
@@ -0,0 +1,61 @@
package com.github.alathra.siegeengines;
import org.bukkit.Location;
import org.bukkit.damage.DamageSource;
import org.bukkit.damage.DamageType;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SiegeEnginesDamageSource implements DamageSource {
private Entity causingEntity;
private Entity directEntity;
private Entity siegeEngineEntity;
public SiegeEnginesDamageSource(Entity causingEntity, Entity directEntity, Entity siegeEngineEntity) {
this.causingEntity = causingEntity;
this.directEntity = directEntity;
this.siegeEngineEntity = siegeEngineEntity;
}
@Override
public @NotNull DamageType getDamageType() {
return DamageType.ARROW;
}
@Override
public @Nullable Entity getCausingEntity() {
return causingEntity;
}
@Override
public @Nullable Entity getDirectEntity() {
return directEntity;
}
@Override
public @Nullable Location getDamageLocation() {
return siegeEngineEntity.getLocation();
}
@Override
public @Nullable Location getSourceLocation() {
return causingEntity.getLocation();
}
@Override
public boolean isIndirect() {
return true;
}
@Override
public float getFoodExhaustion() {
return 0;
}
@Override
public boolean scalesWithDifficulty() {
return false;
}
}
@@ -1,5 +1,6 @@
package com.github.alathra.siegeengines.listeners;
import com.github.alathra.siegeengines.SiegeEnginesDamageSource;
import com.github.alathra.siegeengines.SiegeEnginesLogger;
import com.github.alathra.siegeengines.config.Config;
import com.github.alathra.siegeengines.data.SiegeEnginesData;
@@ -35,7 +36,7 @@ public class SiegeEngineDamagedListener implements Listener {
if (stand.getHealth() - 2 > 0) {
stand.setHealth(stand.getHealth() - 2);
} else {
EntityDeathEvent death = new EntityDeathEvent(stand, SiegeEnginesData.items, 0);
EntityDeathEvent death = new EntityDeathEvent(stand, new SiegeEnginesDamageSource(stand, event.getHitEntity(), stand), SiegeEnginesData.items);
Bukkit.getServer().getPluginManager().callEvent(death);
if (!death.isCancelled()) stand.setHealth(0.0f);
}
@@ -55,7 +56,7 @@ public class SiegeEngineDamagedListener implements Listener {
+ String.format("%.2f", player.getLocation().distance(snowball.getLocation())));
}
Location loc = snowball.getLocation();
Entity tnt = event.getEntity().getWorld().spawnEntity(loc, EntityType.PRIMED_TNT);
Entity tnt = event.getEntity().getWorld().spawnEntity(loc, EntityType.TNT);
SiegeEnginesData.projectiles.remove(event.getEntity().getUniqueId());
@@ -90,7 +91,7 @@ public class SiegeEngineDamagedListener implements Listener {
if (stand.getHealth() - 2 > 0) {
stand.setHealth(stand.getHealth() - 2);
} else {
EntityDeathEvent death = new EntityDeathEvent(stand, SiegeEnginesData.items, 0);
EntityDeathEvent death = new EntityDeathEvent(stand, event.getDamageSource(), SiegeEnginesData.items);
Bukkit.getServer().getPluginManager().callEvent(death);
if (death.isCancelled()) return;
stand.setHealth(0.0f);
@@ -100,3 +101,4 @@ public class SiegeEngineDamagedListener implements Listener {
}
}
}
@@ -21,7 +21,7 @@ public class ExplosiveProjectile extends SiegeEngineProjectile {
public int projectilesCount = 1;
public final Boolean delayedFire = false;
public final int delayTime = 6;
public final Particle particleType = Particle.EXPLOSION_LARGE;
public final Particle particleType = Particle.EXPLOSION;
public Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
public Boolean alertOnLanding = false;
public float velocityFactor = 1.0f;
@@ -16,7 +16,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
public int projectileCount = 1;
public Boolean delayedFire = true;
public int delayTime = 6;
public EntityType entityType = EntityType.FIREWORK;
public EntityType entityType = EntityType.FIREWORK_ROCKET;
public float inaccuracy = 0.125f;
public Particle particleType = Particle.FLASH;
public Sound soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
@@ -32,7 +32,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
public static FireworkProjectile getDefaultRocketShot(ItemStack rocketItem) {
FireworkProjectile fireProj = new FireworkProjectile(rocketItem);
fireProj.projectileCount = 1;
fireProj.entityType = EntityType.FIREWORK;
fireProj.entityType = EntityType.FIREWORK_ROCKET;
fireProj.particleType = Particle.WHITE_ASH;
fireProj.soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
fireProj.inaccuracy = 0.125f;
@@ -16,7 +16,7 @@ public class PotionProjectile extends SiegeEngineProjectile {
public Boolean delayedFire = false;
public int delayTime = 6;
public float inaccuracy = 0.1f;
public final Particle particleType = Particle.EXPLOSION_LARGE;
public final Particle particleType = Particle.EXPLOSION;
public final Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
public float velocityFactor = 1.0f;
@@ -41,7 +41,7 @@ public class PotionProjectile extends SiegeEngineProjectile {
private void CreateEntity(Entity entity, Location loc, Float velocity) {
World world = entity.getLocation().getWorld();
Entity arrow = world.spawnEntity(loc, EntityType.SPLASH_POTION);
Entity arrow = world.spawnEntity(loc, EntityType.POTION);
if (inaccuracy != 0f) {
arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()).subtract(Randomise()));
} else {
@@ -51,9 +51,6 @@ public class PotionProjectile extends SiegeEngineProjectile {
Bukkit.getServer().getPluginManager().callEvent(new org.bukkit.event.entity.ProjectileLaunchEvent(arrow));
ItemStack itemStack = this.getAmmuinitionItem();
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
System.out.println(potionMeta.toString());
System.out.println(itemStack);
potionMeta.getBasePotionData();
itemStack.setItemMeta(potionMeta);
ThrownPotion potion = (ThrownPotion) arrow;
potion.setItem(itemStack);
+3 -3
View File
@@ -41,7 +41,7 @@ RotateDistance: 10
# The maximum siege engines a player can control at the same time
MaxSiegeEnginesControlled: 1
# Whether or not the crafting recipes for siege engines are enabled
# Whether the crafting recipes for siege engines are enabled
CraftingRecipes: true
# The auto-reload feature by shift-clicking
@@ -50,7 +50,7 @@ AutoReload: false
# Worlds where all Siege Engine actions will be disabled including placing and firing
DisabledWorlds:
- world_nether
- World-o_nether
- world_the_end
# ======================================
# | Projectiles |
@@ -157,7 +157,7 @@ Projectiles:
# MaxFuel: The maximum amount of fuel that can be loaded into each Siege Engine
# ItemName: The default item name for the Siege Engine item
# Lore: The default lore for the Siege Engine item
# CanMount (EXPERIMENTAL): Whether or not the Siege Engine can be placed on a mountable mob
# CanMount (EXPERIMENTAL): Whether the Siege Engine can be placed on a mountable mob
SiegeEngines:
Trebuchet: