added todos, debug state can launch at 45 degree angle
parent
80cf8d3290
commit
2756a560a9
|
@ -2,7 +2,6 @@ package xyz.soper.arty.debug;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
|
@ -44,6 +43,11 @@ public class DebugCommand implements TabExecutor, Listener {
|
||||||
false,
|
false,
|
||||||
Boolean.parseBoolean(args[2]),
|
Boolean.parseBoolean(args[2]),
|
||||||
player);
|
player);
|
||||||
|
player.getWorld().createExplosion(player.getLocation(),
|
||||||
|
(float)(Double.parseDouble(args[1])*3),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else player.sendMessage(ChatColor.RED + "Incorrect usage. This command does not exist.");
|
else player.sendMessage(ChatColor.RED + "Incorrect usage. This command does not exist.");
|
||||||
|
|
|
@ -51,15 +51,26 @@ public class MortarInteract implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
public void onShellLand(ProjectileHitEvent event){
|
public void onShellLand(ProjectileHitEvent event){
|
||||||
if(event.getEntity() instanceof Arrow
|
if(event.getEntity() instanceof Arrow
|
||||||
&& event.getEntity().getCustomName() != null
|
&& event.getEntity().getCustomName() != null
|
||||||
&& event.getEntity().getCustomName().equals("shell")){
|
&& event.getEntity().getCustomName().equals("shell")){
|
||||||
if(event.getHitBlock() != null){
|
if(event.getHitBlock() != null){
|
||||||
event.getHitBlock().getWorld().createExplosion(event.getHitBlock().getLocation(), 2.5F, false, true);
|
//TODO: This needs to have another accompanying explosion that does more player damage than physical damage.
|
||||||
|
event.getHitBlock().getWorld().createExplosion(
|
||||||
|
event.getHitBlock()
|
||||||
|
.getLocation()
|
||||||
|
.add(.5, 0, .5)
|
||||||
|
.add(event.getHitBlockFace()
|
||||||
|
.getDirection()),
|
||||||
|
2.5F,
|
||||||
|
false,
|
||||||
|
true);
|
||||||
|
event.getEntity().remove();
|
||||||
}
|
}
|
||||||
else if(event.getHitEntity() != null){
|
else if(event.getHitEntity() != null){
|
||||||
|
event.getHitEntity().getWorld().createExplosion(event.getHitEntity().getLocation(), 2.5F, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Nameable;
|
import org.bukkit.Nameable;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class Mortar {
|
public class Mortar {
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@ public class Mortar {
|
||||||
public double velocityMultiplier; //Multiplier applied to the shell's velocity
|
public double velocityMultiplier; //Multiplier applied to the shell's velocity
|
||||||
public boolean incendiaryCapable; //Is the mortar fit to fire an incendiary-type shell?
|
public boolean incendiaryCapable; //Is the mortar fit to fire an incendiary-type shell?
|
||||||
|
|
||||||
|
private Vector direction;
|
||||||
|
|
||||||
private Block block;
|
private Block block;
|
||||||
|
|
||||||
public Mortar(Block mortar){
|
public Mortar(Block mortar){
|
||||||
|
|
|
@ -6,6 +6,9 @@ import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A wrapper class for an arrow. Represents a mortar shell.
|
||||||
|
*/
|
||||||
public class Shell {
|
public class Shell {
|
||||||
|
|
||||||
public double explosionMultiplier = 1.0;
|
public double explosionMultiplier = 1.0;
|
||||||
|
@ -14,10 +17,17 @@ public class Shell {
|
||||||
public double baseVelocity = 2.5;
|
public double baseVelocity = 2.5;
|
||||||
public double failChance = .01;
|
public double failChance = .01;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a shell with default stats. Represents the first basic craftable shell in-game.
|
||||||
|
*/
|
||||||
public Shell(){
|
public Shell(){
|
||||||
//TODO: Create default constructor
|
//TODO: Create default constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a shell from a pre-existing arrow ItemStack with lore. If arrow is not a Shell, will create a default shell.
|
||||||
|
* @param shell The ItemStack with lore
|
||||||
|
*/
|
||||||
public Shell(ItemStack shell){
|
public Shell(ItemStack shell){
|
||||||
List<String> stats = shell.getItemMeta().getLore();
|
List<String> stats = shell.getItemMeta().getLore();
|
||||||
explosionMultiplier = Double.parseDouble(stats.get(1).substring(11, 14));
|
explosionMultiplier = Double.parseDouble(stats.get(1).substring(11, 14));
|
||||||
|
@ -27,6 +37,14 @@ public class Shell {
|
||||||
failChance = Double.parseDouble(stats.get(5).substring(13));
|
failChance = Double.parseDouble(stats.get(5).substring(13));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a shell with the specified statistics.
|
||||||
|
* @param explosionMultiplier Explosion multiplier. 1 represents default 2.5
|
||||||
|
* @param penetration
|
||||||
|
* @param incendiaryType
|
||||||
|
* @param baseVelocity
|
||||||
|
* @param failChance
|
||||||
|
*/
|
||||||
public Shell(double explosionMultiplier, int penetration, boolean incendiaryType, double baseVelocity, double failChance){
|
public Shell(double explosionMultiplier, int penetration, boolean incendiaryType, double baseVelocity, double failChance){
|
||||||
this.explosionMultiplier = explosionMultiplier;
|
this.explosionMultiplier = explosionMultiplier;
|
||||||
this.penetration = penetration;
|
this.penetration = penetration;
|
||||||
|
@ -48,4 +66,20 @@ public class Shell {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getShell(){
|
||||||
|
//TODO: Create getShell method that returns ItemStack with shell metadata.
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the stats defined by this function to create a shell with lore and item information.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private ItemStack createShell(){
|
||||||
|
//TODO: Create createShell method
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class MortarHandler {
|
||||||
shellProjectile.setShooter(shooter);
|
shellProjectile.setShooter(shooter);
|
||||||
shellProjectile.setCustomName("shell");
|
shellProjectile.setCustomName("shell");
|
||||||
mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL, mortarLocation, 500, 0, 0, 0, .5);
|
mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL, mortarLocation, 500, 0, 0, 0, .5);
|
||||||
if(shooter instanceof Player) ((Player) shooter).sendMessage("Shell fired with a velocity " + shell.baseVelocity);
|
if(shooter instanceof Player) ((Player) shooter).sendMessage("DEBUG: Shell fired with a velocity " + shell.baseVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue