mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 14:38:48 +00:00
Add extra placeholders to spy locale entries
This commit is contained in:
1 parent
dad284b321
commit
bf5020ce6f
3 files changed
+23
-4
No files matched your search
@@ -29,6 +29,7 @@ import net.draycia.carbon.api.users.CarbonPlayer;
|
||||
import net.draycia.carbon.api.users.Party;
|
||||
import net.draycia.carbon.common.channels.PartyChatChannel;
|
||||
import net.draycia.carbon.common.messages.CarbonMessages;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@@ -45,10 +46,11 @@ public class PartyChatSpyHandler implements Listener {
|
||||
|
||||
final @Nullable Party party = event.sender().party().get();
|
||||
final Set<UUID> members = party == null ? Set.of() : party.members();
|
||||
final Component partyName = party == null ? Component.empty() : party.name();
|
||||
|
||||
for (final CarbonPlayer player : server.players()) {
|
||||
if (player.spying() && !members.contains(player.uuid())) {
|
||||
messages.partySpy(player, event.message());
|
||||
messages.partySpy(player, event.sender().uuid(), event.sender().displayName(), event.sender().username(), event.message(), partyName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -101,7 +101,8 @@ public class RadiusListener implements Listener {
|
||||
}
|
||||
|
||||
for (final CarbonPlayer player : spyingPlayers) {
|
||||
carbonMessages.radiusSpy(player, event.message());
|
||||
carbonMessages.radiusSpy(player, event.sender().uuid(), event.chatChannel().key(), event.sender().displayName(),
|
||||
event.sender().username(), event.message());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
*/
|
||||
package net.draycia.carbon.common.messages;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.moonshine.annotation.Message;
|
||||
import net.kyori.moonshine.annotation.Placeholder;
|
||||
@@ -39,7 +41,14 @@ public interface CarbonMessages {
|
||||
void emptyRecipients(final Audience audience);
|
||||
|
||||
@Message("channel.radius.spy")
|
||||
void radiusSpy(Audience audience, Component message);
|
||||
void radiusSpy(
|
||||
Audience audience,
|
||||
@Placeholder UUID uuid,
|
||||
@Placeholder Key channel,
|
||||
@Placeholder("display_name") Component displayName,
|
||||
@Placeholder String username,
|
||||
@Placeholder Component message
|
||||
);
|
||||
|
||||
@Message("channel.not_found")
|
||||
void channelNotFound(final Audience audience);
|
||||
@@ -560,7 +569,14 @@ public interface CarbonMessages {
|
||||
Component cannotUsePartyChannel(Audience audience);
|
||||
|
||||
@Message("party.spy")
|
||||
void partySpy(Audience audience, Component message);
|
||||
void partySpy(
|
||||
Audience audience,
|
||||
@Placeholder UUID uuid,
|
||||
@Placeholder("display_name") Component displayName,
|
||||
@Placeholder String username,
|
||||
@Placeholder Component message,
|
||||
@Placeholder("party_name") Component partyName
|
||||
);
|
||||
|
||||
@Message("deletemessage.prefix")
|
||||
Component deleteMessagePrefix();
|
||||
|
||||
Reference in new issue
Block a user