fix all style issues

This commit is contained in:
Draycia authored and Josua Parks committed 2021-11-16 20:48:23 -08:00
1 parent 07da847864
commit 304f13b0f9
35 files changed
+197 -137

No files matched your search

@@ -62,6 +62,12 @@ public interface CarbonChat {
*/ */
ChannelRegistry channelRegistry(); ChannelRegistry channelRegistry();
/**
* The message renderer, tailored for the current platform.
*
* @return the message renderer
* @since 2.0.0
*/
IMessageRenderer<SourcedAudience, String, RenderedMessage, Component> messageRenderer(); IMessageRenderer<SourcedAudience, String, RenderedMessage, Component> messageRenderer();
// TODO: Redis as MariaDB cache // TODO: Redis as MariaDB cache
@@ -1,7 +1,6 @@
package net.draycia.carbon.api.events; package net.draycia.carbon.api.events;
import java.util.List; import java.util.List;
import net.draycia.carbon.api.channels.ChatChannel; import net.draycia.carbon.api.channels.ChatChannel;
import net.draycia.carbon.api.users.CarbonPlayer; import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.util.KeyedRenderer; import net.draycia.carbon.api.util.KeyedRenderer;
@@ -22,6 +22,13 @@ import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class) @DefaultQualifier(NonNull.class)
public interface CarbonPlayer extends Audience, Identified { public interface CarbonPlayer extends Audience, Identified {
/**
* Returns the appropriate {@link Component} to represent the player's name.
*
* @param player the player
* @return the player's name
* @since 2.0.0
*/
static Component renderName(final CarbonPlayer player) { static Component renderName(final CarbonPlayer player) {
if (player.hasActiveTemporaryDisplayName()) { if (player.hasActiveTemporaryDisplayName()) {
return Objects.requireNonNull(player.temporaryDisplayName()); return Objects.requireNonNull(player.temporaryDisplayName());
@@ -41,9 +48,10 @@ public interface CarbonPlayer extends Audience, Identified {
String username(); String username();
/** /**
* Checks if the player has a display name set through {@link CarbonPlayer#displayName(Component)} * Checks if the player has a display name set through {@link CarbonPlayer#displayName(Component)}.
* *
* @return if the player has a display name set through {@link CarbonPlayer#displayName(Component)} * @return if the player has a display name set through {@link CarbonPlayer#displayName(Component)}
* @since 2.0.0
*/ */
boolean hasCustomDisplayName(); boolean hasCustomDisplayName();
@@ -80,6 +88,7 @@ public interface CarbonPlayer extends Audience, Identified {
* The player's temporary display name. * The player's temporary display name.
* *
* @return the player's temporary display name. * @return the player's temporary display name.
* @since 2.0.0
*/ */
// TODO: improve javadocs here // TODO: improve javadocs here
@Nullable Component temporaryDisplayName(); @Nullable Component temporaryDisplayName();
@@ -88,9 +97,16 @@ public interface CarbonPlayer extends Audience, Identified {
* The expiration date in milliseconds for the temporary display name. * The expiration date in milliseconds for the temporary display name.
* *
* @return the temporary display name's expiration in MS since Unix Epoch * @return the temporary display name's expiration in MS since Unix Epoch
* @since 2.0.0
*/ */
long temporaryDisplayNameExpiration(); long temporaryDisplayNameExpiration();
/**
* If the player has a temporary display name and it is not expired.
*
* @return if the player's temporary display name is active
* @since 2.0.0
*/
boolean hasActiveTemporaryDisplayName(); boolean hasActiveTemporaryDisplayName();
/** /**
@@ -229,7 +245,6 @@ public interface CarbonPlayer extends Audience, Identified {
* Sends the message as the player. * Sends the message as the player.
* *
* @param message the message to be sent * @param message the message to be sent
* //@return the message result
* @since 2.0.0 * @since 2.0.0
*/ */
// TODO: change return type, provide information useful like what message was actually sent? // TODO: change return type, provide information useful like what message was actually sent?
@@ -1,12 +1,16 @@
package net.draycia.carbon.api.users.punishments; package net.draycia.carbon.api.users.punishments;
import java.util.UUID;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
import java.util.UUID; /**
* An entry describing when and why and how a player was muted.
*
* @since 2.0.0
*/
@DefaultQualifier(NonNull.class) @DefaultQualifier(NonNull.class)
public record MuteEntry( public record MuteEntry(
long muteEpoch, long muteEpoch,
@@ -17,8 +21,14 @@ public record MuteEntry(
UUID muteId UUID muteId
) { ) {
/**
* Returns if this entry is still active and should be enforced.
*
* @return if this entry is still valid
* @since 2.0.0
*/
public boolean valid() { public boolean valid() {
return System.currentTimeMillis() < expirationEpoch; return this.expirationEpoch == -1 || System.currentTimeMillis() < this.expirationEpoch;
} }
} }
@@ -2,8 +2,20 @@ package net.draycia.carbon.api.util;
import java.util.List; import java.util.List;
/**
* A slot in a player's inventory.
*
* @since 2.0.0
*/
public final class InventorySlot { public final class InventorySlot {
/**
* An {@link InventorySlot} instance, usable in chat with the given placeholders.
*
* @param placeholders the placeholders that can be used in chat
* @return the instance
* @since 2.0.0
*/
public static InventorySlot of(final String... placeholders) { public static InventorySlot of(final String... placeholders) {
return new InventorySlot(placeholders); return new InventorySlot(placeholders);
} }
@@ -18,8 +30,23 @@ public final class InventorySlot {
this.placeholders = List.of(placeholders); this.placeholders = List.of(placeholders);
} }
/**
* Returns this slot's placeholders, which can be used in chat to show the item in said slot.
*
* @return this slot's placeholders
* @since 2.0.0
*/
public List<String> placeholders() { public List<String> placeholders() {
return this.placeholders; return this.placeholders;
} }
public static final InventorySlot HELMET = InventorySlot.of("helm", "helmet", "hat", "head");
public static final InventorySlot CHEST = InventorySlot.of("chest", "chestplate");
public static final InventorySlot LEGS = InventorySlot.of("legs", "leggings");
public static final InventorySlot BOOTS = InventorySlot.of("boots", "feet");
public static final InventorySlot MAIN_HAND = InventorySlot.of("main_hand", "hand", "item");
public static final InventorySlot OFF_HAND = InventorySlot.of("off_hand");
public static List<InventorySlot> SLOTS = List.of(HELMET, CHEST, LEGS, BOOTS, MAIN_HAND, OFF_HAND);
} }
@@ -1,16 +0,0 @@
package net.draycia.carbon.api.util;
import java.util.List;
public final class InventorySlots {
public static final InventorySlot HELMET = InventorySlot.of("helm", "helmet", "hat", "head");
public static final InventorySlot CHEST = InventorySlot.of("chest", "chestplate");
public static final InventorySlot LEGS = InventorySlot.of("legs", "leggings");
public static final InventorySlot BOOTS = InventorySlot.of("boots", "feet");
public static final InventorySlot MAIN_HAND = InventorySlot.of("main_hand", "hand", "item");
public static final InventorySlot OFF_HAND = InventorySlot.of("off_hand");
public static List<InventorySlot> VALUES = List.of(HELMET, CHEST, LEGS, BOOTS, MAIN_HAND, OFF_HAND);
}
@@ -3,6 +3,11 @@ package net.draycia.carbon.api.util;
import net.kyori.adventure.audience.MessageType; import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
/**
* A message that's been rendered.
*
* @since 2.0.0
*/
public record RenderedMessage(Component component, MessageType messageType) { public record RenderedMessage(Component component, MessageType messageType) {
} }
@@ -4,17 +4,28 @@ import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.ForwardingAudience; import net.kyori.adventure.audience.ForwardingAudience;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/**
* An audience, where messages are sent from another Audience.
*
* @since 2.0.0
*/
public record SourcedAudience(Audience sender, Audience recipient) implements ForwardingAudience.Single { public record SourcedAudience(Audience sender, Audience recipient) implements ForwardingAudience.Single {
public static final SourcedAudience EMPTY = new SourcedAudience(Audience.empty(), Audience.empty()); public static final SourcedAudience EMPTY = new SourcedAudience(Audience.empty(), Audience.empty());
/**
* An empty {@link SourcedAudience}, with an empty sender and recipient.
*
* @return an empty sourced audience
* @since 2.0.0
*/
public static SourcedAudience empty() { public static SourcedAudience empty() {
return EMPTY; return EMPTY;
} }
@Override @Override
public @NotNull Audience audience() { public @NotNull Audience audience() {
return Audience.audience(sender, recipient); return Audience.audience(this.sender, this.recipient);
} }
} }
@@ -5,7 +5,6 @@ import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import net.draycia.carbon.api.channels.ChatChannel; import net.draycia.carbon.api.channels.ChatChannel;
import net.draycia.carbon.api.util.InventorySlot; import net.draycia.carbon.api.util.InventorySlot;
import net.draycia.carbon.api.util.InventorySlots;
import net.draycia.carbon.common.users.CarbonPlayerCommon; import net.draycia.carbon.common.users.CarbonPlayerCommon;
import net.draycia.carbon.common.users.WrappedCarbonPlayer; import net.draycia.carbon.common.users.WrappedCarbonPlayer;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
@@ -87,17 +86,17 @@ public final class CarbonPlayerBukkit extends WrappedCarbonPlayer implements For
final EquipmentSlot equipmentSlot; final EquipmentSlot equipmentSlot;
if (slot.equals(InventorySlots.MAIN_HAND)) { if (slot.equals(InventorySlot.MAIN_HAND)) {
equipmentSlot = EquipmentSlot.HAND; equipmentSlot = EquipmentSlot.HAND;
} else if (slot.equals(InventorySlots.OFF_HAND)) { } else if (slot.equals(InventorySlot.OFF_HAND)) {
equipmentSlot = EquipmentSlot.OFF_HAND; equipmentSlot = EquipmentSlot.OFF_HAND;
} else if (slot.equals(InventorySlots.HELMET)) { } else if (slot.equals(InventorySlot.HELMET)) {
equipmentSlot = EquipmentSlot.HEAD; equipmentSlot = EquipmentSlot.HEAD;
} else if (slot.equals(InventorySlots.CHEST)) { } else if (slot.equals(InventorySlot.CHEST)) {
equipmentSlot = EquipmentSlot.CHEST; equipmentSlot = EquipmentSlot.CHEST;
} else if (slot.equals(InventorySlots.LEGS)) { } else if (slot.equals(InventorySlot.LEGS)) {
equipmentSlot = EquipmentSlot.LEGS; equipmentSlot = EquipmentSlot.LEGS;
} else if (slot.equals(InventorySlots.BOOTS)) { } else if (slot.equals(InventorySlot.BOOTS)) {
equipmentSlot = EquipmentSlot.FEET; equipmentSlot = EquipmentSlot.FEET;
} else { } else {
return null; return null;
-1
View File
@@ -18,5 +18,4 @@ dependencies {
// Other // Other
api(libs.guice) api(libs.guice)
api(libs.cloudMinecraftExtras) api(libs.cloudMinecraftExtras)
api(libs.luckPerms)
} }
@@ -119,12 +119,12 @@ public class CarbonChannelRegistry extends RegistryImpl<Key, ChatChannel> implem
this.logger.info("Registering channel with key [" + channelKey + "]"); this.logger.info("Registering channel with key [" + channelKey + "]");
register(channelKey, channel); register(channelKey, channel);
var command = commandManager.commandBuilder(channelKey.value()) final var command = commandManager.commandBuilder(channelKey.value())
.argument(StringArgument.<Commander>newBuilder("message").greedy().asOptional().build()) .argument(StringArgument.<Commander>newBuilder("message").greedy().asOptional().build())
.permission("carbon.channel." + channelKey) .permission("carbon.channel." + channelKey)
.senderType(PlayerCommander.class) .senderType(PlayerCommander.class)
.handler(handler -> { .handler(handler -> {
var sender = ((PlayerCommander)handler.getSender()).carbonPlayer(); final var sender = ((PlayerCommander) handler.getSender()).carbonPlayer();
if (sender.muted(channel)) { if (sender.muted(channel)) {
// TODO: "you are muted in this channel!!!!" // TODO: "you are muted in this channel!!!!"
@@ -150,7 +150,7 @@ public class CarbonChannelRegistry extends RegistryImpl<Key, ChatChannel> implem
commandManager.command(command); commandManager.command(command);
var channelCommand = commandManager.commandBuilder("channel", "ch") final var channelCommand = commandManager.commandBuilder("channel", "ch")
.literal(channelKey.value()) .literal(channelKey.value())
.proxies(command) .proxies(command)
.build(); .build();
@@ -10,12 +10,12 @@ import net.draycia.carbon.api.CarbonChatProvider;
import net.draycia.carbon.api.channels.ChatChannel; import net.draycia.carbon.api.channels.ChatChannel;
import net.draycia.carbon.api.users.CarbonPlayer; import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.util.RenderedMessage; import net.draycia.carbon.api.util.RenderedMessage;
import net.draycia.carbon.api.util.SourcedAudience;
import net.draycia.carbon.common.channels.messages.ConfigChannelMessageService; import net.draycia.carbon.common.channels.messages.ConfigChannelMessageService;
import net.draycia.carbon.common.channels.messages.ConfigChannelMessageSource; import net.draycia.carbon.common.channels.messages.ConfigChannelMessageSource;
import net.draycia.carbon.api.util.SourcedAudience;
import net.draycia.carbon.common.messages.SourcedMessageSender;
import net.draycia.carbon.common.messages.ComponentPlaceholderResolver; import net.draycia.carbon.common.messages.ComponentPlaceholderResolver;
import net.draycia.carbon.common.messages.KeyPlaceholderResolver; import net.draycia.carbon.common.messages.KeyPlaceholderResolver;
import net.draycia.carbon.common.messages.SourcedMessageSender;
import net.draycia.carbon.common.messages.SourcedReceiverResolver; import net.draycia.carbon.common.messages.SourcedReceiverResolver;
import net.draycia.carbon.common.messages.StringPlaceholderResolver; import net.draycia.carbon.common.messages.StringPlaceholderResolver;
import net.draycia.carbon.common.messages.UUIDPlaceholderResolver; import net.draycia.carbon.common.messages.UUIDPlaceholderResolver;
@@ -26,8 +26,8 @@ public class CarbonPlayerArgument {
this.server = server; this.server = server;
} }
public static BiPredicate<CarbonPlayer, CarbonPlayer> NO_FILTER = (sender, target) -> true; public static final BiPredicate<CarbonPlayer, CarbonPlayer> NO_FILTER = (sender, target) -> true;
public static BiPredicate<CarbonPlayer, CarbonPlayer> NO_SENDER = (sender, target) -> !sender.equals(target); public static final BiPredicate<CarbonPlayer, CarbonPlayer> NO_SENDER = (sender, target) -> !sender.equals(target);
public CommandArgument<Commander, CarbonPlayer> newInstance( public CommandArgument<Commander, CarbonPlayer> newInstance(
final boolean required, final boolean required,
@@ -65,7 +65,7 @@ public class CarbonPlayerArgument {
final BiPredicate<CarbonPlayer, CarbonPlayer> filter; final BiPredicate<CarbonPlayer, CarbonPlayer> filter;
@Inject @Inject
public CarbonPlayerArgumentParser( CarbonPlayerArgumentParser(
final CarbonServer carbonServer, final CarbonServer carbonServer,
final BiPredicate<CarbonPlayer, CarbonPlayer> filter final BiPredicate<CarbonPlayer, CarbonPlayer> filter
) { ) {
@@ -80,7 +80,7 @@ public class CarbonPlayerArgument {
) { ) {
final @Nullable String input = inputQueue.peek(); final @Nullable String input = inputQueue.peek();
for (var player : this.server.players()) { for (final var player : this.server.players()) {
if (player.username().equalsIgnoreCase(input)) { if (player.username().equalsIgnoreCase(input)) {
inputQueue.remove(); inputQueue.remove();
return ArgumentParseResult.success(player); return ArgumentParseResult.success(player);
@@ -97,7 +97,7 @@ public class CarbonPlayerArgument {
) { ) {
if (commandContext.getSender() instanceof PlayerCommander sender) { if (commandContext.getSender() instanceof PlayerCommander sender) {
return this.server.players().stream() return this.server.players().stream()
.filter(it -> filter.test(sender.carbonPlayer(), it)) .filter(it -> this.filter.test(sender.carbonPlayer(), it))
.filter(sender.carbonPlayer()::awareOf) .filter(sender.carbonPlayer()::awareOf)
.map(CarbonPlayer::username) .map(CarbonPlayer::username)
.toList(); .toList();
@@ -20,12 +20,12 @@ import cloud.commandframework.arguments.parser.ArgumentParseResult;
import cloud.commandframework.arguments.parser.ArgumentParser; import cloud.commandframework.arguments.parser.ArgumentParser;
import cloud.commandframework.context.CommandContext; import cloud.commandframework.context.CommandContext;
import cloud.commandframework.exceptions.parsing.NoInputProvidedException; import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
import java.util.Queue;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Queue;
public final class OptionValueParser<C> implements ArgumentParser<C, String> { public final class OptionValueParser<C> implements ArgumentParser<C, String> {
private static final char ESCAPE = '\\'; private static final char ESCAPE = '\\';
private static final String FLAG_STARTER = "-"; private static final String FLAG_STARTER = "-";
@@ -111,6 +111,7 @@ public final class OptionValueParser<C> implements ArgumentParser<C, String> {
public String getMessage() { public String getMessage() {
return "Missing end quote for input: '" + this.input + "'"; return "Missing end quote for input: '" + this.input + "'";
} }
} }
} }
@@ -15,7 +15,7 @@ public class ClearChatCommand {
final CommandManager<Commander> commandManager, final CommandManager<Commander> commandManager,
final PrimaryConfig config final PrimaryConfig config
) { ) {
var command = commandManager.commandBuilder("clearchat", "chatclear", "cc") final var command = commandManager.commandBuilder("clearchat", "chatclear", "cc")
.permission("carbon.clearchat") .permission("carbon.clearchat")
.senderType(PlayerCommander.class) .senderType(PlayerCommander.class)
.handler(handler -> { .handler(handler -> {
@@ -24,7 +24,7 @@ public class ContinueCommand {
final CarbonMessageService messageService, final CarbonMessageService messageService,
final CarbonChat carbonChat final CarbonChat carbonChat
) { ) {
var command = commandManager.commandBuilder("continue", "c") final var command = commandManager.commandBuilder("continue", "c")
.argument(StringArgument.greedy("message")) .argument(StringArgument.greedy("message"))
.permission("carbon.whisper.continue") // TODO: carbon.whisper.spy .permission("carbon.whisper.continue") // TODO: carbon.whisper.spy
.senderType(PlayerCommander.class) .senderType(PlayerCommander.class)
@@ -18,7 +18,7 @@ public class DebugCommand {
final CommandManager<Commander> commandManager, final CommandManager<Commander> commandManager,
final CarbonPlayerArgument carbonPlayerArgument final CarbonPlayerArgument carbonPlayerArgument
) { ) {
var command = commandManager.commandBuilder("carbondebug", "cdebug") final var command = commandManager.commandBuilder("carbondebug", "cdebug")
.argument(carbonPlayerArgument.newInstance(false, "player")) .argument(carbonPlayerArgument.newInstance(false, "player"))
.permission("carbon.debug") .permission("carbon.debug")
.senderType(PlayerCommander.class) .senderType(PlayerCommander.class)
@@ -97,4 +97,5 @@ public final class HelpCommand {
return help; return help;
} }
} }
@@ -31,7 +31,7 @@ public class MuteCommand {
) { ) {
this.commandManager = commandManager; this.commandManager = commandManager;
var command = commandManager.commandBuilder("mute") final var command = commandManager.commandBuilder("mute")
.argument(carbonPlayerArgument.newInstance(false, "player", CarbonPlayerArgument.NO_SENDER)) .argument(carbonPlayerArgument.newInstance(false, "player", CarbonPlayerArgument.NO_SENDER))
.flag(commandManager.flagBuilder("uuid") .flag(commandManager.flagBuilder("uuid")
.withAliases("u") .withAliases("u")
@@ -70,7 +70,7 @@ public class MuteCommand {
continue; continue;
} }
sendMuteMessage(messageService, muteEntry, (PlayerCommander)handler.getSender(), this.sendMuteMessage(messageService, muteEntry, (PlayerCommander) handler.getSender(),
sender, target, player); sender, target, player);
} }
}) })
@@ -36,7 +36,7 @@ public class NicknameCommand {
.asOptional() .asOptional()
.build(); .build();
var command = commandManager.commandBuilder("nickname", "nick") final var command = commandManager.commandBuilder("nickname", "nick")
.flag(commandManager.flagBuilder("duration") .flag(commandManager.flagBuilder("duration")
.withAliases("d") .withAliases("d")
.withArgument(StringArgument.optional("duration")) .withArgument(StringArgument.optional("duration"))
@@ -59,7 +59,7 @@ public class NicknameCommand {
.permission("carbon.nickname") .permission("carbon.nickname")
.senderType(PlayerCommander.class) .senderType(PlayerCommander.class)
.handler(handler -> { .handler(handler -> {
CarbonPlayer sender = ((PlayerCommander)handler.getSender()).carbonPlayer(); final CarbonPlayer sender = ((PlayerCommander) handler.getSender()).carbonPlayer();
long expirationTime = -1; // TODO: implement timed nicknames long expirationTime = -1; // TODO: implement timed nicknames
@MonotonicNonNull String durationFormat = null; @MonotonicNonNull String durationFormat = null;
@@ -150,7 +150,7 @@ public class NicknameCommand {
} }
// https://stackoverflow.com/a/56395975 // https://stackoverflow.com/a/56395975
private final Pattern periodPattern = Pattern.compile("([0-9]+)([smhdWMY])"); private static final Pattern periodPattern = Pattern.compile("([0-9]+)([smhdWMY])");
private Long parsePeriod(@MonotonicNonNull String period) { private Long parsePeriod(@MonotonicNonNull String period) {
period = Objects.requireNonNull(period).toLowerCase(Locale.ENGLISH); period = Objects.requireNonNull(period).toLowerCase(Locale.ENGLISH);
@@ -27,7 +27,7 @@ public class ReplyCommand {
final CarbonMessageService messageService, final CarbonMessageService messageService,
final CarbonChat carbonChat final CarbonChat carbonChat
) { ) {
var command = commandManager.commandBuilder("reply", "r") final var command = commandManager.commandBuilder("reply", "r")
.argument(StringArgument.greedy("message")) .argument(StringArgument.greedy("message"))
.permission("carbon.whisper.reply") // TODO: carbon.whisper.spy .permission("carbon.whisper.reply") // TODO: carbon.whisper.spy
.senderType(PlayerCommander.class) .senderType(PlayerCommander.class)
@@ -19,7 +19,7 @@ public class WhisperCommand {
final CarbonMessageService messageService, final CarbonMessageService messageService,
final CarbonPlayerArgument carbonPlayerArgument final CarbonPlayerArgument carbonPlayerArgument
) { ) {
var command = commandManager.commandBuilder("whisper", "w", "message", "msg") final var command = commandManager.commandBuilder("whisper", "w", "message", "msg")
.argument(carbonPlayerArgument.newInstance(true, "recipient", CarbonPlayerArgument.NO_SENDER)) .argument(carbonPlayerArgument.newInstance(true, "recipient", CarbonPlayerArgument.NO_SENDER))
.argument(StringArgument.greedy("message")) .argument(StringArgument.greedy("message"))
.permission("carbon.whisper.send") // TODO: carbon.whisper.spy .permission("carbon.whisper.send") // TODO: carbon.whisper.spy
@@ -25,8 +25,8 @@ public class ClearChatSettings {
private @MonotonicNonNull Component messageComponent = null; private @MonotonicNonNull Component messageComponent = null;
public Component message() { public Component message() {
if (messageComponent == null) { if (this.messageComponent == null) {
this.messageComponent = MiniMessage.miniMessage().deserialize(message); this.messageComponent = MiniMessage.miniMessage().deserialize(this.message);
} }
return this.messageComponent; return this.messageComponent;
@@ -39,8 +39,8 @@ public class ClearChatSettings {
private @MonotonicNonNull Component broadcastComponent = null; private @MonotonicNonNull Component broadcastComponent = null;
public Component broadcast() { public Component broadcast() {
if (broadcastComponent == null) { if (this.broadcastComponent == null) {
this.broadcastComponent = MiniMessage.miniMessage().deserialize(broadcast); this.broadcastComponent = MiniMessage.miniMessage().deserialize(this.broadcast);
} }
return this.broadcastComponent; return this.broadcastComponent;
@@ -3,7 +3,7 @@ package net.draycia.carbon.common.listeners;
import com.google.inject.Inject; import com.google.inject.Inject;
import net.draycia.carbon.api.CarbonChat; import net.draycia.carbon.api.CarbonChat;
import net.draycia.carbon.api.events.CarbonChatEvent; import net.draycia.carbon.api.events.CarbonChatEvent;
import net.draycia.carbon.api.util.InventorySlots; import net.draycia.carbon.api.util.InventorySlot;
import net.kyori.adventure.text.TextReplacementConfig; import net.kyori.adventure.text.TextReplacementConfig;
public class ItemLinkHandler { public class ItemLinkHandler {
@@ -17,7 +17,7 @@ public class ItemLinkHandler {
return; return;
} }
for (final var slot : InventorySlots.VALUES) { for (final var slot : InventorySlot.SLOTS) {
for (final var placeholder : slot.placeholders()) { for (final var placeholder : slot.placeholders()) {
event.message( event.message(
event.message() event.message()
@@ -4,9 +4,7 @@ import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.util.RenderedMessage; import net.draycia.carbon.api.util.RenderedMessage;
import net.draycia.carbon.api.util.SourcedAudience; import net.draycia.carbon.api.util.SourcedAudience;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity; import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.moonshine.message.IMessageSender; import net.kyori.moonshine.message.IMessageSender;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
@@ -24,7 +24,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import javax.inject.Singleton; import javax.inject.Singleton;
import net.draycia.carbon.api.util.SourcedAudience; import net.draycia.carbon.api.util.SourcedAudience;
import net.kyori.adventure.audience.Audience;
import net.kyori.moonshine.receiver.IReceiverLocator; import net.kyori.moonshine.receiver.IReceiverLocator;
import net.kyori.moonshine.receiver.IReceiverLocatorResolver; import net.kyori.moonshine.receiver.IReceiverLocatorResolver;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
@@ -1,7 +1,10 @@
package net.draycia.carbon.common.users; package net.draycia.carbon.common.users;
import java.util.*; import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import net.draycia.carbon.api.channels.ChatChannel; import net.draycia.carbon.api.channels.ChatChannel;
import net.draycia.carbon.api.users.CarbonPlayer; import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.users.punishments.MuteEntry; import net.draycia.carbon.api.users.punishments.MuteEntry;
@@ -179,7 +182,9 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
} }
@Override @Override
public void sendMessageAsPlayer(String message) { } public void sendMessageAsPlayer(final String message) {
}
@Override @Override
public boolean online() { public boolean online() {
@@ -192,7 +197,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
} }
@Override @Override
public void whisperReplyTarget(@Nullable UUID uuid) { public void whisperReplyTarget(final @Nullable UUID uuid) {
this.whisperReplyTarget = uuid; this.whisperReplyTarget = uuid;
} }
@@ -202,7 +207,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
} }
@Override @Override
public void lastWhisperTarget(@Nullable UUID uuid) { public void lastWhisperTarget(final @Nullable UUID uuid) {
this.lastWhisperTarget = uuid; this.lastWhisperTarget = uuid;
} }
@@ -212,7 +217,7 @@ public class CarbonPlayerCommon implements CarbonPlayer, ForwardingAudience.Sing
} }
@Override @Override
public boolean awareOf(CarbonPlayer other) { public boolean awareOf(final CarbonPlayer other) {
return true; return true;
} }
@@ -1,5 +1,8 @@
package net.draycia.carbon.common.users; package net.draycia.carbon.common.users;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import net.draycia.carbon.api.channels.ChatChannel; import net.draycia.carbon.api.channels.ChatChannel;
import net.draycia.carbon.api.users.CarbonPlayer; import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.users.punishments.MuteEntry; import net.draycia.carbon.api.users.punishments.MuteEntry;
@@ -11,10 +14,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier; import org.checkerframework.framework.qual.DefaultQualifier;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
@DefaultQualifier(NonNull.class) @DefaultQualifier(NonNull.class)
public abstract class WrappedCarbonPlayer implements CarbonPlayer { public abstract class WrappedCarbonPlayer implements CarbonPlayer {
@@ -30,7 +29,7 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public boolean hasPermission(String permission) { public boolean hasPermission(final String permission) {
// TODO: LuckPerms // TODO: LuckPerms
return this.carbonPlayerCommon().hasPermission(permission); return this.carbonPlayerCommon().hasPermission(permission);
} }
@@ -63,12 +62,12 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public void displayName(@Nullable Component displayName) { public void displayName(final @Nullable Component displayName) {
this.carbonPlayerCommon().displayName(displayName); this.carbonPlayerCommon().displayName(displayName);
} }
@Override @Override
public void temporaryDisplayName(@Nullable Component temporaryDisplayName, long expirationEpoch) { public void temporaryDisplayName(final @Nullable Component temporaryDisplayName, final long expirationEpoch) {
this.carbonPlayerCommon().temporaryDisplayName(temporaryDisplayName, expirationEpoch); this.carbonPlayerCommon().temporaryDisplayName(temporaryDisplayName, expirationEpoch);
} }
@@ -108,7 +107,7 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public void selectedChannel(@Nullable ChatChannel chatChannel) { public void selectedChannel(final @Nullable ChatChannel chatChannel) {
this.carbonPlayerCommon().selectedChannel(chatChannel); this.carbonPlayerCommon().selectedChannel(chatChannel);
} }
@@ -139,7 +138,7 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public void deafened(boolean deafened) { public void deafened(final boolean deafened) {
this.carbonPlayerCommon().deafened(deafened); this.carbonPlayerCommon().deafened(deafened);
} }
@@ -149,12 +148,12 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public void spying(boolean spying) { public void spying(final boolean spying) {
this.carbonPlayerCommon().spying(spying); this.carbonPlayerCommon().spying(spying);
} }
@Override @Override
public void sendMessageAsPlayer(String message) { public void sendMessageAsPlayer(final String message) {
this.carbonPlayerCommon().sendMessageAsPlayer(message); this.carbonPlayerCommon().sendMessageAsPlayer(message);
} }
@@ -169,7 +168,7 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public void whisperReplyTarget(@Nullable UUID uuid) { public void whisperReplyTarget(final @Nullable UUID uuid) {
this.carbonPlayerCommon().whisperReplyTarget(uuid); this.carbonPlayerCommon().whisperReplyTarget(uuid);
} }
@@ -179,7 +178,7 @@ public abstract class WrappedCarbonPlayer implements CarbonPlayer {
} }
@Override @Override
public void lastWhisperTarget(@Nullable UUID uuid) { public void lastWhisperTarget(final @Nullable UUID uuid) {
this.carbonPlayerCommon().lastWhisperTarget(uuid); this.carbonPlayerCommon().lastWhisperTarget(uuid);
} }
@@ -97,42 +97,42 @@ public final class FastUuidSansHyphens {
throw new IllegalArgumentException("Illegal UUID string: " + uuidSequence); throw new IllegalArgumentException("Illegal UUID string: " + uuidSequence);
} }
long mostSignificantBits = getHexValueForChar(uuidSequence.charAt(0)) << 60; long mostSignificantBits = hexValueForChar(uuidSequence.charAt(0)) << 60;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(1)) << 56; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(1)) << 56;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(2)) << 52; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(2)) << 52;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(3)) << 48; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(3)) << 48;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(4)) << 44; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(4)) << 44;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(5)) << 40; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(5)) << 40;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(6)) << 36; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(6)) << 36;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(7)) << 32; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(7)) << 32;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(8)) << 28; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(8)) << 28;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(9)) << 24; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(9)) << 24;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(10)) << 20; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(10)) << 20;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(11)) << 16; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(11)) << 16;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(12)) << 12; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(12)) << 12;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(13)) << 8; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(13)) << 8;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(14)) << 4; mostSignificantBits |= hexValueForChar(uuidSequence.charAt(14)) << 4;
mostSignificantBits |= getHexValueForChar(uuidSequence.charAt(15)); mostSignificantBits |= hexValueForChar(uuidSequence.charAt(15));
long leastSignificantBits = getHexValueForChar(uuidSequence.charAt(16)) << 60; long leastSignificantBits = hexValueForChar(uuidSequence.charAt(16)) << 60;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(17)) << 56; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(17)) << 56;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(18)) << 52; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(18)) << 52;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(19)) << 48; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(19)) << 48;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(20)) << 44; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(20)) << 44;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(21)) << 40; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(21)) << 40;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(22)) << 36; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(22)) << 36;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(23)) << 32; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(23)) << 32;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(24)) << 28; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(24)) << 28;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(25)) << 24; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(25)) << 24;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(26)) << 20; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(26)) << 20;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(27)) << 16; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(27)) << 16;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(28)) << 12; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(28)) << 12;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(29)) << 8; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(29)) << 8;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(30)) << 4; leastSignificantBits |= hexValueForChar(uuidSequence.charAt(30)) << 4;
leastSignificantBits |= getHexValueForChar(uuidSequence.charAt(31)); leastSignificantBits |= hexValueForChar(uuidSequence.charAt(31));
return new UUID(mostSignificantBits, leastSignificantBits); return new UUID(mostSignificantBits, leastSignificantBits);
} }
@@ -187,7 +187,7 @@ public final class FastUuidSansHyphens {
return new String(uuidChars); return new String(uuidChars);
} }
private static long getHexValueForChar(final char c) { private static long hexValueForChar(final char c) {
try { try {
if (HEX_VALUES[c] < 0) { if (HEX_VALUES[c] < 0) {
throw new IllegalArgumentException("Illegal hexadecimal digit: " + c); throw new IllegalArgumentException("Illegal hexadecimal digit: " + c);
@@ -198,4 +198,5 @@ public final class FastUuidSansHyphens {
return HEX_VALUES[c]; return HEX_VALUES[c];
} }
} }
@@ -6,7 +6,7 @@ import net.draycia.carbon.common.listeners.DeafenHandler;
import net.draycia.carbon.common.listeners.ItemLinkHandler; import net.draycia.carbon.common.listeners.ItemLinkHandler;
import net.draycia.carbon.common.listeners.MuteHandler; import net.draycia.carbon.common.listeners.MuteHandler;
public class ListenerUtils { public final class ListenerUtils {
private ListenerUtils() { private ListenerUtils() {
@@ -1,12 +1,14 @@
package net.draycia.carbon.common.util; package net.draycia.carbon.common.util;
import net.draycia.carbon.api.CarbonChat;
import net.draycia.carbon.api.CarbonServer; import net.draycia.carbon.api.CarbonServer;
import net.draycia.carbon.api.users.UserManager; import net.draycia.carbon.api.users.UserManager;
import net.draycia.carbon.common.users.CarbonPlayerCommon; import net.draycia.carbon.common.users.CarbonPlayerCommon;
import net.draycia.carbon.common.users.WrappedCarbonPlayer; import net.draycia.carbon.common.users.WrappedCarbonPlayer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
public class PlayerUtils { @DefaultQualifier(NonNull.class)
public final class PlayerUtils {
private PlayerUtils() { private PlayerUtils() {
@@ -27,6 +29,6 @@ public class PlayerUtils {
return null; return null;
}); });
} }
}
} }
}
-2
View File
@@ -32,8 +32,6 @@ dependencies {
exclude("ca.stellardrift", "colonel") // causes classloading issues when running in dev exclude("ca.stellardrift", "colonel") // causes classloading issues when running in dev
} }
include(libs.adventurePlatformFabric) include(libs.adventurePlatformFabric)
modImplementation(libs.luckPerms)
} }
carbonPlatform { carbonPlatform {
@@ -3,7 +3,6 @@ package net.draycia.carbon.fabric.users;
import java.util.Locale; import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import net.draycia.carbon.api.util.InventorySlot; import net.draycia.carbon.api.util.InventorySlot;
import net.draycia.carbon.api.util.InventorySlots;
import net.draycia.carbon.common.users.CarbonPlayerCommon; import net.draycia.carbon.common.users.CarbonPlayerCommon;
import net.draycia.carbon.common.users.WrappedCarbonPlayer; import net.draycia.carbon.common.users.WrappedCarbonPlayer;
import net.draycia.carbon.fabric.CarbonChatFabric; import net.draycia.carbon.fabric.CarbonChatFabric;
@@ -74,17 +73,17 @@ public class CarbonPlayerFabric extends WrappedCarbonPlayer implements Forwardin
final EquipmentSlot equipmentSlot; final EquipmentSlot equipmentSlot;
if (slot.equals(InventorySlots.MAIN_HAND)) { if (slot.equals(InventorySlot.MAIN_HAND)) {
equipmentSlot = EquipmentSlot.MAINHAND; equipmentSlot = EquipmentSlot.MAINHAND;
} else if (slot.equals(InventorySlots.OFF_HAND)) { } else if (slot.equals(InventorySlot.OFF_HAND)) {
equipmentSlot = EquipmentSlot.OFFHAND; equipmentSlot = EquipmentSlot.OFFHAND;
} else if (slot.equals(InventorySlots.HELMET)) { } else if (slot.equals(InventorySlot.HELMET)) {
equipmentSlot = EquipmentSlot.HEAD; equipmentSlot = EquipmentSlot.HEAD;
} else if (slot.equals(InventorySlots.CHEST)) { } else if (slot.equals(InventorySlot.CHEST)) {
equipmentSlot = EquipmentSlot.CHEST; equipmentSlot = EquipmentSlot.CHEST;
} else if (slot.equals(InventorySlots.LEGS)) { } else if (slot.equals(InventorySlot.LEGS)) {
equipmentSlot = EquipmentSlot.LEGS; equipmentSlot = EquipmentSlot.LEGS;
} else if (slot.equals(InventorySlots.BOOTS)) { } else if (slot.equals(InventorySlot.BOOTS)) {
equipmentSlot = EquipmentSlot.FEET; equipmentSlot = EquipmentSlot.FEET;
} else { } else {
return null; return null;
+6 -3
View File
@@ -34,7 +34,7 @@ versions:
fabricMinecraft: 1.17.1 fabricMinecraft: 1.17.1
fabricLoader: 0.12.5 fabricLoader: 0.12.5
adventurePlatformFabric: 4.1.0-SNAPSHOT adventurePlatformFabric: 4.1.0-SNAPSHOT
luckPerms: 5.3 luckPermsApi: 5.3
dependencies: dependencies:
adventureBom: adventureBom:
@@ -113,12 +113,15 @@ dependencies:
cloudPaper: cloudPaper:
group: cloud.commandframework group: cloud.commandframework
name: cloud-paper name: cloud-paper
version: { ref: cloud }
cloudSponge: cloudSponge:
group: cloud.commandframework group: cloud.commandframework
name: cloud-sponge name: cloud-sponge
version: { ref: cloud }
cloudVelocity: cloudVelocity:
group: cloud.commandframework group: cloud.commandframework
name: cloud-velocity name: cloud-velocity
version: { ref: cloud }
cloudFabric: cloudFabric:
group: cloud.commandframework group: cloud.commandframework
name: cloud-fabric name: cloud-fabric
@@ -202,9 +205,9 @@ dependencies:
name: shadow name: shadow
version: { ref: shadow } version: { ref: shadow }
luckPerms: luckPermsApi:
group: net.luckperms group: net.luckperms
name: api name: api
version: { ref: luckPerms } version: { ref: luckPermsApi }
bundles: bundles:
@@ -3,7 +3,6 @@ package net.draycia.carbon.sponge.users;
import java.util.Locale; import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import net.draycia.carbon.api.util.InventorySlot; import net.draycia.carbon.api.util.InventorySlot;
import net.draycia.carbon.api.util.InventorySlots;
import net.draycia.carbon.common.users.CarbonPlayerCommon; import net.draycia.carbon.common.users.CarbonPlayerCommon;
import net.draycia.carbon.common.users.WrappedCarbonPlayer; import net.draycia.carbon.common.users.WrappedCarbonPlayer;
import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.Audience;
@@ -86,17 +85,17 @@ public final class CarbonPlayerSponge extends WrappedCarbonPlayer implements For
final ServerPlayer player = optionalPlayer.get(); final ServerPlayer player = optionalPlayer.get();
final EquipmentType equipmentSlot; final EquipmentType equipmentSlot;
if (slot.equals(InventorySlots.MAIN_HAND)) { if (slot.equals(InventorySlot.MAIN_HAND)) {
equipmentSlot = EquipmentTypes.MAIN_HAND.get(); equipmentSlot = EquipmentTypes.MAIN_HAND.get();
} else if (slot.equals(InventorySlots.OFF_HAND)) { } else if (slot.equals(InventorySlot.OFF_HAND)) {
equipmentSlot = EquipmentTypes.OFF_HAND.get(); equipmentSlot = EquipmentTypes.OFF_HAND.get();
} else if (slot.equals(InventorySlots.HELMET)) { } else if (slot.equals(InventorySlot.HELMET)) {
equipmentSlot = EquipmentTypes.HEAD.get(); equipmentSlot = EquipmentTypes.HEAD.get();
} else if (slot.equals(InventorySlots.CHEST)) { } else if (slot.equals(InventorySlot.CHEST)) {
equipmentSlot = EquipmentTypes.CHEST.get(); equipmentSlot = EquipmentTypes.CHEST.get();
} else if (slot.equals(InventorySlots.LEGS)) { } else if (slot.equals(InventorySlot.LEGS)) {
equipmentSlot = EquipmentTypes.LEGS.get(); equipmentSlot = EquipmentTypes.LEGS.get();
} else if (slot.equals(InventorySlots.BOOTS)) { } else if (slot.equals(InventorySlot.BOOTS)) {
equipmentSlot = EquipmentTypes.FEET.get(); equipmentSlot = EquipmentTypes.FEET.get();
} else { } else {
return null; return null;