From 9eade9abc7ca598aaa22ae29e7d83f9976c8862c Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 27 Jul 2020 21:11:07 -0700 Subject: [PATCH] placeholder xbow code --- .../skills/crossbows/CrossbowManager.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/crossbows/CrossbowManager.java b/src/main/java/com/gmail/nossr50/skills/crossbows/CrossbowManager.java index e55e5fe8e..7600ee3a5 100644 --- a/src/main/java/com/gmail/nossr50/skills/crossbows/CrossbowManager.java +++ b/src/main/java/com/gmail/nossr50/skills/crossbows/CrossbowManager.java @@ -2,12 +2,17 @@ package com.gmail.nossr50.skills.crossbows; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; +import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.skills.archery.Archery; +import com.gmail.nossr50.util.Permissions; +import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Projectile; import org.bukkit.event.entity.ProjectileLaunchEvent; public class CrossbowManager extends SkillManager { @@ -29,7 +34,7 @@ public class CrossbowManager extends SkillManager { Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value(); Location targetLocation = target.getLocation(); - if (firedLocation.getWorld() != targetLocation.getWorld()) { + if (firedLocation == null || firedLocation.getWorld() != targetLocation.getWorld()) { return 1; } @@ -43,6 +48,19 @@ public class CrossbowManager extends SkillManager { */ public void processProjectileLaunchEvent(ProjectileLaunchEvent projectileLaunchEvent) { mcMMOPlayer.getPlayer().sendMessage("Pew pew!"); + + //Testing + if(Permissions.isSubSkillEnabled(mcMMOPlayer.getPlayer(), SubSkillType.CROSSBOWS_CONE_OF_DEATH)) { + coneOfDeathProcessing(projectileLaunchEvent); + } + } + + + private void coneOfDeathProcessing(ProjectileLaunchEvent projectileLaunchEvent) { + Projectile mainProjectile = projectileLaunchEvent.getEntity(); + World world = mainProjectile.getWorld(); + + }