Closed Maxopoly closed 8 years ago
you want me to just add some nice methods into the CivMenuAPI class to easily make TextComponents like below?
public static TextComponent makeLinkComponent(String text, String link, String hoverText, boolean italic, boolean bold, boolean obfuscated, boolean strikethrough, ChatColor color) {
TextComponent component = new TextComponent(text);
component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hoverText).create()));
component.setItalic(italic);
component.setBold(bold);
component.setObfuscated(obfuscated);
component.setStrikethrough(strikethrough);
component.setColor(color);
return component;
}
Yeah
Or actually could you just allow specifying that in the config additionally to the text? Also add a default that reflects the current behavior so the options only have to be specified if you need them
I'm a little confused where exactly do you want this to be configured? Are we talking about in the TsS message where you can link the ToS?
@CivConfig(name = "terms.link", def = "http://www.google.com", type = CivConfigType.String),
@CivConfig(name = "terms.linkMessage" , def = "You can click this message to open up the terms of service.", type = CivConfigType.String),
do you just want me to add a terms.linkHover?
No, not related to terms at all
I want to be able to make a config like this and just have it work:
currently you can specify a documentation url for a plugin as a whole, but i'll add functionality so you can add a response specific url as well to override the plugin url
Ok, thanks
@Maxopoly so @rourke750 and I were talking about making this entirely config based and not making it a dependency in all our other plugins. To do this we think the best way is to override the plugin manager and getting the event from the callEvent method (you can't listen for a generic event it's dumb tbh). So then the issue is how do you get, say, a player out of an event? So we're thinking maybe allow you to define the method/field in the config and using reflection. Thoughts on if this is a good idea and/or how we could improve it?
What would be the advantage of this? Sounds overly complicated imo. How would this work with custom messages that are not associated with an event?
What custom messages would there be not associated with events?
Many. For example in FM when someone is creating a factory and he has the wrong block setup I have a help message describing exactly what it should look like or if he inputs the wrong materials I have a help message leading to the docu.
Pretty much none of the stuff I did was bound to events, I used custom names for everything and had like 12 messages just in the method for factory creation.
Ok well there goes that idea
@TealNerd
Could you add an option to let a message open a link, if you click it or display more information if you hover it?
You can use this api, which is already included in spigoti: https://www.spigotmc.org/wiki/the-chat-component-api/