1.14.4 Error with plugin.yml

Discussion in 'Spigot Plugin Development' started by Th3Wh1teG0d, Mar 6, 2020.

  1. Hello, is there a way to use Ö, Ä, or Ü for a command ? For Example /testÖ or /testÜ
     
  2. No. You can only use english characters from a-z or numbers.
     
  3. Have you tried doing it the regular way? Did it cause errors?
     
  4. "regular way"? the issue is due to the special character at the end of the plugin.yml in the command..
     
  5. OP didn't mention that, so how am I supposed to know?! That's why I asked what the error is..
     
  6. Im getting this error:
    Code (Java):

    [18:37:54 ERROR]: Could not load 'plugins\CityBuildSystem.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:169) ~[patched_1.14.4.jar:git-Paper-243]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:142) ~[patched_1.14.4.jar:git-Paper-243]
            at org.bukkit.craftbukkit.v1_14_R1.CraftServer.loadPlugins(CraftServer.java:355) ~[patched_1.14.4.jar:git-Paper-243]
            at net.minecraft.server.v1_14_R1.DedicatedServer.init(DedicatedServer.java:226) ~[patched_1.14.4.jar:git-Paper-243]
            at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:876) ~[patched_1.14.4.jar:git-Paper-243]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
    Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
            at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:218) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:171) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1177) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:287) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:195) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:107) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:139) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:524) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:452) ~[patched_1.14.4.jar:git-Paper-243]
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:240) ~[patched_1.14.4.jar:git-Paper-243]
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:164) ~[patched_1.14.4.jar:git-Paper-243]
            ... 5 more
    Caused by: java.nio.charset.MalformedInputException: Input length = 1
            at java.nio.charset.CoderResult.throwException(Unknown Source) ~[?:1.8.0_241]
            at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:1.8.0_241]
            at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[?:1.8.0_241]
            at java.io.InputStreamReader.read(Unknown Source) ~[?:1.8.0_241]
            at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:176) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.ensureEnoughData(StreamReader.java:171) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.reader.StreamReader.peek(StreamReader.java:126) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.scanner.ScannerImpl.scanToNextToken(ScannerImpl.java:1177) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:287) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:195) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:107) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:139) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:524) ~[patched_1.14.4.jar:git-Paper-243]
            at org.yaml.snakeyaml.Yaml.load(Yaml.java:452) ~[patched_1.14.4.jar:git-Paper-243]
            at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:240) ~[patched_1.14.4.jar:git-Paper-243]
            at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:164) ~[patched_1.14.4.jar:git-Paper-243]
            ... 5 more
     
     
  7. In the plugin.yml you cannot use German "Umlaute" or stuff like ß. The only situation where you can use them is in actual Strings. As commands are represented by keys without quotation marks, you cannot have them in commands but if you put them in quotes, YAML files shouldn't have trouble with it.
     
  8. i have heard that you can change the plugin.yml to UTF 8 is this possible ?
     
  9. Yes it is, but it doesn't change the fact that non-String keys in the plugin.yml cannot contain character like ä,ö,ü etc.
     
  10. If you're using IntelliJ, when you're viewing the file your currently used encoding should be on bottom-right. If you click it, there will be a context menu where you can select a different one. I believe it should be in UTF-8 by default though.
     
  11. is there another way that i can only make this command (/testÜ or do with ÖÄÜ etc.) "registerd" in the "HelpMap / HelpTopic" so that you can see it on the auto tab completion ?
     
  12. Real commands cannot contain these characters. Maybe you can add them via Tab Completion (Interface like the CommandExecutor).
     
  13. I use UltraCustomizer and i can make command with ÖÄÜ etc.
     
  14. The way it registers commands is different. Normally commands are registered in the class that extends JavaPlugin using registerCommand("test").setExecutor(a CommandExecutor instance). The entries basically tell bukkit if someone types "/test" the registered commandExecutor will be triggered. Another option is to have a permanently active onCommand method. This will trigger whenever someone types a command that is in the plugin.yml. Then you can check for the command name. The way you might want to do it, is using an event that listens for someone executing a command.

    Let's do it like that:

    Code (Java):

    @EventHandler
    public void onCmd (PlayerCommandPreprocessEvent event) {
        String command = event.getMessage(); // getting the text behind the slash
       
        if (command.equals("test")) {
            event.setCancelled(true); //So it won't say "command not found"
           
            //Do your stuff here
        }
    }
     
    Hope that helps
     
  15. I basically have the problem when i make a new command in UltraCustomizer the command does not be visible in the auto tab complete and in my plugin it then shows a Command not found Message. (the command works) but HOW do i make it so that my commands that i make with UltraCustomizer are shown in the auto tab complete ?
     
  16. That's the developer's task i guess. The reason why auto completion doesn't work is because UltraCustumizer doesn't use "real" commands(so Bukkit doesn't complete it on tab). And as it's theoretically not a command, it might show the "command not found" message. To avoid this, simply cancel the event.
     
  17. PlayerCommandPreprocessEvent shouldn't be used to handle command logic, which is stated quite clearly in the javadocs. The only decent solution is to not use hacky methods to get what you want and just abide by the restrictions Bukkit has set in place.
     
  18. Now you could make a command /test that takes Ö, Ä, or Ü as an argument. /test Ö etc etc

    P.S. https://bukkit.gamepedia.com/Commands.yml this could helpful, I believe aliases set in commands.yml show up in tab completion, but I do not believe it can use special characters, have never tried though ;)
     
  19. For this i dont want to create my own command. I want to make is so that you can see the command in the auto tab (I want to create a Menu and in German its called Menü and i want to display /menü in the auto tab complete... :/)
     
  20. I would say your best bet then is to speak with the dev of UltraCustomizer and ask him/her to add this feature.