-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reintroduce include statements #1028
Conversation
Oh wow, this is unexpected and awesome! |
@RuedigerLP suggested adding back the
I went ahead and implemented it as per @Pablete1234's suggestion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When i suggested it originally i expected you to just save the root element, not switch it to Document
, and then just return root.cloneContent()
on getContent
method. But i think it's fine either way.
Will this properly trigger an XML update without a server restart if a map has an include and the include is changed? Looking at |
Great observation. At the moment there's no way to automatically detect when changes occur in the include files, the A potential solution for the map context issue would be to have MapSource store a list of includes per map (added on load) and combine some logic so As for checking if XML updates will auto-trigger if the include is modified without running the reload command, unsure of the best solution. If anyone has any suggestions let me know! |
What about doing a quick search through the map.xml in |
Also, does errors work when the error is from an include? I can imagine it would show as an element in the map.xml |
I'm not sure parsing the document in that method is the best place for this, but thanks for the suggestion! I've got another idea I'll try though, will see if I can get a commit pushed today/tomorrow 👍
Excellent question! I've not tested that, but I assume it would show the error as part of the map which should be fine. I'll have to check how OCN handled this to compare. |
core/src/main/java/tc/oc/pgm/api/map/includes/MapIncludeProcessor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/map/includes/StoredMapIncludeImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/map/includes/MapIncludeProcessorImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/map/includes/MapIncludeProcessorImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/map/includes/MapIncludeProcessorImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/tc/oc/pgm/map/includes/MapIncludeProcessorImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: applenick <[email protected]>
Signed-off-by: applenick <[email protected]>
Signed-off-by: applenick <[email protected]>
Signed-off-by: applenick <[email protected]>
Signed-off-by: applenick <[email protected]>
Sorry forgot to check this PR for a few days, just went through and made Pablo's most recent suggestions along with a rebase. Thanks again! I'm not sure what else can be improved upon for this, but always open to suggestions 👍 |
Signed-off-by: applenick <[email protected]> Signed-off-by: Samuel Roach <[email protected]>
Reintroduce include statements
Include statements are back 🎉
This PR reintroduces include statements, which allow for global XML files to be loaded and re-used across different maps. Our new implementation is slightly different from the version used on OCN, but should allow for a very user-friendly and familiar experience.
Example
Let's showcase this awesome feature with a simple example, say you're operating a blitz tournament and want every map to have standardized values. Normally you would be able to achieve this by modifying each individual map to ensure they all have the same values set.
With map includes, it's as simple as first defining your map include file:
PGM will automatically infer the include id based on the file name, in this case
blitz.xml -> blitz
Then to include the blitz file, you just have to reference it using the following statement.
The benefit is now you'll be able to modify values in a single location and have all maps which reference the include be provided with the same values. Think of all the cool possibilities this feature will unlock 🤯
Quick Facts
map.includes
).<include src="file.xml"/>
from OCN is NOT supported, but will not prevent the map from loading. Instead a small warning will be shown in the console encouraging server operators to upgrade.Any and all feedback is welcome! As always, these changes have been heavily tested and work as intended 👍
Signed-off-by: applenick [email protected]