diff --git a/api/src/main/java/com/discordsrv/api/component/EnhancedTextBuilder.java b/api/src/main/java/com/discordsrv/api/component/GameTextBuilder.java similarity index 75% rename from api/src/main/java/com/discordsrv/api/component/EnhancedTextBuilder.java rename to api/src/main/java/com/discordsrv/api/component/GameTextBuilder.java index a879c171..0c8f90ae 100644 --- a/api/src/main/java/com/discordsrv/api/component/EnhancedTextBuilder.java +++ b/api/src/main/java/com/discordsrv/api/component/GameTextBuilder.java @@ -33,41 +33,41 @@ import java.util.regex.Pattern; /** * Minecraft equivalent for {@link com.discordsrv.api.discord.entity.message.SendableDiscordMessage.Formatter}. */ -public interface EnhancedTextBuilder { +public interface GameTextBuilder { @NotNull - EnhancedTextBuilder addContext(Object... context); + GameTextBuilder addContext(Object... context); @NotNull - default EnhancedTextBuilder addReplacement(String target, Object replacement) { + default GameTextBuilder addReplacement(String target, Object replacement) { return addReplacement(Pattern.compile(target, Pattern.LITERAL), replacement); } @NotNull - default EnhancedTextBuilder addReplacement(Pattern target, Object replacement) { + default GameTextBuilder addReplacement(Pattern target, Object replacement) { return addReplacement(target, matcher -> replacement); } @NotNull - default EnhancedTextBuilder addReplacement(String target, Supplier replacement) { + default GameTextBuilder addReplacement(String target, Supplier replacement) { return addReplacement(Pattern.compile(target, Pattern.LITERAL), replacement); } @NotNull - default EnhancedTextBuilder addReplacement(Pattern target, Supplier replacement) { + default GameTextBuilder addReplacement(Pattern target, Supplier replacement) { return addReplacement(target, matcher -> replacement.get()); } @NotNull - default EnhancedTextBuilder addReplacement(String target, Function replacement) { + default GameTextBuilder addReplacement(String target, Function replacement) { return addReplacement(Pattern.compile(target, Pattern.LITERAL), replacement); } @NotNull - EnhancedTextBuilder addReplacement(Pattern target, Function replacement); + GameTextBuilder addReplacement(Pattern target, Function replacement); @NotNull - EnhancedTextBuilder applyPlaceholderService(); + GameTextBuilder applyPlaceholderService(); @NotNull MinecraftComponent build(); diff --git a/api/src/main/java/com/discordsrv/api/component/MinecraftComponentFactory.java b/api/src/main/java/com/discordsrv/api/component/MinecraftComponentFactory.java index 105439c7..3cc847ec 100644 --- a/api/src/main/java/com/discordsrv/api/component/MinecraftComponentFactory.java +++ b/api/src/main/java/com/discordsrv/api/component/MinecraftComponentFactory.java @@ -40,5 +40,5 @@ public interface MinecraftComponentFactory { @NotNull MinecraftComponent empty(); - EnhancedTextBuilder enhancedBuilder(String content); + GameTextBuilder enhancedBuilder(String content); } diff --git a/api/src/main/java/com/discordsrv/api/discord/entity/message/SendableDiscordMessage.java b/api/src/main/java/com/discordsrv/api/discord/entity/message/SendableDiscordMessage.java index ee6850df..bc6f197d 100644 --- a/api/src/main/java/com/discordsrv/api/discord/entity/message/SendableDiscordMessage.java +++ b/api/src/main/java/com/discordsrv/api/discord/entity/message/SendableDiscordMessage.java @@ -23,6 +23,7 @@ package com.discordsrv.api.discord.entity.message; +import com.discordsrv.api.component.GameTextBuilder; import com.discordsrv.api.discord.entity.message.impl.SendableDiscordMessageImpl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -219,7 +220,7 @@ public interface SendableDiscordMessage { } /** - * Discord equivalent for {@link com.discordsrv.api.component.EnhancedTextBuilder}. + * Discord equivalent for {@link GameTextBuilder}. */ interface Formatter { diff --git a/common/src/main/java/com/discordsrv/common/component/ComponentFactory.java b/common/src/main/java/com/discordsrv/common/component/ComponentFactory.java index 9cdca1f7..95e0d14e 100644 --- a/common/src/main/java/com/discordsrv/common/component/ComponentFactory.java +++ b/common/src/main/java/com/discordsrv/common/component/ComponentFactory.java @@ -18,7 +18,7 @@ package com.discordsrv.common.component; -import com.discordsrv.api.component.EnhancedTextBuilder; +import com.discordsrv.api.component.GameTextBuilder; import com.discordsrv.api.component.MinecraftComponent; import com.discordsrv.api.component.MinecraftComponentFactory; import com.discordsrv.common.DiscordSRV; @@ -84,7 +84,7 @@ public class ComponentFactory implements MinecraftComponentFactory { } @Override - public EnhancedTextBuilder enhancedBuilder(String content) { + public GameTextBuilder enhancedBuilder(String content) { return new EnhancedTextBuilderImpl(discordSRV, content); } diff --git a/common/src/main/java/com/discordsrv/common/component/EnhancedTextBuilderImpl.java b/common/src/main/java/com/discordsrv/common/component/EnhancedTextBuilderImpl.java index 4f5de9d7..cc207087 100644 --- a/common/src/main/java/com/discordsrv/common/component/EnhancedTextBuilderImpl.java +++ b/common/src/main/java/com/discordsrv/common/component/EnhancedTextBuilderImpl.java @@ -19,7 +19,7 @@ package com.discordsrv.common.component; import com.discordsrv.api.color.Color; -import com.discordsrv.api.component.EnhancedTextBuilder; +import com.discordsrv.api.component.GameTextBuilder; import com.discordsrv.api.component.MinecraftComponent; import com.discordsrv.api.placeholder.PlaceholderService; import com.discordsrv.common.DiscordSRV; @@ -35,7 +35,7 @@ import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; -public class EnhancedTextBuilderImpl implements EnhancedTextBuilder { +public class EnhancedTextBuilderImpl implements GameTextBuilder { private final Set context = new HashSet<>(); private final Map> replacements = new LinkedHashMap<>(); @@ -49,19 +49,19 @@ public class EnhancedTextBuilderImpl implements EnhancedTextBuilder { } @Override - public @NotNull EnhancedTextBuilder addContext(Object... context) { + public @NotNull GameTextBuilder addContext(Object... context) { this.context.addAll(Arrays.asList(context)); return this; } @Override - public @NotNull EnhancedTextBuilder addReplacement(Pattern target, Function replacement) { + public @NotNull GameTextBuilder addReplacement(Pattern target, Function replacement) { this.replacements.put(target, wrapFunction(replacement)); return this; } @Override - public @NotNull EnhancedTextBuilder applyPlaceholderService() { + public @NotNull GameTextBuilder applyPlaceholderService() { this.replacements.put(PlaceholderService.PATTERN, wrapFunction( matcher -> discordSRV.placeholderService().getResult(matcher, context))); return this; diff --git a/common/src/main/java/com/discordsrv/common/component/renderer/DiscordSRVMinecraftRenderer.java b/common/src/main/java/com/discordsrv/common/component/renderer/DiscordSRVMinecraftRenderer.java index 1dabd575..0933e7dd 100644 --- a/common/src/main/java/com/discordsrv/common/component/renderer/DiscordSRVMinecraftRenderer.java +++ b/common/src/main/java/com/discordsrv/common/component/renderer/DiscordSRVMinecraftRenderer.java @@ -18,7 +18,7 @@ package com.discordsrv.common.component.renderer; -import com.discordsrv.api.component.EnhancedTextBuilder; +import com.discordsrv.api.component.GameTextBuilder; import com.discordsrv.api.discord.entity.DiscordUser; import com.discordsrv.api.discord.entity.guild.DiscordGuild; import com.discordsrv.api.discord.entity.guild.DiscordGuildMember; @@ -108,7 +108,7 @@ public class DiscordSRVMinecraftRenderer extends DefaultMinecraftRenderer { DiscordUser user = discordSRV.discordAPI().getUserById(userId).orElse(null); DiscordGuildMember member = guild.getMemberById(userId).orElse(null); - EnhancedTextBuilder builder = discordSRV.componentFactory() + GameTextBuilder builder = discordSRV.componentFactory() .enhancedBuilder(user != null ? format.format : format.unknownFormat); if (user != null) { @@ -135,7 +135,7 @@ public class DiscordSRVMinecraftRenderer extends DefaultMinecraftRenderer { long roleId = MiscUtil.parseLong(id); DiscordRole role = discordSRV.discordAPI().getRoleById(roleId).orElse(null); - EnhancedTextBuilder builder = discordSRV.componentFactory() + GameTextBuilder builder = discordSRV.componentFactory() .enhancedBuilder(role != null ? format.format : format.unknownFormat); if (role != null) { diff --git a/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java b/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java index ad7d67c3..5276bd5e 100644 --- a/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java +++ b/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java @@ -19,7 +19,7 @@ package com.discordsrv.common.messageforwarding.discord; import com.discordsrv.api.channel.GameChannel; -import com.discordsrv.api.component.EnhancedTextBuilder; +import com.discordsrv.api.component.GameTextBuilder; import com.discordsrv.api.component.MinecraftComponent; import com.discordsrv.api.discord.entity.DiscordUser; import com.discordsrv.api.discord.entity.channel.DiscordMessageChannel; @@ -107,7 +107,7 @@ public class DiscordChatMessageModule extends AbstractModule { Component messageComponent = DiscordSRVMinecraftRenderer.getWithContext(event, chatConfig, () -> discordSRV.componentFactory().minecraftSerializer().serialize(message.toString())); - EnhancedTextBuilder componentBuilder = discordSRV.componentFactory() + GameTextBuilder componentBuilder = discordSRV.componentFactory() .enhancedBuilder(format) .addContext(discordMessage, author, channel, channelConfig) .addReplacement("%message%", messageComponent);