SteamWar/BungeeCore
Archiviert
13
2

WIP message deprecation

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2024-05-12 17:20:37 +02:00
Ursprung d7798b3275
Commit e1e1d66177
50 geänderte Dateien mit 356 neuen und 299 gelöschten Zeilen

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bungeecore;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.Team;
import net.md_5.bungee.api.ProxyServer;
@ -59,6 +60,7 @@ public class EventStarter {
Team red = Team.get(next.getTeamRed());
//Don't start EventServer if not the event bungee
String command;
if(BungeeCore.EVENT_MODE || next.getSpectatePort() == 0) {
ServerStarter starter = new ServerStarter().event(next);
@ -67,12 +69,11 @@ public class EventStarter {
eventServer.put(red.getTeamId(), subserver);
}).start();
Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
command = "/event " + blue.getTeamKuerzel();
} else {
Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/" + spectatePorts.get(next.getSpectatePort())), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
command = "/" + spectatePorts.get(next.getSpectatePort());
}
Chatter.broadcast().system("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, command), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName());
}
}

Datei anzeigen

@ -19,12 +19,11 @@
package de.steamwar.bungeecore;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.SteamwarResourceBundle;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import java.text.DateFormat;
import java.text.MessageFormat;
@ -34,16 +33,6 @@ import java.util.ResourceBundle;
public class Message {
@Deprecated
public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, Object... params){
return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, locale(sender), params)));
}
@Deprecated
public static String parsePrefixed(String message, CommandSender sender, Object... params){
return parse(message, true, locale(sender), params);
}
@Deprecated
public static String parse(String message, CommandSender sender, Object... params){
return parse(message, false, locale(sender), params);
@ -56,7 +45,7 @@ public class Message {
@Deprecated
private static Locale locale(CommandSender sender) {
return ChatSender.of(sender).getLocale();
return Chatter.of(sender).getLocale();
}
@Deprecated
@ -103,29 +92,13 @@ public class Message {
@Deprecated
private static void send(String message, boolean prefixed, CommandSender s, ChatMessageType type, String onHover, ClickEvent onClick, Object... params){
ChatSender sender = ChatSender.of(s);
Chatter sender = Chatter.of(s);
if(type == ChatMessageType.CHAT && !sender.chatShown())
return;
sender.send(prefixed, type, onHover != null ? new Message("PLAIN_STRING", onHover) : null, onClick, new Message(message, params));
}
public static void broadcast(String message, Object... params) {
broadcast(message, null, null, params);
}
public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params) {
ChatSender.allReceivers().forEach(player -> player.system(message, onHover != null ? new Message(onHover, params) : null, onClick, params));
}
public static void team(String message, Object... params) {
team(message, null, null, params);
}
public static void team(String message, String onHover, ClickEvent onClick, Object... params) {
ChatSender.serverteamReceivers().forEach(player -> player.prefixless(message, onHover != null ? new Message(onHover, params) : null, onClick, params));
}
private final String format;
private final Object[] params;

Datei anzeigen

@ -1,6 +1,6 @@
package de.steamwar.bungeecore;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.*;
import lombok.Getter;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -144,7 +144,7 @@ public class ServerStarter {
});
if (!atLeastOneSupervisor) {
for (ProxiedPlayer p : playersToSend) {
ChatSender.of(p).system("BAU_START_NOT_ALLOWED");
Chatter.of(p).system("BAU_START_NOT_ALLOWED");
}
}
return atLeastOneSupervisor;
@ -243,7 +243,7 @@ public class ServerStarter {
node = Node.getNode();
if(node == null) {
for (ProxiedPlayer p : playersToSend)
ChatSender.of(p).system("SERVER_START_OVERLOAD");
Chatter.of(p).system("SERVER_START_OVERLOAD");
return false;
}
@ -291,7 +291,7 @@ public class ServerStarter {
private static boolean startingBau(ProxiedPlayer p) {
Bauserver subserver = Bauserver.get(p.getUniqueId());
if(subserver != null && !subserver.isStarted()) {
ChatSender.of(p).system("BAU_START_ALREADY");
Chatter.of(p).system("BAU_START_ALREADY");
return true;
}
return false;

Datei anzeigen

@ -21,9 +21,10 @@ package de.steamwar.bungeecore;
import de.steamwar.bungeecore.network.NetworkSender;
import de.steamwar.bungeecore.network.handlers.FightInfoHandler;
import de.steamwar.messages.Chatter;
import de.steamwar.network.packets.server.StartingServerPacket;
import de.steamwar.sql.IgnoreSystem;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.network.packets.server.StartingServerPacket;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -37,18 +38,17 @@ public class SubserverSystem {
node.execute("rm", "-r", worldName);
}
public static void sendDeniedMessage(ProxiedPlayer p, UUID owner){
public static void sendDeniedMessage(Chatter p, UUID owner){
ProxiedPlayer o = ProxyServer.getInstance().getPlayer(owner);
if(o == null)
return;
if(IgnoreSystem.isIgnored(owner, p.getUniqueId())){
Message.send("SERVER_IGNORED", p);
if(IgnoreSystem.isIgnored(owner, p.user().getUUID())){
p.system("SERVER_IGNORED");
return;
}
Message.send("SERVER_ADD_MEMBER", o, p.getName());
Message.sendPrefixless("SERVER_ADD_MESSAGE", o, Message.parse("SERVER_ADD_MESSAGE_HOVER", o, p.getName()),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau addmember " + p.getName()));
Message.send("SERVER_ADD_MEMBER", o, p);
Message.sendPrefixless("SERVER_ADD_MESSAGE", o, "SERVER_ADD_MESSAGE_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau addmember " + p.user().getUserName()));
}
public static void sendPlayer(Subserver subserver, ProxiedPlayer player) {

Datei anzeigen

@ -28,7 +28,7 @@ import de.steamwar.bungeecore.bot.listeners.*;
import de.steamwar.bungeecore.bot.util.DiscordRolesMessage;
import de.steamwar.bungeecore.bot.util.DiscordRulesMessage;
import de.steamwar.bungeecore.bot.util.DiscordTicketMessage;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.Event;
import lombok.Getter;
import net.dv8tion.jda.api.JDA;
@ -112,8 +112,8 @@ public class SteamwarDiscordBot {
new DiscordEventListener();
new PrivateMessageListener();
announcementListener = new AnnouncementListener();
ingameChatListener = new DiscordChatListener(SteamwarDiscordBotConfig.INGAME_CHANNEL, "CHAT_DISCORD_GLOBAL", ChatSender::globalReceivers);
serverTeamChatListener = new DiscordChatListener(SteamwarDiscordBotConfig.SERVER_TEAM_CHANNEL, "CHAT_SERVERTEAM", ChatSender::serverteamReceivers);
ingameChatListener = new DiscordChatListener(SteamwarDiscordBotConfig.INGAME_CHANNEL, "CHAT_DISCORD_GLOBAL", Chatter::broadcast);
serverTeamChatListener = new DiscordChatListener(SteamwarDiscordBotConfig.SERVER_TEAM_CHANNEL, "CHAT_SERVERTEAM", Chatter::serverteam);
new SlashCommandListener();
jda.retrieveCommands().complete().forEach(command -> jda.deleteCommandById(command.getId()).queue());

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bungeecore.bot.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.PunishmentCommand;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.SteamwarUser;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.interactions.commands.OptionType;
@ -60,7 +61,7 @@ public class BanCommand extends BasicDiscordCommand {
boolean isPerma = event.getOption("time").getAsString().equals("perma");
PunishmentCommand.ban(target, time, msg, sender, isPerma);
Message.team("BAN_TEAM", new Message("PREFIX"), target.getUserName(), sender.getUserName(), new Message((isPerma ? "BAN_PERMA" : "BAN_UNTIL"), time), msg);
Chatter.serverteam().system("BAN_TEAM", new Message("PREFIX"), target.getUserName(), sender.getUserName(), new Message((isPerma ? "BAN_PERMA" : "BAN_UNTIL"), time), msg);
event.reply("Erfolgreich " + target.getUserName() + (isPerma ? " permanent" : " bis " + time) + " gebannt").setEphemeral(true).queue();
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bungeecore.bot.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.PunishmentCommand;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
@ -61,7 +62,7 @@ public class MuteCommand extends BasicDiscordCommand {
boolean isPerma = event.getOption("time").getAsString().equals("perma");
target.punish(Punishment.PunishmentType.Mute, time, msg, sender.getId(), isPerma);
Message.team("MUTE_TEAM", new Message("PREFIX"), target.getUserName(), sender.getUserName(), new Message((isPerma ? "BAN_PERMA" : "BAN_UNTIL"), time), msg);
Chatter.serverteam().system("MUTE_TEAM", new Message("PREFIX"), target.getUserName(), sender.getUserName(), new Message((isPerma ? "BAN_PERMA" : "BAN_UNTIL"), time), msg);
event.reply("Erfolgreich " + target.getUserName() + (isPerma ? " permanent" : " bis " + time) + " gemutet").setEphemeral(true).queue();
}
}

Datei anzeigen

@ -19,9 +19,9 @@
package de.steamwar.bungeecore.bot.listeners;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.messages.Chatter;
import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
@ -37,7 +37,7 @@ public class AnnouncementListener extends BasicDiscordListener {
if (event.getAuthor().isBot()) {
return;
}
Message.broadcast("ALERT", event.getMessage().getContentDisplay());
Chatter.broadcast().system("ALERT", event.getMessage().getContentDisplay());
}
public void announce(String message) {

Datei anzeigen

@ -22,9 +22,10 @@ package de.steamwar.bungeecore.bot.listeners;
import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.ChatterGroup;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.messages.ChatSender;
import net.dv8tion.jda.api.MessageBuilder;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.TextChannel;
@ -32,16 +33,15 @@ import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import org.jetbrains.annotations.NotNull;
import java.util.function.Supplier;
import java.util.stream.Stream;
public class DiscordChatListener extends BasicDiscordListener {
private final String channel;
private final String format;
private final Supplier<Stream<ChatSender>> targets;
private final Supplier<ChatterGroup> targets;
public DiscordChatListener(String channel, String format, Supplier<Stream<ChatSender>> targets) {
public DiscordChatListener(String channel, String format, Supplier<ChatterGroup> targets) {
this.channel = channel;
this.format = format;
this.targets = targets;
@ -57,7 +57,7 @@ public class DiscordChatListener extends BasicDiscordListener {
if (steamwarUser == null || event.getMessage().getContentRaw().length() > 250 || steamwarUser.isPunished(Punishment.PunishmentType.Ban)) {
event.getMessage().delete().queue();
} else {
ChatListener.sendChat(ChatSender.of(event.getMessage(), steamwarUser), targets.get(), format, null, event.getMessage().getContentDisplay().replace('§', '&').replace('\n', ' '));
ChatListener.sendChat(Chatter.of(event.getMessage(), steamwarUser), targets.get(), format, null, event.getMessage().getContentDisplay().replace('§', '&').replace('\n', ' '));
}
}

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.bot.config.DiscordTicketType;
import de.steamwar.bungeecore.bot.config.SteamwarDiscordBotConfig;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.dv8tion.jda.api.EmbedBuilder;
@ -72,7 +73,7 @@ public class DiscordTicketListener extends BasicDiscordListener {
ticketChannel.sendMessage(messageBuilder.build()).complete();
event.reply(SteamwarDiscordBotConfig.TICKET_CREATED.replace("%channel%", ticketChannel.getAsMention())).setEphemeral(true).complete();
Message.team("DISCORD_TICKET_NEW", ticketChannel.getName());
Chatter.serverteam().prefixless("DISCORD_TICKET_NEW", ticketChannel.getName());
} else if(event.getComponentId().startsWith("close-")) {
TextChannel logChannel = event.getGuild().getTextChannelById(SteamwarDiscordBotConfig.TICKET_LOG);
@ -127,7 +128,7 @@ public class DiscordTicketListener extends BasicDiscordListener {
logChannel.sendMessage(builder.build()).queue();
});
Message.team("DISCORD_TICKET_CLOSED", event.getTextChannel().getName());
Chatter.serverteam().prefixless("DISCORD_TICKET_CLOSED", event.getTextChannel().getName());
event.getTextChannel().delete().reason("Closed").queue();
}
}

Datei anzeigen

@ -19,11 +19,10 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
@ -36,12 +35,12 @@ public class AlertCommand extends SWCommand {
@Register(description = "USAGE_ALERT")
public void broadcast(CommandSender sender, @OptionalValue("") @StaticValue("-discord") String sendToDiscord, String... message) {
if (message.length == 0) {
ChatSender.of(sender).system(new Message("USAGE_ALERT"));
Chatter.of(sender).system("USAGE_ALERT");
return;
}
String s = String.join(" ", message);
Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', s));
Chatter.broadcast().system("ALERT", ChatColor.translateAlternateColorCodes('&', s));
if ("-discord".equals(sendToDiscord) && SteamwarDiscordBot.instance() != null) {
SteamwarDiscordBot.instance().getAnnouncementListener().announce(s);
}

Datei anzeigen

@ -30,6 +30,7 @@ import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.messages.Chatter;
import de.steamwar.network.packets.server.BaumemberUpdatePacket;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
@ -157,7 +158,7 @@ public class BauCommand extends SWCommand {
}
ProxiedPlayer p = (ProxiedPlayer) sender;
if (!p.getUniqueId().equals(value.getUUID()) && BauweltMember.getBauMember(value.getUUID(), p.getUniqueId()) == null) {
SubserverSystem.sendDeniedMessage(p, value.getUUID());
SubserverSystem.sendDeniedMessage(Chatter.of(p), value.getUUID());
messageSender.send("BAU_TP_NOALLOWED");
return false;
}

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.sql.SWException;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class BugCommand extends SWCommand {
@ -35,6 +35,6 @@ public class BugCommand extends SWCommand {
String server = player.getServer().getInfo().getName();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
SWException.log(String.join(" ", message), server + " " + player.getName() + " " + user.getId());
ChatSender.of(player).system("BUG_MESSAGE");
Chatter.of(player).system("BUG_MESSAGE");
}
}

Datei anzeigen

@ -6,7 +6,7 @@ import de.steamwar.bungeecore.ServerStarter;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -44,7 +44,7 @@ public class BuilderCloudCommand extends SWCommand {
@Register(description = "BUILDERCLOUD_USAGE")
public void start(ProxiedPlayer player, @ErrorMessage("BUILDERCLOUD_VERSION") ServerStarter.Version version, @Mapper("map") String map) {
if(!mapFile(version, map).exists()) {
ChatSender.of(player).system("BUILDERCLOUD_UNKNOWN_MAP");
Chatter.of(player).system("BUILDERCLOUD_UNKNOWN_MAP");
return;
}
@ -55,13 +55,13 @@ public class BuilderCloudCommand extends SWCommand {
public void rename(ProxiedPlayer player, @ErrorMessage("BUILDERCLOUD_VERSION") ServerStarter.Version version, @Mapper("map") String oldName, String newName) {
File oldMap = mapFile(version, oldName);
if(!oldMap.exists()) {
ChatSender.of(player).system("BUILDERCLOUD_UNKNOWN_MAP");
Chatter.of(player).system("BUILDERCLOUD_UNKNOWN_MAP");
return;
}
File newMap = mapFile(version, newName);
if(newMap.exists()) {
ChatSender.of(player).system("BUILDERCLOUD_EXISTING_MAP");
Chatter.of(player).system("BUILDERCLOUD_EXISTING_MAP");
return;
}
@ -71,20 +71,20 @@ public class BuilderCloudCommand extends SWCommand {
throw new SecurityException(e);
}
ChatSender.of(player).system("BUILDERCLOUD_RENAMED");
Chatter.of(player).system("BUILDERCLOUD_RENAMED");
}
@Register(value = "deploy", description = "BUILDERCLOUD_DEPLOY_USAGE")
public void deploy(ProxiedPlayer player, @Mapper("nonHistoricArenaMode") ArenaMode arenaMode, @ErrorMessage("BUILDERCLOUD_VERSION") ServerStarter.Version version, @Mapper("map") String map) {
if(!mapFile(version, map).exists()) {
ChatSender.of(player).system("BUILDERCLOUD_UNKNOWN_MAP");
Chatter.of(player).system("BUILDERCLOUD_UNKNOWN_MAP");
return;
}
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
BungeeCore.local.execute("/binarys/deployarena.py", arenaMode.getConfig(), Integer.toString(version.getVersionSuffix()), map);
ArenaMode.init();
ChatSender.of(player).system("BUILDERCLOUD_DEPLOY_FINISHED");
Chatter.of(player).system("BUILDERCLOUD_DEPLOY_FINISHED");
});
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.IgnoreSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
@ -44,7 +45,7 @@ public class ChallengeCommand extends SWCommand {
challenges.remove(p);
new ServerStarter().arena(mode, map).blueLeader(player).redLeader(target).callback(
arena -> Message.broadcast("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), p.getName(), target.getName())
arena -> Chatter.broadcast().system("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), p.getName(), target.getName())
).start();
}else{
if(!challenges.containsKey(p)){
@ -53,10 +54,10 @@ public class ChallengeCommand extends SWCommand {
challenges.get(p).add(target);
Message.send("CHALLENGE_CHALLENGED", p, target.getName(), mode.getDisplayName());
Message.send("CHALLENGE_CHALLENGED_TARGET", target, p.getName(), mode.getDisplayName(), mode.getMaps().size() != 1 ? Message.parse("CHALLENGE_CHALLENGED_MAP", target, m) : "");
Chatter.of(p).system("CHALLENGE_CHALLENGED", target.getName(), mode.getDisplayName());
Chatter.of(target).system("CHALLENGE_CHALLENGED_TARGET", p.getName(), mode.getDisplayName(), mode.getMaps().size() != 1 ? new Message("CHALLENGE_CHALLENGED_MAP", m) : "");
Message.send("CHALLENGE_ACCEPT", target, Message.parse("CHALLENGE_ACCEPT_HOVER", target), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge " + p.getName() + " " + mode.getChatName() + " " + m));
Chatter.of(target).system("CHALLENGE_ACCEPT", new Message("CHALLENGE_ACCEPT_HOVER"), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge " + p.getName() + " " + mode.getChatName() + " " + m));
}
});
}

Datei anzeigen

@ -22,9 +22,11 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.bot.util.DiscordSchemAlert;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.*;
import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
@ -66,40 +68,40 @@ public class CheckCommand extends SWCommand {
public CheckCommand() {
super("check", ConnectionListener.CHECK_PERMISSION);
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
List<SchematicNode> schematics = getSchemsToCheck();
if(schematics.size() != currentCheckers.size())
Message.team("CHECK_REMINDER", "CHECK_REMINDER_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list"), schematics.size() - currentCheckers.size());
}, 10, 10, TimeUnit.MINUTES);
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> sendReminder(Chatter.serverteam()), 10, 10, TimeUnit.MINUTES);
}
public static void sendReminder(ProxiedPlayer player) {
public static void sendReminder(Chatter chatter) {
List<SchematicNode> schematics = getSchemsToCheck();
if(schematics.size() != currentCheckers.size())
Message.send("CHECK_REMINDER", player, Message.parse("CHECK_REMINDER_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list"), schematics.size() - currentCheckers.size());
if(schematics.size() == currentCheckers.size())
return;
chatter.system("CHECK_REMINDER", new Message("CHECK_REMINDER_HOVER"), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list"), schematics.size() - currentCheckers.size());
}
@Register(value = "list", description = "CHECK_HELP_LIST")
public void list(ProxiedPlayer player) {
Chatter chatter = Chatter.of(player);
List<SchematicNode> schematicList = getSchemsToCheck();
Message.sendPrefixless("CHECK_LIST_HEADER", player, schematicList.size());
chatter.prefixless("CHECK_LIST_HEADER", schematicList.size());
for (SchematicNode schematic : schematicList) {
CheckSession current = currentSchems.get(schematic.getId());
long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime();
String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a";
String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "c" : "e") : "a";
long hours = waitedMillis / 3600000;
long minutes = (waitedMillis - hours * 3600000) / 60000;
String waitTime = color + Message.parse("CHECK_LIST_WAIT", player, hours, (minutes < 10) ? "0" + minutes : minutes);
Message waitTime = new Message("CHECK_LIST_WAIT", player, color, hours, (minutes < 10) ? "0" + minutes : minutes);
if (current == null) {
Message.sendPrefixless("CHECK_LIST_TO_CHECK", player,
Message.parse("CHECK_LIST_TO_CHECK_HOVER", player),
chatter.prefixless("CHECK_LIST_TO_CHECK",
new Message("CHECK_LIST_TO_CHECK_HOVER"),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()),
waitTime,
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
} else {
Message.sendPrefixless("CHECK_LIST_CHECKING", player,
Message.parse("CHECK_LIST_CHECKING_HOVER", player),
chatter.prefixless("CHECK_LIST_CHECKING",
new Message("CHECK_LIST_CHECKING_HOVER"),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + current.checker.getName()),
waitTime,
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.getName());
@ -109,8 +111,9 @@ public class CheckCommand extends SWCommand {
@Register(value = "schematic", noTabComplete = true)
public void schematic(ProxiedPlayer player, String schemID) {
Chatter chatter = Chatter.of(player);
if(isChecking(player)){
Message.send("CHECK_SCHEMATIC_ALREADY_CHECKING", player);
chatter.system("CHECK_SCHEMATIC_ALREADY_CHECKING");
return;
}
@ -120,16 +123,16 @@ public class CheckCommand extends SWCommand {
ProxyServer.getInstance().getLogger().log(Level.SEVERE, player.getName() + " tried to check an uncheckable schematic!");
return;
}else if(schem.getOwner() == checkingUser.getId()) {
Message.send("CHECK_SCHEMATIC_OWN", player);
chatter.system("CHECK_SCHEMATIC_OWN");
return;
}
int playerTeam = checkingUser.hasPerm(UserPerm.MODERATION) ? 0 : checkingUser.getTeam();
if (playerTeam != 0 && SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam) {
Message.send("CHECK_SCHEMATIC_OWN_TEAM", player);
chatter.system("CHECK_SCHEMATIC_OWN_TEAM");
return;
}
new CheckSession(player, schem);
new CheckSession(chatter, schem);
}
@Register(value = "cancel", description = "CHECK_HELP_CANCEL")
@ -142,7 +145,7 @@ public class CheckCommand extends SWCommand {
if(notChecking(player))
return;
Message.send("CHECK_ABORT", player);
Chatter.of(player).system("CHECK_ABORT");
currentCheckers.get(player.getUniqueId()).abort();
}
@ -185,7 +188,7 @@ public class CheckCommand extends SWCommand {
private static boolean notChecking(ProxiedPlayer player){
if(!isChecking(player)){
Message.send("CHECK_NOT_CHECKING", player);
Chatter.of(player).system("CHECK_NOT_CHECKING");
return true;
}
return false;
@ -200,7 +203,7 @@ public class CheckCommand extends SWCommand {
try{
rank = Integer.parseInt(args[0]);
}catch(NumberFormatException e){
Message.send("CHECK_INVALID_RANK", player);
Chatter.of(player).system("CHECK_INVALID_RANK");
return;
}
}
@ -209,30 +212,30 @@ public class CheckCommand extends SWCommand {
}
private static class CheckSession{
private final ProxiedPlayer checker;
private final Chatter checker;
private final SchematicNode schematic;
private final Timestamp startTime;
private final ListIterator<String> checkList;
private CheckSession(ProxiedPlayer checker, SchematicNode schematic){
private CheckSession(Chatter checker, SchematicNode schematic){
this.checker = checker;
this.schematic = schematic;
this.startTime = Timestamp.from(Instant.now());
this.checkList = checkQuestions.get(schematic.getSchemtype()).listIterator();
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> checker.withPlayer(player -> {
ArenaMode mode = ArenaMode.getBySchemType(fightTypes.get(schematic.getSchemtype()));
if(!new ServerStarter().test(mode, mode.getRandomMap(), checker).check(schematic.getId()).start()) {
if(!new ServerStarter().test(mode, mode.getRandomMap(), player).check(schematic.getId()).start()) {
remove();
return;
}
currentCheckers.put(checker.getUniqueId(), this);
currentCheckers.put(checker.user().getUUID(), this);
currentSchems.put(schematic.getId(), this);
for(CheckedSchematic previous : CheckedSchematic.previousChecks(schematic))
Message.sendPrefixless("CHECK_SCHEMATIC_PREVIOUS", checker, previous.getEndTime(), SteamwarUser.get(previous.getValidator()).getUserName(), previous.getDeclineReason());
checker.prefixless("CHECK_SCHEMATIC_PREVIOUS", previous.getEndTime(), SteamwarUser.get(previous.getValidator()).getUserName(), previous.getDeclineReason());
next(0);
});
}));
}
private void next(int rank) {
@ -241,7 +244,7 @@ public class CheckCommand extends SWCommand {
return;
}
checker.sendMessage(TextComponent.fromLegacyText(checkList.next()));
checker.sendMessage(ChatMessageType.SYSTEM, TextComponent.fromLegacy(checkList.next()));
TextComponent next = new TextComponent();
next.setColor(ChatColor.GREEN);
@ -274,7 +277,7 @@ public class CheckCommand extends SWCommand {
if(createLog("freigegeben")) {
if(ranks.containsKey(schematic.getSchemtype())){
if(rank <= 0 || ranks.get(schematic.getSchemtype()).size() < rank){
Message.send("CHECK_INVALID_RANK", checker);
checker.system("CHECK_INVALID_RANK");
return;
}
schematic.setRank(rank);
@ -288,7 +291,7 @@ public class CheckCommand extends SWCommand {
} else {
DiscordSchemAlert.sendAccept(schematic, user);
}
Message.team("CHECK_ACCEPTED_TEAM", schematic.getName(), user.getUserName());
Chatter.serverteam().system("CHECK_ACCEPTED_TEAM", schematic.getName(), user.getUserName());
}
stop();
}
@ -302,7 +305,7 @@ public class CheckCommand extends SWCommand {
} else {
DiscordSchemAlert.sendDecline(schematic, user, reason);
}
Message.team("CHECK_DECLINED_TEAM", schematic.getName(), user.getUserName(), reason);
Chatter.serverteam().system("CHECK_DECLINED_TEAM", schematic.getName(), user.getUserName(), reason);
schematic.setType(SchematicType.Normal.toDB());
}

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.command.*;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -45,7 +45,7 @@ public class DevCommand extends SWCommand {
@Register
public void simpleCommand(@Validator ProxiedPlayer player) {
updateDevServers();
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if (devServers.isEmpty()) {
sender.system("DEV_NO_SERVER");
return;
@ -66,7 +66,7 @@ public class DevCommand extends SWCommand {
@Register
public void selectedCommand(@Validator ProxiedPlayer player, @Mapper("dev") String name) {
updateDevServers();
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
ServerInfo info = devServers.get(name.toLowerCase());
if (info == null) {
sender.system("DEV_NO_SERVER");

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.*;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
@ -118,7 +118,7 @@ public class EventCommand extends SWCommand {
Message.send("EVENT_NO_FIGHT_TEAM", player);
return;
}
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if (!PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer)) {
SubserverSystem.sendPlayer(eventArena, player);
}

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.inventory.SWInventory;
import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.ClickEvent;
@ -47,7 +47,7 @@ public class FightCommand extends SWCommand {
super("fight", "", "f");
}
private static ArenaMode getMode(ChatSender sender, String arg){
private static ArenaMode getMode(Chatter sender, String arg){
ArenaMode mode = ArenaMode.getByChat(arg);
if(mode != null)
return mode;
@ -56,7 +56,7 @@ public class FightCommand extends SWCommand {
return null;
}
private static String getMap(ChatSender sender, ArenaMode mode, String arg){
private static String getMap(Chatter sender, ArenaMode mode, String arg){
String realMap = mode.hasMap(arg.toLowerCase());
if(realMap != null)
return realMap;
@ -67,7 +67,7 @@ public class FightCommand extends SWCommand {
return null;
}
private static void getModes(ChatSender sender, String precommand, boolean historic){
private static void getModes(Chatter sender, String precommand, boolean historic){
TextComponent start = new TextComponent();
TextComponent current = start;
for(ArenaMode mode : ArenaMode.getAllModes()){
@ -98,7 +98,7 @@ public class FightCommand extends SWCommand {
}
static void createArena(ProxiedPlayer player, String precommand, boolean allowMerging, ArenaMode arenaMode, String map, boolean historic, FightCallback callback) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if(alreadyInArena(player))
return;
@ -161,7 +161,7 @@ public class FightCommand extends SWCommand {
public void fight(@Validator("arenaPlayer") ProxiedPlayer player, @Mapper("nonHistoricArenaMode") @OptionalValue("") @AllowNull ArenaMode arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
createArena(player, "/fight ", true, arenaMode, map, false,
(p, mode, m) -> new ServerStarter().arena(mode, m).blueLeader(p).callback(
arena -> Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), p.getName())
arena -> Chatter.broadcast().system("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), p.getName())
).start()
);
}

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -33,7 +33,7 @@ public class HelpCommand extends SWCommand {
@Register
public void genericCommand(ProxiedPlayer player) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
printPage(sender, ClickEvent.Action.RUN_COMMAND,
"HELP_LOBBY", "/l",
@ -49,12 +49,12 @@ public class HelpCommand extends SWCommand {
@Register({"build","world"})
public void buildWorld(ProxiedPlayer player) {
printPage(ChatSender.of(player), "HELP_BAU_GROUP_WORLD_TITLE", "HELP_TNT", "HELP_FIRE", "HELP_FREEZE", "HELP_TPSLIMIT", "HELP_PROTECT", "HELP_RESET");
printPage(Chatter.of(player), "HELP_BAU_GROUP_WORLD_TITLE", "HELP_TNT", "HELP_FIRE", "HELP_FREEZE", "HELP_TPSLIMIT", "HELP_PROTECT", "HELP_RESET");
}
@Register({"build","player"})
public void buildPlayer(ProxiedPlayer player) {
printPage(ChatSender.of(player), "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER");
printPage(Chatter.of(player), "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER");
}
@Register({"build","worldedit"})
@ -62,19 +62,19 @@ public class HelpCommand extends SWCommand {
@Register({"build","world-edit"})
@Register({"build","edit"})
public void buildWorldedit(ProxiedPlayer player) {
printPage(ChatSender.of(player), "HELP_BAU_GROUP_WE_TITLE", "HELP_WE_POS1", "HELP_WE_POS2", "HELP_WE_COPY", "HELP_WE_PASTE", "HELP_WE_FLOPY", "HELP_WE_FLOPYP", "HELP_WE_ROTATE_90", "HELP_WE_ROTATE_180", "HELP_WE_ROTATE_N90");
printPage(Chatter.of(player), "HELP_BAU_GROUP_WE_TITLE", "HELP_WE_POS1", "HELP_WE_POS2", "HELP_WE_COPY", "HELP_WE_PASTE", "HELP_WE_FLOPY", "HELP_WE_FLOPYP", "HELP_WE_ROTATE_90", "HELP_WE_ROTATE_180", "HELP_WE_ROTATE_N90");
}
@Register({"build","other"})
public void buildOther(ProxiedPlayer player) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
printPage(sender, "HELP_BAU_GROUP_OTHER_TITLE", "HELP_TESTBLOCK", "HELP_SKULL", "HELP_BAUINFO");
sender.prefixless("HELP_SCHEMSUBMIT", new Message("HELP_SCHEMSUBMIT_HOVER"), new ClickEvent(ClickEvent.Action.OPEN_URL, "https://www.youtube.com/watch?v=9QrQ3UBWveE"));
}
@Register("build")
public void sendBauHelpGroup(ProxiedPlayer player) {
printPage(ChatSender.of(player), ClickEvent.Action.RUN_COMMAND,
printPage(Chatter.of(player), ClickEvent.Action.RUN_COMMAND,
"HELP_BAU_GROUP_ADMIN", "/help build admin",
"HELP_BAU_GROUP_WORLD", "/help build world",
"HELP_BAU_GROUP_PLAYER", "/help build player",
@ -87,7 +87,7 @@ public class HelpCommand extends SWCommand {
@Register({"build","owner"})
@Register({"build","bauwelt"})
public void sendBauHelp(ProxiedPlayer player) {
printPage(ChatSender.of(player), ClickEvent.Action.SUGGEST_COMMAND,
printPage(Chatter.of(player), ClickEvent.Action.SUGGEST_COMMAND,
"HELP_BAU_TP", "/build tp ",
"HELP_BAU_ADDMEMBER", "/build addmember ",
"HELP_BAU_DELMEMBER", "/build delmember ",
@ -100,7 +100,7 @@ public class HelpCommand extends SWCommand {
"HELP_BAU_UNLOCK", "/build unlock");
}
private static void printPage(ChatSender sender, ClickEvent.Action action, String... args) {
private static void printPage(Chatter sender, ClickEvent.Action action, String... args) {
for(int i = 0; i < args.length; i += 2) {
String message = args[i];
String hoverMessage = message + "_HOVER";
@ -110,7 +110,7 @@ public class HelpCommand extends SWCommand {
}
}
private static void printPage(ChatSender sender, String title, String... messages) {
private static void printPage(Chatter sender, String title, String... messages) {
sender.system(title);
for (String message : messages) {
sender.prefixless(message);

Datei anzeigen

@ -20,9 +20,9 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.ArenaMode;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.ServerStarter;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -35,7 +35,7 @@ public class HistoricCommand extends SWCommand {
public void historic(@Validator("arenaPlayer") ProxiedPlayer player, @Mapper("historicArenaMode") @OptionalValue("") @AllowNull ArenaMode arenaMode, @Mapper("arenaMap") @OptionalValue("") @AllowNull String map) {
FightCommand.createArena(player, "/historic ", true, arenaMode, map, true, (p, mode, m) -> {
new ServerStarter().arena(mode, m).blueLeader(p).callback(
arena -> Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), p.getName())
arena -> Chatter.broadcast().system("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/arena " + arena.getServer().getName()), mode.getDisplayName(), p.getName())
).start();
});
}

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeValidator;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.chat.ClickEvent;
@ -40,7 +41,7 @@ public class JoinmeCommand extends SWCommand {
Message.send("JOINME_USAGE", player);
return;
}
Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER",
Chatter.broadcast().system("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName());
}

Datei anzeigen

@ -19,10 +19,9 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -35,10 +34,10 @@ public class KickCommand extends SWCommand {
@Register(description = "KICK_USAGE")
public void genericCommand(CommandSender sender, @ErrorMessage("KICK_OFFLINE") ProxiedPlayer target, String... message) {
if (message.length == 0) {
target.disconnect(Message.parseToComponent("KICK_NORMAL", true, target));
Chatter.disconnect(target).system("KICK_NORMAL");
} else {
target.disconnect(BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§c" + String.join(" ", message)));
Chatter.disconnect(target).system("KICK_CUSTOM", String.join(" ", message));
}
Message.send("KICK_CONFIRM", sender, target.getName());
Chatter.of(sender).system("KICK_CONFIRM", target);
}
}

Datei anzeigen

@ -20,13 +20,12 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.sql.IgnoreSystem;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.ChatterGroup;
import de.steamwar.sql.IgnoreSystem;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.stream.Stream;
import static de.steamwar.bungeecore.Storage.lastChats;
public class MsgCommand extends SWCommand {
@ -41,7 +40,7 @@ public class MsgCommand extends SWCommand {
}
public static void msg(ProxiedPlayer player, ProxiedPlayer target, String[] args) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if(target == null || !target.isConnected()) {
sender.system("MSG_OFFLINE");
return;
@ -52,8 +51,8 @@ public class MsgCommand extends SWCommand {
return;
}
ChatSender receiver = ChatSender.of(target);
ChatListener.sendChat(sender, Stream.of(sender, receiver), "CHAT_MSG", receiver, String.join(" ", args));
Chatter receiver = Chatter.of(target);
ChatListener.sendChat(sender, new ChatterGroup(sender, receiver), "CHAT_MSG", receiver, String.join(" ", args));
lastChats.put(player, target);
lastChats.put(target, player);
}

Datei anzeigen

@ -27,7 +27,7 @@ import de.steamwar.bungeecore.listeners.IPSanitizer;
import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.BannedUserIPs;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
@ -83,7 +83,7 @@ public class PunishmentCommand {
return null;
}
public static boolean isPunishedWithMessage(ChatSender player, Punishment.PunishmentType punishment) {
public static boolean isPunishedWithMessage(Chatter player, Punishment.PunishmentType punishment) {
SteamwarUser user = player.user();
if (!user.isPunished(punishment)) {
return false;
@ -98,7 +98,7 @@ public class PunishmentCommand {
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(user.getUUID());
if (player != null) {
String ip = IPSanitizer.getTrueAddress(player.getPendingConnection()).getHostAddress();
ChatSender.disconnect(player).system(punishmentMessage(user, Punishment.PunishmentType.Ban));
Chatter.disconnect(player).system(punishmentMessage(user, Punishment.PunishmentType.Ban));
for (BannedUserIPs banned : BannedUserIPs.get(ip)) {
SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID());
if (bannedUser.isPunished(Punishment.PunishmentType.Ban) && bannedUser.getPunishment(Punishment.PunishmentType.Ban).getEndTime().before(time)) {
@ -142,12 +142,12 @@ public class PunishmentCommand {
ban(target, banTime, msg, punisher, isPerma);
else
target.punish(punishmentType, banTime, msg, punisher.getId(), isPerma);
Message.team(punishmentType.getTeamMessage(), new Message("PREFIX"), target.getUserName(), player.getName(), new Message((isPerma ? "PUNISHMENT_PERMA" : "PUNISHMENT_UNTIL"), banTime), msg);
Chatter.serverteam().system(punishmentType.getTeamMessage(), new Message("PREFIX"), target.getUserName(), player.getName(), new Message((isPerma ? "PUNISHMENT_PERMA" : "PUNISHMENT_UNTIL"), banTime), msg);
}
@Register
public void genericError(ProxiedPlayer player, String... args) {
ChatSender.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("PUNISHMENT_USAGE", command));
Chatter.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("PUNISHMENT_USAGE", command));
}
@Mapper(value = "toPunish", local = true)
@ -192,7 +192,7 @@ public class PunishmentCommand {
@Register
public void genericError(ProxiedPlayer player, String... args) {
ChatSender.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("UNPUNISHMENT_USAGE", antiCommand));
Chatter.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("UNPUNISHMENT_USAGE", antiCommand));
}
};
}

Datei anzeigen

@ -25,7 +25,7 @@ import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.bungeecore.inventory.SWStreamInv;
import de.steamwar.sql.*;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList;
@ -40,7 +40,7 @@ public class ReplayCommand extends SWCommand {
@Register
public void genericCommand(ProxiedPlayer player, @OptionalValue("") String optionalMap) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if (PunishmentCommand.isPunishedWithMessage(sender, Punishment.PunishmentType.NoFightServer))
return;
@ -65,7 +65,7 @@ public class ReplayCommand extends SWCommand {
}, page -> Fight.getPage(page, 45).stream().map(fight -> new SWListInv.SWListEntry<>(getFightItem(sender, fight), fight)).collect(Collectors.toList())).open();
}
private SWItem getFightItem(ChatSender sender, Fight fight) {
private SWItem getFightItem(Chatter sender, Fight fight) {
SchematicType type = fight.getSchemType();
SWItem item = new SWItem(type != null ? type.getMaterial() : "BARRIER", parseLeader(sender, fight.getBlueLeader(), fight.getBluePlayers().size(), fight.getWin() == 1));
@ -84,7 +84,7 @@ public class ReplayCommand extends SWCommand {
return item;
}
private String parseLeader(ChatSender sender, SteamwarUser leader, int players, boolean winner) {
private String parseLeader(Chatter sender, SteamwarUser leader, int players, boolean winner) {
return sender.parseToLegacy(winner ? (players > 1 ? "REPLAY_WINNER" : "REPLAY_SOLO_WINNER") : (players > 1 ? "REPLAY_LOSER" : "REPLAY_SOLO_LOSER"), leader.getUserName(), players - 1);
}
}

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.CommandSender;
public class ServerTeamchatCommand extends SWCommand {
@ -33,6 +33,6 @@ public class ServerTeamchatCommand extends SWCommand {
@Register(description = "STC_USAGE")
public void genericCommand(CommandSender commandSender, @ErrorMessage(value = "STC_USAGE", allowEAs = false) String... message) {
ChatListener.sendChat(ChatSender.of(commandSender), ChatSender.serverteamReceivers(), "CHAT_SERVERTEAM", null, String.join(" ", message));
ChatListener.sendChat(Chatter.of(commandSender), Chatter.serverteam(), "CHAT_SERVERTEAM", null, String.join(" ", message));
}
}

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.network.NetworkSender;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.network.packets.server.LocaleInvalidationPacket;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -35,7 +35,7 @@ public class SetLocaleCommand extends SWCommand {
@Register
public void genericCommand(ProxiedPlayer player) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
sender.user().setLocale(Objects.requireNonNull(player.getLocale()), true);
NetworkSender.send(player, new LocaleInvalidationPacket(sender.user().getId()));
sender.system("LOCK_LOCALE_CHANGED");

Datei anzeigen

@ -27,7 +27,7 @@ import de.steamwar.command.PreviousArguments;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.*;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ChatColor;
@ -533,7 +533,7 @@ public class TeamCommand extends SWCommand {
public void server(@Validator("isLeader") ProxiedPlayer player, String server, @Min(intValue = 1) @Max(intValue = 65535) @ErrorMessage("TEAM_SERVER_PORT_INVALID") int port){
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Team team = Team.get(user.getTeam());
if (PunishmentCommand.isPunishedWithMessage(ChatSender.of(player), Punishment.PunishmentType.NoTeamServer)) {
if (PunishmentCommand.isPunishedWithMessage(Chatter.of(player), Punishment.PunishmentType.NoTeamServer)) {
return;
}

Datei anzeigen

@ -20,10 +20,10 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.listeners.ChatListener;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.CommandSender;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.ChatterGroup;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class TeamchatCommand extends SWCommand {
@ -34,7 +34,7 @@ public class TeamchatCommand extends SWCommand {
@Register(description = "TC_USAGE")
public void genericCommand(ProxiedPlayer player, @ErrorMessage(value = "TC_USAGE", allowEAs = false) String... args) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
SteamwarUser user = sender.user();
if(user.getTeam() == 0){
@ -42,6 +42,6 @@ public class TeamchatCommand extends SWCommand {
return;
}
ChatListener.sendChat(sender, ChatSender.allReceivers().filter(p -> p.user().getTeam() == user.getTeam()), "CHAT_TEAM", null, String.join(" ", args));
ChatListener.sendChat(sender, new ChatterGroup(Chatter.allStream().filter(p -> p.user().getTeam() == user.getTeam())), "CHAT_TEAM", null, String.join(" ", args));
}
}

Datei anzeigen

@ -25,7 +25,7 @@ import de.steamwar.bungeecore.util.BauLock;
import de.steamwar.bungeecore.util.Chat19;
import de.steamwar.command.SWCommand;
import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
@ -42,7 +42,7 @@ public class TpCommand extends SWCommand {
@Register
public void genericCommand(ProxiedPlayer p) {
ChatSender.of(p).system(Event.get() == null ? "TP_USAGE" : "TP_USAGE_EVENT");
Chatter.of(p).system(Event.get() == null ? "TP_USAGE" : "TP_USAGE_EVENT");
}
@Register
@ -95,7 +95,7 @@ public class TpCommand extends SWCommand {
}
public static void teleport(ProxiedPlayer player, ServerInfo server) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if(CheckCommand.isChecking(player)){
sender.system("CHECK_CHECKING");
return;

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bungeecore.ArenaMode;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import de.steamwar.command.TypeValidator;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.Punishment;
import lombok.experimental.UtilityClass;
import net.md_5.bungee.api.CommandSender;
@ -43,7 +43,7 @@ public class TypeMappers {
private static TypeValidator<ProxiedPlayer> arenaPlayer() {
return (sender, value, messageSender) -> {
ChatSender player = ChatSender.of(value);
Chatter player = Chatter.of(value);
if (PunishmentCommand.isPunishedWithMessage(player, Punishment.PunishmentType.NoFightServer)) {
return false;
}

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.command.SWCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.io.BufferedReader;
@ -37,7 +37,7 @@ public class WebpasswordCommand extends SWCommand {
@Register(description = "WEB_USAGE")
public void genericCommand(ProxiedPlayer player, String password) {
if(password.length() < 8) {
ChatSender.of(player).system("WEB_PASSWORD_LENGTH");
Chatter.of(player).system("WEB_PASSWORD_LENGTH");
return;
}
@ -49,14 +49,14 @@ public class WebpasswordCommand extends SWCommand {
String errorLine;
if((errorLine = reader.readLine()) != null) {
if ("updated".equals(errorLine)) {
ChatSender.of(player).system("WEB_UPDATED");
Chatter.of(player).system("WEB_UPDATED");
return;
} else {
throw new SecurityException("Could not create webaccount " + errorLine);
}
}
ChatSender.of(player).system("WEB_CREATED");
Chatter.of(player).system("WEB_CREATED");
} catch (IOException e) {
throw new SecurityException("Could not create webaccount", e);
}

Datei anzeigen

@ -25,7 +25,7 @@ import de.steamwar.bungeecore.mods.ModUtils;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.*;
import lombok.Getter;
import net.md_5.bungee.BungeeCord;
@ -48,7 +48,7 @@ public class WhoisCommand extends SWCommand {
@Register(description = "WHOIS_USAGE")
public void genericCommand(ProxiedPlayer player, @Mapper("player") String target, WhoisParameterTypes... parameters) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
SteamwarUser user = SteamwarUser.get(target);
if (sender.user().hasPerm(UserPerm.ADMINISTRATION)) {
if (user == null) {
@ -83,7 +83,7 @@ public class WhoisCommand extends SWCommand {
return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()));
}
private static void sendUserinfo(ChatSender sender, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
private static void sendUserinfo(Chatter sender, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
Team team = Team.get(user.getTeam());
sender.system("WHOIS_USERNAME", user.getUserName());

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.PunishmentCommand;
import de.steamwar.bungeecore.commands.WebpasswordCommand;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.BannedUserIPs;
import de.steamwar.sql.Punishment;
import de.steamwar.sql.SteamwarUser;
@ -50,7 +50,7 @@ public class BanListener extends BasicListener {
if (user.isPunished(Punishment.PunishmentType.Ban)) {
event.setCancelled(true);
BannedUserIPs.banIP(user.getId(), ip);
ChatSender.of(event).system(PunishmentCommand.punishmentMessage(user, Punishment.PunishmentType.Ban));
Chatter.of(event).system(PunishmentCommand.punishmentMessage(user, Punishment.PunishmentType.Ban));
event.completeIntent(BungeeCore.get());
return;
}
@ -75,7 +75,7 @@ public class BanListener extends BasicListener {
+ (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")))
+ " Ban Evasion - Bannumgehung");
ChatSender.serverteamReceivers().forEach(sender -> sender.system(
Chatter.serverteam().system(
"BAN_AVOIDING_ALERT",
new Message("BAN_AVOIDING_BAN_HOVER"),
clickEvent,
@ -85,7 +85,7 @@ public class BanListener extends BasicListener {
return sender.parseToLegacy("BAN_AVOIDING_LIST", bannedUser.getUserName(),
banned.getTimestamp().toLocalDateTime().format(DateTimeFormatter.ofPattern(sender.parseToPlain("TIMEFORMAT"))));
}).collect(Collectors.joining(" "))
));
);
}
event.completeIntent(BungeeCore.get());

Datei anzeigen

@ -24,23 +24,24 @@ import de.steamwar.bungeecore.bot.SteamwarDiscordBot;
import de.steamwar.bungeecore.commands.PunishmentCommand;
import de.steamwar.bungeecore.network.NetworkSender;
import de.steamwar.bungeecore.util.Chat19;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.messages.ChatterGroup;
import de.steamwar.network.packets.server.PingPacket;
import de.steamwar.sql.*;
import net.md_5.bungee.api.*;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.event.TabCompleteEvent;
import net.md_5.bungee.api.event.TabCompleteResponseEvent;
import net.md_5.bungee.api.scheduler.TaskScheduler;
import net.md_5.bungee.event.EventHandler;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ChatListener extends BasicListener {
@ -71,7 +72,7 @@ public class ChatListener extends BasicListener {
} else if (message.startsWith("+")) {
localChat(player, message.substring(1));
} else {
sendChat(ChatSender.of(player), ChatSender.globalReceivers(), "CHAT_GLOBAL", null, message);
sendChat(Chatter.of(player), Chatter.globalChat(), "CHAT_GLOBAL", null, message);
}
}
@ -92,34 +93,37 @@ public class ChatListener extends BasicListener {
return isCommand;
}
public static void sendChat(ChatSender sender, Stream<ChatSender> receivers, String format, ChatSender msgReceiver, String message) {
public static void sendChat(Chatter sender, ChatterGroup receivers, String format, Chatter msgReceiver, String message) {
SteamwarUser user = sender.user();
final String coloredMessage = user.hasPerm(UserPerm.COLOR_CHAT) ? ChatColor.translateAlternateColorCodes('&', message) : message;
if(chatFilter(sender, coloredMessage))
return;
AtomicBoolean noReceiver = new AtomicBoolean(true);
receivers.filter(ChatSender::chatShown).forEach(player -> {
if(sender.user().getId() != player.user().getId())
noReceiver.set(false);
boolean noReceiver = true;
for(Chatter player : receivers.getChatters()) {
if(player.chatShown()) {
chatToReciever(player, msgReceiver, user, format, coloredMessage);
});
if(sender.user().getId() != player.user().getId())
noReceiver = false;
}
chatToReciever(ChatSender.console(), msgReceiver, user, format, coloredMessage);
}
chatToReciever(Chatter.console(), msgReceiver, user, format, coloredMessage);
if(format.equals("CHAT_GLOBAL")) {
if (SteamwarDiscordBot.instance() != null)
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getIngameChatListener()), msgReceiver, user, format, coloredMessage);
chatToReciever(Chatter.discordChannel(SteamwarDiscordBot.instance().getIngameChatListener()), msgReceiver, user, format, coloredMessage);
} else if (format.equals("CHAT_SERVERTEAM")) {
if (SteamwarDiscordBot.instance() != null)
chatToReciever(ChatSender.discordChannel(SteamwarDiscordBot.instance().getServerTeamChatListener()), msgReceiver, user, format, coloredMessage);
} else if (noReceiver.get()) {
chatToReciever(Chatter.discordChannel(SteamwarDiscordBot.instance().getServerTeamChatListener()), msgReceiver, user, format, coloredMessage);
} else if (noReceiver) {
sender.system("CHAT_NO_RECEIVER");
}
}
public static void localChat(ProxiedPlayer player, String message) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
if(message.length() == 0){
sender.system("CHAT_BC_USAGE");
return;
@ -134,7 +138,7 @@ public class ChatListener extends BasicListener {
Chat19.chat(player, message);
}
private static boolean chatFilter(ChatSender sender, String message) {
private static boolean chatFilter(Chatter sender, String message) {
if(!sender.chatShown()) {
sender.system("CHAT_RECEIVE");
return true;
@ -164,7 +168,7 @@ public class ChatListener extends BasicListener {
return false;
}
private static void chatToReciever(ChatSender receiver, ChatSender msgReceiver, SteamwarUser sender, String format, String message) {
private static void chatToReciever(Chatter receiver, Chatter msgReceiver, SteamwarUser sender, String format, String message) {
UserPerm.Prefix prefix = sender.prefix();
String chatColorCode = sender.hasPerm(UserPerm.TEAM) ? "§f" : "§7";
receiver.chat(new Message(format,
@ -187,7 +191,7 @@ public class ChatListener extends BasicListener {
return false;
}
private static void specialAlert(ChatSender sender, String name, String baseMessage, int... delay) {
private static void specialAlert(Chatter sender, String name, String baseMessage, int... delay) {
sender.system("CHAT_LIXFEL_ACTION_BAR");
TaskScheduler scheduler = ProxyServer.getInstance().getScheduler();
for(int i = 0; i < delay.length; i++) {
@ -196,7 +200,7 @@ public class ChatListener extends BasicListener {
}
}
private static String highlightMentions(String message, String returnColor, ChatSender player) {
private static String highlightMentions(String message, String returnColor, Chatter player) {
if(!message.contains("@"))
return message;

Datei anzeigen

@ -30,6 +30,7 @@ import de.steamwar.bungeecore.commands.CheckCommand;
import de.steamwar.bungeecore.commands.ModCommand;
import de.steamwar.bungeecore.commands.MsgCommand;
import de.steamwar.bungeecore.mods.ModUtils;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.AbstractReconnectHandler;
@ -70,6 +71,7 @@ public class ConnectionListener extends BasicListener {
public void onPostLogin(PostLoginEvent event) {
ProxiedPlayer player = event.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Chatter chatter = Chatter.of(player);
if(user.hasPerm(UserPerm.ADMINISTRATION)) {
player.setPermission("bungeecord.command.end", true);
@ -95,7 +97,7 @@ public class ConnectionListener extends BasicListener {
}
if(user.hasPerm(UserPerm.CHECK)) {
CheckCommand.sendReminder(player);
CheckCommand.sendReminder(chatter);
player.setPermission(CHECK_PERMISSION, true);
}
@ -114,7 +116,7 @@ public class ConnectionListener extends BasicListener {
}
if(newPlayers.contains(player.getUniqueId())){
Message.broadcast("JOIN_FIRST", player.getName());
Chatter.broadcast().system("JOIN_FIRST", player.getName());
newPlayers.remove(player.getUniqueId());
}

Datei anzeigen

@ -25,7 +25,7 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.TeamCommand;
import de.steamwar.bungeecore.mods.*;
import de.steamwar.bungeecore.network.ServerMetaInfo;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.network.packets.NetworkPacket;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
@ -151,9 +151,9 @@ public class PluginMessage extends BasicListener {
channelRegisterHandlers.put(ApolloManager.PLUGIN_MESSAGE_CHANNEL, lunar::sendRestrictions);
channelRegisterHandlers.put(Feather.CHANNEL, new Feather()::sendRestrictions);
channelRegisterHandlers.put("xaerominimap:main", player -> player.sendMessage(ChatMessageType.SYSTEM, new TextComponent("§n§o§m§i§n§i§m§a§p"))); //https://www.curseforge.com/minecraft/mc-mods/xaeros-minimap
channelRegisterHandlers.put("litemoretica:init_easy_place", player -> player.disconnect(ChatSender.of(player).parseToComponent(false, new Message("MOD_YELLOW_SING", "litematica")))); //https://github.com/Earthcomputer/litemoretica/tree/master
channelRegisterHandlers.put("voxelmap:settings", player -> player.disconnect(ChatSender.of(player).parseToComponent(false, new Message("MOD_YELLOW_SING", "voxelmap")))); //https://modrinth.com/mod/voxelmap-updated undocumented
channelRegisterHandlers.put("worldinfo:world_id", player -> player.disconnect(ChatSender.of(player).parseToComponent(false, new Message("MOD_YELLOW_SING", "minimap")))); // JourneyMap and VoxelMap
channelRegisterHandlers.put("litemoretica:init_easy_place", player -> player.disconnect(Chatter.of(player).parse(false, new Message("MOD_YELLOW_SING", "litematica")))); //https://github.com/Earthcomputer/litemoretica/tree/master
channelRegisterHandlers.put("voxelmap:settings", player -> player.disconnect(Chatter.of(player).parse(false, new Message("MOD_YELLOW_SING", "voxelmap")))); //https://modrinth.com/mod/voxelmap-updated undocumented
channelRegisterHandlers.put("worldinfo:world_id", player -> player.disconnect(Chatter.of(player).parse(false, new Message("MOD_YELLOW_SING", "minimap")))); // JourneyMap and VoxelMap
channelRegisterHandlers.put(Controlify.CHANNEL, new Controlify()::onRegister);
registerBiDirPassthrough("worldedit:cui");
@ -283,7 +283,7 @@ public class PluginMessage extends BasicListener {
private void steamWarBrand(PluginMessageEvent event) {
ProxiedPlayer player = (ProxiedPlayer) event.getReceiver();
String brandString = ChatSender.of(player).parseToLegacy("STEAMWAR_BRAND", ProxyServer.getInstance().getName(), player.getServer().getInfo().getName(), new String(event.getData(), 1, event.getData().length - 1));
String brandString = Chatter.of(player).parseToLegacy("STEAMWAR_BRAND", ProxyServer.getInstance().getName(), player.getServer().getInfo().getName(), new String(event.getData(), 1, event.getData().length - 1));
ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer();
DefinedPacket.writeString(brandString, brand);

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.commands.PunishmentCommand;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.Mod;
import de.steamwar.sql.Mod.ModType;
import de.steamwar.sql.UserPerm;
@ -48,7 +48,7 @@ public class ModUtils {
private static final Map<UUID,List<Mod>> playerModMap = new HashMap<>();
public static boolean handleMods(ProxiedPlayer player, List<Mod> mods) {
return handleMods(player.getUniqueId(), ChatSender.of(player).getLocale(), player::disconnect, mods);
return handleMods(player.getUniqueId(), Chatter.of(player).getLocale(), player::disconnect, mods);
}
public static boolean handleMods(UUID uuid, Locale locale, Consumer<BaseComponent> disconnect, List<Mod> mods){

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bungeecore.tablist;
import de.steamwar.bungeecore.Storage;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
@ -55,12 +55,12 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
private final List<PlayerListItem.Item> current = new ArrayList<>();
private final ProxiedPlayer player;
private final ChatSender viewer;
private final Chatter viewer;
private ServerConnection connection;
public Tablist(ProxiedPlayer player) {
this.player = player;
this.viewer = ChatSender.of(player);
this.viewer = Chatter.of(player);
this.directTabItems = Storage.directTabItems.computeIfAbsent(player, p -> new HashMap<>());
injection();
}
@ -344,7 +344,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
}
}
private BaseComponent[] header(ChatSender p, int seconds) {
private BaseComponent[] header(Chatter p, int seconds) {
int phase = (seconds % 10) / 5;
if (phase == 0)
return p.parse(false, "TABLIST_PHASE_DISCORD");

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bungeecore.tablist;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -55,7 +55,7 @@ public class TablistBuild implements TablistPart {
}
@Override
public void print(ChatSender viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct) {
public void print(Chatter viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct) {
ServerInfo server = player.getServer().getInfo();
if(players.keySet().stream().anyMatch(info -> server != info)) {
tablist.add(new Item(null, "", TablistServer.GRAY));

Datei anzeigen

@ -19,7 +19,7 @@
package de.steamwar.bungeecore.tablist;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.List;
@ -37,7 +37,7 @@ public class TablistGroup implements TablistPart {
}
@Override
public void print(ChatSender viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct) {
public void print(Chatter viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct) {
for (TablistPart sublist : sublists) {
sublist.print(viewer, player, tablist, direct);
}

Datei anzeigen

@ -19,7 +19,7 @@
package de.steamwar.bungeecore.tablist;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import net.md_5.bungee.api.chat.BaseComponent;
@ -34,7 +34,7 @@ import java.util.UUID;
interface TablistPart {
String sortKey();
void print(ChatSender viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct);
void print(Chatter viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct);
class Item {

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bungeecore.tablist;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.network.packets.common.FightInfoPacket;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.config.ServerInfo;
@ -68,7 +68,7 @@ public class TablistServer implements TablistPart {
}
@Override
public void print(ChatSender viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct) {
public void print(Chatter viewer, ProxiedPlayer player, List<Item> tablist, List<Item> direct) {
boolean onServer = player.getServer().getInfo() == server;
List<Item> items = onServer ? direct : tablist;

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.bungeecore.util;
import de.steamwar.bungeecore.Message;
import de.steamwar.messages.ChatSender;
import de.steamwar.messages.Chatter;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserConfig;
import de.steamwar.sql.UserPerm;
@ -39,7 +39,7 @@ public class BauLock {
}
public static boolean checkNotifyLocked(SteamwarUser owner, ProxiedPlayer player) {
ChatSender sender = ChatSender.of(player);
Chatter sender = Chatter.of(player);
SteamwarUser target = sender.user();
if (owner.getId() == target.getId())
return false;
@ -72,7 +72,7 @@ public class BauLock {
ProxiedPlayer ownerPlayer = ProxyServer.getInstance().getPlayer(owner.getUUID());
if(ownerPlayer != null)
ChatSender.of(ownerPlayer).system("BAU_LOCK_BLOCKED", player.getName());
Chatter.of(ownerPlayer).system("BAU_LOCK_BLOCKED", player.getName());
}
return locked;

Datei anzeigen

@ -21,8 +21,7 @@ package de.steamwar.command;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.messages.ChatSender;
import net.md_5.bungee.BungeeCord;
import de.steamwar.messages.Chatter;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -31,7 +30,6 @@ import net.md_5.bungee.api.plugin.TabExecutor;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import java.util.logging.Level;
@ -103,7 +101,7 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
@Override
protected void commandSystemError(CommandSender sender, CommandFrameworkException e) {
BungeeCore.get().getLogger().log(Level.SEVERE, e.getMessage(), e);
ChatSender.of(sender).prefixless("COMMAND_SYSTEM_ERROR");
Chatter.of(sender).prefixless("COMMAND_SYSTEM_ERROR");
}
@Override
@ -117,15 +115,15 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
@Override
protected void sendMessage(CommandSender sender, String message, Object[] args) {
ChatSender.of(sender).system(message, args);
Chatter.of(sender).system(message, args);
}
@Register(noTabComplete = true)
public void internalHelp(ProxiedPlayer p, String... args) {
ChatSender chatSender = ChatSender.of(p);
Chatter chatter = Chatter.of(p);
try {
chatSender.prefixless("COMMAND_HELP_HEAD", command.getName());
defaultHelpMessages.forEach(chatSender::prefixless);
chatter.prefixless("COMMAND_HELP_HEAD", command.getName());
defaultHelpMessages.forEach(chatter::prefixless);
} catch (Exception e) {
BungeeCore.get().getLogger().log(Level.WARNING, "Failed to send help message", e);
return;
@ -141,7 +139,7 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
boolean hasTabCompletes = tabCompletes.stream()
.anyMatch(s -> s.toLowerCase().startsWith(args[args.length - 1].toLowerCase()));
if (hasTabCompletes) {
send(chatSender, subCommand);
send(chatter, subCommand);
} else {
atomicInteger.incrementAndGet();
}
@ -150,18 +148,18 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
if (args.length == 0 || atomicInteger.get() == commandList.size()) {
commandList.forEach(subCommand -> {
if (subCommand.validator == null || subCommand.validator.validate(p, p, (s, args1) -> {})) {
send(chatSender, subCommand);
send(chatter, subCommand);
}
});
}
}
private void send(ChatSender chatSender, SubCommand<CommandSender> subCommand) {
private void send(Chatter chatter, SubCommand<CommandSender> subCommand) {
try {
for (String s : subCommand.description) {
String hover = "§8/§e" + command.getName() + " " + String.join(" ", subCommand.subCommand);
String suggest = "/" + command.getName() + " " + String.join(" ", subCommand.subCommand);
chatSender.prefixless(s, new Message("PLAIN_STRING", hover), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, suggest));
chatter.prefixless(s, new Message("PLAIN_STRING", hover), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, suggest));
}
} catch (Exception e) {
BungeeCore.get().getLogger().log(Level.WARNING, "Failed to send description of registered method '" + subCommand.method + "' with description '" + subCommand.description + "'", e);

Datei anzeigen

@ -283,7 +283,7 @@ CHECK_HELP_DECLINE=§8/§7check decline §8[§ereason§8] - §7Decline schematic
CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Cancels reviewing process
CHECK_LIST_HEADER=§e§l{0} schematics are left to review
CHECK_LIST_TO_CHECK={0} §8{1} §7{2} §e{3}
CHECK_LIST_WAIT={0}:{1}
CHECK_LIST_WAIT=§{0}{1}:{2}
CHECK_LIST_TO_CHECK_HOVER=§eCheck schematic
CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7is being reviewed by §e{4}
CHECK_LIST_CHECKING_HOVER=§eTo the reviewer
@ -322,6 +322,7 @@ KICK_USAGE=§8/§7kick §8[§ePlayer§8] [§eMessage§8]
KICK_OFFLINE=§cThis player is currently not online!
KICK_CONFIRM=The player {0} was kicked.
KICK_NORMAL=§cYou were kicked.
KICK_CUSTOM=§c{0}
#MsgCommand
MSG_USAGE=§8/§7msg §8[§euser§8] [§emessage§8]

Datei anzeigen

@ -266,7 +266,6 @@ CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen
CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab
CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics
CHECK_LIST_TO_CHECK={0} §8{1} §7{2} §e{3}
CHECK_LIST_WAIT={0}:{1}
CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen
CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7wird geprüft von §e{4}
CHECK_LIST_CHECKING_HOVER=§eZum Prüfer

Datei anzeigen

@ -19,7 +19,10 @@
package de.steamwar.messages;
import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.bot.listeners.DiscordChatListener;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
@ -41,28 +44,33 @@ import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.stream.Stream;
public interface ChatSender {
public interface Chatter {
static Stream<ProxiedPlayer> all() {
static Stream<ProxiedPlayer> allPlayers() {
return ProxyServer.getInstance().getPlayers().stream();
}
static Stream<ChatSender> allReceivers() {
return all().map(ChatSender::of);
static Stream<Chatter> allStream() {
return Stream.concat(Stream.of(Chatter.console()), allPlayers().map(Chatter::of));
}
static Stream<ChatSender> globalReceivers() {
return all().filter(player -> {
static ChatterGroup broadcast() {
return new ChatterGroup(allStream());
}
static ChatterGroup globalChat() {
return new ChatterGroup(Stream.concat(Stream.of(Chatter.console()), allPlayers().filter(player -> {
Subserver subserver = Subserver.getSubserver(player);
return subserver == null || !(subserver.getType() == Servertype.ARENA && subserver.getServer() == player.getServer().getInfo());
}).map(ChatSender::of);
}).map(Chatter::of)));
}
static Stream<ChatSender> serverteamReceivers() {
return allReceivers().filter(player -> player.user().hasPerm(UserPerm.TEAM));
static ChatterGroup serverteam() {
return new ChatterGroup(allStream().filter(player -> player.user().hasPerm(UserPerm.TEAM)));
}
SteamwarUser user();
@ -70,6 +78,7 @@ public interface ChatSender {
Locale getLocale();
boolean chatShown();
void sendMessage(ChatMessageType type, BaseComponent... msg);
void withPlayer(Consumer<ProxiedPlayer> function);
default void chat(Message message) {
send(false, ChatMessageType.CHAT, null, null, message);
@ -96,7 +105,7 @@ public interface ChatSender {
}
default void send(boolean prefixed, ChatMessageType type, Message onHover, ClickEvent onClick, Message message) {
TextComponent msg = parseToComponent(prefixed, message);
BaseComponent msg = parse(prefixed, message);
if(onHover != null)
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(parse(false, onHover))));
if(onClick != null)
@ -104,16 +113,12 @@ public interface ChatSender {
sendMessage(type, msg);
}
default TextComponent parseToComponent(boolean prefixed, Message message) {
return new TextComponent(parse(prefixed, message));
}
default String parseToPlain(String format, Object... params) {
return parseToPlain(new Message(format, params));
}
default String parseToPlain(Message message) {
return parseToComponent(false, message).toPlainText();
return parse(false, message).toPlainText();
}
default String parseToLegacy(String format, Object... params) {
@ -121,14 +126,14 @@ public interface ChatSender {
}
default String parseToLegacy(Message message) {
return parseToComponent(false, message).toLegacyText();
return parse(false, message).toLegacyText();
}
default BaseComponent[] parse(boolean prefixed, String format, Object... params) {
default BaseComponent parse(boolean prefixed, String format, Object... params) {
return parse(prefixed, new Message(format, params));
}
default BaseComponent[] parse(boolean prefixed, Message message) {
default BaseComponent parse(boolean prefixed, Message message) {
Locale locale = getLocale();
ResourceBundle resourceBundle = SteamwarResourceBundle.getResourceBundle(locale);
String pattern = "";
@ -147,15 +152,15 @@ public interface ChatSender {
params[i] = ((SteamwarUser) params[i]).getUserName();
} else if(params[i] instanceof ProxiedPlayer) {
params[i] = ((ProxiedPlayer) params[i]).getName();
} else if(params[i] instanceof ChatSender) {
params[i] = ((ChatSender) params[i]).user().getUserName();
} else if(params[i] instanceof Chatter) {
params[i] = ((Chatter) params[i]).user().getUserName();
}
}
return TextComponent.fromLegacyText(format.format(params));
return TextComponent.fromLegacy(format.format(params));
}
static ChatSender ofProxiedPlayer(ProxiedPlayer player, BiConsumer<ChatMessageType, BaseComponent[]> sendMessage) {
return new ChatSender() {
static Chatter ofProxiedPlayer(ProxiedPlayer player, BiConsumer<ChatMessageType, BaseComponent[]> sendMessage) {
return new Chatter() {
@Override
public SteamwarUser user() {
return SteamwarUser.get(player.getUniqueId());
@ -175,33 +180,33 @@ public interface ChatSender {
public void sendMessage(ChatMessageType type, BaseComponent... msg) {
sendMessage.accept(type, msg);
}
@Override
public void withPlayer(Consumer<ProxiedPlayer> function) {
function.accept(player);
}
};
}
static ChatSender of(ProxiedPlayer player) {
static Chatter of(ProxiedPlayer player) {
return ofProxiedPlayer(player, player::sendMessage);
}
static ChatSender disconnect(ProxiedPlayer player) {
static Chatter disconnect(ProxiedPlayer player) {
return ofProxiedPlayer(player, (type, msg) -> player.disconnect(msg));
}
static ChatSender of(CommandSender sender) {
static Chatter of(CommandSender sender) {
if(sender instanceof ProxiedPlayer)
return of((ProxiedPlayer) sender);
//Console
return new ChatSender() {
return new PlayerlessChatter() {
@Override
public SteamwarUser user() {
return SteamwarUser.get(-1);
}
@Override
public Locale getLocale() {
return Locale.getDefault();
}
@Override
public boolean chatShown() {
return true;
@ -214,22 +219,17 @@ public interface ChatSender {
};
}
static ChatSender console() {
static Chatter console() {
return of(ConsoleCommandSender.getInstance());
}
static ChatSender of(LoginEvent event) {
return new ChatSender() {
static Chatter of(LoginEvent event) {
return new PlayerlessChatter() {
@Override
public SteamwarUser user() {
return SteamwarUser.get(event.getConnection().getUniqueId());
}
@Override
public Locale getLocale() {
return Locale.getDefault();
}
@Override
public boolean chatShown() {
return false;
@ -242,18 +242,13 @@ public interface ChatSender {
};
}
static ChatSender discordChannel(DiscordChatListener channel) {
return new ChatSender() {
static Chatter discordChannel(DiscordChatListener channel) {
return new PlayerlessChatter() {
@Override
public SteamwarUser user() {
return SteamwarUser.get(-1);
}
@Override
public Locale getLocale() {
return Locale.getDefault();
}
@Override
public boolean chatShown() {
return true;
@ -270,18 +265,13 @@ public interface ChatSender {
};
}
static ChatSender of(net.dv8tion.jda.api.entities.Message message, SteamwarUser user) {
return new ChatSender() {
static Chatter of(net.dv8tion.jda.api.entities.Message message, SteamwarUser user) {
return new PlayerlessChatter() {
@Override
public SteamwarUser user() {
return user;
}
@Override
public Locale getLocale() {
return Locale.getDefault();
}
@Override
public boolean chatShown() {
return true;
@ -297,4 +287,16 @@ public interface ChatSender {
}
};
}
abstract class PlayerlessChatter implements Chatter {
@Override
public Locale getLocale() {
return Locale.getDefault();
}
@Override
public void withPlayer(Consumer<ProxiedPlayer> function) {
//Not a player
}
}
}

Datei anzeigen

@ -0,0 +1,71 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.messages;
import de.steamwar.bungeecore.Message;
import de.steamwar.sql.SteamwarUser;
import lombok.Getter;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import java.util.Arrays;
import java.util.Locale;
import java.util.stream.Stream;
@Getter
public class ChatterGroup implements Chatter {
final Chatter[] chatters;
public ChatterGroup(Stream<Chatter> stream) {
chatters = stream.toArray(Chatter[]::new);
}
public ChatterGroup(Chatter... chatters) {
this.chatters = chatters;
}
@Override
public boolean chatShown() {
return Arrays.stream(chatters).allMatch(Chatter::chatShown);
}
@Override
public void send(boolean prefixed, ChatMessageType type, Message onHover, ClickEvent onClick, Message message) {
for(Chatter sender : chatters)
sender.send(prefixed, type, onHover, onClick, message);
}
@Override
public SteamwarUser user() {
throw new UnsupportedOperationException();
}
@Override
public Locale getLocale() {
throw new UnsupportedOperationException();
}
@Override
public void sendMessage(ChatMessageType type, BaseComponent... msg) {
throw new UnsupportedOperationException();
}
}