Fix compilation

This commit is contained in:
Draycia committed 2020-10-22 02:14:26 -07:00
1 parent aea660cf97
commit cd36dcb701
9 files changed
+19 -21

No files matched your search

@@ -111,7 +111,7 @@ public class CarbonChatChannel extends ChatChannel {
CarbonEvents.post(event);
if (event.cancelled()) {
return TextComponent.empty();
return Component.empty();
}
// Get player's formatting
@@ -125,7 +125,7 @@ public class CarbonChatChannel extends ChatChannel {
// Return if cancelled or message is emptied
if (preFormatEvent.cancelled() || preFormatEvent.message().trim().isEmpty()) {
return TextComponent.empty();
return Component.empty();
}
final String displayName;
@@ -94,7 +94,7 @@ public class ChannelListCommand {
}
final Iterator<ChatChannel> visibleChannels = canSee.iterator();
final TextComponent.Builder availableList = TextComponent.builder("");
final TextComponent.Builder availableList = Component.text();
this.makeList(visibleChannels, availableList);
@@ -108,7 +108,7 @@ public class ChannelListCommand {
if (sender.hasPermission("carbonchat.channellist.bypass") && !cannotSee.isEmpty()) {
final Iterator<ChatChannel> invisibleChannels = cannotSee.iterator();
final TextComponent.Builder unavailableList = TextComponent.builder("");
final TextComponent.Builder unavailableList = Component.text();
this.makeList(invisibleChannels, unavailableList);
@@ -123,10 +123,10 @@ public class ChannelListCommand {
private void makeList(@NonNull final Iterator<@NonNull ChatChannel> iterator, final TextComponent.@NonNull Builder list) {
final String listSeparator = this.carbonChat.language().getString("channel-list-separator", ", ");
// TODO: Larry, why did you double assign the listSeparatorComponent?
final Component listSeparatorComponent = TextComponent.of(listSeparator);
final Component listSeparatorComponent = Component.text(listSeparator);
while (iterator.hasNext()) {
list.append(TextComponent.of(iterator.next().name()));
list.append(Component.text(iterator.next().name()));
if (iterator.hasNext()) {
list.append(listSeparatorComponent);
@@ -4,7 +4,6 @@ import net.draycia.carbon.CarbonChat;
import net.draycia.carbon.channels.ChatChannel;
import net.draycia.carbon.storage.ChatUser;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -81,7 +80,7 @@ public class BukkitChatListener implements Listener {
if (event.isAsynchronous()) {
final Component component = selectedChannel.sendMessage(user, recipients, event.getMessage(), false);
if (!component.equals(TextComponent.empty())) {
if (!component.equals(Component.empty())) {
event.setFormat(PlainComponentSerializer.plain().serialize(component)
.replaceAll("(?:[^%]|\\A)%(?:[^%]|\\z)", "%%"));
}
@@ -27,7 +27,7 @@ public class ItemLinkHandler {
final Component itemComponent = CarbonUtils.createComponent(player);
if (itemComponent.equals(TextComponent.empty())) {
if (itemComponent.equals(Component.empty())) {
return;
}
@@ -36,7 +36,7 @@ public class ItemLinkHandler {
if (event.originalMessage().contains(patternContent)) {
final TextComponent component = (TextComponent) event.component().replaceFirstText(pattern, input -> {
return TextComponent.builder().append(itemComponent);
return Component.text().append(itemComponent);
});
event.component(component);
@@ -38,12 +38,12 @@ public class PingHandler {
}
}
final Key key = Key.of(carbonChat.getConfig().getString("pings.sound"));
final Key key = Key.key(carbonChat.getConfig().getString("pings.sound"));
final Sound.Source source = Sound.Source.valueOf(carbonChat.getConfig().getString("pings.source"));
final float volume = (float) carbonChat.getConfig().getDouble("pings.volume");
final float pitch = (float) carbonChat.getConfig().getDouble("pings.pitch");
event.target().playSound(Sound.of(key, source, volume, pitch));
event.target().playSound(Sound.sound(key, source, volume, pitch));
});
}
@@ -27,12 +27,12 @@ public class WhisperPingHandler {
return;
}
final Key key = Key.of(carbonChat.getConfig().getString("whisper.pings.sound"));
final Key key = Key.key(carbonChat.getConfig().getString("whisper.pings.sound"));
final Sound.Source source = Sound.Source.valueOf(carbonChat.getConfig().getString("whisper.pings.source"));
final float volume = (float) carbonChat.getConfig().getDouble("whisper.pings.volume");
final float pitch = (float) carbonChat.getConfig().getDouble("whisper.pings.pitch");
event.sender().playSound(Sound.of(key, source, volume, pitch));
event.sender().playSound(Sound.sound(key, source, volume, pitch));
});
}
@@ -6,7 +6,6 @@ import net.draycia.carbon.CarbonChat;
import net.draycia.carbon.util.CarbonUtils;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.serializer.craftbukkit.BukkitComponentSerializer;
import org.bukkit.entity.Player;
@@ -30,7 +29,7 @@ public class AdventureManager {
public Component processMessageWithPapi(@NonNull final Player player, @Nullable final String input,
@NonNull final String @NonNull ... placeholders) {
if (input == null || input.trim().isEmpty()) {
return TextComponent.empty();
return Component.empty();
}
return this.processMessage(PlaceholderAPI.setPlaceholders(player, input), placeholders);
@@ -39,7 +38,7 @@ public class AdventureManager {
@NonNull
public Component processMessage(@Nullable final String input, @NonNull final String @NonNull ... placeholders) {
if (input == null || input.trim().isEmpty()) {
return TextComponent.empty();
return Component.empty();
}
final String format = CarbonUtils.translateAlternateColors(input);
@@ -331,12 +331,12 @@ public class CarbonChatUser implements ChatUser, ForwardingAudience {
this.replyTarget(sender);
if (this.carbonChat.getConfig().getBoolean("pings.on-whisper")) {
final Key key = Key.of(this.carbonChat.getConfig().getString("pings.sound"));
final Key key = Key.key(this.carbonChat.getConfig().getString("pings.sound"));
final Sound.Source source = Sound.Source.valueOf(this.carbonChat.getConfig().getString("pings.source"));
final float volume = (float) this.carbonChat.getConfig().getDouble("pings.volume");
final float pitch = (float) this.carbonChat.getConfig().getDouble("pings.pitch");
this.playSound(Sound.of(key, source, volume, pitch));
this.playSound(Sound.sound(key, source, volume, pitch));
}
}
} else if (sender.online()) {
@@ -71,13 +71,13 @@ public final class CarbonUtils {
@NonNull
public static Component createComponent(@NonNull final Player player) {
if (!FunctionalityConstants.HAS_HOVER_EVENT_METHOD) {
return net.kyori.adventure.text.TextComponent.empty();
return net.kyori.adventure.text.Component.empty();
}
final ItemStack itemStack = player.getInventory().getItemInMainHand();
if (itemStack.getType().isAir()) {
return net.kyori.adventure.text.TextComponent.empty();
return net.kyori.adventure.text.Component.empty();
}
final Content content = Bukkit.getItemFactory().hoverContentOf(itemStack);