MortarInteract now does tuner checking
parent
7b62e07892
commit
b27f56efdb
|
@ -1,5 +1,6 @@
|
|||
package xyz.soper.arty.event.Listener;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -11,6 +12,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import xyz.soper.arty.item.Mortar;
|
||||
import xyz.soper.arty.item.MortarTuner;
|
||||
import xyz.soper.arty.item.Shell;
|
||||
import xyz.soper.arty.util.MortarHandler;
|
||||
|
||||
|
@ -36,15 +38,36 @@ public class MortarInteract implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(MortarTuner.isTuner(item)){
|
||||
player.sendMessage("DEBUG: Player has a tuner in hand.");
|
||||
if(player.isSneaking()){
|
||||
if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
|
||||
MortarHandler.linkTuner(block, item);
|
||||
player.updateInventory();
|
||||
player.sendMessage(ChatColor.GOLD + "Linked Tuner with to Mortar at "
|
||||
+ block.getLocation().getBlockX() + ", "
|
||||
+ block.getLocation().getBlockY() + ", "
|
||||
+ block.getLocation().getBlockZ());
|
||||
}
|
||||
}
|
||||
else{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onShellLand(ProjectileHitEvent event){
|
||||
if(event.getEntity() instanceof Arrow
|
||||
&& event.getEntity().getCustomName() != null
|
||||
&& event.getEntity().getCustomName().equals("shell")){
|
||||
//START DEBUG
|
||||
System.out.println(ChatColor.GOLD + "------ARTY-DEBUG:------");
|
||||
System.out.println(event.getEntity().getCustomName());
|
||||
System.out.println(event.getEntity().getShooter());
|
||||
System.out.println(Shell.isShell(event.getEntity()));
|
||||
//END DEBUG
|
||||
if(Shell.isShell(event.getEntity())){
|
||||
Shell shell = new Shell(event.getEntity());
|
||||
/*DEBUG*/System.out.println("Projectile is an arrow, not null, and a shell");
|
||||
if(event.getHitBlock() != null){
|
||||
/*DEBUG*/System.out.println("Projectile hit a block, exploding shell in front of block.");
|
||||
shell.explodeShell(
|
||||
event.getHitBlock()
|
||||
.getLocation()
|
||||
|
@ -56,9 +79,12 @@ public class MortarInteract implements Listener {
|
|||
event.getEntity().remove();
|
||||
}
|
||||
else if(event.getHitEntity() != null){
|
||||
/*DEBUG*/System.out.println("Projectile hit an entity, exploding shell on entity.");
|
||||
shell.explodeShell(event.getHitEntity().getLocation());
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
/*DEBUG*/System.out.println("Ending onShellLand event");
|
||||
/*DEBUG*/System.out.println(ChatColor.GOLD + "---END OF ARTY-DEBUG---");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue