mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-22 18:09:06 +00:00
Remove ancient comments.
This commit is contained in:
parent
d5822b8840
commit
b6cbc846c6
@ -7,28 +7,28 @@ import org.bukkit.event.HandlerList;
|
||||
|
||||
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.
|
||||
public class MutePlayerEvent extends Event implements Cancellable { //unimplemented
|
||||
// TODO
|
||||
public class MutePlayerEvent extends Event implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private Player player;
|
||||
private ChatChannel channel;
|
||||
private int time;
|
||||
|
||||
|
||||
public MutePlayerEvent(Player player, ChatChannel channel, int time) {
|
||||
this.player = player;
|
||||
this.channel = channel;
|
||||
this.time = time;
|
||||
this.cancelled = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
return handlers;
|
||||
}
|
||||
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,24 +40,24 @@ public class MutePlayerEvent extends Event implements Cancellable { //unimplemen
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
|
||||
public void setChannel(ChatChannel channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
|
||||
public ChatChannel getChannel() {
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
|
||||
public int getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class VentureChatEvent extends Event {
|
||||
private final String playerPrimaryGroup;
|
||||
private final ChatChannel channel;
|
||||
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 chat;
|
||||
private final String globalJSON;
|
||||
|
@ -35,7 +35,6 @@ import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||
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")
|
||||
@Singleton
|
||||
public class ChatListener implements Listener {
|
||||
|
@ -16,9 +16,6 @@ import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||
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
|
||||
public class PacketListener extends PacketAdapter {
|
||||
@Inject
|
||||
@ -27,8 +24,7 @@ public class PacketListener extends PacketAdapter {
|
||||
private VentureChatPlayerApiService playerApiService;
|
||||
@Inject
|
||||
private VersionService versionService;
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
public PacketListener(final VentureChat plugin) {
|
||||
super(plugin, ListenerPriority.MONITOR, new PacketType[] { PacketType.Play.Server.CHAT });
|
||||
@ -36,48 +32,45 @@ public class PacketListener extends PacketAdapter {
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
if(event.isCancelled() || event.getPacketType() != PacketType.Play.Server.CHAT) {
|
||||
if (event.isCancelled() || event.getPacketType() != PacketType.Play.Server.CHAT) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(event.getPlayer());
|
||||
if(mcp == null) {
|
||||
if (mcp == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PacketContainer packet = event.getPacket();
|
||||
WrappedChatComponent chat = packet.getChatComponents().read(0);
|
||||
if(chat == null) {
|
||||
if (chat == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if(versionService.is1_7()) {
|
||||
if (versionService.is1_7()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
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);
|
||||
if(((Byte) packet.getBytes().getField(0).get(packet.getHandle())).intValue() > 1) {
|
||||
if (((Byte) packet.getBytes().getField(0).get(packet.getHandle())).intValue() > 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
String message = formatter.toPlainText(chat.getHandle(), chat.getHandleType());
|
||||
String coloredMessage = formatter.toColoredText(chat.getHandle(), chat.getHandleType());
|
||||
if(message == null) {
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
int hash = message.hashCode();
|
||||
|
@ -36,8 +36,6 @@ import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||
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
|
||||
public class PreProcessCommandListener implements CommandExecutor, Listener {
|
||||
@Inject
|
||||
@ -184,23 +182,6 @@ public class PreProcessCommandListener implements CommandExecutor, Listener {
|
||||
pluginMessageController.synchronize(mcp, true);
|
||||
}
|
||||
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.getPlayer().chat(message);
|
||||
event.setCancelled(true);
|
||||
|
@ -12,25 +12,24 @@ import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||
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
|
||||
public class SignListener implements Listener {
|
||||
@Inject
|
||||
private VentureChatPlayerApiService playerApiService;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
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);
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color.legacy")) {
|
||||
if (mcp.getPlayer().hasPermission("venturechat.color.legacy")) {
|
||||
line = FormatUtils.FormatStringLegacyColor(line);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
if (mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
line = FormatUtils.FormatStringColor(line);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.format")) {
|
||||
if (mcp.getPlayer().hasPermission("venturechat.format")) {
|
||||
line = FormatUtils.FormatString(line);
|
||||
}
|
||||
event.setLine(a, line);
|
||||
|
@ -38,9 +38,6 @@ public class VentureChatDatabaseService {
|
||||
String password = mysqlConfig.getString("password");
|
||||
|
||||
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);
|
||||
config.setJdbcUrl(jdbcUrl);
|
||||
config.setUsername(user);
|
||||
|
Loading…
x
Reference in New Issue
Block a user