mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 02:19:05 +00:00
Refactored away ChatChannelInfo class
This commit is contained in:
parent
5142e1bb0a
commit
6d438f9372
@ -352,7 +352,6 @@ channels:
|
||||
alias: g
|
||||
permissions: None
|
||||
format: '&f[&2Global&f] {prefix} {nickname}&2:'
|
||||
irc: false
|
||||
Staff:
|
||||
color: green
|
||||
chatcolor: green
|
||||
@ -366,7 +365,6 @@ channels:
|
||||
alias: st
|
||||
permissions: staffchannel
|
||||
format: '&f[&aStaff&f] {prefix} {nickname}&a:'
|
||||
irc: false
|
||||
Admin:
|
||||
color: red
|
||||
chatcolor: red
|
||||
@ -380,7 +378,6 @@ channels:
|
||||
alias: a
|
||||
permissions: adminchannel
|
||||
format: '&f[&cAdmin&f] {prefix} {nickname}&c:'
|
||||
irc: false
|
||||
Donator:
|
||||
color: light_purple
|
||||
chatcolor: light_purple
|
||||
@ -394,7 +391,6 @@ channels:
|
||||
alias: d
|
||||
permissions: donatorchannel
|
||||
format: '&f[&dDonator&f] {prefix} {nickname}&d:'
|
||||
irc: false
|
||||
Help:
|
||||
color: aqua
|
||||
chatcolor: aqua
|
||||
@ -408,7 +404,6 @@ channels:
|
||||
alias: h
|
||||
permissions: None
|
||||
format: '&f[&bHelp&f] {prefix} {nickname}&b:'
|
||||
irc: false
|
||||
Trade:
|
||||
color: dark_aqua
|
||||
chatcolor: dark_aqua
|
||||
@ -422,7 +417,6 @@ channels:
|
||||
alias: t
|
||||
permissions: None
|
||||
format: '&f[&3Trade&f] {prefix} {nickname}&3:'
|
||||
irc: false
|
||||
Local:
|
||||
color: yellow
|
||||
chatcolor: yellow
|
||||
@ -436,7 +430,6 @@ channels:
|
||||
alias: l
|
||||
permissions: None
|
||||
format: '&f[&eLocal&f] {prefix} {nickname}&e:'
|
||||
irc: false
|
||||
Network:
|
||||
color: gold
|
||||
chatcolor: gold
|
||||
@ -449,5 +442,4 @@ channels:
|
||||
bungeecord: true
|
||||
alias: n
|
||||
permissions: None
|
||||
format: '&f[&6Network&f] {prefix} {nickname}&6:'
|
||||
irc: false
|
||||
format: '&f[&6Network&f] {prefix} {nickname}&6:'
|
@ -1,4 +1,4 @@
|
||||
#===============================================================
|
||||
#===============================================================
|
||||
# VentureChat Config =
|
||||
# Author: Aust1n46 =
|
||||
#===============================================================
|
||||
@ -352,7 +352,6 @@ channels:
|
||||
alias: g
|
||||
permissions: None
|
||||
format: '&f[&2Global&f] {prefix} {nickname}&2:'
|
||||
irc: false
|
||||
Staff:
|
||||
color: green
|
||||
chatcolor: green
|
||||
@ -366,7 +365,6 @@ channels:
|
||||
alias: st
|
||||
permissions: staffchannel
|
||||
format: '&f[&aStaff&f] {prefix} {nickname}&a:'
|
||||
irc: false
|
||||
Admin:
|
||||
color: red
|
||||
chatcolor: red
|
||||
@ -380,7 +378,6 @@ channels:
|
||||
alias: a
|
||||
permissions: adminchannel
|
||||
format: '&f[&cAdmin&f] {prefix} {nickname}&c:'
|
||||
irc: false
|
||||
Donator:
|
||||
color: light_purple
|
||||
chatcolor: light_purple
|
||||
@ -394,7 +391,6 @@ channels:
|
||||
alias: d
|
||||
permissions: donatorchannel
|
||||
format: '&f[&dDonator&f] {prefix} {nickname}&d:'
|
||||
irc: false
|
||||
Help:
|
||||
color: aqua
|
||||
chatcolor: aqua
|
||||
@ -408,7 +404,6 @@ channels:
|
||||
alias: h
|
||||
permissions: None
|
||||
format: '&f[&bHelp&f] {prefix} {nickname}&b:'
|
||||
irc: false
|
||||
Trade:
|
||||
color: dark_aqua
|
||||
chatcolor: dark_aqua
|
||||
@ -422,7 +417,6 @@ channels:
|
||||
alias: t
|
||||
permissions: None
|
||||
format: '&f[&3Trade&f] {prefix} {nickname}&3:'
|
||||
irc: false
|
||||
Local:
|
||||
color: yellow
|
||||
chatcolor: yellow
|
||||
@ -436,7 +430,6 @@ channels:
|
||||
alias: l
|
||||
permissions: None
|
||||
format: '&f[&eLocal&f] {prefix} {nickname}&e:'
|
||||
irc: false
|
||||
Network:
|
||||
color: gold
|
||||
chatcolor: gold
|
||||
@ -449,5 +442,4 @@ channels:
|
||||
bungeecord: true
|
||||
alias: n
|
||||
permissions: None
|
||||
format: '&f[&6Network&f] {prefix} {nickname}&6:'
|
||||
irc: false
|
||||
format: '&f[&6Network&f] {prefix} {nickname}&6:'
|
@ -42,7 +42,6 @@ import mineverse.Aust1n46.chat.alias.AliasInfo;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
//import mineverse.Aust1n46.chat.command.CCommand;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommandExecutor;
|
||||
@ -143,7 +142,6 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// public Connection lite = null;
|
||||
|
||||
// Misc --------------------------------
|
||||
public static ChatChannelInfo ccInfo;
|
||||
public static AliasInfo aaInfo;
|
||||
public static JsonFormatInfo jfInfo;
|
||||
public static GuiSlotInfo gsInfo;
|
||||
@ -199,7 +197,10 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
catch(Exception ex) {
|
||||
log.severe(String.format("[" + String.format("VentureChat") + "]" + " - Could not load configuration!\n " + ex, getDescription().getName()));
|
||||
}
|
||||
ccInfo = new ChatChannelInfo(this);
|
||||
|
||||
this.setLogLevel(plugin.getConfig().getString("loglevel", "INFO").toUpperCase());
|
||||
ChatChannel.initialize();
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Checking for Vault..."));
|
||||
// Set up Vault
|
||||
if(!this.setupPermissions()) {
|
||||
@ -225,7 +226,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
UUID uuid = UUID.fromString(uuidString);
|
||||
String name = PlayerData.getPlayerData().getConfigurationSection("players." + uuid).getString("name");
|
||||
String currentChannelName = PlayerData.getPlayerData().getConfigurationSection("players." + uuid).getString("current");
|
||||
ChatChannel currentChannel = ccInfo.isChannel(currentChannelName) ? ccInfo.getChannelInfo(currentChannelName) : ccInfo.getDefaultChannel();
|
||||
ChatChannel currentChannel = ChatChannel.isChannel(currentChannelName) ? ChatChannel.getChannel(currentChannelName) : ChatChannel.getDefaultChannel();
|
||||
Set<UUID> ignores = new HashSet<UUID>();
|
||||
StringTokenizer i = new StringTokenizer(PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("ignores"), ",");
|
||||
while(i.hasMoreTokens()) {
|
||||
@ -235,7 +236,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
StringTokenizer l = new StringTokenizer(PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("listen"), ",");
|
||||
while(l.hasMoreTokens()) {
|
||||
String channel = l.nextToken();
|
||||
if(ccInfo.isChannel(channel)) {
|
||||
if(ChatChannel.isChannel(channel)) {
|
||||
listening.add(channel);
|
||||
}
|
||||
}
|
||||
@ -243,12 +244,12 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
StringTokenizer m = new StringTokenizer(PlayerData.getPlayerData().getConfigurationSection("players." + uuidString).getString("mutes"), ",");
|
||||
while(m.hasMoreTokens()) {
|
||||
String[] parts = m.nextToken().split(":");
|
||||
if(ccInfo.isChannel(parts[0])) {
|
||||
if(ChatChannel.isChannel(parts[0])) {
|
||||
if(parts[1].equals("null")) {
|
||||
log.info("[VentureChat] Null Mute Time: " + parts[0] + " " + name);
|
||||
continue;
|
||||
}
|
||||
mutes.put(ccInfo.getChannelInfo(parts[0]).getName(), Integer.parseInt(parts[1]));
|
||||
mutes.put(ChatChannel.getChannel(parts[0]).getName(), Integer.parseInt(parts[1]));
|
||||
}
|
||||
}
|
||||
Set<String> blockedCommands = new HashSet<String>();
|
||||
@ -279,10 +280,6 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
onlinePlayers.add(mcp);
|
||||
}
|
||||
|
||||
if(ccInfo == null) {
|
||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - &cConfiguration is BAD!"));
|
||||
}
|
||||
|
||||
if(this.getConfig().getConfigurationSection("mysql").getBoolean("enabled")) {
|
||||
this.MySQL = new MySQL(this, getConfig().getConfigurationSection("mysql").getString("host"), getConfig().getConfigurationSection("mysql").getString("port"), getConfig().getConfigurationSection("mysql").getString("database"), getConfig().getConfigurationSection("mysql").getString("user"), getConfig().getConfigurationSection("mysql").getString("password"));
|
||||
this.mysql = true;
|
||||
@ -346,16 +343,16 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
}
|
||||
|
||||
channelListener = new Channel();
|
||||
signListener = new SignListener(ccInfo);
|
||||
chatListener = new ChatListener(ccInfo);
|
||||
commandListener = new CommandListener(ccInfo, aaInfo);
|
||||
signListener = new SignListener();
|
||||
chatListener = new ChatListener();
|
||||
commandListener = new CommandListener(aaInfo);
|
||||
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
pluginManager.registerEvents(channelListener, this);
|
||||
pluginManager.registerEvents(chatListener, this);
|
||||
pluginManager.registerEvents(signListener, this);
|
||||
pluginManager.registerEvents(commandListener, this);
|
||||
loginListener = new LoginListener(ccInfo);
|
||||
loginListener = new LoginListener();
|
||||
pluginManager.registerEvents(loginListener, this);
|
||||
this.registerPacketListeners();
|
||||
this.loadNMS();
|
||||
@ -438,7 +435,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
int time = (int) (System.currentTimeMillis() / 60000);
|
||||
|
||||
for(String c : p.getMutes().keySet()) {
|
||||
ChatChannel channel = ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
int timemark = p.getMutes().get(channel.getName());
|
||||
if(timemark == 0) return;
|
||||
// System.out.println(time + " " + timemark);
|
||||
@ -586,14 +583,14 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// out.writeUTF("Channels");
|
||||
int channelCount = 0;
|
||||
for(String c : mcp.getListening()) {
|
||||
ChatChannel channel = ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
if(channel.getBungee()) {
|
||||
channelCount++;
|
||||
}
|
||||
}
|
||||
out.write(channelCount);
|
||||
for(String c : mcp.getListening()) {
|
||||
ChatChannel channel = ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
if(channel.getBungee()) {
|
||||
out.writeUTF(channel.getName());
|
||||
}
|
||||
@ -601,7 +598,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// out.writeUTF("Mutes");
|
||||
int muteCount = 0;
|
||||
for(String c : mcp.getMutes().keySet()) {
|
||||
ChatChannel channel = ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
if(channel.getBungee()) {
|
||||
muteCount++;
|
||||
}
|
||||
@ -609,7 +606,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// System.out.println(muteCount + " mutes");
|
||||
out.write(muteCount);
|
||||
for(String c : mcp.getMutes().keySet()) {
|
||||
ChatChannel channel = ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
if(channel.getBungee()) {
|
||||
out.writeUTF(channel.getName());
|
||||
}
|
||||
@ -684,27 +681,44 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
UUID senderUUID = UUID.fromString(msgin.readUTF());
|
||||
int hash = msgin.readInt();
|
||||
String consoleChat = msgin.readUTF();
|
||||
String globalJSON = msgin.readUTF();
|
||||
if(ccInfo.isChannel(chatchannel) && ccInfo.getChannelInfo(chatchannel).getBungee()) {
|
||||
boolean hasJSON = msgin.readBoolean();
|
||||
String globalJSON = "";
|
||||
if(hasJSON) {
|
||||
globalJSON = msgin.readUTF();
|
||||
}
|
||||
if(ChatChannel.isChannel(chatchannel) && ChatChannel.getChannel(chatchannel).getBungee()) {
|
||||
Bukkit.getConsoleSender().sendMessage(consoleChat);
|
||||
for(MineverseChatPlayer p : MineverseChat.onlinePlayers) {
|
||||
if(p.isListening(ccInfo.getChannelInfo(chatchannel).getName())) {
|
||||
if(p.isListening(ChatChannel.getChannel(chatchannel).getName())) {
|
||||
if(!p.getBungeeToggle() && MineverseChatAPI.getOnlineMineverseChatPlayer(senderName) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String json = Format.formatModerationGUI(globalJSON, p.getPlayer(), senderName, chatchannel, hash);
|
||||
WrappedChatComponent chatComponent = WrappedChatComponent.fromJson(json);
|
||||
PacketContainer packet = Format.createPacketPlayOutChat(chatComponent);
|
||||
PacketContainer packet = null;
|
||||
if(hasJSON) {
|
||||
String json = Format.formatModerationGUI(globalJSON, p.getPlayer(), senderName, chatchannel, hash);
|
||||
WrappedChatComponent chatComponent = WrappedChatComponent.fromJson(json);
|
||||
packet = Format.createPacketPlayOutChat(chatComponent);
|
||||
}
|
||||
|
||||
if(plugin.getConfig().getBoolean("ignorechat", false)) {
|
||||
if(!p.getIgnores().contains(senderUUID)) {
|
||||
// System.out.println("Chat sent");
|
||||
Format.sendPacketPlayOutChat(p.getPlayer(), packet);
|
||||
if(hasJSON) {
|
||||
Format.sendPacketPlayOutChat(p.getPlayer(), packet);
|
||||
}
|
||||
else {
|
||||
p.getPlayer().sendMessage(consoleChat);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Format.sendPacketPlayOutChat(p.getPlayer(), packet);
|
||||
if(hasJSON) {
|
||||
Format.sendPacketPlayOutChat(p.getPlayer(), packet);
|
||||
}
|
||||
else {
|
||||
p.getPlayer().sendMessage(consoleChat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -716,7 +730,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
String name = msgin.readUTF();
|
||||
String chatchannel = msgin.readUTF();
|
||||
List<String> listening = new ArrayList<String>();
|
||||
if(ccInfo.isChannel(chatchannel)) {
|
||||
if(ChatChannel.isChannel(chatchannel)) {
|
||||
for(MineverseChatPlayer mcp : onlinePlayers) {
|
||||
if(mcp.isListening(chatchannel)) {
|
||||
String entry = "&f" + mcp.getName();
|
||||
@ -742,7 +756,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
String sender = msgin.readUTF();
|
||||
String stringchannel = msgin.readUTF();
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getOnlineMineverseChatPlayer(UUID.fromString(sender));
|
||||
ChatChannel chatchannel = ccInfo.getChannelInfo(stringchannel);
|
||||
ChatChannel chatchannel = ChatChannel.getChannel(stringchannel);
|
||||
String playerList = "";
|
||||
int size = msgin.readInt();
|
||||
for(int a = 0; a < size; a++) {
|
||||
@ -777,7 +791,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
MineverseChatPlayer p = MineverseChatAPI.getMineverseChatPlayer(UUID.fromString(uuid));
|
||||
for(Object ch : p.getListening().toArray()) {
|
||||
String c = ch.toString();
|
||||
ChatChannel cha = ccInfo.getChannelInfo(c);
|
||||
ChatChannel cha = ChatChannel.getChannel(c);
|
||||
if(cha.getBungee()) {
|
||||
p.removeListening(c);
|
||||
}
|
||||
@ -786,15 +800,15 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
// System.out.println(size);
|
||||
for(int a = 0; a < size; a++) {
|
||||
String ch = msgin.readUTF();
|
||||
if(ccInfo.isChannel(ch)) {
|
||||
ChatChannel cha = ccInfo.getChannelInfo(ch);
|
||||
if(ChatChannel.isChannel(ch)) {
|
||||
ChatChannel cha = ChatChannel.getChannel(ch);
|
||||
if(cha.hasPermission() && p.getPlayer().hasPermission(cha.getPermission())) {
|
||||
p.addListening(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(Object o : p.getMutes().keySet().toArray()) {
|
||||
ChatChannel ch = ccInfo.getChannelInfo((String) o);
|
||||
ChatChannel ch = ChatChannel.getChannel((String) o);
|
||||
if(ch.getBungee()) {
|
||||
p.removeMute(ch.getName());
|
||||
}
|
||||
@ -804,7 +818,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
for(int b = 0; b < sizeB; b++) {
|
||||
String ch = msgin.readUTF();
|
||||
// System.out.println(ch);
|
||||
if(ccInfo.isChannel(ch)) {
|
||||
if(ChatChannel.isChannel(ch)) {
|
||||
p.addMute(ch, 0);
|
||||
}
|
||||
}
|
||||
@ -823,7 +837,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
p.addIgnore(UUID.fromString(i));
|
||||
}
|
||||
if(!p.hasPlayed()) {
|
||||
for(ChatChannel ch : ccInfo.getAutojoinList()) {
|
||||
for(ChatChannel ch : ChatChannel.getAutojoinList()) {
|
||||
if(ch.hasPermission()) {
|
||||
if(p.getPlayer().hasPermission(ch.getPermission())) {
|
||||
p.addListening(ch.getName());
|
||||
@ -938,7 +952,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
else {
|
||||
UUID uuid = sender;
|
||||
String name = sName;
|
||||
ChatChannel current = ccInfo.getDefaultChannel();
|
||||
ChatChannel current = ChatChannel.getDefaultChannel();
|
||||
Set<UUID> ignores = new HashSet<UUID>();
|
||||
Set<String> listening = new HashSet<String>();
|
||||
listening.add(current.getName());
|
||||
@ -1030,7 +1044,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
String time = msgin.readUTF();
|
||||
int numtime = 0;
|
||||
MineverseChatPlayer p = MineverseChatAPI.getMineverseChatPlayer(mutePlayer);
|
||||
ChatChannel cc = ccInfo.getChannelInfo(chatchannel);
|
||||
ChatChannel cc = ChatChannel.getChannel(chatchannel);
|
||||
if(cc == null) {
|
||||
try {
|
||||
out.writeUTF("Mute");
|
||||
@ -1187,7 +1201,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
return;
|
||||
}
|
||||
boolean bungee = false;
|
||||
for(ChatChannel c : ccInfo.getChannelsInfo()) {
|
||||
for(ChatChannel c : ChatChannel.getChannels()) {
|
||||
if(c.isMutable()) {
|
||||
p.addMute(c.getName(), 0);
|
||||
if(c.getBungee()) {
|
||||
@ -1235,7 +1249,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
return;
|
||||
}
|
||||
boolean bungee = false;
|
||||
for(ChatChannel c : ccInfo.getChannelsInfo()) {
|
||||
for(ChatChannel c : ChatChannel.getChannels()) {
|
||||
p.removeMute(c.getName());
|
||||
if(c.getBungee()) {
|
||||
bungee = true;
|
||||
@ -1266,7 +1280,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
String chatchannel = msgin.readUTF();
|
||||
String server = msgin.readUTF();
|
||||
MineverseChatPlayer p = MineverseChatAPI.getMineverseChatPlayer(mutePlayer);
|
||||
ChatChannel cc = ccInfo.getChannelInfo(chatchannel);
|
||||
ChatChannel cc = ChatChannel.getChannel(chatchannel);
|
||||
if(cc == null) {
|
||||
try {
|
||||
out.writeUTF("Unmute");
|
||||
|
@ -158,14 +158,21 @@ public class MineverseChatBungee extends Plugin implements Listener {
|
||||
boolean bungeeToggle = in.readBoolean();
|
||||
int hash = in.readInt();
|
||||
String consoleChat = in.readUTF();
|
||||
String json = in.readUTF();
|
||||
boolean hasJSON = in.readBoolean();
|
||||
String json = "";
|
||||
if(hasJSON) {
|
||||
json = in.readUTF();
|
||||
}
|
||||
out.writeUTF("Chat");
|
||||
out.writeUTF(chatchannel);
|
||||
out.writeUTF(senderName);
|
||||
out.writeUTF(senderUUID);
|
||||
out.writeInt(hash);
|
||||
out.writeUTF(consoleChat);
|
||||
out.writeUTF(json);
|
||||
out.writeBoolean(hasJSON);
|
||||
if(hasJSON) {
|
||||
out.writeUTF(json);
|
||||
}
|
||||
for(String send : getProxy().getServers().keySet()) {
|
||||
if(getProxy().getServers().get(send).getPlayers().size() > 0) {
|
||||
if(!bungeeToggle && !getProxy().getServers().get(send).getName().equalsIgnoreCase(ser.getInfo().getName())) {
|
||||
|
@ -1,5 +1,13 @@
|
||||
package mineverse.Aust1n46.chat.channel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
//This class is used to create ChatChannel objects, which store all the information for a channel. This
|
||||
//information is read in from the config file when the server starts up.
|
||||
public class ChatChannel {
|
||||
@ -17,12 +25,100 @@ public class ChatChannel {
|
||||
private String format;
|
||||
private int cooldown;
|
||||
private boolean irc;
|
||||
|
||||
private static MineverseChat plugin = MineverseChat.getInstance();
|
||||
private static ChatChannel defaultChatChannel;
|
||||
private static ChatChannel[] channels;
|
||||
private static String defaultColor;
|
||||
|
||||
public static void initialize() {
|
||||
String _color = "";
|
||||
String _chatcolor = "";
|
||||
String _name = "";
|
||||
String _permission = "";
|
||||
Boolean _mutable = false;
|
||||
Boolean _filter = false;
|
||||
Boolean _defaultchannel = false;
|
||||
String _alias = "";
|
||||
Double _distance = (double) 0;
|
||||
Boolean _autojoin = false;
|
||||
Boolean _bungee = false;
|
||||
String _format = "";
|
||||
int _cooldown = 0;
|
||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
||||
int len = (cs.getKeys(false)).size();
|
||||
channels = new ChatChannel[len];
|
||||
int x = 0;
|
||||
for(String key : cs.getKeys(false)) {
|
||||
_color = (String) cs.getString(key + ".color", "white");
|
||||
_chatcolor = (String) cs.getString(key + ".chatcolor", "white");
|
||||
if(!(Format.isValidColor(_color))) {
|
||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "] " + _color + " is not valid. Changing to white.");
|
||||
_color = "white";
|
||||
}
|
||||
if(!(Format.isValidColor(_chatcolor)) && !_chatcolor.equalsIgnoreCase("None")) {
|
||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "] " + _chatcolor + " is not valid. Changing to white.");
|
||||
_chatcolor = "white";
|
||||
}
|
||||
_name = key;
|
||||
_permission = (String) cs.getString(key + ".permissions", "None");
|
||||
_mutable = (Boolean) cs.getBoolean(key + ".mutable", false);
|
||||
_filter = (Boolean) cs.getBoolean(key + ".filter", true);
|
||||
_bungee = (Boolean) cs.getBoolean(key + ".bungeecord", false);
|
||||
_format = cs.getString(key + ".format", "Default");
|
||||
_defaultchannel = (Boolean) cs.getBoolean(key + ".default", false);
|
||||
_alias = (String) cs.getString(key + ".alias", "None");
|
||||
_distance = (Double) cs.getDouble(key + ".distance", (double) 0);
|
||||
_cooldown = (int) cs.getInt(key + ".cooldown", 0);
|
||||
_autojoin = (Boolean) cs.getBoolean(key + ".autojoin", false);
|
||||
ChatChannel c = new ChatChannel(_name, _color, _chatcolor, _permission, _mutable, _filter, _defaultchannel, _alias, _distance, _autojoin, _bungee, _cooldown, _format);
|
||||
channels[x++] = c;
|
||||
if(_defaultchannel) {
|
||||
defaultChatChannel = c;
|
||||
defaultColor = _color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ChatChannel[] getChannels() {
|
||||
return channels;
|
||||
}
|
||||
|
||||
public static ChatChannel getChannel(String ChannelName) {
|
||||
for(ChatChannel c : channels) {
|
||||
if(c.getName().equalsIgnoreCase(ChannelName) || c.getAlias().equalsIgnoreCase(ChannelName)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isChannel(String channel) {
|
||||
return getChannel(channel) != null;
|
||||
}
|
||||
|
||||
public static String getDefaultColor() {
|
||||
return defaultColor;
|
||||
}
|
||||
|
||||
public static ChatChannel getDefaultChannel() {
|
||||
return defaultChatChannel;
|
||||
}
|
||||
|
||||
public static List<ChatChannel> getAutojoinList() {
|
||||
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
||||
for(ChatChannel c : channels) {
|
||||
if(c.getAutojoin()) {
|
||||
joinlist.add(c);
|
||||
}
|
||||
}
|
||||
return joinlist;
|
||||
}
|
||||
|
||||
public ChatChannel(String _Name, String _color, String _chatcolor, String _Permission, Boolean _mutable, Boolean _filter, Boolean _defaultchannel, String _alias, Double _distance, Boolean _autojoin, Boolean _bungee, int _cooldown, String _format, boolean irc) {
|
||||
public ChatChannel(String _Name, String _color, String _chatcolor, String _Permission, Boolean _mutable, Boolean _filter, Boolean _defaultchannel, String _alias, Double _distance, Boolean _autojoin, Boolean _bungee, int _cooldown, String _format) {
|
||||
name = _Name;
|
||||
permission = "venturechat." + _Permission;
|
||||
mutable = _mutable;
|
||||
this.irc = irc;
|
||||
setColor(_color);
|
||||
setChatColor(_chatcolor);
|
||||
setDefaultChannel(_defaultchannel);
|
||||
|
@ -1,168 +0,0 @@
|
||||
package mineverse.Aust1n46.chat.channel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
//This class stores an array of all of the channels and contains some channel related helper methods.
|
||||
public class ChatChannelInfo {
|
||||
MineverseChat plugin;
|
||||
List<String> filters;
|
||||
List<String> blockablecommands;
|
||||
ChatChannel[] cc;
|
||||
public boolean useSuffix;
|
||||
public boolean chatPrefix;
|
||||
public String tellColor;
|
||||
private ChatChannel defaultChannel;
|
||||
public String defaultColor;
|
||||
|
||||
// Broadcast Variables
|
||||
public String broadcastColor;
|
||||
public String broadcastDisplayTag;
|
||||
public String broadcastPermissions;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ChatChannelInfo(MineverseChat _plugin) { //Contructor that creates the channels and puts them into their array
|
||||
plugin = _plugin;
|
||||
filters = (List<String>) plugin.getConfig().getList("filters");
|
||||
blockablecommands = (List<String>) plugin.getConfig().getList("blockablecommands");
|
||||
String _color = "";
|
||||
String _chatcolor = "";
|
||||
String _name = "";
|
||||
String _permission = "";
|
||||
Boolean _mutable = false;
|
||||
Boolean _filter = false;
|
||||
Boolean _defaultchannel = false;
|
||||
String _alias = "";
|
||||
Double _distance = (double) 0;
|
||||
Boolean _autojoin = false;
|
||||
Boolean _bungee = false;
|
||||
String _format = "";
|
||||
boolean irc = false;
|
||||
int _cooldown = 0;
|
||||
tellColor = "gray";
|
||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
||||
ConfigurationSection bs = plugin.getConfig().getConfigurationSection("broadcast");
|
||||
broadcastColor = bs.getString("color", "white");
|
||||
broadcastPermissions = bs.getString("permissions", "");
|
||||
broadcastDisplayTag = Format.FormatStringAll(bs.getString("displaytag", "[Broadcast]"));
|
||||
chatPrefix = false;
|
||||
if(plugin.getConfig().getBoolean("chatPrefix", false)) {
|
||||
chatPrefix = plugin.getConfig().getBoolean("chatPrefix", false);
|
||||
}
|
||||
plugin.setLogLevel(plugin.getConfig().getString("loglevel", "INFO").toUpperCase());
|
||||
tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
||||
int len = (cs.getKeys(false)).size();
|
||||
cc = new ChatChannel[len];
|
||||
int x = 0;
|
||||
for(String key : cs.getKeys(false)) {
|
||||
_color = (String) cs.getString(key + ".color", "white");
|
||||
_chatcolor = (String) cs.getString(key + ".chatcolor", "white");
|
||||
if(!(isValidColor(_color))) {
|
||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "] " + _color + " is not valid. Changing to white.");
|
||||
_color = "white";
|
||||
}
|
||||
if(!(isValidColor(_chatcolor)) && !_chatcolor.equalsIgnoreCase("None")) {
|
||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "] " + _chatcolor + " is not valid. Changing to white.");
|
||||
_chatcolor = "white";
|
||||
}
|
||||
_name = key;
|
||||
_permission = (String) cs.getString(key + ".permissions", "None");
|
||||
_mutable = (Boolean) cs.getBoolean(key + ".mutable", false);
|
||||
_filter = (Boolean) cs.getBoolean(key + ".filter", true);
|
||||
_bungee = (Boolean) cs.getBoolean(key + ".bungeecord", false);
|
||||
_format = cs.getString(key + ".format", "Default");
|
||||
irc = cs.getBoolean(key + ".irc", false);
|
||||
_defaultchannel = (Boolean) cs.getBoolean(key + ".default", false);
|
||||
_alias = (String) cs.getString(key + ".alias", "None");
|
||||
_distance = (Double) cs.getDouble(key + ".distance", (double) 0);
|
||||
_cooldown = (int) cs.getInt(key + ".cooldown", 0);
|
||||
_autojoin = (Boolean) cs.getBoolean(key + ".autojoin", false);
|
||||
ChatChannel c = new ChatChannel(_name, _color, _chatcolor, _permission, _mutable, _filter, _defaultchannel, _alias, _distance, _autojoin, _bungee, _cooldown, _format, irc);
|
||||
cc[x++] = c;
|
||||
if(_defaultchannel) {
|
||||
defaultChannel = c;
|
||||
defaultColor = _color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<ChatChannel> getAutojoinList() {
|
||||
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
||||
for(ChatChannel c : cc) {
|
||||
if(c.getAutojoin()) {
|
||||
joinlist.add(c);
|
||||
}
|
||||
}
|
||||
return joinlist;
|
||||
}
|
||||
|
||||
int getChannelCount() {
|
||||
return cc.length;
|
||||
}
|
||||
|
||||
void logChannelList() {
|
||||
for(ChatChannel p : cc) {
|
||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "]" + p.getName() + ":" + p.getChatColor() + ":" + p.getPermission() + ":" + p.isMutable() + ":" + p.isFiltered() + ":" + p.isDefaultchannel());
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean isValidColor(String _color) {
|
||||
Boolean bFound = false;
|
||||
for(ChatColor bkColors : ChatColor.values()) {
|
||||
if(_color.equalsIgnoreCase(bkColors.name())) {
|
||||
bFound = true;
|
||||
}
|
||||
}
|
||||
return bFound;
|
||||
}
|
||||
|
||||
public ChatChannel[] getChannelsInfo() {
|
||||
return cc;
|
||||
}
|
||||
|
||||
public ChatChannel getChannelInfo(String ChannelName) {
|
||||
for(ChatChannel c : cc) {
|
||||
if(c.getName().equalsIgnoreCase(ChannelName) || c.getAlias().equalsIgnoreCase(ChannelName)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ChatChannel getDefaultChannel() {
|
||||
return this.defaultChannel;
|
||||
}
|
||||
|
||||
public boolean isChannel(String channel) {
|
||||
return this.getChannelInfo(channel) != null;
|
||||
}
|
||||
|
||||
public String FilterChat(String msg) {
|
||||
int t = 0;
|
||||
for(String s : filters) {
|
||||
t = 0;
|
||||
String[] pparse = new String[2];
|
||||
pparse[0] = " ";
|
||||
pparse[1] = " ";
|
||||
StringTokenizer st = new StringTokenizer(s, ",");
|
||||
while(st.hasMoreTokens()) {
|
||||
if(t < 2) {
|
||||
pparse[t++] = st.nextToken();
|
||||
}
|
||||
}
|
||||
msg = msg.replaceAll("(?i)" + pparse[0], pparse[1]);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
List<String> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
}
|
@ -2,31 +2,33 @@ package mineverse.Aust1n46.chat.command.chat;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
public class Broadcast extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Broadcast(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String command, String[] args) {
|
||||
if(cc.broadcastPermissions.equalsIgnoreCase("None") || sender.hasPermission(cc.broadcastPermissions)) {
|
||||
ConfigurationSection bs = plugin.getConfig().getConfigurationSection("broadcast");
|
||||
String broadcastColor = bs.getString("color", "white");
|
||||
String broadcastPermissions = bs.getString("permissions", "");
|
||||
String broadcastDisplayTag = Format.FormatStringAll(bs.getString("displaytag", "[Broadcast]"));
|
||||
if(broadcastPermissions.equalsIgnoreCase("None") || sender.hasPermission(broadcastPermissions)) {
|
||||
if(args.length > 0) {
|
||||
String bc = "";
|
||||
for(int x = 0; x < args.length; x++) {
|
||||
if(args[x].length() > 0) bc += args[x] + " ";
|
||||
}
|
||||
bc = Format.FormatStringAll(bc);
|
||||
plugin.getServer().broadcastMessage(cc.broadcastDisplayTag + ChatColor.valueOf(cc.broadcastColor.toUpperCase()) + " " + bc);
|
||||
plugin.getServer().broadcastMessage(broadcastDisplayTag + ChatColor.valueOf(broadcastColor.toUpperCase()) + " " + bc);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@ -12,18 +12,15 @@ import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.api.events.ChannelJoinEvent;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Channel extends MineverseCommand implements Listener {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Channel() {}
|
||||
|
||||
public Channel(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,11 +31,11 @@ public class Channel extends MineverseCommand implements Listener {
|
||||
}
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer((Player) sender);
|
||||
if(args.length > 0) {
|
||||
if(!cc.isChannel(args[0])) {
|
||||
if(!ChatChannel.isChannel(args[0])) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid channel: " + args[0]);
|
||||
return;
|
||||
}
|
||||
ChatChannel channel = cc.getChannelInfo(args[0]);
|
||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
||||
plugin.getServer().getPluginManager().callEvent(new ChannelJoinEvent(mcp.getPlayer(), channel, "Channel Set: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + "[" + channel.getName() + "]"));
|
||||
return;
|
||||
}
|
||||
|
@ -3,13 +3,10 @@ package mineverse.Aust1n46.chat.command.chat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Channelinfo extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Channelinfo(String name) {
|
||||
super(name);
|
||||
@ -22,7 +19,7 @@ public class Channelinfo extends MineverseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid command: /channelinfo [channel]");
|
||||
return;
|
||||
}
|
||||
ChatChannel chname = cc.getChannelInfo(args[0]);
|
||||
ChatChannel chname = ChatChannel.getChannel(args[0]);
|
||||
if(chname == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid channel: " + args[0]);
|
||||
return;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package mineverse.Aust1n46.chat.command.chat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -10,17 +8,13 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class Chatinfo extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();;
|
||||
|
||||
public Chatinfo(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
//@SuppressWarnings("unchecked")
|
||||
@ -39,11 +33,11 @@ public class Chatinfo extends MineverseCommand {
|
||||
if(args.length < 1) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + mcp.getName());
|
||||
for(String c : mcp.getListening()) {
|
||||
ChatChannel channel = MineverseChat.ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
listen += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
||||
}
|
||||
for(String c : mcp.getMutes().keySet()) {
|
||||
ChatChannel channel = MineverseChat.ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
mute += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
||||
}
|
||||
for(String bc : mcp.getBlockedCommands()) {
|
||||
@ -100,11 +94,11 @@ public class Chatinfo extends MineverseCommand {
|
||||
}
|
||||
sender.sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + p.getName());
|
||||
for(String c : p.getListening()) {
|
||||
ChatChannel channel = MineverseChat.ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
listen += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
||||
}
|
||||
for(String c : p.getMutes().keySet()) {
|
||||
ChatChannel channel = MineverseChat.ccInfo.getChannelInfo(c);
|
||||
ChatChannel channel = ChatChannel.getChannel(c);
|
||||
mute += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
||||
}
|
||||
for(String bc : p.getBlockedCommands()) {
|
||||
|
@ -3,13 +3,10 @@ package mineverse.Aust1n46.chat.command.chat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Chlist extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Chlist(String name) {
|
||||
super(name);
|
||||
@ -18,7 +15,7 @@ public class Chlist extends MineverseCommand {
|
||||
@Override
|
||||
public void execute(CommandSender sender, String command, String[] args) {
|
||||
sender.sendMessage(ChatColor.GOLD + "Channel List : Alias");
|
||||
for(ChatChannel chname : cc.getChannelsInfo()) {
|
||||
for(ChatChannel chname : ChatChannel.getChannels()) {
|
||||
if(chname.hasPermission()) {
|
||||
if(sender.hasPermission(chname.getPermission())) {
|
||||
sender.sendMessage(ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getName() + " : " + chname.getAlias() + " - Permission Required");
|
||||
|
@ -17,16 +17,13 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Chwho extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Chwho(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,7 +31,7 @@ public class Chwho extends MineverseCommand {
|
||||
String playerlist = "";
|
||||
if(sender.hasPermission("venturechat.chwho")) {
|
||||
if(args.length > 0) {
|
||||
ChatChannel channel = cc.getChannelInfo(args[0]);
|
||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
||||
if(channel != null) {
|
||||
if(channel.hasPermission()) {
|
||||
if(!sender.hasPermission(channel.getPermission())) {
|
||||
|
@ -18,7 +18,6 @@ public class Commandblock extends MineverseCommand {
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void execute(CommandSender sender, String command, String[] args) {
|
||||
if(sender.hasPermission("venturechat.commandblock")) {
|
||||
@ -29,7 +28,7 @@ public class Commandblock extends MineverseCommand {
|
||||
return;
|
||||
}
|
||||
boolean match = false;
|
||||
for(String cb : (List<String>) plugin.getConfig().getList("blockablecommands"))
|
||||
for(String cb : (List<String>) plugin.getConfig().getStringList("blockablecommands"))
|
||||
if(args[1].equals("/" + cb))
|
||||
match = true;
|
||||
if(match || player.isBlockedCommand(args[1])) {
|
||||
|
@ -7,16 +7,14 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
public class Config extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Config(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -521,7 +519,7 @@ public class Config extends MineverseCommand {
|
||||
}
|
||||
case "tellcolor": {
|
||||
try {
|
||||
if(cc.isValidColor(args[1])) {
|
||||
if(Format.isValidColor(args[1])) {
|
||||
plugin.getConfig().set("tellcolor", args[1].toLowerCase());
|
||||
sender.sendMessage(ChatColor.GREEN + "tellcolor: has been set to " + args[1].toLowerCase());
|
||||
plugin.saveConfig();
|
||||
@ -767,7 +765,7 @@ public class Config extends MineverseCommand {
|
||||
switch(args[1]) {
|
||||
case "color": {
|
||||
try {
|
||||
if(cc.isValidColor(args[2])) {
|
||||
if(Format.isValidColor(args[2])) {
|
||||
plugin.getConfig().getConfigurationSection("broadcast").set("color", args[2].toLowerCase());
|
||||
sender.sendMessage(ChatColor.GREEN + "color: has been set to " + args[2].toLowerCase());
|
||||
plugin.saveConfig();
|
||||
@ -834,7 +832,7 @@ public class Config extends MineverseCommand {
|
||||
switch(args[2]) {
|
||||
case "color": {
|
||||
try {
|
||||
if(cc.isValidColor(args[3])) {
|
||||
if(Format.isValidColor(args[3])) {
|
||||
plugin.getConfig().getConfigurationSection("channels." + args[1]).set("color", args[3].toLowerCase());
|
||||
sender.sendMessage(ChatColor.GREEN + "color: has been set to " + args[3].toLowerCase());
|
||||
plugin.saveConfig();
|
||||
@ -853,7 +851,7 @@ public class Config extends MineverseCommand {
|
||||
}
|
||||
case "chatcolor": {
|
||||
try {
|
||||
if(cc.isValidColor(args[3]) || args[3].equalsIgnoreCase("None")) {
|
||||
if(Format.isValidColor(args[3]) || args[3].equalsIgnoreCase("None")) {
|
||||
plugin.getConfig().getConfigurationSection("channels." + args[1]).set("chatcolor", args[3].toLowerCase());
|
||||
sender.sendMessage(ChatColor.GREEN + "chatcolor: has been set to " + args[3].toLowerCase());
|
||||
plugin.saveConfig();
|
||||
|
@ -3,15 +3,12 @@ package mineverse.Aust1n46.chat.command.chat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Kickchannel extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Kickchannel(String name) {
|
||||
super(name);
|
||||
@ -29,7 +26,7 @@ public class Kickchannel extends MineverseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Player: " + ChatColor.GOLD + args[0] + ChatColor.RED + " is not online.");
|
||||
return;
|
||||
}
|
||||
ChatChannel channel = cc.getChannelInfo(args[1]);
|
||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
||||
if(channel == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid channel: " + args[1]);
|
||||
return;
|
||||
@ -43,10 +40,10 @@ public class Kickchannel extends MineverseCommand {
|
||||
else
|
||||
player.setModified(true);
|
||||
if(player.getListening().size() == 0) {
|
||||
player.setCurrentChannel(cc.getDefaultChannel());
|
||||
player.setCurrentChannel(ChatChannel.getDefaultChannel());
|
||||
if(player.isOnline()) {
|
||||
player.getPlayer().sendMessage(ChatColor.RED + "You need to be listening on at least one channel, setting you into the default channel.");
|
||||
player.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(cc.defaultColor.toUpperCase()) + "[" + cc.getDefaultChannel().getName() + "]");
|
||||
player.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(ChatChannel.getDefaultColor().toUpperCase()) + "[" + ChatChannel.getDefaultChannel().getName() + "]");
|
||||
}
|
||||
else
|
||||
player.setModified(true);
|
||||
|
@ -3,14 +3,12 @@ package mineverse.Aust1n46.chat.command.chat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Kickchannelall extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Kickchannelall(String name) {
|
||||
super(name);
|
||||
@ -30,12 +28,12 @@ public class Kickchannelall extends MineverseCommand {
|
||||
}
|
||||
player.clearListening();
|
||||
sender.sendMessage(ChatColor.GOLD + "Kicked player " + ChatColor.RED + player.getName() + ChatColor.GOLD + " from all channels.");
|
||||
player.addListening(cc.getDefaultChannel().getName());
|
||||
player.setCurrentChannel(cc.getDefaultChannel());
|
||||
player.addListening(ChatChannel.getDefaultChannel().getName());
|
||||
player.setCurrentChannel(ChatChannel.getDefaultChannel());
|
||||
if(player.isOnline()) {
|
||||
player.getPlayer().sendMessage(ChatColor.RED + "You have been kicked from all channels.");
|
||||
player.getPlayer().sendMessage(ChatColor.RED + "You need to be listening on at least one channel, setting you into the default channel.");
|
||||
player.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(cc.defaultColor.toUpperCase()) + "[" + cc.getDefaultChannel().getName() + "]");
|
||||
player.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(ChatChannel.getDefaultColor().toUpperCase()) + "[" + ChatChannel.getDefaultChannel().getName() + "]");
|
||||
}
|
||||
else
|
||||
player.setModified(true);
|
||||
|
@ -8,16 +8,13 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Leave extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();;
|
||||
|
||||
public Leave(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,7 +25,7 @@ public class Leave extends MineverseCommand {
|
||||
}
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer((Player) sender);
|
||||
if(args.length > 0) {
|
||||
ChatChannel channel = cc.getChannelInfo(args[0]);
|
||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
||||
if(channel == null) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid channel: " + args[0]);
|
||||
return;
|
||||
@ -37,10 +34,10 @@ public class Leave extends MineverseCommand {
|
||||
String format = ChatColor.valueOf(channel.getColor().toUpperCase()) + "[" + channel.getName() + "]";
|
||||
mcp.getPlayer().sendMessage("Leaving channel: " + format);
|
||||
if(mcp.getListening().size() == 0) {
|
||||
mcp.addListening(cc.getDefaultChannel().getName());
|
||||
mcp.setCurrentChannel(cc.getDefaultChannel());
|
||||
mcp.addListening(ChatChannel.getDefaultChannel().getName());
|
||||
mcp.setCurrentChannel(ChatChannel.getDefaultChannel());
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "You need to be listening on at least one channel, setting you into the default channel.");
|
||||
mcp.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(cc.defaultColor.toUpperCase()) + "[" + cc.getDefaultChannel().getName() + "]");
|
||||
mcp.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(ChatChannel.getDefaultColor().toUpperCase()) + "[" + ChatChannel.getDefaultChannel().getName() + "]");
|
||||
}
|
||||
if(channel.getBungee()) {
|
||||
MineverseChat.getInstance().synchronize(mcp, true);
|
||||
|
@ -8,16 +8,13 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Listen extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();;
|
||||
|
||||
public Listen(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,7 +25,7 @@ public class Listen extends MineverseCommand {
|
||||
}
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer((Player) sender);
|
||||
if(args.length > 0) {
|
||||
ChatChannel channel = cc.getChannelInfo(args[0]);
|
||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
||||
if(channel == null) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid channel: " + args[0]);
|
||||
return;
|
||||
|
@ -6,17 +6,14 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
public class Me extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Me(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -31,7 +28,7 @@ public class Me extends MineverseCommand {
|
||||
msg = Format.FormatStringColor(msg);
|
||||
if(sender.hasPermission("venturechat.format"))
|
||||
msg = Format.FormatString(msg);
|
||||
String filtered = cc.FilterChat(msg);
|
||||
String filtered = Format.FilterChat(msg);
|
||||
if(sender instanceof Player && MineverseChatAPI.getMineverseChatPlayer((Player) sender).hasFilter()) {
|
||||
Player p = (Player) sender;
|
||||
plugin.getServer().broadcastMessage("* " +p.getDisplayName() + filtered);
|
||||
|
@ -7,17 +7,14 @@ import org.bukkit.entity.Player;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
public class Party extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Party(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -286,7 +283,7 @@ public class Party extends MineverseCommand {
|
||||
if(args[x].length() > 0) msg += " " + args[x];
|
||||
}
|
||||
if(mcp.hasFilter()) {
|
||||
msg = cc.FilterChat(msg);
|
||||
msg = Format.FilterChat(msg);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
msg = Format.FormatStringColor(msg);
|
||||
|
@ -10,6 +10,7 @@ import java.util.Map;
|
||||
import mineverse.Aust1n46.chat.ChatMessage;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
@ -23,12 +24,11 @@ import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
|
||||
public class Removemessage extends MineverseCommand {
|
||||
private PacketContainer emptyLinePacketContainer = Format.createPacketPlayOutChat(WrappedChatComponent.fromJson("{\"extra\":[\" \"],\"text\":\"\"}"));
|
||||
private MineverseChat plugin;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
private WrappedChatComponent messageDeletedComponentPlayer;
|
||||
|
||||
public Removemessage(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,7 +46,7 @@ public class Removemessage extends MineverseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid hashcode.");
|
||||
return;
|
||||
}
|
||||
if(args.length > 1 && MineverseChat.ccInfo.isChannel(args[1]) && MineverseChat.ccInfo.getChannelInfo(args[1]).getBungee() && sender instanceof Player) {
|
||||
if(args.length > 1 && ChatChannel.isChannel(args[1]) && ChatChannel.getChannel(args[1]).getBungee() && sender instanceof Player) {
|
||||
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(byteOutStream);
|
||||
try {
|
||||
|
@ -7,11 +7,9 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Setchannel extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Setchannel(String name) {
|
||||
super(name);
|
||||
@ -25,7 +23,7 @@ public class Setchannel extends MineverseCommand {
|
||||
return;
|
||||
}
|
||||
if(args[0].length() > 1) {
|
||||
ChatChannel channel = cc.getChannelInfo(args[1]);
|
||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
||||
MineverseChatPlayer player = MineverseChatAPI.getMineverseChatPlayer(args[0]);
|
||||
if(player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Player: " + ChatColor.GOLD + args[0] + ChatColor.RED + " is not online.");
|
||||
|
@ -3,15 +3,12 @@ package mineverse.Aust1n46.chat.command.chat;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Setchannelall extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Setchannelall(String name) {
|
||||
super(name);
|
||||
@ -29,7 +26,7 @@ public class Setchannelall extends MineverseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Player: " + ChatColor.GOLD + args[0] + ChatColor.RED + " is not online.");
|
||||
return;
|
||||
}
|
||||
for(ChatChannel channel : cc.getChannelsInfo()) {
|
||||
for(ChatChannel channel : ChatChannel.getChannels()) {
|
||||
if(channel.hasPermission()) {
|
||||
if(!player.isOnline()) {
|
||||
sender.sendMessage(ChatColor.RED + "Can't run permission check on offline player.");
|
||||
|
@ -24,11 +24,10 @@ import mineverse.Aust1n46.chat.utilities.Format;
|
||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
||||
|
||||
public class VentureChatGui extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();;
|
||||
|
||||
public VentureChatGui(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,8 +67,8 @@ public class VentureChatGui extends MineverseCommand {
|
||||
MineverseChat.players.add(target);
|
||||
*/
|
||||
}
|
||||
if(MineverseChat.ccInfo.isChannel(args[1])) {
|
||||
ChatChannel channel = MineverseChat.ccInfo.getChannelInfo(args[1]);
|
||||
if(ChatChannel.isChannel(args[1])) {
|
||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
||||
int hash = Integer.parseInt(args[2]);
|
||||
this.openInventory(mcp, target, channel, hash);
|
||||
return;
|
||||
|
@ -11,18 +11,15 @@ import org.bukkit.entity.Player;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
||||
|
||||
public class Message extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Message(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,11 +44,12 @@ public class Message extends MineverseCommand {
|
||||
String send = "";
|
||||
String echo = "";
|
||||
String spy = "";
|
||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
||||
for(int r = 1; r < args.length; r++) {
|
||||
msg += " " + args[r];
|
||||
}
|
||||
if(mcp.hasFilter()) {
|
||||
msg = cc.FilterChat(msg);
|
||||
msg = Format.FilterChat(msg);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
msg = Format.FormatStringColor(msg);
|
||||
@ -60,19 +58,19 @@ public class Message extends MineverseCommand {
|
||||
msg = Format.FormatString(msg);
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatfrom").equalsIgnoreCase("Default")) {
|
||||
send = "{playerfrom} messages you:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
send = "{playerfrom} messages you:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom")) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatto").equalsIgnoreCase("Default")) {
|
||||
echo = "You message {playerto}:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
echo = "You message {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto")) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatspy").equalsIgnoreCase("Default")) {
|
||||
spy = "{playerfrom} messages {playerto}:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
spy = "{playerfrom} messages {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy")) + msg;
|
||||
@ -123,12 +121,13 @@ public class Message extends MineverseCommand {
|
||||
String echo = "";
|
||||
String send = "";
|
||||
String spy = "";
|
||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
||||
if(args[1].length() > 0) {
|
||||
for(int r = 1; r < args.length; r++) {
|
||||
msg += " " + args[r];
|
||||
}
|
||||
if(mcp.hasFilter()) {
|
||||
msg = cc.FilterChat(msg);
|
||||
msg = Format.FilterChat(msg);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
msg = Format.FormatStringColor(msg);
|
||||
@ -137,19 +136,19 @@ public class Message extends MineverseCommand {
|
||||
msg = Format.FormatString(msg);
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatto").equalsIgnoreCase("Default")) {
|
||||
echo = "You message " + player.getNickname() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
echo = "You message " + player.getNickname() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto").replace("{playerto}", player.getNickname()).replace("{playerfrom}", mcp.getNickname())) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatfrom").equalsIgnoreCase("Default")) {
|
||||
send = mcp.getNickname() + " messages you:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
send = mcp.getNickname() + " messages you:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom").replace("{playerto}", player.getNickname()).replace("{playerfrom}", mcp.getNickname())) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatspy").equalsIgnoreCase("Default")) {
|
||||
spy = mcp.getName() + " messages " + player.getName() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
spy = mcp.getName() + " messages " + player.getName() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy").replace("{playerto}", player.getName()).replace("{playerfrom}", mcp.getName())) + msg;
|
||||
|
@ -11,18 +11,15 @@ import org.bukkit.entity.Player;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
||||
|
||||
public class Reply extends MineverseCommand {
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
|
||||
public Reply(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,23 +39,24 @@ public class Reply extends MineverseCommand {
|
||||
String send = "";
|
||||
String echo = "";
|
||||
String spy = "";
|
||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
||||
for(int r = 0; r < args.length; r++) {
|
||||
msg += " " + args[r];
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatfrom").equalsIgnoreCase("Default")) {
|
||||
send = "{playerfrom} replies to you:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
send = "{playerfrom} replies to you:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom")) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatto").equalsIgnoreCase("Default")) {
|
||||
echo = "You reply to {playerto}:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
echo = "You reply to {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto")) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatspy").equalsIgnoreCase("Default")) {
|
||||
spy = "{playerfrom} replied to {playerto}:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
spy = "{playerfrom} replied to {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy")) + msg;
|
||||
@ -101,11 +99,12 @@ public class Reply extends MineverseCommand {
|
||||
String echo = "";
|
||||
String send = "";
|
||||
String spy = "";
|
||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
||||
if(args.length > 0) {
|
||||
for(int r = 0; r < args.length; r++)
|
||||
msg += " " + args[r];
|
||||
if(mcp.hasFilter()) {
|
||||
msg = cc.FilterChat(msg);
|
||||
msg = Format.FilterChat(msg);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
msg = Format.FormatStringColor(msg);
|
||||
@ -114,19 +113,19 @@ public class Reply extends MineverseCommand {
|
||||
msg = Format.FormatString(msg);
|
||||
}
|
||||
if(plugin.getConfig().getString("replyformatto").equalsIgnoreCase("Default")) {
|
||||
echo = "You reply to " + player.getNickname() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
echo = "You reply to " + player.getNickname() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
echo = Format.FormatStringAll(plugin.getConfig().getString("replyformatto").replace("{playerto}", player.getNickname()).replace("{playerfrom}", mcp.getNickname())) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("replyformatfrom").equalsIgnoreCase("Default")) {
|
||||
send = mcp.getNickname() + " replies to you:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
send = mcp.getNickname() + " replies to you:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
send = Format.FormatStringAll(plugin.getConfig().getString("replyformatfrom").replace("{playerto}", player.getNickname()).replace("{playerfrom}", mcp.getNickname())) + msg;
|
||||
}
|
||||
if(plugin.getConfig().getString("replyformatspy").equalsIgnoreCase("Default")) {
|
||||
spy = mcp.getName() + " replied to " + player.getName() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + msg;
|
||||
spy = mcp.getName() + " replied to " + player.getName() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
||||
}
|
||||
else {
|
||||
spy = Format.FormatStringAll(plugin.getConfig().getString("replyformatspy").replace("{playerto}", player.getName()).replace("{playerfrom}", mcp.getName())) + msg;
|
||||
|
@ -7,11 +7,9 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Mute extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Mute(String name) {
|
||||
super(name);
|
||||
@ -30,8 +28,8 @@ public class Mute extends MineverseCommand {
|
||||
return;
|
||||
}
|
||||
if(args.length == 2) {
|
||||
if(cc.isChannel(args[1])) {
|
||||
ChatChannel channel = cc.getChannelInfo(args[1]);
|
||||
if(ChatChannel.isChannel(args[1])) {
|
||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
||||
if(player.isMuted(channel.getName())) {
|
||||
sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.RED + " is already muted in channel: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName());
|
||||
return;
|
||||
@ -54,8 +52,8 @@ public class Mute extends MineverseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Invalid channel: " + args[1]);
|
||||
return;
|
||||
}
|
||||
if(cc.isChannel(args[1])) {
|
||||
ChatChannel channel = cc.getChannelInfo(args[1]);
|
||||
if(ChatChannel.isChannel(args[1])) {
|
||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
||||
if(player.isMuted(channel.getName())) {
|
||||
sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.RED + " is already muted in channel: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName());
|
||||
return;
|
||||
|
@ -7,17 +7,12 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Muteall extends MineverseCommand {
|
||||
@SuppressWarnings("unused")
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Muteall(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -33,7 +28,7 @@ public class Muteall extends MineverseCommand {
|
||||
return;
|
||||
}
|
||||
boolean bungee = false;
|
||||
for(ChatChannel channel : cc.getChannelsInfo()) {
|
||||
for(ChatChannel channel : ChatChannel.getChannels()) {
|
||||
if(channel.isMutable()) {
|
||||
player.addMute(channel.getName(), 0);
|
||||
if(channel.getBungee()) {
|
||||
|
@ -7,11 +7,9 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Unmute extends MineverseCommand {
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Unmute(String name) {
|
||||
super(name);
|
||||
@ -29,7 +27,7 @@ public class Unmute extends MineverseCommand {
|
||||
sender.sendMessage(ChatColor.RED + "Player: " + ChatColor.GOLD + args[0] + ChatColor.RED + " is not online.");
|
||||
return;
|
||||
}
|
||||
for(ChatChannel channel : cc.getChannelsInfo()) {
|
||||
for(ChatChannel channel : ChatChannel.getChannels()) {
|
||||
if(channel.getName().equalsIgnoreCase(args[1]) || channel.getAlias().equalsIgnoreCase(args[1])) {
|
||||
if(!player.isMuted(channel.getName())) {
|
||||
sender.sendMessage(ChatColor.GOLD + player.getName() + ChatColor.RED + " is not muted in channel: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName());
|
||||
|
@ -7,17 +7,12 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
|
||||
public class Unmuteall extends MineverseCommand {
|
||||
@SuppressWarnings("unused")
|
||||
private MineverseChat plugin;
|
||||
private ChatChannelInfo cc = MineverseChat.ccInfo;
|
||||
|
||||
public Unmuteall(String name) {
|
||||
super(name);
|
||||
this.plugin = MineverseChat.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -33,7 +28,7 @@ public class Unmuteall extends MineverseCommand {
|
||||
return;
|
||||
}
|
||||
boolean bungee = false;
|
||||
for(ChatChannel channel : cc.getChannelsInfo()) {
|
||||
for(ChatChannel channel : ChatChannel.getChannels()) {
|
||||
player.removeMute(channel.getName());
|
||||
if(channel.getBungee()) {
|
||||
bungee = true;
|
||||
|
@ -70,12 +70,12 @@ public class PlayerData {
|
||||
cs.set("ignores", ignores);
|
||||
String listening = "";
|
||||
for(String channel : p.getListening()) {
|
||||
ChatChannel c = MineverseChat.ccInfo.getChannelInfo(channel);
|
||||
ChatChannel c = ChatChannel.getChannel(channel);
|
||||
listening += c.getName() + ",";
|
||||
}
|
||||
String mutes = "";
|
||||
for(String channel : p.getMutes().keySet()) {
|
||||
ChatChannel c = MineverseChat.ccInfo.getChannelInfo(channel);
|
||||
ChatChannel c = ChatChannel.getChannel(channel);
|
||||
mutes += c.getName() + ":" + p.getMutes().get(c.getName()) + ",";
|
||||
}
|
||||
String blockedCommands = "";
|
||||
|
@ -31,7 +31,6 @@ import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.api.events.ChannelJoinEvent;
|
||||
import mineverse.Aust1n46.chat.api.events.VentureChatEvent;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.database.DatabaseSender;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
import mineverse.Aust1n46.chat.utilities.FormatTags;
|
||||
@ -40,11 +39,6 @@ import mineverse.Aust1n46.chat.versions.VersionHandler;
|
||||
//This class listens to chat through the chat event and handles the bulk of the chat channels and formatting.
|
||||
public class ChatListener implements Listener {
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
private ChatChannelInfo cc;
|
||||
|
||||
public ChatListener(ChatChannelInfo cc) {
|
||||
this.cc = cc;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onChannelJoin(ChannelJoinEvent event) {
|
||||
@ -108,8 +102,9 @@ public class ChatListener implements Listener {
|
||||
String echo = "";
|
||||
String send = "";
|
||||
String spy = "";
|
||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
||||
if(mcp.hasFilter()) {
|
||||
filtered = cc.FilterChat(filtered);
|
||||
filtered = Format.FilterChat(filtered);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
filtered = Format.FormatStringColor(filtered);
|
||||
@ -119,19 +114,19 @@ public class ChatListener implements Listener {
|
||||
}
|
||||
filtered = " " + filtered;
|
||||
if(plugin.getConfig().getString("tellformatto").equalsIgnoreCase("Default")) {
|
||||
echo = "You message " + tp.getPlayer().getDisplayName() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + filtered;
|
||||
echo = "You message " + tp.getPlayer().getDisplayName() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + filtered;
|
||||
}
|
||||
else {
|
||||
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto").replace("{playerto}", tp.getPlayer().getDisplayName()).replace("{playerfrom}", mcp.getPlayer().getDisplayName())) + filtered;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatfrom").equalsIgnoreCase("Default")) {
|
||||
send = mcp.getPlayer().getDisplayName() + " messages you:" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + filtered;
|
||||
send = mcp.getPlayer().getDisplayName() + " messages you:" + ChatColor.valueOf(tellColor.toUpperCase()) + filtered;
|
||||
}
|
||||
else {
|
||||
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom").replace("{playerto}", tp.getPlayer().getDisplayName()).replace("{playerfrom}", mcp.getPlayer().getDisplayName())) + filtered;
|
||||
}
|
||||
if(plugin.getConfig().getString("tellformatspy").equalsIgnoreCase("Default")) {
|
||||
spy = mcp.getName() + " messages " + tp.getName() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + filtered;
|
||||
spy = mcp.getName() + " messages " + tp.getName() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + filtered;
|
||||
}
|
||||
else {
|
||||
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy").replace("{playerto}", tp.getName()).replace("{playerfrom}", mcp.getName())) + filtered;
|
||||
@ -155,7 +150,7 @@ public class ChatListener implements Listener {
|
||||
}
|
||||
mcp.setReplyPlayer(tp.getUUID());
|
||||
tp.setReplyPlayer(mcp.getUUID());
|
||||
Bukkit.getConsoleSender().sendMessage(mcp.getName() + " messages " + tp.getName() + ":" + ChatColor.valueOf(cc.tellColor.toUpperCase()) + filtered);
|
||||
Bukkit.getConsoleSender().sendMessage(mcp.getName() + " messages " + tp.getName() + ":" + ChatColor.valueOf(tellColor.toUpperCase()) + filtered);
|
||||
if(plugin.mysql) {
|
||||
Calendar currentDate = Calendar.getInstance();
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@ -173,7 +168,7 @@ public class ChatListener implements Listener {
|
||||
if((p.hasParty() && p.getParty().toString().equals(mcp.getParty().toString()) || p.isSpy())) {
|
||||
String filtered = chat;
|
||||
if(mcp.hasFilter()) {
|
||||
filtered = cc.FilterChat(filtered);
|
||||
filtered = Format.FilterChat(filtered);
|
||||
}
|
||||
if(mcp.getPlayer().hasPermission("venturechat.color")) {
|
||||
filtered = Format.FormatStringColor(filtered);
|
||||
@ -245,7 +240,7 @@ public class ChatListener implements Listener {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "You do not have permission for this channel.");
|
||||
mcp.setQuickChat(false);
|
||||
mcp.removeListening(eventChannel.getName());
|
||||
mcp.setCurrentChannel(cc.getDefaultChannel());
|
||||
mcp.setCurrentChannel(ChatChannel.getDefaultChannel());
|
||||
return;
|
||||
}
|
||||
curColor = eventChannel.getChatColor().toUpperCase();
|
||||
@ -324,14 +319,14 @@ public class ChatListener implements Listener {
|
||||
}
|
||||
if(plugin.getConfig().getConfigurationSection("channels." + eventChannel.getName()).getString("format").equalsIgnoreCase("Default")) {
|
||||
if(curColor.equalsIgnoreCase("None")) {
|
||||
format = FormatTags.ChatFormat(ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + "[" + eventChannel.getName() + "] {prefix}{name}" + ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + ":", mcp.getPlayer(), plugin, cc, eventChannel, plugin.getConfig().getBoolean("jsonFormat"));
|
||||
format = FormatTags.ChatFormat(ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + "[" + eventChannel.getName() + "] {prefix}{name}" + ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + ":", mcp.getPlayer(), plugin, eventChannel, plugin.getConfig().getBoolean("jsonFormat"));
|
||||
}
|
||||
else {
|
||||
format = FormatTags.ChatFormat(ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + "[" + eventChannel.getName() + "] {prefix}{name}" + ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + ":" + ChatColor.valueOf(eventChannel.getChatColor().toUpperCase()), mcp.getPlayer(), plugin, cc, eventChannel, plugin.getConfig().getBoolean("jsonFormat"));
|
||||
format = FormatTags.ChatFormat(ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + "[" + eventChannel.getName() + "] {prefix}{name}" + ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + ":" + ChatColor.valueOf(eventChannel.getChatColor().toUpperCase()), mcp.getPlayer(), plugin, eventChannel, plugin.getConfig().getBoolean("jsonFormat"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
format = FormatTags.ChatFormat(plugin.getConfig().getConfigurationSection("channels." + eventChannel.getName()).getString("format"), mcp.getPlayer(), plugin, cc, eventChannel, plugin.getConfig().getBoolean("jsonFormat"));
|
||||
format = FormatTags.ChatFormat(plugin.getConfig().getConfigurationSection("channels." + eventChannel.getName()).getString("format"), mcp.getPlayer(), plugin, eventChannel, plugin.getConfig().getBoolean("jsonFormat"));
|
||||
if(plugin.getConfig().getBoolean("formatcleaner", false)) {
|
||||
format = format.replace("[]", " ");
|
||||
format = format.replace(" ", " ").replace(" ", " ").replace(" ", " ");
|
||||
@ -340,7 +335,7 @@ public class ChatListener implements Listener {
|
||||
filterthis = eventChannel.isFiltered();
|
||||
if(filterthis) {
|
||||
if(mcp.hasFilter()) {
|
||||
chat = cc.FilterChat(chat);
|
||||
chat = Format.FilterChat(chat);
|
||||
}
|
||||
}
|
||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
@ -521,6 +516,7 @@ public class ChatListener implements Listener {
|
||||
if(plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
||||
System.out.println(out.size() + " size bytes without json");
|
||||
}
|
||||
out.writeBoolean(true);
|
||||
out.writeUTF(globalJSON);
|
||||
if(plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
||||
System.out.println(out.size() + " bytes size with json");
|
||||
|
@ -12,7 +12,6 @@ import mineverse.Aust1n46.chat.alias.AliasInfo;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.gui.GuiSlot;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
||||
@ -39,11 +38,9 @@ import me.clip.placeholderapi.PlaceholderAPI;
|
||||
//in the custom commands such as aliases.
|
||||
public class CommandListener implements CommandExecutor, Listener {
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
private ChatChannelInfo cc;
|
||||
private AliasInfo aa;
|
||||
|
||||
public CommandListener(ChatChannelInfo cc, AliasInfo aa) {
|
||||
this.cc = cc;
|
||||
public CommandListener(AliasInfo aa) {
|
||||
this.aa = aa;
|
||||
}
|
||||
|
||||
@ -153,7 +150,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
||||
}
|
||||
|
||||
if(!plugin.quickchat) {
|
||||
for(ChatChannel channel : cc.getChannelsInfo()) {
|
||||
for(ChatChannel channel : ChatChannel.getChannels()) {
|
||||
if(!channel.hasPermission() || mcp.getPlayer().hasPermission(channel.getPermission())) {
|
||||
if(message.equals("/" + channel.getAlias())) {
|
||||
mcp.getPlayer().sendMessage("Channel Set: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + "[" + channel.getName() + "]");
|
||||
@ -220,7 +217,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
||||
return true;
|
||||
}
|
||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer((Player) sender);
|
||||
for(ChatChannel channel : cc.getChannelsInfo()) {
|
||||
for(ChatChannel channel : ChatChannel.getChannels()) {
|
||||
if(command.getName().toLowerCase().equals(channel.getAlias())) {
|
||||
if(args.length == 0) {
|
||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid command: /" + channel.getAlias() + " message");
|
||||
@ -252,7 +249,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
||||
MineverseChatPlayer target = MineverseChatAPI.getMineverseChatPlayer(e.getView().getTitle().replace(" GUI", "").replace("VentureChat: ", ""));
|
||||
ItemStack skull = e.getInventory().getItem(0);
|
||||
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
|
||||
ChatChannel channel = MineverseChat.ccInfo.getChannelInfo(ChatColor.stripColor(skullMeta.getLore().get(0)).replace("Channel: ", ""));
|
||||
ChatChannel channel = ChatChannel.getChannel(ChatColor.stripColor(skullMeta.getLore().get(0)).replace("Channel: ", ""));
|
||||
int hash = Integer.parseInt(ChatColor.stripColor(skullMeta.getLore().get(1).replace("Hash: ", "")));
|
||||
if(VersionHandler.is1_7_10()) {
|
||||
if(item.getType() == Material.BEDROCK) {
|
||||
|
@ -11,7 +11,6 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.database.PlayerData;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
@ -29,13 +28,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
//and it's data.
|
||||
public class LoginListener implements Listener {
|
||||
private MineverseChat plugin = MineverseChat.getInstance();
|
||||
private ChatChannelInfo cc;
|
||||
private FileConfiguration playerData = PlayerData.getPlayerData();
|
||||
|
||||
public LoginListener(ChatChannelInfo cc) {
|
||||
this.cc = cc;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerKick(PlayerKickEvent plog) {
|
||||
if(!plugin.getConfig().getConfigurationSection("logout").getString("message", "Default").equalsIgnoreCase("Default")) {
|
||||
@ -67,7 +61,7 @@ public class LoginListener implements Listener {
|
||||
// Disabling Mojang UUID Query
|
||||
//UUID uuid = UUIDFetcher.getUUIDOf(name);
|
||||
UUID uuid = player.getUniqueId();
|
||||
ChatChannel current = cc.getDefaultChannel();
|
||||
ChatChannel current = ChatChannel.getDefaultChannel();
|
||||
Set<UUID> ignores = new HashSet<UUID>();
|
||||
Set<String> listening = new HashSet<String>();
|
||||
listening.add(current.getName());
|
||||
@ -93,7 +87,7 @@ public class LoginListener implements Listener {
|
||||
}
|
||||
mcp.getPlayer().setPlayerListName(Format.FormatStringAll(nick));
|
||||
}
|
||||
for(ChatChannel ch : MineverseChat.ccInfo.getAutojoinList()) {
|
||||
for(ChatChannel ch : ChatChannel.getAutojoinList()) {
|
||||
if(ch.hasPermission()) {
|
||||
if(mcp.getPlayer().hasPermission(ch.getPermission())) {
|
||||
mcp.addListening(ch.getName());
|
||||
@ -148,12 +142,12 @@ public class LoginListener implements Listener {
|
||||
cs.set("ignores", ignores);
|
||||
String listening = "";
|
||||
for(String channel : mcp.getListening()) {
|
||||
ChatChannel c = MineverseChat.ccInfo.getChannelInfo(channel);
|
||||
ChatChannel c = ChatChannel.getChannel(channel);
|
||||
listening += c.getName() + ",";
|
||||
}
|
||||
String mutes = "";
|
||||
for(String channel : mcp.getMutes().keySet()) {
|
||||
ChatChannel c = MineverseChat.ccInfo.getChannelInfo(channel);
|
||||
ChatChannel c = ChatChannel.getChannel(channel);
|
||||
mutes += c.getName() + ":" + mcp.getMutes().get(c.getName()) + ",";
|
||||
}
|
||||
String blockedCommands = "";
|
||||
|
@ -8,17 +8,11 @@ import org.bukkit.event.block.SignChangeEvent;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
//This class listens for text being added to signs, and it formats them to allow colors and formatting.
|
||||
public class SignListener implements Listener {
|
||||
MineverseChat plugin = MineverseChat.getInstance();
|
||||
ChatChannelInfo cc;
|
||||
|
||||
public SignListener(ChatChannelInfo cc) {
|
||||
this.cc = cc;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
|
@ -3,6 +3,7 @@ package mineverse.Aust1n46.chat.utilities;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -426,4 +427,33 @@ public class Format {
|
||||
allFormated = allFormated.replaceAll("%", "\\%");
|
||||
return allFormated;
|
||||
}
|
||||
|
||||
public static String FilterChat(String msg) {
|
||||
int t = 0;
|
||||
List<String> filters = plugin.getConfig().getStringList("filters");
|
||||
for(String s : filters) {
|
||||
t = 0;
|
||||
String[] pparse = new String[2];
|
||||
pparse[0] = " ";
|
||||
pparse[1] = " ";
|
||||
StringTokenizer st = new StringTokenizer(s, ",");
|
||||
while(st.hasMoreTokens()) {
|
||||
if(t < 2) {
|
||||
pparse[t++] = st.nextToken();
|
||||
}
|
||||
}
|
||||
msg = msg.replaceAll("(?i)" + pparse[0], pparse[1]);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
public static Boolean isValidColor(String color) {
|
||||
Boolean bFound = false;
|
||||
for(ChatColor bkColors : ChatColor.values()) {
|
||||
if(color.equalsIgnoreCase(bkColors.name())) {
|
||||
bFound = true;
|
||||
}
|
||||
}
|
||||
return bFound;
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ package mineverse.Aust1n46.chat.utilities;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import mineverse.Aust1n46.chat.MineverseChat;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannelInfo;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,7 +17,7 @@ import com.palmergames.bukkit.towny.object.TownyUniverse;
|
||||
//This class formats the chat by replacing format place holders with their data.
|
||||
public class FormatTags {
|
||||
|
||||
public static String ChatFormat(String format, Player p, MineverseChat plugin, ChatChannelInfo cc, ChatChannel channel, boolean json) {
|
||||
public static String ChatFormat(String format, Player p, MineverseChat plugin, ChatChannel channel, boolean json) {
|
||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
String town = "";
|
||||
String name = p.getName();
|
||||
@ -152,7 +151,7 @@ public class FormatTags {
|
||||
/**
|
||||
* Unused
|
||||
* **/
|
||||
public static String TabFormat(String format, Player p, MineverseChat plugin, ChatChannelInfo cc) {
|
||||
public static String TabFormat(String format, Player p, MineverseChat plugin) {
|
||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
String town = "";
|
||||
String name = p.getName();
|
||||
|
Loading…
x
Reference in New Issue
Block a user