mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-06 06:41:44 +00:00
fix handling empty messages
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<groupId>lol.hyper</groupId>
|
<groupId>lol.hyper</groupId>
|
||||||
<artifactId>toolstats</artifactId>
|
<artifactId>toolstats</artifactId>
|
||||||
<version>1.8.5</version>
|
<version>1.8.6</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ToolStats</name>
|
<name>ToolStats</name>
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ public class CraftItem implements Listener {
|
|||||||
// if the player shift clicks, send them this warning
|
// if the player shift clicks, send them this warning
|
||||||
if (event.isShiftClick()) {
|
if (event.isShiftClick()) {
|
||||||
Component component = toolStats.configTools.formatLore("shift-click-warning.crafting", null, null);
|
Component component = toolStats.configTools.formatLore("shift-click-warning.crafting", null, null);
|
||||||
event.getWhoClicked().sendMessage(component);
|
if (component != null) {
|
||||||
|
event.getWhoClicked().sendMessage(component);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// test the item before setting it
|
// test the item before setting it
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ public class VillagerTrade implements Listener {
|
|||||||
// if the player shift clicks, show the warning
|
// if the player shift clicks, show the warning
|
||||||
if (event.isShiftClick()) {
|
if (event.isShiftClick()) {
|
||||||
Component component = toolStats.configTools.formatLore("shift-click-warning.trading", null, null);
|
Component component = toolStats.configTools.formatLore("shift-click-warning.trading", null, null);
|
||||||
event.getWhoClicked().sendMessage(component);
|
if (component != null) {
|
||||||
|
event.getWhoClicked().sendMessage(component);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ItemStack newItem = addLore(item, player);
|
ItemStack newItem = addLore(item, player);
|
||||||
if (newItem != null) {
|
if (newItem != null) {
|
||||||
|
|||||||
@@ -100,6 +100,12 @@ public class ConfigTools {
|
|||||||
public Component formatLore(String configName, String placeHolder, Object value) {
|
public Component formatLore(String configName, String placeHolder, Object value) {
|
||||||
String lore = toolStats.config.getString("messages." + configName);
|
String lore = toolStats.config.getString("messages." + configName);
|
||||||
if (lore == null) {
|
if (lore == null) {
|
||||||
|
toolStats.logger.warning("Unable to find config message for: messages." + configName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the config message is empty, don't send it
|
||||||
|
if (lore.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user