|
|
|
@ -11,10 +11,10 @@ import org.bukkit.inventory.ItemStack; |
|
|
|
|
public class itemeffect_eventhandler implements Listener { |
|
|
|
|
@EventHandler |
|
|
|
|
public void onProjectileHit(ProjectileHitEvent e) { //투사체 착탄시 실행
|
|
|
|
|
if(e.getEntity().hasMetadata("shotgun")) { //만약 화살이 명령어로 생성되었다면
|
|
|
|
|
Arrow arrow = (Arrow)e.getEntity(); //객체를 화살로 변환
|
|
|
|
|
if (e.getEntity().hasMetadata("shotgun")) { //만약 화살이 명령어로 생성되었다면
|
|
|
|
|
Arrow arrow = (Arrow) e.getEntity(); //객체를 화살로 변환
|
|
|
|
|
arrow.getWorld().createExplosion(arrow.getLocation(), 1); //화살의 착탄 위치에 폭발 생성
|
|
|
|
|
arrow.remove(); //화살 삭제
|
|
|
|
|
arrow.remove(); //화 삭제
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -25,11 +25,12 @@ public class itemeffect_eventhandler implements Listener { |
|
|
|
|
ItemStack item = e.getItem(); //플레이어가 상호작용할 때 손에 들고 있던 아이템
|
|
|
|
|
|
|
|
|
|
//플레이어가 좌클릭을 눌렀을 때(허공을 때리거나 블럭을 때릴 때)
|
|
|
|
|
if(action.equals(Action.LEFT_CLICK_AIR) || action.equals(Action.LEFT_CLICK_BLOCK)) { |
|
|
|
|
if(item != null) { //플레이어 손에 무언가 있으면
|
|
|
|
|
switch(item.getType()) { |
|
|
|
|
if (action.equals(Action.LEFT_CLICK_AIR) || action.equals(Action.LEFT_CLICK_BLOCK)) { |
|
|
|
|
if (item != null) { //플레이어 손에 무언가 있으면
|
|
|
|
|
switch (item.getType()) { |
|
|
|
|
case BOW: //그 무언가가 활이라면
|
|
|
|
|
player.performCommand("itemeffect:shotgun"); //산탄화살 발사
|
|
|
|
|
player.performCommand("User_DB:shotgun"); //산탄화살 발사
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|