GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Support for custom tablist header and footer by Kecerim24 · Pull Request #513 · feather-rs/feather Conversation
|
| game.insert_resource(TablistHeaderFooter { | ||
| header: "{\"text\":\"\"}".to_string(), | ||
| footer: "{\"text\":\"\"}".to_string(), | ||
| }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It would be great if you add the initial values to config.toml
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's that important to have default values, because this isn't a vanilla feature. If anyone needs this, it would be better to use a plugin.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Feather is not even close to be fully survival-compatible, so the only usage for Feather in production will be lobbies and mini-games. And there's 99% chance that everyone needs this feature. If someone wants more advanced features (like placeholders, animations), it would still be possible to override the resource by a plugin. I don't know why vanilla server doesn't have this feature, but lack of feature is not a good thing to copy.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Then in what format and where in the config would you like it?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In what format
Just like motd, using Text::from(str). Or there is libcraft_text::markdown module that allows writing rich text components in format @red some text @on_hover @show_text @green some hover text, but I don't see any existing usage or documentation for this format.
Where
[server] section
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Add configurable values to config.toml
| default_header = "" | ||
| default_footer = "" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Users won't understand what header/footer is, I think it should be named like tablist_header or playerlist_header, and have default values to make it even more obvious (like vanilla's "A Minecraft Server" default motd).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Rename `default_header` to `tablist_header` Rename `default_footer` to `tablist_footer`
| #[derive(Debug, Clone)] | ||
| pub struct TablistHeaderFooter { | ||
| pub header: Text, | ||
| pub footer: Text, | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
feather_common::events is for events, while TablistHeaderFooter is a resource. I'm not sure what file would fit best for this small struct, but definitely not events.rs
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Where does it need to be for plugins to get to it?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
quill/common. Quill doesn't support resources though.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You can create feather/common/src/tablist.rs or quill/common/src/tablist.rs, but not in feather/server. No other crate can access feather-server.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Ok(()) | ||
| } | ||
|
|
||
| fn update_tablist_header(game: &mut Game, server: &mut Server) -> SysResult { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It updates not only header, but also footer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Ok(()) | ||
| } | ||
|
|
||
| fn send_tablist_header_on_join(game: &mut Game, server: &mut Server) -> SysResult { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It sends not only header, but also footer.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Rename `update_tablist_header` to `update_tablist_header_footer` Rename `send_tablist_header_on_join` to `send_tablist_header_footer_on_join`
…into pretty_tablist
There was an error while loading. Please reload this page.
|
(45d01df) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| /// The default tablist header. | ||
| pub tablist_header: Text, | ||
|
|
||
| /// The default tablist footer. | ||
| pub tablist_footer: Text, | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We have Config for server config and Options for Server options (mostly for initial connection handling, status, ping, working with proxies), so I think tablist values should only be in Config.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
let server_options = game.resources.get::<Server>().unwrap().options.clone();
game.insert_resource(TablistHeaderFooter {
header: server_options.tablist_header.clone(),
footer: server_options.tablist_footer.clone(),
});
Then how do I get it from config to use it for TablistHeaderFooter in tablist.rs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, got it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You can pass it to register(game) function, or even better, make Config (or even Rc<Config> to make it immutable) a resource and Options non-resource. Options is never used as a resource (just did a quick search on cs.github)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Add config to resources
…into pretty_tablist
| #[derive(Debug)] | ||
| pub struct TablistExtrasUpdateEvent; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
#522 is now merged, so quill-compatible events should be in quill/common/srs/events/change.rs, implement Serialize, Deserialize, Clone, be defined in quill/common/src/component.rs in HostComponent enum and have bincode_component_impl! in the end.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not sure if this should be store in the default config. It would be quite easy to write a plugin, which sets the header and footer based on a config file. Going down this rapid hole, would result in a masive config file. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It's currently impossible to write a plugin that interacts with resources, and we don't have a config API yet. Also, I think it would be a great first experience if we have static tablist header/footer built-in, the same way as we do with motd. Like I said in the previous conversation, everyone wants a pretty tablist in their [mini-game or lobby] server, and it's important to have very-commonly-used features built-in rather than to rely on third-party "must-have" plugins (which we don't even have yet). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.