ME1312 / SubServers-2

SubServers – The Minecraft Server Management Platform
Apache License 2.0
91 stars 23 forks source link

It seems like files are not being copied when importing templates. #83

Closed ajh123 closed 1 year ago

ajh123 commented 1 year ago

Platform Information

Paste in the version information from the SubServers app in question here. To get this info, run the /sub version command where applicable or launch SubServers with the -v argument. Make sure the app name matches the one you are reporting this bug for.

[11:34:10 INFO]: SubServers > These are the platforms and versions that are running SubServers.Bungee:
[11:34:10 INFO]:   Windows 10 (19045.2965) [x64],
[11:34:10 INFO]:   Java 17.0.1 [x64],
[11:34:10 INFO]:   Waterfall git:Waterfall-Bootstrap:1.19-R0.1-SNAPSHOT:3df3a27:526,
[11:34:10 INFO]:   SubServers.Bungee v2.19a (23w14c)
[11:34:10 INFO]:
[11:34:11 INFO]: You are on the latest version.

What Happened

The server is unable to start because the paper-1.19.4-538.jar file is part of the Main template, which did not get copied to the Lobby server.

How It Happened

I created two templates a "Main" one and a "Lobby" one. The lobby imports the main. Main template

Version: '2.18a+'
Template:
  Enabled: true
  Internal: true
  Icon: 'anvil'
  Replace: # Would `SubServers::template` be "Main" or would it be "Lobby"?
  - '/plugins/LuckPerms/config.yml' # This file contains a line like `server: SubServers::template`
  Build:
    Server-Type: 'Spigot'
    Use-Cache: true
    Require-Version: false
    Can-Update: true
    Update-Files: true
    Update-Settings: true
    Executable: 'bash build.sh'
  Settings:
    Executable: 'java -Xmx2048M -jar paper-1.19.4-538.jar --nogui'

Lobby template

Version: '2.18a+'
Template:
  Enabled: true
  Icon: 'anvil'
  Import:
  - Main
  Build:
    Server-Type: 'Spigot'
    Use-Cache: true
    Require-Version: false
    Can-Update: true
    Update-Files: true
    Update-Settings: true
    Executable: 'bash build.sh'
  Settings:
    Executable: 'java -Xmx2048M -jar paper-1.19.4-538.jar --nogui'

In both templates the "build.sh" is just a simple exit 0 because I already have the paper-1.19.4-538.jar inside the Main template's folder. Also the Main template contains other files like plugins and server.properties.

When I run /sub create Lobby_1 ~ Lobby I expect it to copy the contents of the Main template first then the Lobby template before starting the server. Instead it look like only files in the Lobby template gets copied, so when the server starts the error: Lobby_1 > Error: Unable to access jarfile paper-1.19.4-538.jar is produced because the paper-1.19.4-538.jar is found in the Main template.

Additional Information

I was able to do this a long while ago, but I don't know when.

ajh123 commented 1 year ago

I originally thought it might of been the variable replacement thing, but after updating my templates to ...

Main

Version: '2.18a+'
Template:
  Enabled: true
  Internal: false
  Icon: 'anvil'
  Build:
    Server-Type: 'Spigot'
    Use-Cache: true
    Require-Version: false
    Can-Update: true
    Update-Files: true
    Update-Settings: true
    Executable: 'bash build.sh'
  Settings:
    Executable: 'java -Xmx2048M -jar paper-1.19.4-538.jar --nogui'

Lobby

Version: '2.18a+'
Template:
  Enabled: true
  Icon: 'anvil'
  Import:
  - Main
  Build:
    Server-Type: 'Spigot'
    Use-Cache: true
    Require-Version: false
    Can-Update: true
    Update-Files: true
    Update-Settings: true
    Executable: 'bash build.sh'
  Settings:
    Executable: 'java -Xmx2048M -jar paper-1.19.4-538.jar --nogui'

Still no luck.

ME1312 commented 1 year ago

So, both of the properties you added actually belong under the Build section of the config. (Also, there's no need to launch an empty build script, you can just remove that line.) (Same for the creation of the template cache folder that's going unused.)

As for your question, SubServers::template would output the user-specified template name (Lobby). (Although, perhaps the actual server name (SubServers::name) would be better for this use-case?) (And, it seems there was actually a problem making replacements in parent-specified files. This is what the above commit fixed.)

ajh123 commented 1 year ago

Thanks that did solve the issue. Also the LuckPerms' "server" variable is used like a group like Lobby, so Lobby_1 and Lobby_2 will share the same permissions.,