Release v1.2.1! Set hover-text to false by default for 1.19-R01-SNAPSHOT and true for other versions

This commit is contained in:
Artemis-the-gr8 2022-06-08 21:05:24 +02:00
parent bf3feda8cc
commit 1484ebb912
7 changed files with 16 additions and 11 deletions

View File

@ -54,7 +54,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -30,7 +30,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -30,9 +30,10 @@ public class Main extends JavaPlugin {
//initialize the Adventure library
adventure = BukkitAudiences.create(this);
boolean canHover = !Bukkit.getBukkitVersion().equalsIgnoreCase("1.19-R0.1-SNAPSHOT");
//get instances of the classes that should be initialized
ConfigHandler config = new ConfigHandler(this);
ConfigHandler config = new ConfigHandler(this, canHover);
MessageFactory messageFactory = new MessageFactory(config);
ThreadManager threadManager = new ThreadManager(this, adventure(), config, messageFactory);

View File

@ -36,7 +36,8 @@ public class StatCommand implements CommandExecutor {
return true;
}
else if (args[0].equalsIgnoreCase("examples")) { //in case of "statistic examples", show examples
else if (args[0].equalsIgnoreCase("examples") ||
args[0].equalsIgnoreCase("example")) { //in case of "statistic examples", show examples
adventure.sender(sender).sendMessage(messageFactory.usageExamples(sender instanceof ConsoleCommandSender));
return true;
}

View File

@ -15,9 +15,11 @@ public class ConfigHandler {
private File configFile;
private FileConfiguration config;
private final Main plugin;
private final boolean canHover;
public ConfigHandler(Main p) {
public ConfigHandler(Main p, boolean useHover) {
plugin = p;
this.canHover = useHover;
saveDefaultConfig();
config = YamlConfiguration.loadConfiguration(configFile);
@ -66,9 +68,9 @@ public class ConfigHandler {
return config.getInt("number-of-days-since-last-joined", 0);
}
/** On Spigot 1.19, do not use hover-text by default - otherwise do*/
public boolean useHoverText() {
return config.getBoolean("enable-hover-text", true);
return config.getBoolean("enable-hover-text", canHover);
}
/** Returns the config setting for use-dots, or the default value "true" if no value can be retrieved. */

View File

@ -385,7 +385,7 @@ public class MessageFactory {
//returns the usage-explanation without any hovering text
private TextComponent helpMsgPlain(boolean isConsoleSender) {
TextComponent underscores = text("____________").color(TextColor.fromHexString("#6E3485")); //12 underscores
TextComponent underscores = text("__________").color(TextColor.fromHexString("#6E3485")); //10 underscores
TextComponent spaces = text(" "); //4 spaces
TextComponent arrow = text("").color(NamedTextColor.GOLD); //alt + 26;
TextComponent bullet = text("").color(NamedTextColor.GOLD); //alt + 7
@ -399,7 +399,7 @@ public class MessageFactory {
}
return Component.newline()
.append(underscores).append(spaces).append(pluginPrefix()).append(spaces).append(underscores)
.append(underscores).append(spaces).append(pluginPrefix()).append(text(" ")).append(underscores)
.append(newline())
.append(text("Type \"/statistic examples\" to see examples!").color(NamedTextColor.GRAY).decorate(TextDecoration.ITALIC))
.append(newline())

View File

@ -22,8 +22,9 @@ number-of-days-since-last-joined: 0
# ------------------------------- #
# Format & Display #
# ------------------------------- #
# Use hover-text for additional info in the usage explanation
enable-hover-text: false
# Use hover-text for additional info in the usage explanation (set "false" to disable)
# If you leave this un-set, PlayerStats will use hover-text if the Minecraft-version supports it
enable-hover-text:
# If true, the stat-numbers in the top list will be aligned with dots
use-dots: true