mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2026-01-04 15:41:45 +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";
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,93 @@
|
||||
title: Set Color
|
||||
rows: 3
|
||||
title: "<white>"
|
||||
rows: 4
|
||||
items:
|
||||
10:
|
||||
material: BLUE_STAINED_GLASS
|
||||
name: Set to blue
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 255
|
||||
green: 255
|
||||
blue: 255
|
||||
name: "<gray>Set to <#FFFFFF>white"
|
||||
set-color:
|
||||
red: 255
|
||||
green: 255
|
||||
blue: 255
|
||||
11:
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 190
|
||||
green: 20
|
||||
blue: 20
|
||||
name: "<gray>Set to <#BE1414>red"
|
||||
set-color:
|
||||
red: 190
|
||||
green: 20
|
||||
blue: 20
|
||||
12:
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 234
|
||||
green: 92
|
||||
blue: 43
|
||||
name: "<gray>Set to <#EA5C2B>orange"
|
||||
set-color:
|
||||
red: 234
|
||||
green: 92
|
||||
blue: 43
|
||||
13:
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 255
|
||||
green: 201
|
||||
blue: 0
|
||||
name: "<gray>Set to <#FFC900>yellow"
|
||||
set-color:
|
||||
red: 255
|
||||
green: 201
|
||||
blue: 0
|
||||
14:
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 163
|
||||
green: 218
|
||||
blue: 141
|
||||
name: "<gray>Set to <#A3DA8D>green"
|
||||
set-color:
|
||||
red: 163
|
||||
green: 218
|
||||
blue: 141
|
||||
15:
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 55
|
||||
green: 49
|
||||
blue: 181
|
||||
name: "<gray>Set to <#3731B5>blue"
|
||||
set-color:
|
||||
red: 55
|
||||
green: 49
|
||||
blue: 181
|
||||
11:
|
||||
material: RED_STAINED_GLASS
|
||||
name: Set to red
|
||||
16:
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
model-data: 1
|
||||
color:
|
||||
red: 137
|
||||
green: 70
|
||||
blue: 166
|
||||
name: "<gray>Set to <#8946A6>purple"
|
||||
set-color:
|
||||
red: 190
|
||||
green: 20
|
||||
blue: 20
|
||||
red: 137
|
||||
green: 70
|
||||
blue: 166
|
||||
31:
|
||||
material: PAPER
|
||||
name: "<#F7DCFA>Previous Page"
|
||||
amount: 1
|
||||
model-data: 1
|
||||
open-menu: main
|
||||
@@ -1,87 +1,55 @@
|
||||
title: "<red>Main</red>"
|
||||
rows: 3
|
||||
title: "<white>" # GUI Title
|
||||
rows: 5 # Rows in the GUI
|
||||
items:
|
||||
10:
|
||||
material: NETHERITE_CHESTPLATE
|
||||
name: "<blue>Backpack"
|
||||
lore:
|
||||
1: # GUI Slot number
|
||||
material: LEATHER_HORSE_ARMOR
|
||||
name: "<rainbow>Colorful Hat</rainbow>"
|
||||
lore: # Lore displayed when the player owns the item
|
||||
- ""
|
||||
- "Enabled: %enabled%"
|
||||
- "Allowed: %allowed%"
|
||||
locked-lore:
|
||||
- "Not allowed"
|
||||
amount: 1
|
||||
type: BACKPACK
|
||||
permission: ""
|
||||
id: netherite_backpack
|
||||
11:
|
||||
material: NETHERITE_HELMET
|
||||
name: "<blue>Hat"
|
||||
lore:
|
||||
- ""
|
||||
- "Enabled: %enabled%"
|
||||
- "Allowed: %allowed%"
|
||||
locked-lore:
|
||||
- "Not allowed"
|
||||
- "<gray>Enabled: <#6D9DC5>%enabled%"
|
||||
- "<gray>Allowed: <#6D9DC5>%allowed%"
|
||||
locked-lore: # Lore displayed when the player does not have the correct permission.
|
||||
- "<red>You do not own this item!"
|
||||
amount: 1
|
||||
model-data: 2 # CustomModelData Number
|
||||
type: HAT
|
||||
permission: ""
|
||||
id: netherite_hat
|
||||
12:
|
||||
material: DIAMOND_CHESTPLATE
|
||||
name: "<blue>Backpack"
|
||||
lore:
|
||||
- ""
|
||||
- "Enabled: %enabled%"
|
||||
- "Allowed: %allowed%"
|
||||
locked-lore:
|
||||
- "Not allowed"
|
||||
amount: 1
|
||||
type: BACKPACK
|
||||
permission: ""
|
||||
id: diamond_backpack
|
||||
13:
|
||||
material: DIAMOND_HELMET
|
||||
name: "<blue>Hat "
|
||||
lore:
|
||||
- ""
|
||||
- "Enabled: %enabled%"
|
||||
- "Allowed: %allowed%"
|
||||
locked-lore:
|
||||
- "Not allowed"
|
||||
amount: 1
|
||||
type: HAT
|
||||
permission: ""
|
||||
id: diamond_hat
|
||||
14:
|
||||
material: LEATHER_CHESTPLATE
|
||||
name: "<blue>Backpack"
|
||||
lore:
|
||||
- ""
|
||||
- "Enabled: %enabled%"
|
||||
- "Allowed: %allowed%"
|
||||
locked-lore:
|
||||
- "Not allowed"
|
||||
amount: 1
|
||||
type: BACKPACK
|
||||
permission: ""
|
||||
id: leather_backpack
|
||||
dyeable: true
|
||||
15:
|
||||
material: LEATHER_HELMET
|
||||
name: "<blue>Hat "
|
||||
lore:
|
||||
- ""
|
||||
- "Enabled: %enabled%"
|
||||
- "Allowed: %allowed%"
|
||||
locked-lore:
|
||||
- "Not allowed"
|
||||
amount: 1
|
||||
type: HAT
|
||||
color:
|
||||
dyeable: true # Enables dyeable item feature
|
||||
color: # Sets default color for item. Uses RGB format.
|
||||
red: 5
|
||||
blue: 100
|
||||
green: 230
|
||||
blue: 100
|
||||
open-menu: dye-menu # Automatically open the dye menu when applying this cosmetic
|
||||
permission: "cosmetics.colorful_hat" # Can be anything you want.
|
||||
id: colorful_hat # Internal identifier. Can be anything you want.
|
||||
2:
|
||||
material: PAPER
|
||||
name: "<blue>Backpack"
|
||||
lore:
|
||||
- ""
|
||||
- "<gray>Enabled: <#6D9DC5>%enabled%"
|
||||
- "<gray>Allowed: <#6D9DC5>%allowed%"
|
||||
locked-lore:
|
||||
- "<red>You do not own this item!"
|
||||
amount: 1
|
||||
model-data: 4
|
||||
type: BACKPACK
|
||||
permission: ""
|
||||
id: leather_hat
|
||||
dyeable: true
|
||||
id: backpack
|
||||
37:
|
||||
material: PAPER
|
||||
name: "<#40B7D6>Previous Page"
|
||||
amount: 1
|
||||
model-data: 1
|
||||
open-menu: menu-2
|
||||
40:
|
||||
material: PAPER
|
||||
name: "<rainbow>Customization Menu</rainbow>"
|
||||
amount: 1
|
||||
model-data: 3
|
||||
open-menu: dye-menu
|
||||
43:
|
||||
material: PAPER
|
||||
name: "<#40B7D6>Next Page"
|
||||
amount: 1
|
||||
model-data: 2
|
||||
open-menu: menu-2
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
no-permission: "<red>No Permission!"
|
||||
set-hat: "<green>Set Hat!"
|
||||
removed-hat: "<green>Removed Hat"
|
||||
set-backpack: "<green>Set Backpack!"
|
||||
removed-backpack: "<green>Removed Backpack"
|
||||
must-be-player: "You must be a player to do this!"
|
||||
reloaded: "<green>Config files reloaded"
|
||||
invalid-type: "<red>Invalid cosmetic type, please use hat or backpack"
|
||||
no-permission: "<white> <red>No Permission!"
|
||||
no-cosmetic-permission: "<white> <red>You do not have permission for this cosmetic!"
|
||||
set-hat: "<white> <gradient:#6D9DC5:#45CDE9>Applied hat!"
|
||||
removed-hat: "<white> <gradient:#6D9DC5:#45CDE9>Removed hat!"
|
||||
set-backpack: "<white> <gradient:#6D9DC5:#45CDE9>Applied backpack!"
|
||||
removed-backpack: "<white> <gradient:#6D9DC5:#45CDE9>Removed backpack!"
|
||||
must-be-player: "<red>You must be a player to do this!"
|
||||
reloaded: "<white> <gradient:#00ff87:#60efff>Config files reloaded!"
|
||||
invalid-type: "<white> <red>Invalid cosmetic type, please use <u>hat</u> or <u>backpack</u>!"
|
||||
help-command: "<#6D9DC5><st> </st> <white> <gradient:#40B7D6:#6D9DC5>HMCCosmetics - Help</gradient> <white> <#6D9DC5> <st> </st>
|
||||
|
||||
|
||||
<#5AE4B5>• <#40B7D6>/cosmetics - <#6D9DC5>Opens cosmetics GUI.
|
||||
|
||||
<#5AE4B5>• <#40B7D6>/cosmetics dye <gray><BACKPACK/HAT></gray> - <#6D9DC5>Opens dye menu for specified cosmetic.
|
||||
|
||||
<#5AE4B5>• <#40B7D6>/cosmetics help - <#6D9DC5>Opens this menu.
|
||||
|
||||
|
||||
<st> </st>"
|
||||
@@ -1,6 +1,6 @@
|
||||
name: HMCCosmetics
|
||||
main: io.github.fisher2911.hmccosmetics.HMCCosmetics
|
||||
version: 1.0.0
|
||||
version: 1.0.3
|
||||
api-version: 1.17
|
||||
softdepend:
|
||||
- Multiverse
|
||||
|
||||
Reference in New Issue
Block a user