9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-28 19:39:14 +00:00

add different message for no permission for cosmetics and make the chat thing reload too

This commit is contained in:
Skyslycer
2022-01-13 22:08:10 +01:00
parent c97c3650ea
commit a8ba081975
5 changed files with 7 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@Command("cosmetics")
@@ -51,6 +52,7 @@ public class CosmeticsCommand extends CommandBase {
this.plugin,
() -> {
this.cosmeticsMenu.reload();
this.plugin.getMessageHandler().load();
this.messageHandler.sendMessage(
sender,
Messages.RELOADED

View File

@@ -96,7 +96,7 @@ public class CosmeticGui {
if (!hasPermission) {
this.messageHandler.sendMessage(
player,
Messages.NO_PERMISSION
Messages.NO_COSMETIC_PERMISSION
);
return;
}

View File

@@ -140,7 +140,6 @@ public class MessageHandler {
}
for (final String key : config.getKeys(false)) {
final String message = Utils.replaceIfNull(config.getString(key), "", value -> {
if (value == null) {
this.logger.warning(String.format(ErrorMessages.ITEM_NOT_FOUND, "message", fileName));
@@ -148,8 +147,7 @@ public class MessageHandler {
}).replace(Placeholder.PREFIX, prefix);
final Message.Type messageType = Utils.stringToEnum(
Utils.replaceIfNull(config.getString("type"), "")
, Message.Type.class, Message.Type.MESSAGE
Utils.replaceIfNull(config.getString("type"), ""), Message.Type.class, Message.Type.MESSAGE
);
this.messageMap.put(key, new Message(key, message, messageType));

View File

@@ -4,6 +4,8 @@ public class Messages {
public static final Message NO_PERMISSION =
new Message("no-permission", "You do not have permission for this!");
public static final Message NO_COSMETIC_PERMISSION =
new Message("no-cosmetic-permission", "You do not have permission for this cosmetic!");
public static final Message SET_HAT =
new Message("set-hat", "Set hat");
public static final Message REMOVED_HAT =