Remove ancient comments.

This commit is contained in:
Aust1n46 2022-05-11 23:27:41 -05:00
parent d5822b8840
commit b6cbc846c6
7 changed files with 35 additions and 66 deletions

View File

@ -7,8 +7,8 @@ import org.bukkit.event.HandlerList;
import venture.Aust1n46.chat.model.ChatChannel; import venture.Aust1n46.chat.model.ChatChannel;
//This class is a custom event that is part of the plugins API. It is called when a player executes the mute command. // TODO
public class MutePlayerEvent extends Event implements Cancellable { //unimplemented public class MutePlayerEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancelled; private boolean cancelled;
private Player player; private Player player;

View File

@ -26,7 +26,7 @@ public class VentureChatEvent extends Event {
private final String playerPrimaryGroup; private final String playerPrimaryGroup;
private final ChatChannel channel; private final ChatChannel channel;
private final Set<Player> recipients; private final Set<Player> recipients;
private final int recipientCount; // For not counting vanished players private final int recipientCount;
private final String format; private final String format;
private final String chat; private final String chat;
private final String globalJSON; private final String globalJSON;

View File

@ -35,7 +35,6 @@ import venture.Aust1n46.chat.service.VentureChatFormatService;
import venture.Aust1n46.chat.service.VentureChatPlayerApiService; import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
import venture.Aust1n46.chat.utilities.FormatUtils; import venture.Aust1n46.chat.utilities.FormatUtils;
//This class listens to chat through the chat event and handles the bulk of the chat channels and formatting.
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Singleton @Singleton
public class ChatListener implements Listener { public class ChatListener implements Listener {

View File

@ -16,9 +16,6 @@ import venture.Aust1n46.chat.service.VentureChatFormatService;
import venture.Aust1n46.chat.service.VentureChatPlayerApiService; import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
import venture.Aust1n46.chat.xcut.VersionService; import venture.Aust1n46.chat.xcut.VersionService;
//This class listens for chat packets and intercepts them before they are sent to the Player.
//The packets are modified to include advanced json formating and the message remover button if the
//player has permission to remove messages.
@Singleton @Singleton
public class PacketListener extends PacketAdapter { public class PacketListener extends PacketAdapter {
@Inject @Inject
@ -28,7 +25,6 @@ public class PacketListener extends PacketAdapter {
@Inject @Inject
private VersionService versionService; private VersionService versionService;
@Inject @Inject
public PacketListener(final VentureChat plugin) { public PacketListener(final VentureChat plugin) {
super(plugin, ListenerPriority.MONITOR, new PacketType[] { PacketType.Play.Server.CHAT }); super(plugin, ListenerPriority.MONITOR, new PacketType[] { PacketType.Play.Server.CHAT });
@ -36,48 +32,45 @@ public class PacketListener extends PacketAdapter {
@Override @Override
public void onPacketSending(PacketEvent event) { public void onPacketSending(PacketEvent event) {
if(event.isCancelled() || event.getPacketType() != PacketType.Play.Server.CHAT) { if (event.isCancelled() || event.getPacketType() != PacketType.Play.Server.CHAT) {
return; return;
} }
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(event.getPlayer()); VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(event.getPlayer());
if(mcp == null) { if (mcp == null) {
return; return;
} }
PacketContainer packet = event.getPacket(); PacketContainer packet = event.getPacket();
WrappedChatComponent chat = packet.getChatComponents().read(0); WrappedChatComponent chat = packet.getChatComponents().read(0);
if(chat == null) { if (chat == null) {
return; return;
} }
try { try {
if(versionService.is1_7()) { if (versionService.is1_7()) {
packet.getBooleans().getField(0).setAccessible(true); packet.getBooleans().getField(0).setAccessible(true);
if(!((boolean) packet.getBooleans().getField(0).get(packet.getHandle()))) { if (!((boolean) packet.getBooleans().getField(0).get(packet.getHandle()))) {
return; return;
} }
} } else if (versionService.is1_8() || versionService.is1_9() || versionService.is1_10() || versionService.is1_11()) {
else if(versionService.is1_8() || versionService.is1_9() || versionService.is1_10() || versionService.is1_11()) {
packet.getBytes().getField(0).setAccessible(true); packet.getBytes().getField(0).setAccessible(true);
if(((Byte) packet.getBytes().getField(0).get(packet.getHandle())).intValue() > 1) { if (((Byte) packet.getBytes().getField(0).get(packet.getHandle())).intValue() > 1) {
return; return;
} }
} } else {
else {
packet.getChatTypes().getField(0).setAccessible(true); packet.getChatTypes().getField(0).setAccessible(true);
if(packet.getChatTypes().getField(0).get(packet.getHandle()) == packet.getChatTypes().getField(0).getType().getEnumConstants()[2]) { if (packet.getChatTypes().getField(0).get(packet.getHandle()) == packet.getChatTypes().getField(0).getType().getEnumConstants()[2]) {
return; return;
} }
} }
} } catch (Exception e) {
catch(Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
String message = formatter.toPlainText(chat.getHandle(), chat.getHandleType()); String message = formatter.toPlainText(chat.getHandle(), chat.getHandleType());
String coloredMessage = formatter.toColoredText(chat.getHandle(), chat.getHandleType()); String coloredMessage = formatter.toColoredText(chat.getHandle(), chat.getHandleType());
if(message == null) { if (message == null) {
return; return;
} }
int hash = message.hashCode(); int hash = message.hashCode();

View File

@ -36,8 +36,6 @@ import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
import venture.Aust1n46.chat.utilities.FormatUtils; import venture.Aust1n46.chat.utilities.FormatUtils;
import venture.Aust1n46.chat.xcut.VersionService; import venture.Aust1n46.chat.xcut.VersionService;
//This class listens for commands (Any chat that begins with a /) to use in the command spy and
//in the custom commands such as aliases.
@Singleton @Singleton
public class PreProcessCommandListener implements CommandExecutor, Listener { public class PreProcessCommandListener implements CommandExecutor, Listener {
@Inject @Inject
@ -184,23 +182,6 @@ public class PreProcessCommandListener implements CommandExecutor, Listener {
pluginMessageController.synchronize(mcp, true); pluginMessageController.synchronize(mcp, true);
} }
mcp.setQuickChannel(channel); mcp.setQuickChannel(channel);
/*
* String format = ""; if(plugin.getConfig().getConfigurationSection("channels."
* + channel.getName()).getString("format").equalsIgnoreCase("Default")) {
* format =
* FormatTags.ChatFormat(ChatColor.valueOf(channel.getColor().toUpperCase()) +
* "[" + channel.getName() + "] {prefix}{name}" +
* ChatColor.valueOf(channel.getColor().toUpperCase()) + ":" +
* ChatColor.valueOf(channel.getChatColor().toUpperCase()), mcp.getPlayer(),
* plugin, cc, channel, plugin.getConfig().getBoolean("jsonFormat")); } else {
* format =
* FormatTags.ChatFormat(plugin.getConfig().getConfigurationSection("channels."
* + channel.getName()).getString("format"), mcp.getPlayer(), plugin, cc,
* channel, plugin.getConfig().getBoolean("jsonFormat"));
* if(plugin.getConfig().getBoolean("formatcleaner", false)) { format =
* format.replace("[]", " "); format = format.replace(" ",
* " ").replace(" ", " ").replace(" ", " "); } }
*/
mcp.setQuickChat(true); mcp.setQuickChat(true);
mcp.getPlayer().chat(message); mcp.getPlayer().chat(message);
event.setCancelled(true); event.setCancelled(true);

View File

@ -12,7 +12,6 @@ import venture.Aust1n46.chat.model.VentureChatPlayer;
import venture.Aust1n46.chat.service.VentureChatPlayerApiService; import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
import venture.Aust1n46.chat.utilities.FormatUtils; import venture.Aust1n46.chat.utilities.FormatUtils;
//This class listens for text being added to signs, and it formats them to allow colors and formatting.
@Singleton @Singleton
public class SignListener implements Listener { public class SignListener implements Listener {
@Inject @Inject
@ -22,15 +21,15 @@ public class SignListener implements Listener {
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onSignChange(SignChangeEvent event) { public void onSignChange(SignChangeEvent event) {
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(event.getPlayer()); VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(event.getPlayer());
for(int a = 0; a < event.getLines().length; a++) { for (int a = 0; a < event.getLines().length; a++) {
String line = event.getLine(a); String line = event.getLine(a);
if(mcp.getPlayer().hasPermission("venturechat.color.legacy")) { if (mcp.getPlayer().hasPermission("venturechat.color.legacy")) {
line = FormatUtils.FormatStringLegacyColor(line); line = FormatUtils.FormatStringLegacyColor(line);
} }
if(mcp.getPlayer().hasPermission("venturechat.color")) { if (mcp.getPlayer().hasPermission("venturechat.color")) {
line = FormatUtils.FormatStringColor(line); line = FormatUtils.FormatStringColor(line);
} }
if(mcp.getPlayer().hasPermission("venturechat.format")) { if (mcp.getPlayer().hasPermission("venturechat.format")) {
line = FormatUtils.FormatString(line); line = FormatUtils.FormatString(line);
} }
event.setLine(a, line); event.setLine(a, line);

View File

@ -38,9 +38,6 @@ public class VentureChatDatabaseService {
String password = mysqlConfig.getString("password"); String password = mysqlConfig.getString("password");
final HikariConfig config = new HikariConfig(); final HikariConfig config = new HikariConfig();
// config.setDriverClassName(org.postgresql.Driver.class.getName());
// final String jdbcUrl = String.format("jdbc:postgresql://%s:%d/%s", hostname,
// port, database);
final String jdbcUrl = String.format("jdbc:mysql://%s:%d/%s?autoReconnect=true&useSSL=false", host, port, database); final String jdbcUrl = String.format("jdbc:mysql://%s:%d/%s?autoReconnect=true&useSSL=false", host, port, database);
config.setJdbcUrl(jdbcUrl); config.setJdbcUrl(jdbcUrl);
config.setUsername(user); config.setUsername(user);