Skip to content

Commit 9ce4dc1

Browse files
authored
Merge pull request #21 from ADHDMC/message-handling
Message handling
2 parents 90bc155 + 0c3ea60 commit 9ce4dc1

File tree

7 files changed

+364
-339
lines changed

7 files changed

+364
-339
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>ADHDMC</groupId>
88
<artifactId>VillagerInfo</artifactId>
9-
<version>2.4</version>
9+
<version>2.5</version>
1010
<packaging>jar</packaging>
1111

1212
<name>VillagerInfo</name>

src/main/java/adhdmc/villagerinfo/Config/Defaults.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ public static void localeDefaults() {
1717
locale.addDefault("help-toggle", "<#4dd5ff> • /vill toggle\n<grey>Toggles the ability to receive villager information on or off.");
1818
locale.addDefault("help-reload", "<#4dd5ff> • /vill reload\n<grey>Reloads the plugin, applies config values");
1919
locale.addDefault("not-a-player", "<red>Sorry, you must be a player to use this command");
20-
locale.addDefault("zombie-villager-conversion-time", "<green>TIME UNTIL CONVERTED: \n<aqua> • <time>");
21-
locale.addDefault("villager-age", "<green>TIME UNTIL ADULT: \n<aqua> • <age>");
22-
locale.addDefault("purpur-lobotomized","<green>LOBOTOMIZED: \n<aqua> • <state>");
23-
locale.addDefault("villager-health", "<green>HEALTH:\n<aqua><grey><current></grey>/<green><total>");
24-
locale.addDefault("villager-profession", "<green>PROFESSION:\n<aqua> • <profession>");
25-
locale.addDefault("villager-jobsite-msg", "<green>JOB SITE:\n<aqua> • <jobsitelocation>");
26-
locale.addDefault("villager-last-worked-msg", "<green>LAST WORKED AT WORKSTATION:\n<aqua> • <worktime>");
27-
locale.addDefault("villager-num-restocks-msg", "<green>RESTOCKS TODAY:\n<aqua> • <restockcount>");
28-
locale.addDefault("villager-home-msg", "<green>HOME:\n<aqua> • <homelocation>");
29-
locale.addDefault("villager-slept-msg", "<green>LAST SLEPT:\n<aqua> • <sleeptime>");
30-
locale.addDefault("villager-inventory-msg", "<green>VILLAGER INVENTORY:<aqua> <contents>");
20+
locale.addDefault("purpur-lobotomized","<#05bff7><hover:show_text:'<aqua>Lobotomized: <grey><state>'>[<#c4fff7>Lobotomized</#c4fff7>]");
21+
locale.addDefault("zombie-villager-conversion-time", "<#05bff7><hover:show_text:'<aqua>Conversion Time: <grey><time>'>[<#c4fff7>Time Until Converted</#c4fff7>]</hover>");
22+
locale.addDefault("villager-age", "<#05bff7><hover:show_text:'<aqua>Childhood Left: <grey><age>'>[<#c4fff7>Time Until Adult</#c4fff7>]");
23+
locale.addDefault("villager-health", "<#05bff7><hover:show_text:'<aqua>Health: <grey><current><aqua>/</aqua><total>'>[<#c4fff7>Health</#c4fff7>]");
24+
locale.addDefault("villager-profession", "<#05bff7><hover:show_text:'<aqua>Profession: <grey><profession>'>[<#c4fff7>Profession</#c4fff7>]");
25+
locale.addDefault("villager-jobsite-msg", "<#05bff7><hover:show_text:'<aqua>POI: <grey><jobsitelocation>'>[<#c4fff7>Job Site</#c4fff7>]");
26+
locale.addDefault("villager-last-worked-msg", "<#05bff7><hover:show_text:'<aqua>Last Worked: <grey><worktime>'>[<#c4fff7>Last Worked At Workstation</#c4fff7>]");
27+
locale.addDefault("villager-num-restocks-msg", "<#05bff7><hover:show_text:'<aqua>Restocks: <grey><restockcount>'>[<#c4fff7>Restocks Today</#c4fff7>]");
28+
locale.addDefault("villager-home-msg", "<#05bff7><hover:show_text:'<aqua>Bed: <grey><homelocation>'>[<#c4fff7>Home</#c4fff7>]");
29+
locale.addDefault("villager-slept-msg", "<#05bff7><hover:show_text:'<aqua>Last Slept: <grey><sleeptime>'>[<#c4fff7>Last Slept</#c4fff7>]");
30+
locale.addDefault("villager-inventory-msg", "<#05bff7><hover:show_text:'<aqua>Inventory: <grey><contents>'>[<#c4fff7>Villager Inventory</#c4fff7>]");
3131
locale.addDefault("inventory-contents-msg", "\n • <item> (<amount>)");
32-
locale.addDefault("player-reputation-msg", "<green>PLAYER REPUTATION:\n<reputation>");
33-
locale.addDefault("true-msg", "<aqua>TRUE");
34-
locale.addDefault("false-msg", "<aqua>FALSE");
35-
locale.addDefault("none-msg", "<grey>NONE");
36-
locale.addDefault("never-msg", "<grey>NEVER");
37-
locale.addDefault("empty-msg", "\n<grey>EMPTY");
32+
locale.addDefault("player-reputation-msg", "<#05bff7><hover:show_text:'<#05bff7>[<#c4fff7>Player Reputation</#c4fff7>]'><reputation>");
33+
locale.addDefault("true-msg", "<grey>True");
34+
locale.addDefault("false-msg", "<grey>False");
35+
locale.addDefault("none-msg", "<grey>None");
36+
locale.addDefault("never-msg", "<grey>Never");
37+
locale.addDefault("empty-msg", "\n<grey>Empty");
3838
locale.addDefault("no-information", "<grey>No information to display on this villager");
3939
locale.addDefault("hour", "h, ");
4040
locale.addDefault("minute", "m, ");
@@ -47,6 +47,8 @@ public static void localeDefaults() {
4747

4848
public static void configDefaults() {
4949
FileConfiguration config = VillagerInfo.getInstance().getConfig();
50+
config.addDefault("hover-messages", true);
51+
config.addDefault("purpur-lobotomized", false);
5052
config.addDefault("baby-age", true);
5153
config.addDefault("zombie-conversion", true);
5254
config.addDefault("profession", true);

src/main/java/adhdmc/villagerinfo/Config/Message.java

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ public enum Message {
1717
NOT_A_PLAYER("<red>Sorry, you must be a player to use this command"),
1818

1919
// Villager Info
20-
PURPUR_LOBOTOMIZED("<green>LOBOTOMIZED: \n<aqua> • <state>"),
21-
ZOMBIE_VILLAGER_CONVERSION_TIME("<green>TIME UNTIL CONVERTED: \n<aqua> • <time>"),
22-
VILLAGER_AGE("<green>TIME UNTIL ADULT: \n<aqua> • <age>"),
23-
VILLAGER_PROFESSION("<green>PROFESSION:\n<aqua> • <profession>"),
24-
VILLAGER_HEALTH("<green>HEALTH:\n<aqua><grey><current></grey>/<green><total>"),
25-
VILLAGER_JOBSITE("<green>JOB SITE:\n<aqua> • <jobsitelocation>"),
26-
VILLAGER_LAST_WORKED("<green>LAST WORKED AT WORKSTATION:\n<aqua> • <worktime>"),
27-
VILLAGER_RESTOCKS("<green>RESTOCKS TODAY:\n<aqua> • <restockcount>"),
28-
VILLAGER_HOME("<green>HOME:\n<aqua> • <homelocation>"),
29-
VILLAGER_SLEPT("<green>LAST SLEPT:\n<aqua> • <sleeptime>"),
30-
VILLAGER_INVENTORY("<green>VILLAGER INVENTORY:<aqua> <contents>"),
20+
PURPUR_LOBOTOMIZED("<#05bff7><hover:show_text:'<aqua>Lobotomized: <grey><state>'>[<#c4fff7>Lobotomized</#c4fff7>]"),
21+
ZOMBIE_VILLAGER_CONVERSION_TIME("<#05bff7><hover:show_text:'<aqua>Conversion Time: <grey><time>'>[<#c4fff7>Time Until Converted</#c4fff7>]</hover>"),
22+
VILLAGER_AGE("<#05bff7><hover:show_text:'<aqua>Childhood Left: <grey><age>'>[<#c4fff7>Time Until Adult</#c4fff7>]"),
23+
VILLAGER_PROFESSION("<#05bff7><hover:show_text:'<aqua>Profession: <grey><profession>'>[<#c4fff7>Profession</#c4fff7>]"),
24+
VILLAGER_HEALTH("<#05bff7><hover:show_text:'<aqua>Health: <grey><current><aqua>/</aqua><total>'>[<#c4fff7>Health</#c4fff7>]"),
25+
VILLAGER_JOBSITE("<#05bff7><hover:show_text:'<aqua>POI: <grey><jobsitelocation>'>[<#c4fff7>Job Site</#c4fff7>]"),
26+
VILLAGER_LAST_WORKED("<#05bff7><hover:show_text:'<aqua>Last Worked: <grey><worktime>'>[<#c4fff7>Last Worked At Workstation</#c4fff7>]"),
27+
VILLAGER_RESTOCKS("<#05bff7><hover:show_text:'<aqua>Restocks: <grey><restockcount>'>[<#c4fff7>Restocks Today</#c4fff7>]"),
28+
VILLAGER_HOME("<#05bff7><hover:show_text:'<aqua>Bed: <grey><homelocation>'>[<#c4fff7>Home</#c4fff7>]"),
29+
VILLAGER_SLEPT("<#05bff7><hover:show_text:'<aqua>Last Slept: <grey><sleeptime>'>[<#c4fff7>Last Slept</#c4fff7>]"),
30+
VILLAGER_INVENTORY("<#05bff7><hover:show_text:'<aqua>Inventory: <grey><contents>'>[<#c4fff7>Villager Inventory</#c4fff7>]"),
3131
INVENTORY_CONTENTS("\n • <item> (<amount>)"),
32-
PLAYER_REPUTATION("<green>PLAYER REPUTATION:\n<reputation>"),
32+
PLAYER_REPUTATION("<#05bff7><hover:show_text:'<#05bff7>[<#c4fff7>Player Reputation</#c4fff7>]'><reputation>"),
3333

3434
// Fillers
35-
TRUE("<aqua>TRUE"), FALSE("<aqua>FALSE"),
36-
NONE("<grey>NONE"), NEVER("<grey>NEVER"), EMPTY("\n<grey>EMPTY"),
35+
TRUE("<grey>True"), FALSE("<grey>False"),
36+
NONE("<grey>None"), NEVER("<grey>Never"), EMPTY("\n<grey>Empty"),
3737
NO_INFORMATION("<grey>No information to display on this villager"),
3838

3939
// Time
@@ -53,47 +53,47 @@ public enum Message {
5353
public static void reloadLocale() {
5454
FileConfiguration locale = VillagerInfo.getLocaleConfig().getlocaleConfig();
5555
// General
56-
PREFIX.setMessage(locale.getString("prefix", "<#3256a8><bold>[</bold><#4dd5ff>Villager Info<#3256a8><bold>]<reset>"));
57-
TOGGLE_ON.setMessage(locale.getString("toggle-on", "<green> Villager Info Toggled <u>ON"));
58-
TOGGLE_OFF.setMessage(locale.getString("toggle-off", "<red> Villager Info Toggled <u>OFF"));
59-
NO_PERMISSION.setMessage(locale.getString("no-permission", "<red>You don't have permission to use this command!"));
56+
PREFIX.setMessage(locale.getString("prefix"));
57+
TOGGLE_ON.setMessage(locale.getString("toggle-on"));
58+
TOGGLE_OFF.setMessage(locale.getString("toggle-off"));
59+
NO_PERMISSION.setMessage(locale.getString("no-permission"));
6060
// Commands
61-
NO_COMMAND.setMessage(locale.getString("no-command", "<red>No subcommand by that name!"));
62-
CONFIG_RELOADED.setMessage(locale.getString("config-reloaded", "<gold>VillagerInfo Config Reloaded!"));
63-
HELP_MAIN.setMessage(locale.getString("help-main", "<#4dd5ff> • How to use Villager Info\n<grey>Shift-right-click a villager while toggle is on to have a villager's information displayed"));
64-
HELP_TOGGLE.setMessage(locale.getString("help-toggle", "<#4dd5ff> • /vill toggle\n<grey>Toggles the ability to receive villager information on or off."));
65-
HELP_RELOAD.setMessage(locale.getString("help-reload", "<#4dd5ff> • /vill reload\n<grey>Reloads the plugin, applies config values"));
66-
NOT_A_PLAYER.setMessage(locale.getString("not-a-player", "<red>Sorry, you must be a player to use this command"));
61+
NO_COMMAND.setMessage(locale.getString("no-command"));
62+
CONFIG_RELOADED.setMessage(locale.getString("config-reloaded"));
63+
HELP_MAIN.setMessage(locale.getString("help-main"));
64+
HELP_TOGGLE.setMessage(locale.getString("help-toggle"));
65+
HELP_RELOAD.setMessage(locale.getString("help-reload"));
66+
NOT_A_PLAYER.setMessage(locale.getString("not-a-player"));
6767
// Villager Info
68-
PURPUR_LOBOTOMIZED.setMessage(locale.getString("purpur-lobotomized","<green>LOBOTOMIZED: \n<aqua> • <state>"));
69-
ZOMBIE_VILLAGER_CONVERSION_TIME.setMessage(locale.getString("zombie-villager-conversion-time", "<green>TIME UNTIL CONVERTED: \n<aqua> • <time>"));
70-
VILLAGER_AGE.setMessage(locale.getString("villager-age", "<green>TIME UNTIL ADULT: \n<aqua> • <age>"));
71-
VILLAGER_HEALTH.setMessage(locale.getString("villager-health", "<green>HEALTH:\n<aqua> • <grey><current></grey>/<green><total>"));
72-
VILLAGER_PROFESSION.setMessage(locale.getString("villager-profession", "<green>PROFESSION:\n<aqua> • <profession>"));
73-
VILLAGER_JOBSITE.setMessage(locale.getString("villager-jobsite-msg", "<green>JOB SITE:\n<aqua> • <jobsitelocation>"));
74-
VILLAGER_LAST_WORKED.setMessage(locale.getString("villager-last-worked-msg", "<green>LAST WORKED AT WORKSTATION:\n<aqua> • <worktime>"));
75-
VILLAGER_RESTOCKS.setMessage(locale.getString("villager-num-restocks-msg", "<green>RESTOCKS TODAY:\n<aqua> • <restockcount>"));
76-
VILLAGER_HOME.setMessage(locale.getString("villager-home-msg", "<green>HOME:\n<aqua> • <homelocation>"));
77-
VILLAGER_SLEPT.setMessage(locale.getString("villager-slept-msg", "<green>LAST SLEPT:\n<aqua> • <sleeptime>"));
78-
VILLAGER_INVENTORY.setMessage(locale.getString("villager-inventory-msg", "<green>VILLAGER INVENTORY:<aqua> <contents>"));
79-
INVENTORY_CONTENTS.setMessage(locale.getString("inventory-contents-msg", "\n • <item> (<amount>)"));
80-
PLAYER_REPUTATION.setMessage(locale.getString("player-reputation-msg", "<green>PLAYER REPUTATION:\n<reputation>"));
68+
PURPUR_LOBOTOMIZED.setMessage(locale.getString("purpur-lobotomized"));
69+
ZOMBIE_VILLAGER_CONVERSION_TIME.setMessage(locale.getString("zombie-villager-conversion-time"));
70+
VILLAGER_AGE.setMessage(locale.getString("villager-age"));
71+
VILLAGER_HEALTH.setMessage(locale.getString("villager-health"));
72+
VILLAGER_PROFESSION.setMessage(locale.getString("villager-profession"));
73+
VILLAGER_JOBSITE.setMessage(locale.getString("villager-jobsite-msg"));
74+
VILLAGER_LAST_WORKED.setMessage(locale.getString("villager-last-worked-msg"));
75+
VILLAGER_RESTOCKS.setMessage(locale.getString("villager-num-restocks-msg"));
76+
VILLAGER_HOME.setMessage(locale.getString("villager-home-msg"));
77+
VILLAGER_SLEPT.setMessage(locale.getString("villager-slept-msg"));
78+
VILLAGER_INVENTORY.setMessage(locale.getString("villager-inventory-msg"));
79+
INVENTORY_CONTENTS.setMessage(locale.getString("inventory-contents-msg"));
80+
PLAYER_REPUTATION.setMessage(locale.getString("player-reputation-msg"));
8181
// Fillers
82-
TRUE.setMessage(locale.getString("true-msg", "<aqua>TRUE"));
83-
FALSE.setMessage(locale.getString("false-msg", "<aqua>FALSE"));
84-
NONE.setMessage(locale.getString("none-msg", "<grey>NONE"));
85-
NEVER.setMessage(locale.getString("never-msg", "<grey>NEVER"));
86-
EMPTY.setMessage(locale.getString("empty-msg", "\n • <grey>EMPTY"));
87-
NO_INFORMATION.setMessage(locale.getString("no-information", "<grey>No information to display on this villager"));
82+
TRUE.setMessage(locale.getString("true-msg"));
83+
FALSE.setMessage(locale.getString("false-msg"));
84+
NONE.setMessage(locale.getString("none-msg"));
85+
NEVER.setMessage(locale.getString("never-msg"));
86+
EMPTY.setMessage(locale.getString("empty-msg"));
87+
NO_INFORMATION.setMessage(locale.getString("no-information"));
8888
// Time
89-
HOUR.setMessage(locale.getString("hour", "h, "));
90-
MINUTE.setMessage(locale.getString("minute", "m, "));
91-
SECOND.setMessage(locale.getString("second", "s"));
92-
AGO.setMessage(locale.getString("ago", " Ago"));
89+
HOUR.setMessage(locale.getString("hour"));
90+
MINUTE.setMessage(locale.getString("minute"));
91+
SECOND.setMessage(locale.getString("second"));
92+
AGO.setMessage(locale.getString("ago"));
9393

9494
// Location
95-
LOCATION_X.setMessage(locale.getString("location-x", "<int>x, "));
96-
LOCATION_Y.setMessage(locale.getString("location-y", "<int>y, "));
97-
LOCATION_Z.setMessage(locale.getString("location-z", "<int>z"));
95+
LOCATION_X.setMessage(locale.getString("location-x"));
96+
LOCATION_Y.setMessage(locale.getString("location-y"));
97+
LOCATION_Z.setMessage(locale.getString("location-z"));
9898
}
9999
}

src/main/java/adhdmc/villagerinfo/Config/ToggleSetting.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.bukkit.configuration.file.FileConfiguration;
55

66
public enum ToggleSetting {
7+
HOVER_MESSAGES(true),
78
PURPUR_LOBOTOMIZED(false),
89
BABY_AGE(true),
910
ZOMBIE_CONVERSION(true),
@@ -27,6 +28,7 @@ public enum ToggleSetting {
2728

2829
public static void reloadToggles() {
2930
FileConfiguration config = VillagerInfo.getInstance().getConfig();
31+
HOVER_MESSAGES.setEnabled(config.getBoolean("hover-messages", true));
3032
PURPUR_LOBOTOMIZED.setEnabled(config.getBoolean("purpur-lobotomized", false));
3133
BABY_AGE.setEnabled(config.getBoolean("baby-age", true));
3234
ZOMBIE_CONVERSION.setEnabled(config.getBoolean("zombie-conversion", true));

0 commit comments

Comments
 (0)