Chest Commands

Chest Commands

1M Downloads

ChestCommands errors on server boot with symlink config directory

datig opened this issue ยท 1 comments

commented

Description

For my servers with common configurations, I like to keep my config files in the same place. Then I create a symlink from:

/plugins/ --> ~/common/plugins/

When I try this configuration layout with ChestCommands the server won't start. See the full stack below. It hits an exception in ChestCommands.load(ChestCommands.java:148).

From a little digging it looks like you may be able to make the change suggested here and fix the issue:

https://stackoverflow.com/questions/2450612/java-file-isdirectory-returns-false-for-a-directory-in-linux

Here's another resource with more details: https://stackabuse.com/java-check-if-a-file-or-directory-exists/

Thanks for considering this change!

How to reproduce

On a Linux host:

  • mv /plugins/ ~/common/plugins/
  • ln -s ~/common/plugins/ /plugins/
  • Reboot server

Platform

  • Server version (output of /version):
  • {"oldVersion":"git-Paper-446 (MC: 1.16.5)","currentVersion":"git-Paper-449 (MC: 1.16.5)"}%
  • Chest Commands version (check with /cc): 4.0.3

Additional context

17:19:04] [Server thread/INFO]: [ChestCommands] Encountered 1 error(s) on load:

  1. Plugin failed to load, couldn't create data folder.
    --------[ Exception details ]--------
    java.nio.file.FileAlreadyExistsException: plugins/ChestCommands
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389)
    at java.base/java.nio.file.Files.createDirectory(Files.java:689)
    at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:796)
    at java.base/java.nio.file.Files.createDirectories(Files.java:742)
    at me.filoghost.chestcommands.ChestCommands.load(ChestCommands.java:148)
    at me.filoghost.chestcommands.ChestCommands.onCheckedEnable(ChestCommands.java:124)
    at me.filoghost.chestcommands.fcommons.BaseJavaPlugin.onEnable(BaseJavaPlugin.java:21)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483)
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501)
    at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415)
    at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:465)
    at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:239)
    at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:936)
    at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)

commented

Sorry for not replying, however I tested this on a Linux machine and it works fine. Maybe it has been fixed in more recent Java versions.