mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-04 06:28:55 +00:00
Updated Some stuff, Ported over my Changes
Hi!
This commit is contained in:
1 parent
4283710716
commit
09eecbb8ee
4 files changed
+60
-38
No files matched your search
@@ -161,7 +161,7 @@ public class SiegeEngines extends JavaPlugin {
|
||||
if (customModelId == null || customModelId == 0)
|
||||
customModelId = 150;
|
||||
if (name == null)
|
||||
name = "Light Turret";
|
||||
name = "Unnamed Cannon";
|
||||
if (XOffset == null)
|
||||
XOffset = 0;
|
||||
if (YOffset == null)
|
||||
@@ -208,8 +208,8 @@ public class SiegeEngines extends JavaPlugin {
|
||||
equip.YOffset = 5;
|
||||
equip.VelocityPerFuel = 0.3f;
|
||||
ExplosiveProjectile proj = new ExplosiveProjectile();
|
||||
proj.ExplodePower = 2;
|
||||
equip.shotAmount = 1;
|
||||
proj.ExplodePower = 1;
|
||||
equip.shotAmount = 2;
|
||||
equip.RotateStandHead = false;
|
||||
equip.RotateSideways = true;
|
||||
equip.FuelMaterial = new ItemStack(Material.STRING);
|
||||
@@ -236,20 +236,21 @@ public class SiegeEngines extends JavaPlugin {
|
||||
equip.RotateSideways = false;
|
||||
proj = new ExplosiveProjectile();
|
||||
proj.ExplodePower = 1;
|
||||
proj.ProjectilesCount = 3;
|
||||
proj.ProjectilesCount = 5;
|
||||
proj.DelayedFire = true;
|
||||
proj.Inaccuracy = 0.75f;
|
||||
equip.Projectiles.put(new ItemStack(Material.TNT), proj);
|
||||
proj = new ExplosiveProjectile();
|
||||
proj.ExplodePower = 4;
|
||||
proj.ExplodePower = 3;
|
||||
proj.ProjectilesCount = 1;
|
||||
equip.Projectiles.put(new ItemStack(Material.COPPER_BLOCK), proj);
|
||||
equip.Projectiles.put(new ItemStack(Material.IRON_BLOCK), proj);
|
||||
|
||||
EntityProjectile fireProj = new EntityProjectile();
|
||||
fireProj.EntityCount = 2;
|
||||
fireProj.EntityCount = 4;
|
||||
fireProj.EntityTyp = EntityType.SMALL_FIREBALL;
|
||||
fireProj.ParticleType = Particle.WHITE_ASH;
|
||||
fireProj.SoundType = Sound.ENTITY_BLAZE_SHOOT;
|
||||
fireProj.Inaccuracy = 0.75f;
|
||||
equip.Projectiles.put(new ItemStack(Material.FIRE_CHARGE), fireProj);
|
||||
DefinedEquipment.put(equip.ReadyModelNumber, equip);
|
||||
equip = new SiegeEquipment();
|
||||
@@ -264,16 +265,21 @@ public class SiegeEngines extends JavaPlugin {
|
||||
equip.RotateStandHead = true;
|
||||
equip.RotateSideways = true;
|
||||
proj = new ExplosiveProjectile();
|
||||
proj.ExplodePower = 1;
|
||||
proj.ExplodePower = 2;
|
||||
proj.ProjectilesCount = 3;
|
||||
proj.DelayedFire = true;
|
||||
proj.Inaccuracy = 0.5f;
|
||||
proj.Inaccuracy = 0.75f;
|
||||
equip.Projectiles.put(new ItemStack(Material.TNT), proj);
|
||||
proj = new ExplosiveProjectile();
|
||||
proj.ExplodePower = 4;
|
||||
proj.ExplodePower = 3;
|
||||
proj.ProjectilesCount = 1;
|
||||
equip.Projectiles.put(new ItemStack(Material.COPPER_BLOCK), proj);
|
||||
equip.Projectiles.put(new ItemStack(Material.GRAVEL), new EntityProjectile());
|
||||
equip.Projectiles.put(new ItemStack(Material.IRON_BLOCK), proj);
|
||||
EntityProjectile scatterShot = new EntityProjectile();
|
||||
scatterShot.Inaccuracy = 0.5f;
|
||||
scatterShot.EntityCount = 24;
|
||||
scatterShot.ParticleType = Particle.ELECTRIC_SPARK;
|
||||
scatterShot.SoundType = Sound.ITEM_CROSSBOW_SHOOT;
|
||||
equip.Projectiles.put(new ItemStack(Material.GRAVEL), scatterShot);
|
||||
DefinedEquipment.put(equip.ReadyModelNumber, equip);
|
||||
// EntityProjectile pig = new EntityProjectile();
|
||||
// pig.EntityCount = 100;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.github.alathra.siegeengines.command;
|
||||
|
||||
import com.github.alathra.siegeengines.SiegeEquipment;
|
||||
import com.github.alathra.siegeengines.config.Config;
|
||||
import com.github.alathra.siegeengines.projectile.GunnersProjectile;
|
||||
import com.github.milkdrinkers.colorparser.ColorParser;
|
||||
import dev.jorel.commandapi.CommandAPIBukkit;
|
||||
@@ -50,7 +49,7 @@ public class SiegeEnginesCommand {
|
||||
new StringArgument("equipmentid")
|
||||
.replaceSuggestions(
|
||||
ArgumentSuggestions.strings(
|
||||
DefinedEquipment.values().stream().map(gunnerEquipment -> gunnerEquipment.EquipmentId).toList()
|
||||
DefinedEquipment.values().stream().map(SiegeEquipment -> SiegeEquipment.EquipmentId).toList()
|
||||
)
|
||||
),
|
||||
new PlayerArgument("target")
|
||||
@@ -77,9 +76,9 @@ public class SiegeEnginesCommand {
|
||||
|
||||
Player player = (Player) args.getOptional("target").orElse(sender);
|
||||
|
||||
for (SiegeEquipment gunnerEquipment : DefinedEquipment.values()) {
|
||||
if (gunnerEquipment.equals(equipmentId)) {
|
||||
giveEquipment(player, gunnerEquipment);
|
||||
for (SiegeEquipment SiegeEquipment : DefinedEquipment.values()) {
|
||||
if (SiegeEquipment.equals(equipmentId)) {
|
||||
giveEquipment(player, SiegeEquipment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +102,7 @@ public class SiegeEnginesCommand {
|
||||
DefinedEquipment.clear();
|
||||
AddDefaults();
|
||||
HashMap<ItemStack, GunnersProjectile> projObj = new HashMap<>();
|
||||
SiegeEquipment equip = CreateNewGun(null, null, null, null, null, null, projObj);
|
||||
//SiegeEquipment equip = CreateNewGun(null, null, null, null, null, null, projObj);
|
||||
for (SiegeEquipment i : DefinedEquipment.values()) {
|
||||
sender.sendMessage(ColorParser.of("<yellow>Enabled Weapon : %s".formatted(i.EquipmentName)).build());
|
||||
sender.sendMessage(ColorParser.of("<yellow>Weapon Propellant/\"Fuel\" ItemStacks : %s".formatted(i.FuelMaterial)).build());
|
||||
@@ -111,17 +110,16 @@ public class SiegeEnginesCommand {
|
||||
sender.sendMessage(ColorParser.of("<yellow>Weapon Projectile ItemStacks : %s".formatted(proj)).build());
|
||||
}
|
||||
}
|
||||
Config.reload();
|
||||
sender.sendMessage("<yellow>Gunners Core configs reloaded");
|
||||
}
|
||||
|
||||
private void giveEquipment(Player player, SiegeEquipment gunnerEquipment) {
|
||||
private void giveEquipment(Player player, SiegeEquipment SiegeEquipment) {
|
||||
ItemStack item = new ItemStack(Material.CARVED_PUMPKIN);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setCustomModelData(gunnerEquipment.ReadyModelNumber);
|
||||
meta.displayName(ColorParser.of("<yellow>%s Item".formatted(gunnerEquipment.EquipmentName)).build());
|
||||
meta.setCustomModelData(SiegeEquipment.ReadyModelNumber);
|
||||
meta.displayName(ColorParser.of("<yellow>%s Item".formatted(SiegeEquipment.EquipmentName)).build());
|
||||
List<Component> lore = new ArrayList<>();
|
||||
lore.add(ColorParser.of("<yellow>Place as a block to spawn a '%s'".formatted(gunnerEquipment.EquipmentName)).build());
|
||||
lore.add(ColorParser.of("<yellow>Place as a block to spawn a '%s'".formatted(SiegeEquipment.EquipmentName)).build());
|
||||
lore.add(ColorParser.of("<yellow>or put on an Armor Stand.").build());
|
||||
lore.add(ColorParser.of("<yellow>Right click to toggle visibility of stand.").build());
|
||||
meta.lore(lore);
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.github.alathra.siegeengines.config.Config;
|
||||
import com.github.alathra.siegeengines.EquipmentMagazine;
|
||||
import com.github.alathra.siegeengines.SiegeEngines;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -44,7 +45,6 @@ import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
import com.github.alathra.siegeengines.SiegeEquipment;
|
||||
import com.github.alathra.siegeengines.config.Config;
|
||||
import com.github.alathra.siegeengines.projectile.ExplosiveProjectile;
|
||||
|
||||
//import com.palmergames.bukkit.towny.TownyAPI;
|
||||
@@ -195,7 +195,7 @@ public class ClickHandler implements Listener {
|
||||
continue;
|
||||
}
|
||||
double distance = player.getLocation().distance(ent.getLocation());
|
||||
if (distance >= 127) {
|
||||
if (distance >= 64) {
|
||||
continue;
|
||||
}
|
||||
SiegeEquipment siege = SiegeEngines.equipment.get(ent.getUniqueId());
|
||||
@@ -228,7 +228,6 @@ public class ClickHandler implements Listener {
|
||||
for (int i = 0; i < contents.length; i++) {
|
||||
if (contents[i] == null) continue;
|
||||
if (contents[i].isSimilar(m)) {
|
||||
System.out.println(m.toString());
|
||||
int amountInInv = contents[i].getAmount();
|
||||
if (toRemove >= amountInInv) {
|
||||
contents[i].setType(Material.AIR);
|
||||
@@ -249,7 +248,6 @@ public class ClickHandler implements Listener {
|
||||
for(int i = 0; i < contents.length; i++) {
|
||||
if(contents[i] == null) continue;
|
||||
if(contents[i].isSimilar(m)) {
|
||||
System.out.println(m.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -279,12 +277,23 @@ public class ClickHandler implements Listener {
|
||||
if (ItemInHand.getType() != Config.controlItem) {
|
||||
return;
|
||||
}
|
||||
if (!player.isSneaking())
|
||||
Shoot((Entity) player, 7);
|
||||
if (SiegeEngines.TrackedStands.containsKey(player.getUniqueId())) {
|
||||
if (!player.isSneaking()) {
|
||||
List<Entity> entities = SiegeEngines.TrackedStands.get(player.getUniqueId());
|
||||
for (Entity entity : entities) {
|
||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
||||
if (equip != null && equip.Enabled && !(entity.isDead())) {
|
||||
equip.Fire(player,10f,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SiegeEngines.TrackedStands.containsKey(player.getUniqueId())) {
|
||||
List<Entity> entities = SiegeEngines.TrackedStands.get(player.getUniqueId());
|
||||
player.sendMessage("§eReloading Ammunition");
|
||||
for (Entity entity : entities) {
|
||||
boolean foundAmmo = false;
|
||||
if ((entity.isDead())) continue;
|
||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
||||
if (equip == null || !equip.Enabled) {
|
||||
@@ -364,9 +373,10 @@ public class ClickHandler implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage("§eReloading Ammunition");
|
||||
player.sendMessage("§eReloading Propellant");
|
||||
for (Entity entity : entities) {
|
||||
boolean foundAmmo = false;
|
||||
if ((entity.isDead())) continue;
|
||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||
SiegeEquipment equip = SiegeEngines.equipment.get(entity.getUniqueId());
|
||||
if (equip == null || !equip.Enabled) {
|
||||
@@ -383,7 +393,6 @@ public class ClickHandler implements Listener {
|
||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||
//state.update(true,true);
|
||||
equip.AmmoHolder.LoadedFuel += 1;
|
||||
equip.AmmoHolder.MaterialName = stack;
|
||||
foundAmmo = true;
|
||||
//state.update(true,true);
|
||||
}
|
||||
@@ -398,7 +407,6 @@ public class ClickHandler implements Listener {
|
||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||
//state.update(true,true);
|
||||
equip.AmmoHolder.LoadedFuel += 1;
|
||||
equip.AmmoHolder.MaterialName = stack;
|
||||
foundAmmo = true;
|
||||
//state.update(true,true);
|
||||
}
|
||||
@@ -413,7 +421,6 @@ public class ClickHandler implements Listener {
|
||||
state.getInventory().removeItem(stack);//setStorageContents(updateContents(state.getInventory(),stack,1));
|
||||
//state.update(true,true);
|
||||
equip.AmmoHolder.LoadedFuel += 1;
|
||||
equip.AmmoHolder.MaterialName = stack;
|
||||
foundAmmo = true;
|
||||
//state.update(true,true);
|
||||
}
|
||||
@@ -436,7 +443,6 @@ public class ClickHandler implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage("§eReloading Propellant");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -449,7 +455,7 @@ public class ClickHandler implements Listener {
|
||||
if (topline == null) topline = "";
|
||||
Player player = event.getPlayer();
|
||||
String toplinetrimmed = topline.trim();
|
||||
if (toplinetrimmed.equals("[Cannon]")) {
|
||||
if (toplinetrimmed.equalsIgnoreCase("[Cannon]")) {
|
||||
SaveCannons(player, event.getBlock());
|
||||
}
|
||||
|
||||
@@ -527,6 +533,9 @@ public class ClickHandler implements Listener {
|
||||
return;
|
||||
}
|
||||
for (Entity ent : SiegeEngines.TrackedStands.get(player.getUniqueId())) {
|
||||
if (ent.isDead()) {
|
||||
continue;
|
||||
}
|
||||
Ids.add(ent.getUniqueId().toString());
|
||||
}
|
||||
TileState state = ((TileState) block.getState());
|
||||
@@ -787,7 +796,13 @@ public class ClickHandler implements Listener {
|
||||
return;
|
||||
}
|
||||
if (entity.getType() == EntityType.ARMOR_STAND) {
|
||||
if (itemInHand.getType() != Config.controlItem) {
|
||||
SiegeEngines.TrackedStands.get(player.getUniqueId()).remove(entity);
|
||||
player.sendMessage("§eThis Equipment is no longer commanded by you.");
|
||||
return;
|
||||
} else {
|
||||
TakeControl(player, entity);
|
||||
}
|
||||
if (SiegeEngines.equipment.containsKey(entity.getUniqueId())) {
|
||||
if (itemInHand.getType() == Material.CLOCK) {
|
||||
if (player.isSneaking()) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class RotationHandler implements Listener {
|
||||
continue;
|
||||
}
|
||||
double distance = player.getLocation().distance(ent.getLocation());
|
||||
if (distance <= 250) {
|
||||
if (distance <= 32) {
|
||||
// player.sendMessage("§egot id");
|
||||
LivingEntity living = (LivingEntity) ent;
|
||||
Location loc = ent.getLocation();
|
||||
@@ -81,6 +81,9 @@ public class RotationHandler implements Listener {
|
||||
|
||||
living.teleport(loc);
|
||||
equipment.ShowFireLocation(player);
|
||||
} else {
|
||||
SiegeEngines.TrackedStands.get(player.getUniqueId()).remove(ent);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,7 +91,7 @@ public class RotationHandler implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
Vector getDirectionBetweenLocations(Location Start, Location End) {
|
||||
public Vector getDirectionBetweenLocations(Location Start, Location End) {
|
||||
Vector from = Start.toVector();
|
||||
Vector to = End.toVector();
|
||||
return to.subtract(from);
|
||||
|
||||
Reference in new issue
Block a user