mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-01 14:38:55 +00:00
feat: 1.21.4 support
This commit is contained in:
1 parent
4d144e3c9e
commit
21f3aa780f
11 files changed
+105
-23
No files matched your search
+4
-4
@@ -15,7 +15,7 @@ val mainPackage = "${project.group}.${project.name.lowercase()}"
|
|||||||
applyCustomVersion()
|
applyCustomVersion()
|
||||||
|
|
||||||
java {
|
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()
|
withJavadocJar()
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ tasks {
|
|||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release.set(17)
|
options.release.set(21)
|
||||||
options.compilerArgs.addAll(arrayListOf("-Xlint:all", "-Xlint:-processing", "-Xdiags:verbose"))
|
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
|
prefix = project.name
|
||||||
version = "${project.version}"
|
version = "${project.version}"
|
||||||
description = "${project.description}"
|
description = "${project.description}"
|
||||||
authors = listOf("ShermansWorld", "C_Corp2002", "TheCrunchy")
|
authors = listOf("ShermansWorld", "C_Corp2002")
|
||||||
contributors = listOf("darksaid98")
|
contributors = listOf("darksaid98")
|
||||||
apiVersion = "1.20"
|
apiVersion = "1.21"
|
||||||
|
|
||||||
// Misc properties
|
// Misc properties
|
||||||
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD // STARTUP or POSTWORLD
|
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD // STARTUP or POSTWORLD
|
||||||
|
|||||||
+1
-1
@@ -3,5 +3,5 @@ org.gradle.parallel=true
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xmx2048M
|
org.gradle.jvmargs=-Xmx2048M
|
||||||
group=com.github.alathra
|
group=com.github.alathra
|
||||||
version=1.1.0
|
version=1.2.0
|
||||||
description=
|
description=
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
[libraries]
|
[libraries]
|
||||||
# Core dependencies
|
# Core dependencies
|
||||||
annotations = "org.jetbrains:annotations:26.0.1"
|
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
|
# API dependencies
|
||||||
colorparser = "com.github.milkdrinkers:colorparser:2.0.3"
|
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]
|
[bundles]
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,29 @@
|
|||||||
package com.github.alathra.siegeengines;
|
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.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.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class SiegeEngineAmmoHolder {
|
public class SiegeEngineAmmoHolder {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class SiegeEngines extends JavaPlugin {
|
|||||||
public static MetadataValueAdapter metadata;
|
public static MetadataValueAdapter metadata;
|
||||||
public static final Random random = new Random();
|
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<>();
|
public static final HashMap<Integer, SiegeEngine> definedSiegeEngines = new HashMap<>();
|
||||||
// SiegeEngine entity, SiegeEngine object
|
// SiegeEngine entity, SiegeEngine object
|
||||||
public static final HashMap<UUID, SiegeEngine> activeSiegeEngines = new HashMap<>();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-4
@@ -1,5 +1,6 @@
|
|||||||
package com.github.alathra.siegeengines.listeners;
|
package com.github.alathra.siegeengines.listeners;
|
||||||
|
|
||||||
|
import com.github.alathra.siegeengines.SiegeEnginesDamageSource;
|
||||||
import com.github.alathra.siegeengines.SiegeEnginesLogger;
|
import com.github.alathra.siegeengines.SiegeEnginesLogger;
|
||||||
import com.github.alathra.siegeengines.config.Config;
|
import com.github.alathra.siegeengines.config.Config;
|
||||||
import com.github.alathra.siegeengines.data.SiegeEnginesData;
|
import com.github.alathra.siegeengines.data.SiegeEnginesData;
|
||||||
@@ -35,7 +36,7 @@ public class SiegeEngineDamagedListener implements Listener {
|
|||||||
if (stand.getHealth() - 2 > 0) {
|
if (stand.getHealth() - 2 > 0) {
|
||||||
stand.setHealth(stand.getHealth() - 2);
|
stand.setHealth(stand.getHealth() - 2);
|
||||||
} else {
|
} 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);
|
Bukkit.getServer().getPluginManager().callEvent(death);
|
||||||
if (!death.isCancelled()) stand.setHealth(0.0f);
|
if (!death.isCancelled()) stand.setHealth(0.0f);
|
||||||
}
|
}
|
||||||
@@ -52,10 +53,10 @@ public class SiegeEngineDamagedListener implements Listener {
|
|||||||
Entity player = (Entity) snowball.getShooter();
|
Entity player = (Entity) snowball.getShooter();
|
||||||
if (player instanceof Player) {
|
if (player instanceof Player) {
|
||||||
player.sendMessage("§eDistance to impact: "
|
player.sendMessage("§eDistance to impact: "
|
||||||
+ String.format("%.2f", player.getLocation().distance(snowball.getLocation())));
|
+ String.format("%.2f", player.getLocation().distance(snowball.getLocation())));
|
||||||
}
|
}
|
||||||
Location loc = 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());
|
SiegeEnginesData.projectiles.remove(event.getEntity().getUniqueId());
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ public class SiegeEngineDamagedListener implements Listener {
|
|||||||
if (stand.getHealth() - 2 > 0) {
|
if (stand.getHealth() - 2 > 0) {
|
||||||
stand.setHealth(stand.getHealth() - 2);
|
stand.setHealth(stand.getHealth() - 2);
|
||||||
} else {
|
} else {
|
||||||
EntityDeathEvent death = new EntityDeathEvent(stand, SiegeEnginesData.items, 0);
|
EntityDeathEvent death = new EntityDeathEvent(stand, event.getDamageSource(), SiegeEnginesData.items);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(death);
|
Bukkit.getServer().getPluginManager().callEvent(death);
|
||||||
if (death.isCancelled()) return;
|
if (death.isCancelled()) return;
|
||||||
stand.setHealth(0.0f);
|
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 int projectilesCount = 1;
|
||||||
public final Boolean delayedFire = false;
|
public final Boolean delayedFire = false;
|
||||||
public final int delayTime = 6;
|
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 Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
|
||||||
public Boolean alertOnLanding = false;
|
public Boolean alertOnLanding = false;
|
||||||
public float velocityFactor = 1.0f;
|
public float velocityFactor = 1.0f;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
|
|||||||
public int projectileCount = 1;
|
public int projectileCount = 1;
|
||||||
public Boolean delayedFire = true;
|
public Boolean delayedFire = true;
|
||||||
public int delayTime = 6;
|
public int delayTime = 6;
|
||||||
public EntityType entityType = EntityType.FIREWORK;
|
public EntityType entityType = EntityType.FIREWORK_ROCKET;
|
||||||
public float inaccuracy = 0.125f;
|
public float inaccuracy = 0.125f;
|
||||||
public Particle particleType = Particle.FLASH;
|
public Particle particleType = Particle.FLASH;
|
||||||
public Sound soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
|
public Sound soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
|
||||||
@@ -32,7 +32,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
|
|||||||
public static FireworkProjectile getDefaultRocketShot(ItemStack rocketItem) {
|
public static FireworkProjectile getDefaultRocketShot(ItemStack rocketItem) {
|
||||||
FireworkProjectile fireProj = new FireworkProjectile(rocketItem);
|
FireworkProjectile fireProj = new FireworkProjectile(rocketItem);
|
||||||
fireProj.projectileCount = 1;
|
fireProj.projectileCount = 1;
|
||||||
fireProj.entityType = EntityType.FIREWORK;
|
fireProj.entityType = EntityType.FIREWORK_ROCKET;
|
||||||
fireProj.particleType = Particle.WHITE_ASH;
|
fireProj.particleType = Particle.WHITE_ASH;
|
||||||
fireProj.soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
|
fireProj.soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
|
||||||
fireProj.inaccuracy = 0.125f;
|
fireProj.inaccuracy = 0.125f;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class PotionProjectile extends SiegeEngineProjectile {
|
|||||||
public Boolean delayedFire = false;
|
public Boolean delayedFire = false;
|
||||||
public int delayTime = 6;
|
public int delayTime = 6;
|
||||||
public float inaccuracy = 0.1f;
|
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 final Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
|
||||||
public float velocityFactor = 1.0f;
|
public float velocityFactor = 1.0f;
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ public class PotionProjectile extends SiegeEngineProjectile {
|
|||||||
private void CreateEntity(Entity entity, Location loc, Float velocity) {
|
private void CreateEntity(Entity entity, Location loc, Float velocity) {
|
||||||
World world = entity.getLocation().getWorld();
|
World world = entity.getLocation().getWorld();
|
||||||
|
|
||||||
Entity arrow = world.spawnEntity(loc, EntityType.SPLASH_POTION);
|
Entity arrow = world.spawnEntity(loc, EntityType.POTION);
|
||||||
if (inaccuracy != 0f) {
|
if (inaccuracy != 0f) {
|
||||||
arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()).subtract(Randomise()));
|
arrow.setVelocity(loc.getDirection().multiply(velocity).add(Randomise()).subtract(Randomise()));
|
||||||
} else {
|
} else {
|
||||||
@@ -51,9 +51,6 @@ public class PotionProjectile extends SiegeEngineProjectile {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(new org.bukkit.event.entity.ProjectileLaunchEvent(arrow));
|
Bukkit.getServer().getPluginManager().callEvent(new org.bukkit.event.entity.ProjectileLaunchEvent(arrow));
|
||||||
ItemStack itemStack = this.getAmmuinitionItem();
|
ItemStack itemStack = this.getAmmuinitionItem();
|
||||||
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
|
PotionMeta potionMeta = (PotionMeta) itemStack.getItemMeta();
|
||||||
System.out.println(potionMeta.toString());
|
|
||||||
System.out.println(itemStack);
|
|
||||||
potionMeta.getBasePotionData();
|
|
||||||
itemStack.setItemMeta(potionMeta);
|
itemStack.setItemMeta(potionMeta);
|
||||||
ThrownPotion potion = (ThrownPotion) arrow;
|
ThrownPotion potion = (ThrownPotion) arrow;
|
||||||
potion.setItem(itemStack);
|
potion.setItem(itemStack);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ RotateDistance: 10
|
|||||||
# The maximum siege engines a player can control at the same time
|
# The maximum siege engines a player can control at the same time
|
||||||
MaxSiegeEnginesControlled: 1
|
MaxSiegeEnginesControlled: 1
|
||||||
|
|
||||||
# Whether or not the crafting recipes for siege engines are enabled
|
# Whether the crafting recipes for siege engines are enabled
|
||||||
CraftingRecipes: true
|
CraftingRecipes: true
|
||||||
|
|
||||||
# The auto-reload feature by shift-clicking
|
# 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
|
# Worlds where all Siege Engine actions will be disabled including placing and firing
|
||||||
DisabledWorlds:
|
DisabledWorlds:
|
||||||
- world_nether
|
- world_nether
|
||||||
- World-o_nether
|
- world_the_end
|
||||||
|
|
||||||
# ======================================
|
# ======================================
|
||||||
# | Projectiles |
|
# | Projectiles |
|
||||||
@@ -157,7 +157,7 @@ Projectiles:
|
|||||||
# MaxFuel: The maximum amount of fuel that can be loaded into each Siege Engine
|
# MaxFuel: The maximum amount of fuel that can be loaded into each Siege Engine
|
||||||
# ItemName: The default item name for the Siege Engine item
|
# ItemName: The default item name for the Siege Engine item
|
||||||
# Lore: The default lore 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:
|
SiegeEngines:
|
||||||
Trebuchet:
|
Trebuchet:
|
||||||
|
|||||||
Reference in new issue
Block a user