개인 자료란 (JE)

  서버 커뮤니티

Profile 망망대해 일반인

Leeke_ 4c24772864594b42932ce49715f62f76

Profile

질문하기 플러그인

[1.20.4] 왜 null를 반환하는지 모르겠습니다ㅠ..

2024.03.15 조회 수 26 추천 수 0
이해도 초보자 
게임버전 (JE) 관련없음 
게임버전 (BE) 관련없음 

onCommand에서 자꾸 null을 반환한다고 로그가 떠서 별걸 다 고쳐봤는데 뭔지 모르겠습니다..


[메인 클래스]


[HelpCommand 클래스]


[config.yml 파일]


서버 로그는 아래처럼 되어있습니다ㅠ

[22:01:32] [Server thread/ERROR]: Error occurred while enabling Teleport v1.0 (Is it up to date?)

java.lang.NullPointerException: null

        at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]

        at org.example.code.teleport.Teleport.onEnable(Teleport.java:18) ~[?:?]

        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]

        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]

        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]

        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugin(CraftServer.java:539) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.enablePlugins(CraftServer.java:453) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:623) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:409) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:250) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1000) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4016-Spigot-864e4ac-771182f]

        at java.lang.Thread.run(Thread.java:833) ~[?:?]

로그 보시면 null값을 반환한다고 하는데.. 이게.. 뭘 고쳐야할지...ㅠ




3개의 댓글

qsef1256
2024.03.15

명령어는 config.yml이 아니라 plugin.yml에 정의되어야 합니다.

망망대해
2024.03.15
@qsef1256

후에 uuid 추가할 거 config.yml를 미리 만들어 놓다가 plugin.yml에 적어야하는거 잊어버린 거 같아요ㅠ 감사합니다..ㅠㅠ

NoEul
2024.03.16
  • https://www.koreaminecraft.net/review/3669278
  • non-static 필드 혹은 메소드를 참조할 때 가급적이면 this를 붙이세욘
  • Java 17 이상을 사용하신다면 instanceof 패턴 매칭 #연산자를 사용해 조건식을 작성해 보세욘
    Object o = ...
    if (o instanceof String s)
        // s in scope for this substatement; no cast of o needed
        System.out.println(s.replace('*', '_'));
    else 
        // s not in scope for this substatement (hence, error)
        System.out.println(s);
    
    // 혹은
    void test(Object o) {
        if (!(o instanceof String s)) {
            throw new IllegalArgumentException();
        }
        // This point is only reachable if the pattern match succeeded
        // Thus, s is in scope for the rest of the block
        ...
        System.out.println(s.repeat(5));
        ...
    }
  • Java 17 이상을 사용하신다면 여러 줄의 문자열 적을 때 Text Blocks 리터럴을 사용해 보세욘
    class Story1 {
        public static void main(String[] args) {
            String story = """
                "When I use a word," Humpty Dumpty said,
                in rather a scornful tone, "it means just what I
                choose it to mean - neither more nor less."
                "The question is," said Alice, "whether you
                can make words mean so many different things."
                "The question is," said Humpty Dumpty,
                "which is to be master - that's all."
            """;
        }
    }
  • 명령어 실행에 실패하였을 경우 false 값을 return하세욘
  • 변수 네이밍은 가급적이면 약어를 사용하지 않아야 하는 것인데, 스크린 샷으로 봐서는 네이밍을 잘한 것이에욘
뉴스 및 창작물
/files/thumbnails/268/789/003/262x150.crop.jpg?20240515192032

레드스톤

벌레먹은 돌 빠르게 제거하는 법

GlassesFilm

2024-05-15

0

/files/thumbnails/797/788/003/262x150.crop.jpg?20240515090924

건축

마인크래프트로 구현한 카르카손 보드게임

Warak

2024-05-15

1

/files/thumbnails/487/784/003/262x150.crop.jpg?20240508233607

모드

Windows Borderless 모드에서 악성코드 발견

학교가기싫다

2024-05-08

1

/files/thumbnails/384/778/003/262x150.crop.jpg?20240512002324

업데이트

마인크래프트 자바 에디션 스냅샷 24w18a

학교가기싫다

2024-05-06

0

/files/thumbnails/855/781/003/262x150.crop.jpg?20240505141129

레드스톤

레이저 클리너

GlassesFilm

2024-05-05

1