개인 자료란 (JE)

  서버 커뮤니티

Profile neinerror 대표칭호 없음

boyboy0710 9fffd44cc5804e898461161437fe7911

Profile

질문하기 플러그인

플러그인 칼 날리기

2021.01.24 조회 수 204 추천 수 0

칼을 우클릭이나 좌클릭을 해서 날리는 플러그인 구문이 있나요?(자바)

4개의 댓글

윈초
2021.01.24

아머스텐드로 하면 가능할거같은데요?

던지면 반복한다음 근처에 엔티티가 있으면 뎀지 주게..?

neinerror
2021.01.24
@윈초

예시 구문 있나요?

 

윈초
2021.01.25
@neinerror

onEnable부분

getServer().getScheduler().scheduleSyncRepeatingTask(this, () -> {
        for (Player player : Bukkit.getOnlinePlayers()) {
            List<ArmorStand> stands = new ArrayList<>();
            List<Entity> entities = Bukkit.getWorld("world").getEntities();
            for (Entity entity : entities) {
                if (entity.getType().equals(EntityType.ARMOR_STAND)) {
                    stands.add((ArmorStand) entity);
                }
            }
            for (ArmorStand armorStand : stands) {
                if (armorStand.getScoreboardTags().contains(player.getName())) {
                    armorStand.teleport(armorStand.getLocation().add(armorStand.getLocation().getDirection().multiply(1)));
                }
                for (Entity entity : entities) {
                    if (entity.getLocation().distance(armorStand.getLocation()) < 1) {
                        if (entity instanceof LivingEntity) {
                            ((org.bukkit.entity.LivingEntity) entity).damage(5);
                        }
                    }
                }
            }
        }
    }, 0, 0);
}

listener부분

@EventHandler
public void interact(PlayerInteractEvent event) {
    if(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
        Player player = event.getPlayer();
        World world = event.getPlayer().getWorld();
        ArmorStand stand = world.spawn(player.getLocation(), ArmorStand.class);
        stand.addScoreboardTag(player.getName());
        stand.setItem(EquipmentSlot.HAND, player.getInventory().getItemInMainHand());
        player.getInventory().setItemInMainHand(null);
    }
}




neinerror
2021.01.25
@윈초

감사합니다

뉴스 및 창작물
/files/thumbnails/115/774/003/262x150.crop.jpg?20240424195207

업데이트

마인크래프트 1.20.5 정식 업데이트

학교가기싫다

2024-04-24

0

/files/thumbnails/762/770/003/262x150.crop.jpg?20240418073724

레드스톤

T.B.H (고민중독) | 노트블럭 버전 | NoteBlock Cover [한국어 영어 중국어 가사 추가]

노트블럭전문가

2024-04-18

0

/files/thumbnails/218/767/003/262x150.crop.jpg?20240412130213

레드스톤

우리의 꿈 - 원피스 오프닝

노트블럭전문가

2024-04-12

0

/files/thumbnails/505/766/003/262x150.crop.jpg?20240411122306

레드스톤

기동전사 건담 수성의 마녀 | 노트블럭 커버 1

노트블럭전문가

2024-04-11

1

/files/thumbnails/932/765/003/262x150.crop.jpg?20240410124459

레드스톤

마인크래프트 노트블록으로 만든 『 밤양갱 (Bam Yang Gang) 』

노트블럭전문가

2024-04-10

0