mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-29 03:49:19 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -4,6 +4,7 @@ import io.github.fisher2911.hmccosmetics.HMCCosmetics;
|
||||
import io.github.fisher2911.hmccosmetics.gui.ArmorItem;
|
||||
import io.github.fisher2911.hmccosmetics.gui.CosmeticsMenu;
|
||||
import io.github.fisher2911.hmccosmetics.gui.DyeSelectorGui;
|
||||
import io.github.fisher2911.hmccosmetics.message.Message;
|
||||
import io.github.fisher2911.hmccosmetics.message.MessageHandler;
|
||||
import io.github.fisher2911.hmccosmetics.message.Messages;
|
||||
import io.github.fisher2911.hmccosmetics.user.User;
|
||||
@@ -20,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")
|
||||
@@ -50,6 +52,7 @@ public class CosmeticsCommand extends CommandBase {
|
||||
this.plugin,
|
||||
() -> {
|
||||
this.cosmeticsMenu.reload();
|
||||
this.plugin.getMessageHandler().load();
|
||||
this.messageHandler.sendMessage(
|
||||
sender,
|
||||
Messages.RELOADED
|
||||
@@ -86,4 +89,18 @@ public class CosmeticsCommand extends CommandBase {
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand("help") // WORK IN PROGRESS (WIP)
|
||||
@Permission(io.github.fisher2911.hmccosmetics.message.Permission.HELP_COMMAND)
|
||||
public void helpCommand(final CommandSender sender) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(
|
||||
this.plugin,
|
||||
() -> {
|
||||
this.messageHandler.sendMessage(
|
||||
sender,
|
||||
Messages.HELP_COMMAND
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CosmeticGui {
|
||||
if (!hasPermission) {
|
||||
this.messageHandler.sendMessage(
|
||||
player,
|
||||
Messages.NO_PERMISSION
|
||||
Messages.NO_COSMETIC_PERMISSION
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,12 +121,11 @@ public class CosmeticsMenu {
|
||||
if (id.equals(DYE_MENU)) {
|
||||
this.guiMap.put(id, DyeGuiSerializer.INSTANCE.deserialize(DyeSelectorGui.class,
|
||||
source));
|
||||
this.plugin.getLogger().severe("Loaded dye gui: " + id);
|
||||
this.plugin.getLogger().info("Loaded dye gui: " + id);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.guiMap.put(id, source.get(CosmeticGui.class));
|
||||
this.plugin.getLogger().severe("Loaded gui: " + id);
|
||||
this.plugin.getLogger().info("Loaded gui: " + id);
|
||||
} catch (final ConfigurateException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 =
|
||||
@@ -18,4 +20,16 @@ public class Messages {
|
||||
new Message("reloaded", "Config reloaded");
|
||||
public static final Message INVALID_TYPE =
|
||||
new Message("invalid-type", "Invalid type");
|
||||
public static final Message HELP_COMMAND =
|
||||
new Message("help-command", "<#6D9DC5><st> </st> <gradient:#40B7D6:#6D9DC5>HMCCosmetics - Help</gradient><#6D9DC5> <st> </st>\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"<#5AE4B5>• <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI.\n" +
|
||||
"\n" +
|
||||
"<#5AE4B5>• <#40B7D6>/cosmetics dye <gray><BACKPACK/HAT></gray> - <#6D9DC5>Opens dye menu for specified cosmetic.\n" +
|
||||
"\n" +
|
||||
"<#5AE4B5>• <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu.\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"<st> </st>");
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ public class Permission {
|
||||
public static final String DEFAULT_COMMAND = "hmccosmetics.cmd.default";
|
||||
public static final String DYE_COMMAND = "hmccosmetics.cmd.dye";
|
||||
public static final String RELOAD_COMMAND = "hmccosmetics.cmd.reload";
|
||||
public static final String HELP_COMMAND = "hmccosmetics.cmd.help";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user