mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
More renaming and DI framework.
This commit is contained in:
parent
fb7fb52ce5
commit
d6350e6feb
@ -1,5 +1,8 @@
|
|||||||
#Sun Nov 28 17:16:27 CST 2021
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.release=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
8
pom.xml
8
pom.xml
@ -249,15 +249,15 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
<version>4.12</version>
|
<version>5.8.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-inline</artifactId>
|
<artifactId>mockito-inline</artifactId>
|
||||||
<version>3.12.4</version>
|
<version>4.2.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -3,7 +3,11 @@ package venture.Aust1n46.chat;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
public class Logger {
|
public class Logger {
|
||||||
private static final String LOG_PREFIX = "[VentureChat] ";
|
private static final String LOG_PREFIX = "[VentureChat] ";
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.google.inject.Inject;
|
|||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package venture.Aust1n46.chat;
|
package venture.Aust1n46.chat;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Guice;
|
|
||||||
import com.google.inject.Injector;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
|
||||||
public class VentureChatPluginModule extends AbstractModule {
|
public class VentureChatPluginModule extends AbstractModule {
|
||||||
private final VentureChat plugin;
|
private final VentureChat plugin;
|
||||||
@ -11,10 +11,6 @@ public class VentureChatPluginModule extends AbstractModule {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Injector createInjector() {
|
|
||||||
return Guice.createInjector(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
this.bind(VentureChat.class).toInstance(plugin);
|
this.bind(VentureChat.class).toInstance(plugin);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.api.events;
|
package venture.Aust1n46.chat.api.events;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.api.events;
|
package venture.Aust1n46.chat.api.events;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.api.events;
|
package venture.Aust1n46.chat.api.events;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
|
||||||
@ -17,6 +16,8 @@ import venture.Aust1n46.chat.model.VentureChatPlayer;
|
|||||||
* @author Aust1n46
|
* @author Aust1n46
|
||||||
*/
|
*/
|
||||||
public class VentureChatEvent extends Event {
|
public class VentureChatEvent extends Event {
|
||||||
|
private static final boolean ASYNC = true;
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final VentureChatPlayer mcp;
|
private final VentureChatPlayer mcp;
|
||||||
private final String username;
|
private final String username;
|
||||||
@ -31,7 +32,7 @@ public class VentureChatEvent extends Event {
|
|||||||
private final boolean bungee;
|
private final boolean bungee;
|
||||||
|
|
||||||
public VentureChatEvent(VentureChatPlayer mcp, String username, String playerPrimaryGroup, ChatChannel channel, Set<Player> recipients, int recipientCount, String format, String chat, String globalJSON, int hash, boolean bungee) {
|
public VentureChatEvent(VentureChatPlayer mcp, String username, String playerPrimaryGroup, ChatChannel channel, Set<Player> recipients, int recipientCount, String format, String chat, String globalJSON, int hash, boolean bungee) {
|
||||||
super(VentureChat.ASYNC);
|
super(ASYNC);
|
||||||
this.mcp = mcp;
|
this.mcp = mcp;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.playerPrimaryGroup = playerPrimaryGroup;
|
this.playerPrimaryGroup = playerPrimaryGroup;
|
@ -20,16 +20,17 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.api.events.VentureChatEvent;
|
import venture.Aust1n46.chat.api.events.VentureChatEvent;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PluginMessageController {
|
public class PluginMessageController {
|
||||||
@ -43,6 +44,8 @@ public class PluginMessageController {
|
|||||||
private VentureChatFormatService formatService;
|
private VentureChatFormatService formatService;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
public void sendPluginMessage(ByteArrayOutputStream byteOutStream) {
|
public void sendPluginMessage(ByteArrayOutputStream byteOutStream) {
|
||||||
if(playerApiService.getOnlineMineverseChatPlayers().size() > 0) {
|
if(playerApiService.getOnlineMineverseChatPlayers().size() > 0) {
|
||||||
@ -68,6 +71,15 @@ public class PluginMessageController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void synchronizeWithDelay(final VentureChatPlayer vcp, final boolean changes) {
|
||||||
|
final long delayInTicks = 20L;
|
||||||
|
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
synchronize(vcp, false);
|
||||||
|
}
|
||||||
|
}, delayInTicks);
|
||||||
|
}
|
||||||
|
|
||||||
public void synchronize(VentureChatPlayer mcp, boolean changes) {
|
public void synchronize(VentureChatPlayer mcp, boolean changes) {
|
||||||
// System.out.println("Sync started...");
|
// System.out.println("Sync started...");
|
||||||
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outstream = new ByteArrayOutputStream();
|
||||||
@ -82,7 +94,7 @@ public class PluginMessageController {
|
|||||||
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(!mcp.isOnline() || mcp.hasPlayed()) {
|
if(!mcp.isOnline() || mcp.isHasPlayed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronize(mcp, false);
|
synchronize(mcp, false);
|
||||||
@ -95,14 +107,14 @@ public class PluginMessageController {
|
|||||||
// out.writeUTF("Channels");
|
// out.writeUTF("Channels");
|
||||||
int channelCount = 0;
|
int channelCount = 0;
|
||||||
for(String c : mcp.getListening()) {
|
for(String c : mcp.getListening()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = configService.getChannel(c);
|
||||||
if(channel.getBungee()) {
|
if(channel.getBungee()) {
|
||||||
channelCount++;
|
channelCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out.write(channelCount);
|
out.write(channelCount);
|
||||||
for(String c : mcp.getListening()) {
|
for(String c : mcp.getListening()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = configService.getChannel(c);
|
||||||
if(channel.getBungee()) {
|
if(channel.getBungee()) {
|
||||||
out.writeUTF(channel.getName());
|
out.writeUTF(channel.getName());
|
||||||
}
|
}
|
||||||
@ -110,7 +122,7 @@ public class PluginMessageController {
|
|||||||
// out.writeUTF("Mutes");
|
// out.writeUTF("Mutes");
|
||||||
int muteCount = 0;
|
int muteCount = 0;
|
||||||
for(MuteContainer mute : mcp.getMutes()) {
|
for(MuteContainer mute : mcp.getMutes()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(mute.getChannel());
|
ChatChannel channel = configService.getChannel(mute.getChannel());
|
||||||
if(channel.getBungee()) {
|
if(channel.getBungee()) {
|
||||||
muteCount++;
|
muteCount++;
|
||||||
}
|
}
|
||||||
@ -118,7 +130,7 @@ public class PluginMessageController {
|
|||||||
// System.out.println(muteCount + " mutes");
|
// System.out.println(muteCount + " mutes");
|
||||||
out.write(muteCount);
|
out.write(muteCount);
|
||||||
for(MuteContainer mute : mcp.getMutes()) {
|
for(MuteContainer mute : mcp.getMutes()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(mute.getChannel());
|
ChatChannel channel = configService.getChannel(mute.getChannel());
|
||||||
if(channel.getBungee()) {
|
if(channel.getBungee()) {
|
||||||
out.writeUTF(channel.getName());
|
out.writeUTF(channel.getName());
|
||||||
out.writeLong(mute.getDuration());
|
out.writeLong(mute.getDuration());
|
||||||
@ -170,10 +182,10 @@ public class PluginMessageController {
|
|||||||
String globalJSON = msgin.readUTF();
|
String globalJSON = msgin.readUTF();
|
||||||
String primaryGroup = msgin.readUTF();
|
String primaryGroup = msgin.readUTF();
|
||||||
|
|
||||||
if(!ChatChannel.isChannel(chatchannel)) {
|
if(!configService.isChannel(chatchannel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObject = ChatChannel.getChannel(chatchannel);
|
ChatChannel chatChannelObject = configService.getChannel(chatchannel);
|
||||||
|
|
||||||
if(!chatChannelObject.getBungee()) {
|
if(!chatChannelObject.getBungee()) {
|
||||||
return;
|
return;
|
||||||
@ -181,7 +193,7 @@ public class PluginMessageController {
|
|||||||
|
|
||||||
Set<Player> recipients = new HashSet<Player>();
|
Set<Player> recipients = new HashSet<Player>();
|
||||||
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
||||||
if(p.isListening(chatChannelObject.getName())) {
|
if(configService.isListening(p, chatChannelObject.getName())) {
|
||||||
recipients.add(p.getPlayer());
|
recipients.add(p.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +215,7 @@ public class PluginMessageController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
||||||
if(p.isListening(chatChannelObject.getName())) {
|
if(configService.isListening(p, chatChannelObject.getName())) {
|
||||||
if(!p.isBungeeToggle() && playerApiService.getOnlineMineverseChatPlayer(senderName) == null) {
|
if(!p.isBungeeToggle() && playerApiService.getOnlineMineverseChatPlayer(senderName) == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -225,10 +237,10 @@ public class PluginMessageController {
|
|||||||
if(subchannel.equals("DiscordSRV")) {
|
if(subchannel.equals("DiscordSRV")) {
|
||||||
String chatChannel = msgin.readUTF();
|
String chatChannel = msgin.readUTF();
|
||||||
String message = msgin.readUTF();
|
String message = msgin.readUTF();
|
||||||
if(!ChatChannel.isChannel(chatChannel)) {
|
if(!configService.isChannel(chatChannel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(chatChannel);
|
ChatChannel chatChannelObj = configService.getChannel(chatChannel);
|
||||||
if(!chatChannelObj.getBungee()) {
|
if(!chatChannelObj.getBungee()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -237,7 +249,7 @@ public class PluginMessageController {
|
|||||||
int hash = (message.replaceAll("([<5B>]([a-z0-9]))", "")).hashCode();
|
int hash = (message.replaceAll("([<5B>]([a-z0-9]))", "")).hashCode();
|
||||||
|
|
||||||
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
||||||
if(p.isListening(chatChannelObj.getName())) {
|
if(configService.isListening(p, chatChannelObj.getName())) {
|
||||||
String finalJSON = formatService.formatModerationGUI(json, p.getPlayer(), "Discord", chatChannelObj.getName(), hash);
|
String finalJSON = formatService.formatModerationGUI(json, p.getPlayer(), "Discord", chatChannelObj.getName(), hash);
|
||||||
PacketContainer packet = formatService.createPacketPlayOutChat(finalJSON);
|
PacketContainer packet = formatService.createPacketPlayOutChat(finalJSON);
|
||||||
formatService.sendPacketPlayOutChat(p.getPlayer(), packet);
|
formatService.sendPacketPlayOutChat(p.getPlayer(), packet);
|
||||||
@ -258,9 +270,9 @@ public class PluginMessageController {
|
|||||||
String sender = msgin.readUTF();
|
String sender = msgin.readUTF();
|
||||||
String chatchannel = msgin.readUTF();
|
String chatchannel = msgin.readUTF();
|
||||||
List<String> listening = new ArrayList<String>();
|
List<String> listening = new ArrayList<String>();
|
||||||
if(ChatChannel.isChannel(chatchannel)) {
|
if(configService.isChannel(chatchannel)) {
|
||||||
for(VentureChatPlayer mcp : playerApiService.getOnlineMineverseChatPlayers()) {
|
for(VentureChatPlayer mcp : playerApiService.getOnlineMineverseChatPlayers()) {
|
||||||
if(mcp.isListening(chatchannel)) {
|
if(configService.isListening(mcp, chatchannel)) {
|
||||||
String entry = "&f" + mcp.getName();
|
String entry = "&f" + mcp.getName();
|
||||||
if(mcp.isMuted(chatchannel)) {
|
if(mcp.isMuted(chatchannel)) {
|
||||||
entry = "&c" + mcp.getName();
|
entry = "&c" + mcp.getName();
|
||||||
@ -284,7 +296,7 @@ public class PluginMessageController {
|
|||||||
String sender = msgin.readUTF();
|
String sender = msgin.readUTF();
|
||||||
String stringchannel = msgin.readUTF();
|
String stringchannel = msgin.readUTF();
|
||||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(UUID.fromString(sender));
|
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer(UUID.fromString(sender));
|
||||||
ChatChannel chatchannel = ChatChannel.getChannel(stringchannel);
|
ChatChannel chatchannel = configService.getChannel(stringchannel);
|
||||||
String playerList = "";
|
String playerList = "";
|
||||||
int size = msgin.readInt();
|
int size = msgin.readInt();
|
||||||
for(int a = 0; a < size; a++) {
|
for(int a = 0; a < size; a++) {
|
||||||
@ -309,12 +321,12 @@ public class PluginMessageController {
|
|||||||
}
|
}
|
||||||
String uuid = msgin.readUTF();
|
String uuid = msgin.readUTF();
|
||||||
VentureChatPlayer p = playerApiService.getOnlineMineverseChatPlayer(UUID.fromString(uuid));
|
VentureChatPlayer p = playerApiService.getOnlineMineverseChatPlayer(UUID.fromString(uuid));
|
||||||
if(p == null || p.hasPlayed()) {
|
if(p == null || p.isHasPlayed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(Object ch : p.getListening().toArray()) {
|
for(Object ch : p.getListening().toArray()) {
|
||||||
String c = ch.toString();
|
String c = ch.toString();
|
||||||
ChatChannel cha = ChatChannel.getChannel(c);
|
ChatChannel cha = configService.getChannel(c);
|
||||||
if(cha.getBungee()) {
|
if(cha.getBungee()) {
|
||||||
p.removeListening(c);
|
p.removeListening(c);
|
||||||
}
|
}
|
||||||
@ -322,14 +334,14 @@ public class PluginMessageController {
|
|||||||
int size = msgin.read();
|
int size = msgin.read();
|
||||||
for(int a = 0; a < size; a++) {
|
for(int a = 0; a < size; a++) {
|
||||||
String ch = msgin.readUTF();
|
String ch = msgin.readUTF();
|
||||||
if(ChatChannel.isChannel(ch)) {
|
if(configService.isChannel(ch)) {
|
||||||
ChatChannel cha = ChatChannel.getChannel(ch);
|
ChatChannel cha = configService.getChannel(ch);
|
||||||
if(!cha.hasPermission() || p.getPlayer().hasPermission(cha.getPermission())) {
|
if(!cha.hasPermission() || p.getPlayer().hasPermission(cha.getPermission())) {
|
||||||
p.addListening(ch);
|
p.addListening(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.getMutes().removeIf(mute -> ChatChannel.getChannel(mute.getChannel()).getBungee());
|
p.getMutes().removeIf(mute -> configService.getChannel(mute.getChannel()).getBungee());
|
||||||
int sizeB = msgin.read();
|
int sizeB = msgin.read();
|
||||||
// System.out.println(sizeB + " mute size");
|
// System.out.println(sizeB + " mute size");
|
||||||
for(int b = 0; b < sizeB; b++) {
|
for(int b = 0; b < sizeB; b++) {
|
||||||
@ -337,7 +349,7 @@ public class PluginMessageController {
|
|||||||
long muteTime = msgin.readLong();
|
long muteTime = msgin.readLong();
|
||||||
String muteReason = msgin.readUTF();
|
String muteReason = msgin.readUTF();
|
||||||
// System.out.println(ch);
|
// System.out.println(ch);
|
||||||
if(ChatChannel.isChannel(ch)) {
|
if(configService.isChannel(ch)) {
|
||||||
p.addMute(ch, muteTime, muteReason);
|
p.addMute(ch, muteTime, muteReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,10 +367,10 @@ public class PluginMessageController {
|
|||||||
// System.out.println(i);
|
// System.out.println(i);
|
||||||
p.addIgnore(UUID.fromString(i));
|
p.addIgnore(UUID.fromString(i));
|
||||||
}
|
}
|
||||||
if(!p.hasPlayed()) {
|
if(!p.isHasPlayed()) {
|
||||||
boolean isThereABungeeChannel = false;
|
boolean isThereABungeeChannel = false;
|
||||||
for(ChatChannel ch : ChatChannel.getAutojoinList()) {
|
for(ChatChannel ch : configService.getAutojoinList()) {
|
||||||
if((!ch.hasPermission() || p.getPlayer().hasPermission(ch.getPermission())) && !p.isListening(ch.getName())) {
|
if((!ch.hasPermission() || p.getPlayer().hasPermission(ch.getPermission())) && !configService.isListening(p, ch.getName())) {
|
||||||
p.addListening(ch.getName());
|
p.addListening(ch.getName());
|
||||||
if(ch.getBungee()) {
|
if(ch.getBungee()) {
|
||||||
isThereABungeeChannel = true;
|
isThereABungeeChannel = true;
|
||||||
@ -445,10 +457,10 @@ public class PluginMessageController {
|
|||||||
sendPluginMessage(stream);
|
sendPluginMessage(stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!ChatChannel.isChannel(channelName)) {
|
if(!configService.isChannel(channelName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channelName);
|
ChatChannel chatChannelObj = configService.getChannel(channelName);
|
||||||
if (playerToMuteMCP.isMuted(chatChannelObj.getName())) {
|
if (playerToMuteMCP.isMuted(chatChannelObj.getName())) {
|
||||||
out.writeUTF("Mute");
|
out.writeUTF("Mute");
|
||||||
out.writeUTF("AlreadyMuted");
|
out.writeUTF("AlreadyMuted");
|
||||||
@ -516,10 +528,10 @@ public class PluginMessageController {
|
|||||||
String channelName = msgin.readUTF();
|
String channelName = msgin.readUTF();
|
||||||
long time = msgin.readLong();
|
long time = msgin.readLong();
|
||||||
String reason = msgin.readUTF();
|
String reason = msgin.readUTF();
|
||||||
if(!ChatChannel.isChannel(channelName)) {
|
if(!configService.isChannel(channelName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channelName);
|
ChatChannel chatChannelObj = configService.getChannel(channelName);
|
||||||
if(time > 0) {
|
if(time > 0) {
|
||||||
String timeString = FormatUtils.parseTimeStringFromMillis(time);
|
String timeString = FormatUtils.parseTimeStringFromMillis(time);
|
||||||
if(reason.isEmpty()) {
|
if(reason.isEmpty()) {
|
||||||
@ -617,10 +629,10 @@ public class PluginMessageController {
|
|||||||
String senderIdentifier = msgin.readUTF();
|
String senderIdentifier = msgin.readUTF();
|
||||||
String playerToMute = msgin.readUTF();
|
String playerToMute = msgin.readUTF();
|
||||||
String channelName = msgin.readUTF();
|
String channelName = msgin.readUTF();
|
||||||
if(!ChatChannel.isChannel(channelName)) {
|
if(!configService.isChannel(channelName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channelName);
|
ChatChannel chatChannelObj = configService.getChannel(channelName);
|
||||||
if(senderIdentifier.equals("VentureChat:Console")) {
|
if(senderIdentifier.equals("VentureChat:Console")) {
|
||||||
Bukkit.getConsoleSender().sendMessage(LocalizedMessage.PLAYER_ALREADY_MUTED.toString()
|
Bukkit.getConsoleSender().sendMessage(LocalizedMessage.PLAYER_ALREADY_MUTED.toString()
|
||||||
.replace("{player}", playerToMute).replace("{channel_color}", chatChannelObj.getColor())
|
.replace("{player}", playerToMute).replace("{channel_color}", chatChannelObj.getColor())
|
||||||
@ -654,10 +666,10 @@ public class PluginMessageController {
|
|||||||
sendPluginMessage(stream);
|
sendPluginMessage(stream);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!ChatChannel.isChannel(channelName)) {
|
if(!configService.isChannel(channelName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channelName);
|
ChatChannel chatChannelObj = configService.getChannel(channelName);
|
||||||
if (!playerToUnmuteMCP.isMuted(chatChannelObj.getName())) {
|
if (!playerToUnmuteMCP.isMuted(chatChannelObj.getName())) {
|
||||||
out.writeUTF("Unmute");
|
out.writeUTF("Unmute");
|
||||||
out.writeUTF("NotMuted");
|
out.writeUTF("NotMuted");
|
||||||
@ -686,10 +698,10 @@ public class PluginMessageController {
|
|||||||
String senderIdentifier = msgin.readUTF();
|
String senderIdentifier = msgin.readUTF();
|
||||||
String playerToUnmute = msgin.readUTF();
|
String playerToUnmute = msgin.readUTF();
|
||||||
String channelName = msgin.readUTF();
|
String channelName = msgin.readUTF();
|
||||||
if(!ChatChannel.isChannel(channelName)) {
|
if(!configService.isChannel(channelName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channelName);
|
ChatChannel chatChannelObj = configService.getChannel(channelName);
|
||||||
if(senderIdentifier.equals("VentureChat:Console")) {
|
if(senderIdentifier.equals("VentureChat:Console")) {
|
||||||
Bukkit.getConsoleSender().sendMessage(LocalizedMessage.UNMUTE_PLAYER_SENDER.toString()
|
Bukkit.getConsoleSender().sendMessage(LocalizedMessage.UNMUTE_PLAYER_SENDER.toString()
|
||||||
.replace("{player}", playerToUnmute)
|
.replace("{player}", playerToUnmute)
|
||||||
@ -724,10 +736,10 @@ public class PluginMessageController {
|
|||||||
String senderIdentifier = msgin.readUTF();
|
String senderIdentifier = msgin.readUTF();
|
||||||
String playerToUnmute = msgin.readUTF();
|
String playerToUnmute = msgin.readUTF();
|
||||||
String channelName = msgin.readUTF();
|
String channelName = msgin.readUTF();
|
||||||
if(!ChatChannel.isChannel(channelName)) {
|
if(!configService.isChannel(channelName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channelName);
|
ChatChannel chatChannelObj = configService.getChannel(channelName);
|
||||||
if(senderIdentifier.equals("VentureChat:Console")) {
|
if(senderIdentifier.equals("VentureChat:Console")) {
|
||||||
Bukkit.getConsoleSender().sendMessage(LocalizedMessage.PLAYER_NOT_MUTED.toString()
|
Bukkit.getConsoleSender().sendMessage(LocalizedMessage.PLAYER_NOT_MUTED.toString()
|
||||||
.replace("{player}", playerToUnmute).replace("{channel_color}", chatChannelObj.getColor())
|
.replace("{player}", playerToUnmute).replace("{channel_color}", chatChannelObj.getColor())
|
||||||
@ -782,11 +794,11 @@ public class PluginMessageController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p.getPlayer().sendMessage(FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(p.getPlayer(), send.replaceAll("receiver_", ""))) + msg);
|
p.getPlayer().sendMessage(FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(p.getPlayer(), send.replaceAll("receiver_", ""))) + msg);
|
||||||
if(p.hasNotifications()) {
|
if(p.isNotifications()) {
|
||||||
formatService.playMessageSound(p);
|
formatService.playMessageSound(p);
|
||||||
}
|
}
|
||||||
if(playerApiService.getMineverseChatPlayer(sender) == null) {
|
if(playerApiService.getMineverseChatPlayer(sender) == null) {
|
||||||
VentureChatPlayer senderMCP = new VentureChatPlayer(sender, sName);
|
VentureChatPlayer senderMCP = new VentureChatPlayer(sender, sName, configService.getDefaultChannel());
|
||||||
playerApiService.addMineverseChatPlayerToMap(senderMCP);
|
playerApiService.addMineverseChatPlayerToMap(senderMCP);
|
||||||
playerApiService.addNameToMap(senderMCP);
|
playerApiService.addNameToMap(senderMCP);
|
||||||
}
|
}
|
||||||
@ -832,7 +844,7 @@ public class PluginMessageController {
|
|||||||
VentureChatPlayer senderMCP = playerApiService.getOnlineMineverseChatPlayer(senderUUID);
|
VentureChatPlayer senderMCP = playerApiService.getOnlineMineverseChatPlayer(senderUUID);
|
||||||
String echo = msgin.readUTF();
|
String echo = msgin.readUTF();
|
||||||
if(playerApiService.getMineverseChatPlayer(receiverUUID) == null) {
|
if(playerApiService.getMineverseChatPlayer(receiverUUID) == null) {
|
||||||
VentureChatPlayer receiverMCP = new VentureChatPlayer(receiverUUID, receiverName);
|
VentureChatPlayer receiverMCP = new VentureChatPlayer(receiverUUID, receiverName, configService.getDefaultChannel());
|
||||||
playerApiService.addMineverseChatPlayerToMap(receiverMCP);
|
playerApiService.addMineverseChatPlayerToMap(receiverMCP);
|
||||||
playerApiService.addNameToMap(receiverMCP);
|
playerApiService.addNameToMap(receiverMCP);
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,12 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.proxy.VentureChatProxySource;
|
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
||||||
import venture.Aust1n46.chat.model.SynchronizedVentureChatPlayer;
|
import venture.Aust1n46.chat.model.SynchronizedVentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.proxy.VentureChatProxySource;
|
||||||
import venture.Aust1n46.chat.service.UUIDService;
|
import venture.Aust1n46.chat.service.UUIDService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
|
@ -21,13 +21,14 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.UUIDService;
|
import venture.Aust1n46.chat.service.UUIDService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for reading and writing player data.
|
* Class for reading and writing player data.
|
||||||
@ -42,6 +43,8 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
private UUIDService uuidService;
|
private UUIDService uuidService;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService ventureChatApi;
|
private VentureChatPlayerApiService ventureChatApi;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
private String playerDataDirectoryPath;
|
private String playerDataDirectoryPath;
|
||||||
|
|
||||||
@ -67,7 +70,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
}
|
}
|
||||||
String name = playerData.getConfigurationSection("players." + uuid).getString("name");
|
String name = playerData.getConfigurationSection("players." + uuid).getString("name");
|
||||||
String currentChannelName = playerData.getConfigurationSection("players." + uuid).getString("current");
|
String currentChannelName = playerData.getConfigurationSection("players." + uuid).getString("current");
|
||||||
ChatChannel currentChannel = ChatChannel.isChannel(currentChannelName) ? ChatChannel.getChannel(currentChannelName) : ChatChannel.getDefaultChannel();
|
ChatChannel currentChannel = configService.isChannel(currentChannelName) ? configService.getChannel(currentChannelName) : configService.getDefaultChannel();
|
||||||
Set<UUID> ignores = new HashSet<UUID>();
|
Set<UUID> ignores = new HashSet<UUID>();
|
||||||
StringTokenizer i = new StringTokenizer(playerData.getConfigurationSection("players." + uuidString).getString("ignores"), ",");
|
StringTokenizer i = new StringTokenizer(playerData.getConfigurationSection("players." + uuidString).getString("ignores"), ",");
|
||||||
while (i.hasMoreTokens()) {
|
while (i.hasMoreTokens()) {
|
||||||
@ -77,7 +80,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
StringTokenizer l = new StringTokenizer(playerData.getConfigurationSection("players." + uuidString).getString("listen"), ",");
|
StringTokenizer l = new StringTokenizer(playerData.getConfigurationSection("players." + uuidString).getString("listen"), ",");
|
||||||
while (l.hasMoreTokens()) {
|
while (l.hasMoreTokens()) {
|
||||||
String channel = l.nextToken();
|
String channel = l.nextToken();
|
||||||
if (ChatChannel.isChannel(channel)) {
|
if (configService.isChannel(channel)) {
|
||||||
listening.add(channel);
|
listening.add(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +88,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
StringTokenizer m = new StringTokenizer(playerData.getConfigurationSection("players." + uuidString).getString("mutes"), ",");
|
StringTokenizer m = new StringTokenizer(playerData.getConfigurationSection("players." + uuidString).getString("mutes"), ",");
|
||||||
while (m.hasMoreTokens()) {
|
while (m.hasMoreTokens()) {
|
||||||
String[] parts = m.nextToken().split(":");
|
String[] parts = m.nextToken().split(":");
|
||||||
if (ChatChannel.isChannel(parts[0])) {
|
if (configService.isChannel(parts[0])) {
|
||||||
if (parts[1].equals("null")) {
|
if (parts[1].equals("null")) {
|
||||||
Bukkit.getConsoleSender().sendMessage("[VentureChat] Null Mute Time: " + parts[0] + " " + name);
|
Bukkit.getConsoleSender().sendMessage("[VentureChat] Null Mute Time: " + parts[0] + " " + name);
|
||||||
continue;
|
continue;
|
||||||
@ -161,7 +164,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
}
|
}
|
||||||
String name = playerDataFileYamlConfiguration.getString("name");
|
String name = playerDataFileYamlConfiguration.getString("name");
|
||||||
String currentChannelName = playerDataFileYamlConfiguration.getString("current");
|
String currentChannelName = playerDataFileYamlConfiguration.getString("current");
|
||||||
ChatChannel currentChannel = ChatChannel.isChannel(currentChannelName) ? ChatChannel.getChannel(currentChannelName) : ChatChannel.getDefaultChannel();
|
ChatChannel currentChannel = configService.isChannel(currentChannelName) ? configService.getChannel(currentChannelName) : configService.getDefaultChannel();
|
||||||
Set<UUID> ignores = new HashSet<UUID>();
|
Set<UUID> ignores = new HashSet<UUID>();
|
||||||
StringTokenizer i = new StringTokenizer(playerDataFileYamlConfiguration.getString("ignores"), ",");
|
StringTokenizer i = new StringTokenizer(playerDataFileYamlConfiguration.getString("ignores"), ",");
|
||||||
while (i.hasMoreTokens()) {
|
while (i.hasMoreTokens()) {
|
||||||
@ -171,7 +174,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
StringTokenizer l = new StringTokenizer(playerDataFileYamlConfiguration.getString("listen"), ",");
|
StringTokenizer l = new StringTokenizer(playerDataFileYamlConfiguration.getString("listen"), ",");
|
||||||
while (l.hasMoreTokens()) {
|
while (l.hasMoreTokens()) {
|
||||||
String channel = l.nextToken();
|
String channel = l.nextToken();
|
||||||
if (ChatChannel.isChannel(channel)) {
|
if (configService.isChannel(channel)) {
|
||||||
listening.add(channel);
|
listening.add(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -211,7 +214,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void savePlayerData(VentureChatPlayer mcp) {
|
public void savePlayerData(VentureChatPlayer mcp) {
|
||||||
if (mcp == null || uuidService.shouldSkipOfflineUUID(mcp.getUuid()) || (!mcp.isOnline() && !mcp.wasModified())) {
|
if (mcp == null || uuidService.shouldSkipOfflineUUID(mcp.getUuid()) || (!mcp.isOnline() && !mcp.isModified())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -230,7 +233,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
playerDataFileYamlConfiguration.set("ignores", ignores);
|
playerDataFileYamlConfiguration.set("ignores", ignores);
|
||||||
String listening = "";
|
String listening = "";
|
||||||
for (String channel : mcp.getListening()) {
|
for (String channel : mcp.getListening()) {
|
||||||
ChatChannel c = ChatChannel.getChannel(channel);
|
ChatChannel c = configService.getChannel(channel);
|
||||||
listening += c.getName() + ",";
|
listening += c.getName() + ",";
|
||||||
}
|
}
|
||||||
String blockedCommands = "";
|
String blockedCommands = "";
|
||||||
@ -253,7 +256,7 @@ public class VentureChatSpigotFlatFileController {
|
|||||||
playerDataFileYamlConfiguration.set("host", mcp.isHost());
|
playerDataFileYamlConfiguration.set("host", mcp.isHost());
|
||||||
playerDataFileYamlConfiguration.set("party", mcp.hasParty() ? mcp.getParty().toString() : "");
|
playerDataFileYamlConfiguration.set("party", mcp.hasParty() ? mcp.getParty().toString() : "");
|
||||||
playerDataFileYamlConfiguration.set("filter", mcp.isFilter());
|
playerDataFileYamlConfiguration.set("filter", mcp.isFilter());
|
||||||
playerDataFileYamlConfiguration.set("notifications", mcp.hasNotifications());
|
playerDataFileYamlConfiguration.set("notifications", mcp.isNotifications());
|
||||||
playerDataFileYamlConfiguration.set("spy", mcp.isSpy());
|
playerDataFileYamlConfiguration.set("spy", mcp.isSpy());
|
||||||
playerDataFileYamlConfiguration.set("commandspy", mcp.hasCommandSpy());
|
playerDataFileYamlConfiguration.set("commandspy", mcp.hasCommandSpy());
|
||||||
playerDataFileYamlConfiguration.set("rangedspy", mcp.getRangedSpy());
|
playerDataFileYamlConfiguration.set("rangedspy", mcp.getRangedSpy());
|
||||||
|
@ -6,11 +6,11 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Broadcast implements VentureCommand {
|
public class Broadcast implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -7,12 +7,13 @@ import org.bukkit.entity.Player;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.api.events.ChannelJoinEvent;
|
import venture.Aust1n46.chat.api.events.ChannelJoinEvent;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@ -21,6 +22,8 @@ public class Channel implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -30,12 +33,12 @@ public class Channel implements VentureCommand {
|
|||||||
}
|
}
|
||||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
if (!ChatChannel.isChannel(args[0])) {
|
if (!configService.isChannel(args[0])) {
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
||||||
.replace("{args}", args[0]));
|
.replace("{args}", args[0]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = configService.getChannel(args[0]);
|
||||||
ChannelJoinEvent channelJoinEvent = new ChannelJoinEvent(mcp.getPlayer(), channel, LocalizedMessage.SET_CHANNEL.toString()
|
ChannelJoinEvent channelJoinEvent = new ChannelJoinEvent(mcp.getPlayer(), channel, LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", channel.getColor() + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
|
@ -3,11 +3,16 @@ package venture.Aust1n46.chat.controllers.commands;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Channelinfo implements VentureCommand {
|
public class Channelinfo implements VentureCommand {
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -16,7 +21,7 @@ public class Channelinfo implements VentureCommand {
|
|||||||
sender.sendMessage(ChatColor.RED + "Invalid command: /channelinfo [channel]");
|
sender.sendMessage(ChatColor.RED + "Invalid command: /channelinfo [channel]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel chname = ChatChannel.getChannel(args[0]);
|
ChatChannel chname = configService.getChannel(args[0]);
|
||||||
if (chname == null) {
|
if (chname == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid channel: " + args[0]);
|
sender.sendMessage(ChatColor.RED + "Invalid channel: " + args[0]);
|
||||||
return;
|
return;
|
||||||
|
@ -10,11 +10,14 @@ import com.google.inject.Inject;
|
|||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Chatinfo implements VentureCommand {
|
public class Chatinfo implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -31,11 +34,11 @@ public class Chatinfo implements VentureCommand {
|
|||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + mcp.getName());
|
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + mcp.getName());
|
||||||
for (String c : mcp.getListening()) {
|
for (String c : mcp.getListening()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = configService.getChannel(c);
|
||||||
listen += channel.getColor() + channel.getName() + " ";
|
listen += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for (MuteContainer muteContainer : mcp.getMutes()) {
|
for (MuteContainer muteContainer : mcp.getMutes()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(muteContainer.getChannel());
|
ChatChannel channel = configService.getChannel(muteContainer.getChannel());
|
||||||
mute += channel.getColor() + channel.getName() + " ";
|
mute += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for (String bc : mcp.getBlockedCommands()) {
|
for (String bc : mcp.getBlockedCommands()) {
|
||||||
@ -86,11 +89,11 @@ public class Chatinfo implements VentureCommand {
|
|||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + p.getName());
|
sender.sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + p.getName());
|
||||||
for (String c : p.getListening()) {
|
for (String c : p.getListening()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = configService.getChannel(c);
|
||||||
listen += channel.getColor() + channel.getName() + " ";
|
listen += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for (MuteContainer muteContainer : p.getMutes()) {
|
for (MuteContainer muteContainer : p.getMutes()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(muteContainer.getChannel());
|
ChatChannel channel = configService.getChannel(muteContainer.getChannel());
|
||||||
mute += channel.getColor() + channel.getName() + " ";
|
mute += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for (String bc : p.getBlockedCommands()) {
|
for (String bc : p.getBlockedCommands()) {
|
||||||
|
@ -8,13 +8,15 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
|
import venture.Aust1n46.chat.model.JsonFormat;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Chatreload implements VentureCommand {
|
public class Chatreload implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
@ -23,6 +25,8 @@ public class Chatreload implements VentureCommand {
|
|||||||
private VentureChatSpigotFlatFileController spigotFlatFileController;
|
private VentureChatSpigotFlatFileController spigotFlatFileController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -33,7 +37,7 @@ public class Chatreload implements VentureCommand {
|
|||||||
playerApiService.clearOnlineMineverseChatPlayerMap();
|
playerApiService.clearOnlineMineverseChatPlayerMap();
|
||||||
|
|
||||||
plugin.reloadConfig();
|
plugin.reloadConfig();
|
||||||
plugin.initializeConfigReaders();
|
configService.postConstruct();
|
||||||
|
|
||||||
spigotFlatFileController.loadLegacyPlayerData();
|
spigotFlatFileController.loadLegacyPlayerData();
|
||||||
spigotFlatFileController.loadPlayerData();
|
spigotFlatFileController.loadPlayerData();
|
||||||
@ -44,11 +48,20 @@ public class Chatreload implements VentureCommand {
|
|||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&c - There could be an issue with your player data saving."));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&c - There could be an issue with your player data saving."));
|
||||||
String name = p.getName();
|
String name = p.getName();
|
||||||
UUID uuid = p.getUniqueId();
|
UUID uuid = p.getUniqueId();
|
||||||
mcp = new VentureChatPlayer(uuid, name);
|
mcp = new VentureChatPlayer(uuid, name, configService.getDefaultChannel());
|
||||||
}
|
}
|
||||||
mcp.setOnline(true);
|
mcp.setOnline(true);
|
||||||
|
mcp.setPlayer(plugin.getServer().getPlayer(mcp.getUuid()));
|
||||||
mcp.setHasPlayed(false);
|
mcp.setHasPlayed(false);
|
||||||
mcp.setJsonFormat();
|
String jsonFormat = mcp.getJsonFormat();
|
||||||
|
for(JsonFormat j : configService.getJsonFormats()) {
|
||||||
|
if(mcp.getPlayer().hasPermission("venturechat.json." + j.getName())) {
|
||||||
|
if(configService.getJsonFormat(mcp.getJsonFormat()).getPriority() > j.getPriority()) {
|
||||||
|
jsonFormat = j.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mcp.setJsonFormat(jsonFormat);
|
||||||
playerApiService.addMineverseChatOnlinePlayerToMap(mcp);
|
playerApiService.addMineverseChatOnlinePlayerToMap(mcp);
|
||||||
playerApiService.addNameToMap(mcp);
|
playerApiService.addNameToMap(mcp);
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,21 @@ package venture.Aust1n46.chat.controllers.commands;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
|
|
||||||
public class Chlist implements VentureCommand {
|
public class Chlist implements VentureCommand {
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_LIST_HEADER.toString());
|
sender.sendMessage(LocalizedMessage.CHANNEL_LIST_HEADER.toString());
|
||||||
for (ChatChannel chname : ChatChannel.getChatChannels()) {
|
for (ChatChannel chname : configService.getChatChannels()) {
|
||||||
if (chname.hasPermission()) {
|
if (chname.hasPermission()) {
|
||||||
if (sender.hasPermission(chname.getPermission())) {
|
if (sender.hasPermission(chname.getPermission())) {
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_LIST_WITH_PERMISSIONS.toString()
|
sender.sendMessage(LocalizedMessage.CHANNEL_LIST_WITH_PERMISSIONS.toString()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package venture.Aust1n46.chat.controllers.commands;
|
package venture.Aust1n46.chat.controllers.commands;
|
||||||
|
|
||||||
import static venture.Aust1n46.chat.VentureChat.LINE_LENGTH;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.LINE_LENGTH;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@ -16,12 +16,13 @@ import com.massivecraft.factions.entity.MPlayer;
|
|||||||
import com.palmergames.bukkit.towny.TownyUniverse;
|
import com.palmergames.bukkit.towny.TownyUniverse;
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Chwho implements VentureCommand {
|
public class Chwho implements VentureCommand {
|
||||||
@ -31,13 +32,15 @@ public class Chwho implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
String playerlist = "";
|
String playerlist = "";
|
||||||
if (sender.hasPermission("venturechat.chwho")) {
|
if (sender.hasPermission("venturechat.chwho")) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = configService.getChannel(args[0]);
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
if (channel.hasPermission()) {
|
if (channel.hasPermission()) {
|
||||||
if (!sender.hasPermission(channel.getPermission())) {
|
if (!sender.hasPermission(channel.getPermission())) {
|
||||||
|
@ -4,8 +4,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.InternalMessage;
|
import venture.Aust1n46.chat.localization.InternalMessage;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -6,8 +6,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -13,13 +13,13 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.ChatMessage;
|
import venture.Aust1n46.chat.model.ChatMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
|
||||||
public class Edit implements VentureCommand {
|
public class Edit implements VentureCommand {
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -4,7 +4,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -16,9 +16,9 @@ import org.bukkit.util.StringUtil;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
|
@ -5,11 +5,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Kickchannel implements VentureCommand {
|
public class Kickchannel implements VentureCommand {
|
||||||
@ -17,6 +18,8 @@ public class Kickchannel implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -33,7 +36,7 @@ public class Kickchannel implements VentureCommand {
|
|||||||
.replace("{args}", args[0]));
|
.replace("{args}", args[0]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
ChatChannel channel = configService.getChannel(args[1]);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
sender.sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
sender.sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
||||||
.replace("{args}", args[1]));
|
.replace("{args}", args[1]));
|
||||||
@ -53,16 +56,16 @@ public class Kickchannel implements VentureCommand {
|
|||||||
}
|
}
|
||||||
boolean isThereABungeeChannel = channel.getBungee();
|
boolean isThereABungeeChannel = channel.getBungee();
|
||||||
if (player.getListening().size() == 0) {
|
if (player.getListening().size() == 0) {
|
||||||
player.addListening(ChatChannel.getDefaultChannel().getName());
|
player.addListening(configService.getDefaultChannel().getName());
|
||||||
player.setCurrentChannel(ChatChannel.getDefaultChannel());
|
player.setCurrentChannel(configService.getDefaultChannel());
|
||||||
if (ChatChannel.getDefaultChannel().getBungee()) {
|
if (configService.getDefaultChannel().getBungee()) {
|
||||||
isThereABungeeChannel = true;
|
isThereABungeeChannel = true;
|
||||||
}
|
}
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.MUST_LISTEN_ONE_CHANNEL.toString());
|
player.getPlayer().sendMessage(LocalizedMessage.MUST_LISTEN_ONE_CHANNEL.toString());
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(ChatChannel.getDefaultColor().toUpperCase()) + "")
|
.replace("{channel_color}", ChatColor.valueOf(configService.getDefaultColor().toUpperCase()) + "")
|
||||||
.replace("{channel_name}", ChatChannel.getDefaultChannel().getName()));
|
.replace("{channel_name}", configService.getDefaultChannel().getName()));
|
||||||
} else
|
} else
|
||||||
player.setModified(true);
|
player.setModified(true);
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Kickchannelall implements VentureCommand {
|
public class Kickchannelall implements VentureCommand {
|
||||||
@ -17,6 +18,8 @@ public class Kickchannelall implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -35,8 +38,8 @@ public class Kickchannelall implements VentureCommand {
|
|||||||
}
|
}
|
||||||
boolean isThereABungeeChannel = false;
|
boolean isThereABungeeChannel = false;
|
||||||
for (String channel : player.getListening()) {
|
for (String channel : player.getListening()) {
|
||||||
if (ChatChannel.isChannel(channel)) {
|
if (configService.isChannel(channel)) {
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(channel);
|
ChatChannel chatChannelObj = configService.getChannel(channel);
|
||||||
if (chatChannelObj.getBungee()) {
|
if (chatChannelObj.getBungee()) {
|
||||||
isThereABungeeChannel = true;
|
isThereABungeeChannel = true;
|
||||||
}
|
}
|
||||||
@ -45,9 +48,9 @@ public class Kickchannelall implements VentureCommand {
|
|||||||
player.clearListening();
|
player.clearListening();
|
||||||
sender.sendMessage(LocalizedMessage.KICK_CHANNEL_ALL_SENDER.toString()
|
sender.sendMessage(LocalizedMessage.KICK_CHANNEL_ALL_SENDER.toString()
|
||||||
.replace("{player}", player.getName()));
|
.replace("{player}", player.getName()));
|
||||||
player.addListening(ChatChannel.getDefaultChannel().getName());
|
player.addListening(configService.getDefaultChannel().getName());
|
||||||
player.setCurrentChannel(ChatChannel.getDefaultChannel());
|
player.setCurrentChannel(configService.getDefaultChannel());
|
||||||
if (ChatChannel.getDefaultChannel().getBungee()) {
|
if (configService.getDefaultChannel().getBungee()) {
|
||||||
isThereABungeeChannel = true;
|
isThereABungeeChannel = true;
|
||||||
}
|
}
|
||||||
if (isThereABungeeChannel) {
|
if (isThereABungeeChannel) {
|
||||||
@ -57,8 +60,8 @@ public class Kickchannelall implements VentureCommand {
|
|||||||
player.getPlayer().sendMessage(LocalizedMessage.KICK_CHANNEL_ALL_PLAYER.toString());
|
player.getPlayer().sendMessage(LocalizedMessage.KICK_CHANNEL_ALL_PLAYER.toString());
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.MUST_LISTEN_ONE_CHANNEL.toString());
|
player.getPlayer().sendMessage(LocalizedMessage.MUST_LISTEN_ONE_CHANNEL.toString());
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(ChatChannel.getDefaultColor().toUpperCase()) + "")
|
.replace("{channel_color}", ChatColor.valueOf(configService.getDefaultColor().toUpperCase()) + "")
|
||||||
.replace("{channel_name}", ChatChannel.getDefaultChannel().getName()));
|
.replace("{channel_name}", configService.getDefaultChannel().getName()));
|
||||||
} else {
|
} else {
|
||||||
player.setModified(true);
|
player.setModified(true);
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,12 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Leave implements VentureCommand {
|
public class Leave implements VentureCommand {
|
||||||
@ -19,6 +20,8 @@ public class Leave implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -28,7 +31,7 @@ public class Leave implements VentureCommand {
|
|||||||
}
|
}
|
||||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = configService.getChannel(args[0]);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
||||||
.replace("{args}", args[0]));
|
.replace("{args}", args[0]));
|
||||||
@ -40,15 +43,15 @@ public class Leave implements VentureCommand {
|
|||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
boolean isThereABungeeChannel = channel.getBungee();
|
boolean isThereABungeeChannel = channel.getBungee();
|
||||||
if (mcp.getListening().size() == 0) {
|
if (mcp.getListening().size() == 0) {
|
||||||
mcp.addListening(ChatChannel.getDefaultChannel().getName());
|
mcp.addListening(configService.getDefaultChannel().getName());
|
||||||
mcp.setCurrentChannel(ChatChannel.getDefaultChannel());
|
mcp.setCurrentChannel(configService.getDefaultChannel());
|
||||||
if (ChatChannel.getDefaultChannel().getBungee()) {
|
if (configService.getDefaultChannel().getBungee()) {
|
||||||
isThereABungeeChannel = true;
|
isThereABungeeChannel = true;
|
||||||
}
|
}
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.MUST_LISTEN_ONE_CHANNEL.toString());
|
mcp.getPlayer().sendMessage(LocalizedMessage.MUST_LISTEN_ONE_CHANNEL.toString());
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(ChatChannel.getDefaultColor().toUpperCase()) + "")
|
.replace("{channel_color}", ChatColor.valueOf(configService.getDefaultColor().toUpperCase()) + "")
|
||||||
.replace("{channel_name}", ChatChannel.getDefaultChannel().getName()));
|
.replace("{channel_name}", configService.getDefaultChannel().getName()));
|
||||||
}
|
}
|
||||||
if (isThereABungeeChannel) {
|
if (isThereABungeeChannel) {
|
||||||
pluginMessageController.synchronize(mcp, true);
|
pluginMessageController.synchronize(mcp, true);
|
||||||
|
@ -6,11 +6,12 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Listen implements VentureCommand {
|
public class Listen implements VentureCommand {
|
||||||
@ -18,6 +19,8 @@ public class Listen implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -27,7 +30,7 @@ public class Listen implements VentureCommand {
|
|||||||
}
|
}
|
||||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = configService.getChannel(args[0]);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
||||||
.replace("{args}", args[0]));
|
.replace("{args}", args[0]));
|
||||||
|
@ -5,10 +5,10 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
|
||||||
public class Me implements VentureCommand {
|
public class Me implements VentureCommand {
|
||||||
|
@ -15,12 +15,12 @@ import org.bukkit.util.StringUtil;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
|
||||||
public class MessageCommandExecutor implements TabExecutor {
|
public class MessageCommandExecutor implements TabExecutor {
|
||||||
@ -109,7 +109,7 @@ public class MessageCommandExecutor implements TabExecutor {
|
|||||||
mcp.setReplyPlayer(player.getUuid());
|
mcp.setReplyPlayer(player.getUuid());
|
||||||
player.getPlayer().sendMessage(send);
|
player.getPlayer().sendMessage(send);
|
||||||
mcp.getPlayer().sendMessage(echo);
|
mcp.getPlayer().sendMessage(echo);
|
||||||
if (player.hasNotifications()) {
|
if (player.isNotifications()) {
|
||||||
formatService.playMessageSound(player);
|
formatService.playMessageSound(player);
|
||||||
}
|
}
|
||||||
if (!mcp.getPlayer().hasPermission("venturechat.spy.override")) {
|
if (!mcp.getPlayer().hasPermission("venturechat.spy.override")) {
|
||||||
|
@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -15,13 +15,14 @@ import org.bukkit.util.StringUtil;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Mute implements VentureCommand {
|
public class Mute implements VentureCommand {
|
||||||
private static final List<String> COMMON_MUTE_TIMES = Collections.unmodifiableList(Arrays.asList(new String[]{"12h", "15m", "1d", "1h", "1m", "30s"}));
|
private static final List<String> COMMON_MUTE_TIMES = Collections.unmodifiableList(Arrays.asList(new String[]{"12h", "15m", "1d", "1h", "1m", "30s"}));
|
||||||
@ -30,6 +31,8 @@ public class Mute implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -39,8 +42,8 @@ public class Mute implements VentureCommand {
|
|||||||
.replace("{args}", "[channel] [player] {time} {reason}"));
|
.replace("{args}", "[channel] [player] {time} {reason}"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ChatChannel.isChannel(args[0])) {
|
if (configService.isChannel(args[0])) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = configService.getChannel(args[0]);
|
||||||
if (channel.isMutable()) {
|
if (channel.isMutable()) {
|
||||||
long datetime = System.currentTimeMillis();
|
long datetime = System.currentTimeMillis();
|
||||||
long time = 0;
|
long time = 0;
|
||||||
@ -167,13 +170,13 @@ public class Mute implements VentureCommand {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
StringUtil.copyPartialMatches(args[0], ChatChannel.getChatChannels().stream().map(ChatChannel::getName).collect(Collectors.toList()), completions);
|
StringUtil.copyPartialMatches(args[0], configService.getChatChannels().stream().map(ChatChannel::getName).collect(Collectors.toList()), completions);
|
||||||
Collections.sort(completions);
|
Collections.sort(completions);
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (ChatChannel.isChannel(args[0])) {
|
if (configService.isChannel(args[0])) {
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(args[0]);
|
ChatChannel chatChannelObj = configService.getChannel(args[0]);
|
||||||
if (chatChannelObj.getBungee()) {
|
if (chatChannelObj.getBungee()) {
|
||||||
StringUtil.copyPartialMatches(args[1], playerApiService.getNetworkPlayerNames(), completions);
|
StringUtil.copyPartialMatches(args[1], playerApiService.getNetworkPlayerNames(), completions);
|
||||||
Collections.sort(completions);
|
Collections.sort(completions);
|
||||||
|
@ -4,19 +4,22 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Muteall implements VentureCommand {
|
public class Muteall implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -43,7 +46,7 @@ public class Muteall implements VentureCommand {
|
|||||||
}
|
}
|
||||||
if (reason.isEmpty()) {
|
if (reason.isEmpty()) {
|
||||||
boolean bungee = false;
|
boolean bungee = false;
|
||||||
for (ChatChannel channel : ChatChannel.getChatChannels()) {
|
for (ChatChannel channel : configService.getChatChannels()) {
|
||||||
if (channel.isMutable()) {
|
if (channel.isMutable()) {
|
||||||
player.addMute(channel.getName());
|
player.addMute(channel.getName());
|
||||||
if (channel.getBungee()) {
|
if (channel.getBungee()) {
|
||||||
@ -63,7 +66,7 @@ public class Muteall implements VentureCommand {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
boolean bungee = false;
|
boolean bungee = false;
|
||||||
for (ChatChannel channel : ChatChannel.getChatChannels()) {
|
for (ChatChannel channel : configService.getChatChannels()) {
|
||||||
if (channel.isMutable()) {
|
if (channel.isMutable()) {
|
||||||
player.addMute(channel.getName(), reason);
|
player.addMute(channel.getName(), reason);
|
||||||
if (channel.getBungee()) {
|
if (channel.getBungee()) {
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
@ -23,7 +23,7 @@ public class Notifications implements VentureCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
||||||
if (!mcp.hasNotifications()) {
|
if (!mcp.isNotifications()) {
|
||||||
mcp.setNotifications(true);
|
mcp.setNotifications(true);
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.NOTIFICATIONS_ON.toString());
|
mcp.getPlayer().sendMessage(LocalizedMessage.NOTIFICATIONS_ON.toString());
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package venture.Aust1n46.chat.controllers.commands;
|
package venture.Aust1n46.chat.controllers.commands;
|
||||||
|
|
||||||
import static venture.Aust1n46.chat.VentureChat.LINE_LENGTH;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.LINE_LENGTH;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -8,12 +8,12 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Party implements VentureCommand {
|
public class Party implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package venture.Aust1n46.chat.controllers.commands;
|
package venture.Aust1n46.chat.controllers.commands;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -16,16 +16,16 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatMessage;
|
import venture.Aust1n46.chat.model.ChatMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class Removemessage implements VentureCommand {
|
public class Removemessage implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
@ -36,6 +36,8 @@ public class Removemessage implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
private PacketContainer emptyLinePacketContainer;
|
private PacketContainer emptyLinePacketContainer;
|
||||||
private WrappedChatComponent messageDeletedComponentPlayer;
|
private WrappedChatComponent messageDeletedComponentPlayer;
|
||||||
@ -62,7 +64,7 @@ public class Removemessage implements VentureCommand {
|
|||||||
sender.sendMessage(LocalizedMessage.INVALID_HASH.toString());
|
sender.sendMessage(LocalizedMessage.INVALID_HASH.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length > 1 && ChatChannel.isChannel(args[1]) && ChatChannel.getChannel(args[1]).getBungee()) {
|
if (args.length > 1 && configService.isChannel(args[1]) && configService.getChannel(args[1]).getBungee()) {
|
||||||
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
|
||||||
DataOutputStream out = new DataOutputStream(byteOutStream);
|
DataOutputStream out = new DataOutputStream(byteOutStream);
|
||||||
try {
|
try {
|
||||||
|
@ -9,13 +9,13 @@ import org.bukkit.entity.Player;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
|
||||||
public class Reply implements VentureCommand {
|
public class Reply implements VentureCommand {
|
||||||
@ -101,7 +101,7 @@ public class Reply implements VentureCommand {
|
|||||||
}
|
}
|
||||||
player.getPlayer().sendMessage(send);
|
player.getPlayer().sendMessage(send);
|
||||||
mcp.getPlayer().sendMessage(echo);
|
mcp.getPlayer().sendMessage(echo);
|
||||||
if (player.hasNotifications()) {
|
if (player.isNotifications()) {
|
||||||
formatService.playMessageSound(player);
|
formatService.playMessageSound(player);
|
||||||
}
|
}
|
||||||
player.setReplyPlayer(mcp.getUuid());
|
player.setReplyPlayer(mcp.getUuid());
|
||||||
|
@ -4,11 +4,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Setchannel implements VentureCommand {
|
public class Setchannel implements VentureCommand {
|
||||||
@ -16,6 +17,8 @@ public class Setchannel implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -32,7 +35,7 @@ public class Setchannel implements VentureCommand {
|
|||||||
.replace("{args}", args[0]));
|
.replace("{args}", args[0]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
ChatChannel channel = configService.getChannel(args[1]);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
sender.sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
sender.sendMessage(LocalizedMessage.INVALID_CHANNEL.toString()
|
||||||
.replace("{args}", args[1]));
|
.replace("{args}", args[1]));
|
||||||
|
@ -4,11 +4,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Setchannelall implements VentureCommand {
|
public class Setchannelall implements VentureCommand {
|
||||||
@ -16,6 +17,8 @@ public class Setchannelall implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -33,7 +36,7 @@ public class Setchannelall implements VentureCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean isThereABungeeChannel = false;
|
boolean isThereABungeeChannel = false;
|
||||||
for (ChatChannel channel : ChatChannel.getChatChannels()) {
|
for (ChatChannel channel : configService.getChatChannels()) {
|
||||||
if (channel.hasPermission()) {
|
if (channel.hasPermission()) {
|
||||||
if (!player.isOnline()) {
|
if (!player.isOnline()) {
|
||||||
sender.sendMessage(LocalizedMessage.PLAYER_OFFLINE_NO_PERMISSIONS_CHECK.toString());
|
sender.sendMessage(LocalizedMessage.PLAYER_OFFLINE_NO_PERMISSIONS_CHECK.toString());
|
||||||
|
@ -6,8 +6,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
@ -14,11 +14,12 @@ import org.bukkit.util.StringUtil;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Unmute implements VentureCommand {
|
public class Unmute implements VentureCommand {
|
||||||
@ -26,6 +27,8 @@ public class Unmute implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -35,8 +38,8 @@ public class Unmute implements VentureCommand {
|
|||||||
.replace("{args}", "[channel] [player]"));
|
.replace("{args}", "[channel] [player]"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ChatChannel.isChannel(args[0])) {
|
if (configService.isChannel(args[0])) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = configService.getChannel(args[0]);
|
||||||
if (channel.getBungee()) {
|
if (channel.getBungee()) {
|
||||||
sendBungeeCordUnmute(sender, args[1], channel);
|
sendBungeeCordUnmute(sender, args[1], channel);
|
||||||
return;
|
return;
|
||||||
@ -77,13 +80,13 @@ public class Unmute implements VentureCommand {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
StringUtil.copyPartialMatches(args[0], ChatChannel.getChatChannels().stream().map(ChatChannel::getName).collect(Collectors.toList()), completions);
|
StringUtil.copyPartialMatches(args[0], configService.getChatChannels().stream().map(ChatChannel::getName).collect(Collectors.toList()), completions);
|
||||||
Collections.sort(completions);
|
Collections.sort(completions);
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (ChatChannel.isChannel(args[0])) {
|
if (configService.isChannel(args[0])) {
|
||||||
ChatChannel chatChannelObj = ChatChannel.getChannel(args[0]);
|
ChatChannel chatChannelObj = configService.getChannel(args[0]);
|
||||||
if (chatChannelObj.getBungee()) {
|
if (chatChannelObj.getBungee()) {
|
||||||
StringUtil.copyPartialMatches(args[1], playerApiService.getNetworkPlayerNames(), completions);
|
StringUtil.copyPartialMatches(args[1], playerApiService.getNetworkPlayerNames(), completions);
|
||||||
Collections.sort(completions);
|
Collections.sort(completions);
|
||||||
|
@ -4,11 +4,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
public class Unmuteall implements VentureCommand {
|
public class Unmuteall implements VentureCommand {
|
||||||
@ -16,6 +17,8 @@ public class Unmuteall implements VentureCommand {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -33,7 +36,7 @@ public class Unmuteall implements VentureCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean bungee = false;
|
boolean bungee = false;
|
||||||
for (ChatChannel channel : ChatChannel.getChatChannels()) {
|
for (ChatChannel channel : configService.getChatChannels()) {
|
||||||
player.removeMute(channel.getName());
|
player.removeMute(channel.getName());
|
||||||
if (channel.getBungee()) {
|
if (channel.getBungee()) {
|
||||||
bungee = true;
|
bungee = true;
|
||||||
|
@ -16,21 +16,24 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.GuiSlot;
|
import venture.Aust1n46.chat.model.GuiSlot;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
import venture.Aust1n46.chat.utilities.VersionHandler;
|
||||||
|
|
||||||
public class VentureChatGui implements VentureCommand {
|
public class VentureChatGui implements VentureCommand {
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChat plugin;
|
private VentureChat plugin;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String command, String[] args) {
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
@ -52,8 +55,8 @@ public class VentureChatGui implements VentureCommand {
|
|||||||
.replace("{args}", args[0]));
|
.replace("{args}", args[0]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ChatChannel.isChannel(args[1])) {
|
if (configService.isChannel(args[1])) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[1]);
|
ChatChannel channel = configService.getChannel(args[1]);
|
||||||
final int hash;
|
final int hash;
|
||||||
try {
|
try {
|
||||||
hash = Integer.parseInt(args[2]);
|
hash = Integer.parseInt(args[2]);
|
||||||
@ -108,7 +111,7 @@ public class VentureChatGui implements VentureCommand {
|
|||||||
skull.setDurability((short) 3);
|
skull.setDurability((short) 3);
|
||||||
inv.setItem(0, skull);
|
inv.setItem(0, skull);
|
||||||
|
|
||||||
for (GuiSlot g : GuiSlot.getGuiSlots()) {
|
for (GuiSlot g : configService.getGuiSlots()) {
|
||||||
if (!g.hasPermission() || mcp.getPlayer().hasPermission(g.getPermission())) {
|
if (!g.hasPermission() || mcp.getPlayer().hasPermission(g.getPermission())) {
|
||||||
if (this.checkSlot(g.getSlot())) {
|
if (this.checkSlot(g.getSlot())) {
|
||||||
plugin.getServer().getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&cGUI: " + g.getName() + " has invalid slot: " + g.getSlot() + "!"));
|
plugin.getServer().getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&cGUI: " + g.getName() + " has invalid slot: " + g.getSlot() + "!"));
|
||||||
@ -165,7 +168,7 @@ public class VentureChatGui implements VentureCommand {
|
|||||||
skull.setDurability((short) 3);
|
skull.setDurability((short) 3);
|
||||||
inv.setItem(0, skull);
|
inv.setItem(0, skull);
|
||||||
|
|
||||||
for (GuiSlot g : GuiSlot.getGuiSlots()) {
|
for (GuiSlot g : configService.getGuiSlots()) {
|
||||||
if (!g.hasPermission() || mcp.getPlayer().hasPermission(g.getPermission())) {
|
if (!g.hasPermission() || mcp.getPlayer().hasPermission(g.getPermission())) {
|
||||||
if (this.checkSlot(g.getSlot())) {
|
if (this.checkSlot(g.getSlot())) {
|
||||||
plugin.getServer().getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&cGUI: " + g.getName() + " has invalid slot: " + g.getSlot() + "!"));
|
plugin.getServer().getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&cGUI: " + g.getName() + " has invalid slot: " + g.getSlot() + "!"));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package venture.Aust1n46.chat.controllers.commands;
|
package venture.Aust1n46.chat.controllers.commands;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.InternalMessage;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import venture.Aust1n46.chat.localization.InternalMessage;
|
||||||
//import net.md_5.bungee.api.chat.ClickEvent;
|
//import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
//import net.md_5.bungee.api.chat.ComponentBuilder;
|
//import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
//import net.md_5.bungee.api.chat.HoverEvent;
|
//import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package venture.Aust1n46.chat;
|
package venture.Aust1n46.chat.initiators.application;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -11,13 +11,14 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
|
|||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.Localization;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import net.milkbowl.vault.chat.Chat;
|
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
import venture.Aust1n46.chat.VentureChatPlaceholders;
|
||||||
|
import venture.Aust1n46.chat.VentureChatPluginModule;
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
||||||
import venture.Aust1n46.chat.initiators.listeners.ChatListener;
|
import venture.Aust1n46.chat.initiators.listeners.ChatListener;
|
||||||
@ -27,13 +28,9 @@ import venture.Aust1n46.chat.initiators.listeners.PacketListener;
|
|||||||
import venture.Aust1n46.chat.initiators.listeners.SignListener;
|
import venture.Aust1n46.chat.initiators.listeners.SignListener;
|
||||||
import venture.Aust1n46.chat.initiators.listeners.VentureCommandExecutor;
|
import venture.Aust1n46.chat.initiators.listeners.VentureCommandExecutor;
|
||||||
import venture.Aust1n46.chat.initiators.schedulers.UnmuteScheduler;
|
import venture.Aust1n46.chat.initiators.schedulers.UnmuteScheduler;
|
||||||
import venture.Aust1n46.chat.model.Alias;
|
import venture.Aust1n46.chat.localization.Localization;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
|
||||||
import venture.Aust1n46.chat.model.GuiSlot;
|
|
||||||
import venture.Aust1n46.chat.model.JsonFormat;
|
|
||||||
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VentureChat Minecraft plugin for servers running Spigot or Paper software.
|
* VentureChat Minecraft plugin for servers running Spigot or Paper software.
|
||||||
@ -42,10 +39,6 @@ import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
|||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
||||||
public static final boolean ASYNC = true;
|
|
||||||
public static final boolean SYNC = false;
|
|
||||||
public static final int LINE_LENGTH = 40;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LoginListener loginListener;
|
private LoginListener loginListener;
|
||||||
@Inject
|
@Inject
|
||||||
@ -55,30 +48,25 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
@Inject
|
@Inject
|
||||||
private CommandListener commandListener;
|
private CommandListener commandListener;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureCommandExecutor commandExecutor;
|
|
||||||
@Inject
|
|
||||||
private PacketListener packetListener;
|
private PacketListener packetListener;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlaceholders ventureChatPlaceholders;
|
private VentureChatPlaceholders ventureChatPlaceholders;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatFormatService formatter;
|
|
||||||
@Inject
|
|
||||||
private VentureChatDatabaseService databaseService;
|
|
||||||
@Inject
|
|
||||||
private VentureChatSpigotFlatFileController spigotFlatFileService;
|
private VentureChatSpigotFlatFileController spigotFlatFileService;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
@Inject
|
@Inject
|
||||||
private UnmuteScheduler unmuteScheduler;
|
|
||||||
@Inject
|
|
||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
|
|
||||||
private Permission permission = null;
|
private Permission permission = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
VentureChatPluginModule pluginModule = new VentureChatPluginModule(this);
|
final VentureChatPluginModule pluginModule = new VentureChatPluginModule(this);
|
||||||
pluginModule.createInjector().injectMembers(this);
|
final Injector injector = Guice.createInjector(pluginModule);
|
||||||
|
injector.injectMembers(this);
|
||||||
|
injector.injectMembers(new VentureCommandExecutor());
|
||||||
|
injector.injectMembers(new UnmuteScheduler());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Initializing..."));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Initializing..."));
|
||||||
@ -89,25 +77,23 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Config not found! Generating file."));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Config not found! Generating file."));
|
||||||
saveDefaultConfig();
|
saveDefaultConfig();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Config found! Loading file."));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Config found! Loading file."));
|
||||||
}
|
}
|
||||||
|
|
||||||
saveResource("example_config_always_up_to_date!.yml", true);
|
saveResource("example_config_always_up_to_date!.yml", true);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch(Exception ex) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - &cCould not load configuration! Something unexpected went wrong!"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - &cCould not load configuration! Something unexpected went wrong!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Checking for Vault..."));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Checking for Vault..."));
|
||||||
|
|
||||||
if(!setupPermissions() || !setupChat()) {
|
if (!setupPermissions()) {
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - &cCould not find Vault and/or a Vault compatible permissions plugin!"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - &cCould not find Vault and/or a Vault compatible permissions plugin!"));
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeConfigReaders();
|
Localization.initialize(this);
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Loading player data"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Loading player data"));
|
||||||
spigotFlatFileService.loadLegacyPlayerData();
|
spigotFlatFileService.loadLegacyPlayerData();
|
||||||
@ -115,9 +101,8 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
|
|
||||||
registerListeners();
|
registerListeners();
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Registering Listeners"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Registering Listeners"));
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Attaching to Executors"));
|
|
||||||
|
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Establishing BungeeCord"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Registering BungeeCord channels"));
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, PluginMessageController.PLUGIN_MESSAGING_CHANNEL);
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, PluginMessageController.PLUGIN_MESSAGING_CHANNEL);
|
||||||
Bukkit.getMessenger().registerIncomingPluginChannel(this, PluginMessageController.PLUGIN_MESSAGING_CHANNEL, this);
|
Bukkit.getMessenger().registerIncomingPluginChannel(this, PluginMessageController.PLUGIN_MESSAGING_CHANNEL, this);
|
||||||
|
|
||||||
@ -129,7 +114,7 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Enabling Jobs Formatting"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Enabling Jobs Formatting"));
|
||||||
}
|
}
|
||||||
if (pluginManager.isPluginEnabled("Factions")) {
|
if (pluginManager.isPluginEnabled("Factions")) {
|
||||||
String version = pluginManager.getPlugin("Factions").getDescription().getVersion();
|
final String version = pluginManager.getPlugin("Factions").getDescription().getVersion();
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Enabling Factions Formatting version " + version));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Enabling Factions Formatting version " + version));
|
||||||
}
|
}
|
||||||
if (pluginManager.isPluginEnabled("PlaceholderAPI")) {
|
if (pluginManager.isPluginEnabled("PlaceholderAPI")) {
|
||||||
@ -143,11 +128,6 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Enabled Successfully"));
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Enabled Successfully"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoad() {
|
|
||||||
//new DebugLoggingProvider().enableDebugLogging();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
spigotFlatFileService.savePlayerData();
|
spigotFlatFileService.savePlayerData();
|
||||||
@ -188,23 +168,6 @@ public class VentureChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
return (permission != null);
|
return (permission != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupChat() {
|
|
||||||
RegisteredServiceProvider<Chat> chatProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
|
|
||||||
Chat chat = null;
|
|
||||||
if(chatProvider != null) {
|
|
||||||
chat = chatProvider.getProvider();
|
|
||||||
}
|
|
||||||
return(chat != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initializeConfigReaders() {
|
|
||||||
Localization.initialize(this);
|
|
||||||
Alias.initialize(this);
|
|
||||||
JsonFormat.initialize(this);
|
|
||||||
GuiSlot.initialize(this);
|
|
||||||
ChatChannel.initialize(this, formatter, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Permission getVaultPermission() {
|
public Permission getVaultPermission() {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
@ -22,18 +22,19 @@ import com.palmergames.bukkit.towny.TownyUniverse;
|
|||||||
import com.palmergames.bukkit.towny.object.Resident;
|
import com.palmergames.bukkit.towny.object.Resident;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.api.events.VentureChatEvent;
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import net.essentialsx.api.v2.services.discord.DiscordService;
|
import net.essentialsx.api.v2.services.discord.DiscordService;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import venture.Aust1n46.chat.api.events.VentureChatEvent;
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
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.
|
//This class listens to chat through the chat event and handles the bulk of the chat channels and formatting.
|
||||||
@Singleton
|
@Singleton
|
||||||
@ -49,6 +50,8 @@ public class ChatListener implements Listener {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
// this event isn't always asynchronous even though the event's name starts with "Async"
|
// this event isn't always asynchronous even though the event's name starts with "Async"
|
||||||
// blame md_5 for that one
|
// blame md_5 for that one
|
||||||
@ -151,7 +154,7 @@ public class ChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
tp.getPlayer().sendMessage(send);
|
tp.getPlayer().sendMessage(send);
|
||||||
mcp.getPlayer().sendMessage(echo);
|
mcp.getPlayer().sendMessage(echo);
|
||||||
if(tp.hasNotifications()) {
|
if(tp.isNotifications()) {
|
||||||
formatService.playMessageSound(tp);
|
formatService.playMessageSound(tp);
|
||||||
}
|
}
|
||||||
mcp.setReplyPlayer(tp.getUuid());
|
mcp.setReplyPlayer(tp.getUuid());
|
||||||
@ -256,7 +259,7 @@ public class ChatListener implements Listener {
|
|||||||
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_NO_PERMISSION.toString());
|
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_NO_PERMISSION.toString());
|
||||||
mcp.setQuickChat(false);
|
mcp.setQuickChat(false);
|
||||||
mcp.removeListening(eventChannel.getName());
|
mcp.removeListening(eventChannel.getName());
|
||||||
mcp.setCurrentChannel(ChatChannel.getDefaultChannel());
|
mcp.setCurrentChannel(configService.getDefaultChannel());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(eventChannel.hasSpeakPermission() && !mcp.getPlayer().hasPermission(eventChannel.getSpeakPermission())) {
|
if(eventChannel.hasSpeakPermission() && !mcp.getPlayer().hasPermission(eventChannel.getSpeakPermission())) {
|
||||||
@ -364,7 +367,7 @@ public class ChatListener implements Listener {
|
|||||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||||
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
for(VentureChatPlayer p : playerApiService.getOnlineMineverseChatPlayers()) {
|
||||||
if(p.getPlayer() != mcp.getPlayer()) {
|
if(p.getPlayer() != mcp.getPlayer()) {
|
||||||
if(!p.isListening(eventChannel.getName())) {
|
if(!configService.isListening(p, eventChannel.getName())) {
|
||||||
recipients.remove(p.getPlayer());
|
recipients.remove(p.getPlayer());
|
||||||
recipientCount--;
|
recipientCount--;
|
||||||
continue;
|
continue;
|
||||||
@ -560,9 +563,10 @@ public class ChatListener implements Listener {
|
|||||||
if(plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
if(plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
||||||
System.out.println(out.size() + " bytes size with json");
|
System.out.println(out.size() + " bytes size with json");
|
||||||
}
|
}
|
||||||
out.writeUTF(plugin.getVaultPermission().getPrimaryGroup(mcp.getPlayer()));
|
out.writeUTF(plugin.getVaultPermission().getPrimaryGroup(mcp.getPlayer())); // look into not sending this
|
||||||
// look into not sending this
|
@SuppressWarnings("deprecation") // Paper Deprecated
|
||||||
out.writeUTF(mcp.getPlayer().getDisplayName());
|
final String displayName = mcp.getPlayer().getDisplayName();
|
||||||
|
out.writeUTF(displayName);
|
||||||
pluginMessageController.sendPluginMessage(byteOutStream);
|
pluginMessageController.sendPluginMessage(byteOutStream);
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
@ -23,16 +23,17 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.Alias;
|
import venture.Aust1n46.chat.model.Alias;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.GuiSlot;
|
import venture.Aust1n46.chat.model.GuiSlot;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
import venture.Aust1n46.chat.utilities.VersionHandler;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
import venture.Aust1n46.chat.service.VentureChatDatabaseService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
|
||||||
@ -50,6 +51,8 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws FileNotFoundException {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws FileNotFoundException {
|
||||||
@ -94,7 +97,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
databaseService.writeVentureChat(mcp.getUuid().toString(), mcp.getName(), "Local", "Command_Component", event.getMessage().replace("'", "''"), "Command");
|
databaseService.writeVentureChat(mcp.getUuid().toString(), mcp.getName(), "Local", "Command_Component", event.getMessage().replace("'", "''"), "Command");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Alias a : Alias.getAliases()) {
|
for(Alias a : configService.getAliases()) {
|
||||||
if(message.toLowerCase().substring(1).split(" ")[0].equals(a.getName().toLowerCase())) {
|
if(message.toLowerCase().substring(1).split(" ")[0].equals(a.getName().toLowerCase())) {
|
||||||
for(String s : a.getComponents()) {
|
for(String s : a.getComponents()) {
|
||||||
if(!mcp.getPlayer().hasPermission(a.getPermission()) && a.hasPermission()) {
|
if(!mcp.getPlayer().hasPermission(a.getPermission()) && a.hasPermission()) {
|
||||||
@ -145,8 +148,8 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ChatChannel.areAliasesRegisteredAsCommands()) {
|
if(!configService.areAliasesRegisteredAsCommands()) {
|
||||||
for(ChatChannel channel : ChatChannel.getChatChannels()) {
|
for(ChatChannel channel : configService.getChatChannels()) {
|
||||||
if(!channel.hasPermission() || mcp.getPlayer().hasPermission(channel.getPermission())) {
|
if(!channel.hasPermission() || mcp.getPlayer().hasPermission(channel.getPermission())) {
|
||||||
if(message.equals("/" + channel.getAlias())) {
|
if(message.equals("/" + channel.getAlias())) {
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
||||||
@ -217,7 +220,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
VentureChatPlayer mcp = playerApiService.getOnlineMineverseChatPlayer((Player) sender);
|
||||||
for(ChatChannel channel : ChatChannel.getChatChannels()) {
|
for(ChatChannel channel : configService.getChatChannels()) {
|
||||||
if(command.getName().toLowerCase().equals(channel.getAlias())) {
|
if(command.getName().toLowerCase().equals(channel.getAlias())) {
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid command: /" + channel.getAlias() + " message");
|
mcp.getPlayer().sendMessage(ChatColor.RED + "Invalid command: /" + channel.getAlias() + " message");
|
||||||
@ -253,7 +256,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
VentureChatPlayer target = playerApiService.getMineverseChatPlayer(playerName);
|
VentureChatPlayer target = playerApiService.getMineverseChatPlayer(playerName);
|
||||||
ItemStack skull = e.getInventory().getItem(0);
|
ItemStack skull = e.getInventory().getItem(0);
|
||||||
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
|
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
|
||||||
ChatChannel channel = ChatChannel.getChannel(ChatColor.stripColor(skullMeta.getLore().get(0)).replace("Channel: ", ""));
|
ChatChannel channel = configService.getChannel(ChatColor.stripColor(skullMeta.getLore().get(0)).replace("Channel: ", ""));
|
||||||
int hash = Integer.parseInt(ChatColor.stripColor(skullMeta.getLore().get(1).replace("Hash: ", "")));
|
int hash = Integer.parseInt(ChatColor.stripColor(skullMeta.getLore().get(1).replace("Hash: ", "")));
|
||||||
if(VersionHandler.is1_7()) {
|
if(VersionHandler.is1_7()) {
|
||||||
if(item.getType() == Material.BEDROCK) {
|
if(item.getType() == Material.BEDROCK) {
|
||||||
@ -265,7 +268,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
mcp.getPlayer().closeInventory();
|
mcp.getPlayer().closeInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(GuiSlot g : GuiSlot.getGuiSlots()) {
|
for(GuiSlot g : configService.getGuiSlots()) {
|
||||||
if(g.getIcon() == item.getType() && g.getDurability() == item.getDurability() && g.getSlot() == e.getSlot()) {
|
if(g.getIcon() == item.getType() && g.getDurability() == item.getDurability() && g.getSlot() == e.getSlot()) {
|
||||||
String command = g.getCommand().replace("{channel}", channel.getName()).replace("{hash}", hash + "");
|
String command = g.getCommand().replace("{channel}", channel.getName()).replace("{hash}", hash + "");
|
||||||
if(target != null) {
|
if(target != null) {
|
||||||
|
@ -12,15 +12,17 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.Logger;
|
import venture.Aust1n46.chat.Logger;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
|
import venture.Aust1n46.chat.model.JsonFormat;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.UUIDService;
|
import venture.Aust1n46.chat.service.UUIDService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages player login and logout events.
|
* Manages player login and logout events.
|
||||||
@ -40,6 +42,8 @@ public class LoginListener implements Listener {
|
|||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
@Inject
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
@Inject
|
||||||
private Logger log;
|
private Logger log;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
@ -56,21 +60,22 @@ public class LoginListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleNameChange(VentureChatPlayer mcp, Player eventPlayerInstance) {
|
private void handleNameChange(VentureChatPlayer mcp, Player eventPlayerInstance) {
|
||||||
plugin.getServer().getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Detected Name Change. Old Name:&c " + mcp.getName() + " &eNew Name:&c " + eventPlayerInstance.getName()));
|
plugin.getServer().getConsoleSender().sendMessage(
|
||||||
|
FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - Detected Name Change. Old Name:&c " + mcp.getName() + " &eNew Name:&c " + eventPlayerInstance.getName()));
|
||||||
playerApiService.removeNameFromMap(mcp.getName());
|
playerApiService.removeNameFromMap(mcp.getName());
|
||||||
mcp.setName(eventPlayerInstance.getName());
|
mcp.setName(eventPlayerInstance.getName());
|
||||||
playerApiService.addNameToMap(mcp);
|
playerApiService.addNameToMap(mcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) throws Exception {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
VentureChatPlayer mcp = playerApiService.getMineverseChatPlayer(event.getPlayer());
|
VentureChatPlayer mcp = playerApiService.getMineverseChatPlayer(event.getPlayer());
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String name = player.getName();
|
String name = player.getName();
|
||||||
if (mcp == null) {
|
if (mcp == null) {
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
mcp = new VentureChatPlayer(uuid, name);
|
mcp = new VentureChatPlayer(uuid, name, configService.getDefaultChannel());
|
||||||
playerApiService.addMineverseChatPlayerToMap(mcp);
|
playerApiService.addMineverseChatPlayerToMap(mcp);
|
||||||
playerApiService.addNameToMap(mcp);
|
playerApiService.addNameToMap(mcp);
|
||||||
}
|
}
|
||||||
@ -80,33 +85,29 @@ public class LoginListener implements Listener {
|
|||||||
handleNameChange(mcp, event.getPlayer());
|
handleNameChange(mcp, event.getPlayer());
|
||||||
}
|
}
|
||||||
mcp.setOnline(true);
|
mcp.setOnline(true);
|
||||||
|
mcp.setPlayer(player);
|
||||||
mcp.setHasPlayed(false);
|
mcp.setHasPlayed(false);
|
||||||
playerApiService.addMineverseChatOnlinePlayerToMap(mcp);
|
playerApiService.addMineverseChatOnlinePlayerToMap(mcp);
|
||||||
mcp.setJsonFormat();
|
String jsonFormat = mcp.getJsonFormat();
|
||||||
for(ChatChannel ch : ChatChannel.getAutojoinList()) {
|
for (JsonFormat j : configService.getJsonFormats()) {
|
||||||
|
if (mcp.getPlayer().hasPermission("venturechat.json." + j.getName())) {
|
||||||
|
if (configService.getJsonFormat(mcp.getJsonFormat()).getPriority() > j.getPriority()) {
|
||||||
|
jsonFormat = j.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mcp.setJsonFormat(jsonFormat);
|
||||||
|
for (ChatChannel ch : configService.getAutojoinList()) {
|
||||||
if (ch.hasPermission()) {
|
if (ch.hasPermission()) {
|
||||||
if (mcp.getPlayer().hasPermission(ch.getPermission())) {
|
if (mcp.getPlayer().hasPermission(ch.getPermission())) {
|
||||||
mcp.addListening(ch.getName());
|
mcp.addListening(ch.getName());
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
mcp.addListening(ch.getName());
|
mcp.addListening(ch.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (configService.isProxyEnabled()) {
|
||||||
try {
|
pluginMessageController.synchronizeWithDelay(mcp, false);
|
||||||
if(plugin.getServer().spigot().getConfig().getBoolean("settings.bungeecord") || plugin.getServer().spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled")) {
|
|
||||||
long delayInTicks = 20L;
|
|
||||||
final VentureChatPlayer sync = mcp;
|
|
||||||
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
pluginMessageController.synchronize(sync, false);
|
|
||||||
}
|
|
||||||
}, delayInTicks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(NoSuchMethodError exception) { // Thrown if server isn't Paper.
|
|
||||||
// Do nothing
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,11 @@ import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.ChatMessage;
|
import venture.Aust1n46.chat.model.ChatMessage;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.VersionHandler;
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
|
||||||
//This class listens for chat packets and intercepts them before they are sent to the Player.
|
//This class listens for chat packets and intercepts them before they are sent to the Player.
|
||||||
|
@ -8,9 +8,9 @@ import org.bukkit.event.block.SignChangeEvent;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
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.
|
//This class listens for text being added to signs, and it formats them to allow colors and formatting.
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -12,7 +12,6 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.commands.Broadcast;
|
import venture.Aust1n46.chat.controllers.commands.Broadcast;
|
||||||
import venture.Aust1n46.chat.controllers.commands.BungeeToggle;
|
import venture.Aust1n46.chat.controllers.commands.BungeeToggle;
|
||||||
import venture.Aust1n46.chat.controllers.commands.Channel;
|
import venture.Aust1n46.chat.controllers.commands.Channel;
|
||||||
@ -50,6 +49,7 @@ import venture.Aust1n46.chat.controllers.commands.Unmute;
|
|||||||
import venture.Aust1n46.chat.controllers.commands.Unmuteall;
|
import venture.Aust1n46.chat.controllers.commands.Unmuteall;
|
||||||
import venture.Aust1n46.chat.controllers.commands.VentureChatGui;
|
import venture.Aust1n46.chat.controllers.commands.VentureChatGui;
|
||||||
import venture.Aust1n46.chat.controllers.commands.Venturechat;
|
import venture.Aust1n46.chat.controllers.commands.Venturechat;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.model.VentureCommand;
|
import venture.Aust1n46.chat.model.VentureCommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,6 +186,7 @@ public class VentureCommandExecutor implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||||
|
if (plugin.isEnabled()) {
|
||||||
commands.put("reply", reply);
|
commands.put("reply", reply);
|
||||||
commands.put("r", reply);
|
commands.put("r", reply);
|
||||||
registerCommand("reply", this);
|
registerCommand("reply", this);
|
||||||
@ -206,6 +207,7 @@ public class VentureCommandExecutor implements TabExecutor {
|
|||||||
registerCommand("whisper", messageCommandExecutor);
|
registerCommand("whisper", messageCommandExecutor);
|
||||||
|
|
||||||
registerCommand("ignore", ignoreCommandExecutor);
|
registerCommand("ignore", ignoreCommandExecutor);
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,14 +7,15 @@ import org.bukkit.scheduler.BukkitScheduler;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
import venture.Aust1n46.chat.controllers.commands.MuteContainer;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
import venture.Aust1n46.chat.model.ChatChannel;
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
public class UnmuteScheduler {
|
public class UnmuteScheduler {
|
||||||
@Inject
|
@Inject
|
||||||
@ -23,6 +24,8 @@ public class UnmuteScheduler {
|
|||||||
private PluginMessageController pluginMessageController;
|
private PluginMessageController pluginMessageController;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public void postConstruct() {
|
public void postConstruct() {
|
||||||
@ -35,8 +38,8 @@ public class UnmuteScheduler {
|
|||||||
Iterator<MuteContainer> iterator = p.getMutes().iterator();
|
Iterator<MuteContainer> iterator = p.getMutes().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
MuteContainer mute = iterator.next();
|
MuteContainer mute = iterator.next();
|
||||||
if(ChatChannel.isChannel(mute.getChannel())) {
|
if(configService.isChannel(mute.getChannel())) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(mute.getChannel());
|
ChatChannel channel = configService.getChannel(mute.getChannel());
|
||||||
long timemark = mute.getDuration();
|
long timemark = mute.getDuration();
|
||||||
if (timemark == 0) {
|
if (timemark == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package mineverse.Aust1n46.chat.localization;
|
package venture.Aust1n46.chat.localization;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Messages internal to the plugin
|
* Messages internal to the plugin
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.localization;
|
package venture.Aust1n46.chat.localization;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -6,8 +6,8 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
//This class is used to create objects of localization for different languages.
|
//This class is used to create objects of localization for different languages.
|
||||||
public class Localization {
|
public class Localization {
|
@ -1,6 +1,6 @@
|
|||||||
package mineverse.Aust1n46.chat.localization;
|
package venture.Aust1n46.chat.localization;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Messages configurable in Messages.yml file.
|
* Messages configurable in Messages.yml file.
|
@ -1,15 +1,11 @@
|
|||||||
package venture.Aust1n46.chat.model;
|
package venture.Aust1n46.chat.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import lombok.Getter;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class Alias {
|
public class Alias {
|
||||||
private static List<Alias> aliases;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int arguments;
|
private int arguments;
|
||||||
private List<String> components;
|
private List<String> components;
|
||||||
@ -22,38 +18,6 @@ public class Alias {
|
|||||||
this.permission = "venturechat." + permission;
|
this.permission = "venturechat." + permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initialize(VentureChat plugin) {
|
|
||||||
aliases = new ArrayList<Alias>();
|
|
||||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("alias");
|
|
||||||
for (String key : cs.getKeys(false)) {
|
|
||||||
String name = key;
|
|
||||||
int arguments = cs.getInt(key + ".arguments", 0);
|
|
||||||
List<String> components = cs.getStringList(key + ".components");
|
|
||||||
String permissions = cs.getString(key + ".permissions", "None");
|
|
||||||
aliases.add(new Alias(name, arguments, components, permissions));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Alias> getAliases() {
|
|
||||||
return aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getArguments() {
|
|
||||||
return arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getComponents() {
|
|
||||||
return components;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPermission() {
|
|
||||||
return permission;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPermission() {
|
public boolean hasPermission() {
|
||||||
return !permission.equalsIgnoreCase("venturechat.none");
|
return !permission.equalsIgnoreCase("venturechat.none");
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,9 @@
|
|||||||
package venture.Aust1n46.chat.model;
|
package venture.Aust1n46.chat.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
import venture.Aust1n46.chat.service.VentureChatFormatService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat channel object pojo. Class also contains static initialization methods
|
* Chat channel object pojo. Class also contains static initialization methods
|
||||||
@ -24,11 +15,6 @@ public class ChatChannel {
|
|||||||
private static final String PERMISSION_PREFIX = "venturechat.";
|
private static final String PERMISSION_PREFIX = "venturechat.";
|
||||||
private static final String NO_PERMISSIONS = "venturechat.none";
|
private static final String NO_PERMISSIONS = "venturechat.none";
|
||||||
|
|
||||||
private static boolean aliasesRegisteredAsCommands;
|
|
||||||
private static ChatChannel defaultChatChannel;
|
|
||||||
private static String defaultColor;
|
|
||||||
private static HashMap<String, ChatChannel> chatChannels;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String permission;
|
private String permission;
|
||||||
private String speakPermission;
|
private String speakPermission;
|
||||||
@ -45,117 +31,6 @@ public class ChatChannel {
|
|||||||
private int cooldown;
|
private int cooldown;
|
||||||
private String prefix;
|
private String prefix;
|
||||||
|
|
||||||
/**
|
|
||||||
* Read chat channels from config file and initialize channel array.
|
|
||||||
*/
|
|
||||||
public static void initialize(final VentureChat plugin, final VentureChatFormatService formatter, final boolean aliasesRegisteredAsCommands) {
|
|
||||||
chatChannels = new HashMap<String, ChatChannel>();
|
|
||||||
ChatChannel.aliasesRegisteredAsCommands = aliasesRegisteredAsCommands;
|
|
||||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
|
||||||
for (String key : cs.getKeys(false)) {
|
|
||||||
String color = cs.getString(key + ".color", "white");
|
|
||||||
String chatColor = cs.getString(key + ".chatcolor", "white");
|
|
||||||
String name = key;
|
|
||||||
String permission = cs.getString(key + ".permissions", "None");
|
|
||||||
String speakPermission = cs.getString(key + ".speak_permissions", "None");
|
|
||||||
boolean mutable = cs.getBoolean(key + ".mutable", false);
|
|
||||||
boolean filter = cs.getBoolean(key + ".filter", true);
|
|
||||||
boolean bungee = cs.getBoolean(key + ".bungeecord", false);
|
|
||||||
String format = cs.getString(key + ".format", "Default");
|
|
||||||
boolean defaultChannel = cs.getBoolean(key + ".default", false);
|
|
||||||
String alias = cs.getString(key + ".alias", "None");
|
|
||||||
double distance = cs.getDouble(key + ".distance", (double) 0);
|
|
||||||
int cooldown = cs.getInt(key + ".cooldown", 0);
|
|
||||||
boolean autojoin = cs.getBoolean(key + ".autojoin", false);
|
|
||||||
String prefix = cs.getString(key + ".channel_prefix");
|
|
||||||
ChatChannel chatChannel = new ChatChannel(name, color, chatColor, permission, speakPermission, mutable,
|
|
||||||
filter, defaultChannel, alias, distance, autojoin, bungee, cooldown, prefix, format);
|
|
||||||
chatChannels.put(name.toLowerCase(), chatChannel);
|
|
||||||
chatChannels.put(alias.toLowerCase(), chatChannel);
|
|
||||||
if (defaultChannel) {
|
|
||||||
defaultChatChannel = chatChannel;
|
|
||||||
defaultColor = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Error handling for missing default channel in the config.
|
|
||||||
if(defaultChatChannel == null) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - &cNo default channel found!"));
|
|
||||||
defaultChatChannel = new ChatChannel("MissingDefault", "red", "red", "None", "None", false,
|
|
||||||
true, true, "md", 0, true, false, 0, "&f[&cMissingDefault&f]", "{venturechat_channel_prefix} {vault_prefix}{player_displayname}&c:");
|
|
||||||
defaultColor = defaultChatChannel.getColor();
|
|
||||||
chatChannels.put("missingdefault", defaultChatChannel);
|
|
||||||
chatChannels.put("md", defaultChatChannel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean areAliasesRegisteredAsCommands() {
|
|
||||||
return aliasesRegisteredAsCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get list of chat channels.
|
|
||||||
*
|
|
||||||
* @return {@link Collection}<{@link ChatChannel}>
|
|
||||||
*/
|
|
||||||
public static Collection<ChatChannel> getChatChannels() {
|
|
||||||
return new HashSet<ChatChannel>(chatChannels.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a chat channel by name.
|
|
||||||
*
|
|
||||||
* @param channelName
|
|
||||||
* name of channel to get.
|
|
||||||
* @return {@link ChatChannel}
|
|
||||||
*/
|
|
||||||
public static ChatChannel getChannel(String channelName) {
|
|
||||||
return chatChannels.get(channelName.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the chat channel exists.
|
|
||||||
*
|
|
||||||
* @param channelName
|
|
||||||
* name of channel to check.
|
|
||||||
* @return true if channel exists, false otherwise.
|
|
||||||
*/
|
|
||||||
public static boolean isChannel(String channelName) {
|
|
||||||
return getChannel(channelName) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get default chat channel color.
|
|
||||||
*
|
|
||||||
* @return {@link String}
|
|
||||||
*/
|
|
||||||
public static String getDefaultColor() {
|
|
||||||
return defaultColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get default chat channel.
|
|
||||||
*
|
|
||||||
* @return {@link ChatChannel}
|
|
||||||
*/
|
|
||||||
public static ChatChannel getDefaultChannel() {
|
|
||||||
return defaultChatChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get list of chat channels with autojoin set to true.
|
|
||||||
*
|
|
||||||
* @return {@link List}<{@link ChatChannel}>
|
|
||||||
*/
|
|
||||||
public static List<ChatChannel> getAutojoinList() {
|
|
||||||
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
|
||||||
for (ChatChannel c : chatChannels.values()) {
|
|
||||||
if (c.getAutojoin()) {
|
|
||||||
joinlist.add(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return joinlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameterized constructor a {@link ChatChannel}.
|
* Parameterized constructor a {@link ChatChannel}.
|
||||||
*
|
*
|
||||||
|
@ -2,8 +2,9 @@ package venture.Aust1n46.chat.model;
|
|||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
|
|
||||||
//This class is used to create ChatMessage objects, which are used to store information about previous text components
|
import lombok.Data;
|
||||||
//that were sent to the player. This is a main component in making the message remover work.
|
|
||||||
|
@Data
|
||||||
public class ChatMessage {
|
public class ChatMessage {
|
||||||
private WrappedChatComponent component;
|
private WrappedChatComponent component;
|
||||||
private String message;
|
private String message;
|
||||||
@ -16,28 +17,4 @@ public class ChatMessage {
|
|||||||
this.coloredMessage = coloredMessage;
|
this.coloredMessage = coloredMessage;
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WrappedChatComponent getComponent() {
|
|
||||||
return this.component;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComponent(WrappedChatComponent component) {
|
|
||||||
this.component = component;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return this.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColoredMessage() {
|
|
||||||
return this.coloredMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHash() {
|
|
||||||
return this.hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHash(int hash) {
|
|
||||||
this.hash = hash;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,16 +1,11 @@
|
|||||||
package venture.Aust1n46.chat.model;
|
package venture.Aust1n46.chat.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class GuiSlot {
|
public class GuiSlot {
|
||||||
private static List<GuiSlot> guiSlots;
|
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
private String command;
|
private String command;
|
||||||
private String permission;
|
private String permission;
|
||||||
@ -29,53 +24,6 @@ public class GuiSlot {
|
|||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initialize(final VentureChat plugin) {
|
|
||||||
guiSlots = new ArrayList<GuiSlot>();
|
|
||||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("venturegui");
|
|
||||||
for (String key : cs.getKeys(false)) {
|
|
||||||
String name = key;
|
|
||||||
String icon = cs.getString(key + ".icon");
|
|
||||||
int durability = cs.getInt(key + ".durability");
|
|
||||||
String text = cs.getString(key + ".text");
|
|
||||||
String permission = cs.getString(key + ".permission");
|
|
||||||
String command = cs.getString(key + ".command");
|
|
||||||
int slot = cs.getInt(key + ".slot");
|
|
||||||
guiSlots.add(new GuiSlot(name, icon, durability, text, permission, command, slot));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<GuiSlot> getGuiSlots() {
|
|
||||||
return guiSlots;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCommand() {
|
|
||||||
return command;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPermission() {
|
|
||||||
return permission;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Material getIcon() {
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDurability() {
|
|
||||||
return durability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSlot() {
|
|
||||||
return slot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPermission() {
|
public boolean hasPermission() {
|
||||||
return !permission.equalsIgnoreCase("venturechat.none");
|
return !permission.equalsIgnoreCase("venturechat.none");
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package venture.Aust1n46.chat.model;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class JsonAttribute {
|
public class JsonAttribute {
|
||||||
private String name;
|
private String name;
|
||||||
private List<String> hoverText;
|
private List<String> hoverText;
|
||||||
@ -14,20 +17,4 @@ public class JsonAttribute {
|
|||||||
this.clickAction = clickAction;
|
this.clickAction = clickAction;
|
||||||
this.clickText = clickText;
|
this.clickText = clickText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getHoverText() {
|
|
||||||
return hoverText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClickAction() {
|
|
||||||
return clickAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClickText() {
|
|
||||||
return clickText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
package venture.Aust1n46.chat.model;
|
package venture.Aust1n46.chat.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import lombok.Getter;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class JsonFormat {
|
public class JsonFormat {
|
||||||
private static HashMap<String, JsonFormat> jsonFormats;
|
|
||||||
|
|
||||||
private List<JsonAttribute> jsonAttributes;
|
private List<JsonAttribute> jsonAttributes;
|
||||||
private int priority;
|
private int priority;
|
||||||
private String name;
|
private String name;
|
||||||
@ -21,43 +15,4 @@ public class JsonFormat {
|
|||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
this.jsonAttributes = jsonAttributes;
|
this.jsonAttributes = jsonAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initialize(final VentureChat plugin) {
|
|
||||||
jsonFormats = new HashMap<String, JsonFormat>();
|
|
||||||
ConfigurationSection jsonFormatSection = plugin.getConfig().getConfigurationSection("jsonformatting");
|
|
||||||
for (String jsonFormat : jsonFormatSection.getKeys(false)) {
|
|
||||||
int priority = jsonFormatSection.getInt(jsonFormat + ".priority", 0);
|
|
||||||
List<JsonAttribute> jsonAttributes = new ArrayList<>();
|
|
||||||
ConfigurationSection jsonAttributeSection = jsonFormatSection.getConfigurationSection(jsonFormat + ".json_attributes");
|
|
||||||
if (jsonAttributeSection != null) {
|
|
||||||
for (String attribute : jsonAttributeSection.getKeys(false)) {
|
|
||||||
List<String> hoverText = jsonAttributeSection.getStringList(attribute + ".hover_text");
|
|
||||||
String clickAction = jsonAttributeSection.getString(attribute + ".click_action", "");
|
|
||||||
String clickText = jsonAttributeSection.getString(attribute + ".click_text", "");
|
|
||||||
jsonAttributes.add(new JsonAttribute(attribute, hoverText, clickAction, clickText));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jsonFormats.put(jsonFormat.toLowerCase(), new JsonFormat(jsonFormat, priority, jsonAttributes));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Collection<JsonFormat> getJsonFormats() {
|
|
||||||
return jsonFormats.values();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JsonFormat getJsonFormat(String name) {
|
|
||||||
return jsonFormats.get(name.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPriority() {
|
|
||||||
return priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JsonAttribute> getJsonAttributes() {
|
|
||||||
return jsonAttributes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
@ -56,11 +55,6 @@ public class VentureChatPlayer {
|
|||||||
private boolean messageToggle;
|
private boolean messageToggle;
|
||||||
private boolean bungeeToggle;
|
private boolean bungeeToggle;
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public VentureChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, MuteContainer> mutes, Set<String> blockedCommands, boolean host, UUID party, boolean filter, boolean notifications, String nickname, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean messageToggle, boolean bungeeToggle) {
|
|
||||||
this(uuid, name, currentChannel, ignores, listening, mutes, blockedCommands, host, party, filter, notifications, jsonFormat, spy, commandSpy, rangedSpy, messageToggle, bungeeToggle);
|
|
||||||
}
|
|
||||||
|
|
||||||
public VentureChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, MuteContainer> mutes, Set<String> blockedCommands, boolean host, UUID party, boolean filter, boolean notifications, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean messageToggle, boolean bungeeToggle) {
|
public VentureChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, MuteContainer> mutes, Set<String> blockedCommands, boolean host, UUID party, boolean filter, boolean notifications, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean messageToggle, boolean bungeeToggle) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -93,10 +87,10 @@ public class VentureChatPlayer {
|
|||||||
this.bungeeToggle = bungeeToggle;
|
this.bungeeToggle = bungeeToggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VentureChatPlayer(UUID uuid, String name) {
|
public VentureChatPlayer(UUID uuid, String name, ChatChannel currentChannel) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.currentChannel = ChatChannel.getDefaultChannel();
|
this.currentChannel = currentChannel;
|
||||||
this.ignores = new HashSet<UUID>();
|
this.ignores = new HashSet<UUID>();
|
||||||
this.listening = new HashSet<String>();
|
this.listening = new HashSet<String>();
|
||||||
listening.add(currentChannel.getName());
|
listening.add(currentChannel.getName());
|
||||||
@ -152,26 +146,8 @@ public class VentureChatPlayer {
|
|||||||
this.ignores.remove(ignore);
|
this.ignores.remove(ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getListening() {
|
|
||||||
return this.listening;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isListening(String channel) {
|
public boolean isListening(String channel) {
|
||||||
if(this.isOnline()) {
|
return listening.contains(channel);
|
||||||
if(ChatChannel.isChannel(channel)) {
|
|
||||||
ChatChannel chatChannel = ChatChannel.getChannel(channel);
|
|
||||||
if(chatChannel.hasPermission()) {
|
|
||||||
if(!this.getPlayer().hasPermission(chatChannel.getPermission())) {
|
|
||||||
if(this.getCurrentChannel().equals(chatChannel)) {
|
|
||||||
this.setCurrentChannel(ChatChannel.getDefaultChannel());
|
|
||||||
}
|
|
||||||
this.removeListening(channel);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.listening.contains(channel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addListening(String channel) {
|
public boolean addListening(String channel) {
|
||||||
@ -234,10 +210,6 @@ public class VentureChatPlayer {
|
|||||||
return channel != null ? this.mutes.containsKey(channel) : false;
|
return channel != null ? this.mutes.containsKey(channel) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getBlockedCommands() {
|
|
||||||
return this.blockedCommands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addBlockedCommand(String command) {
|
public void addBlockedCommand(String command) {
|
||||||
this.blockedCommands.add(command);
|
this.blockedCommands.add(command);
|
||||||
}
|
}
|
||||||
@ -254,28 +226,10 @@ public class VentureChatPlayer {
|
|||||||
return this.party != null;
|
return this.party != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOnline(boolean online) {
|
|
||||||
this.online = online;
|
|
||||||
if(this.online) {
|
|
||||||
this.player = Bukkit.getPlayer(name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.player = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return this.online ? this.player : null;
|
return this.online ? this.player : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getConversation() {
|
|
||||||
return this.conversation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConversation(UUID conversation) {
|
|
||||||
this.conversation = conversation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasConversation() {
|
public boolean hasConversation() {
|
||||||
return this.conversation != null;
|
return this.conversation != null;
|
||||||
}
|
}
|
||||||
@ -290,10 +244,6 @@ public class VentureChatPlayer {
|
|||||||
return this.spy;
|
return this.spy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpy(boolean spy) {
|
|
||||||
this.spy = spy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasCommandSpy() {
|
public boolean hasCommandSpy() {
|
||||||
if(this.isOnline()) {
|
if(this.isOnline()) {
|
||||||
if(!this.getPlayer().hasPermission("venturechat.commandspy")) {
|
if(!this.getPlayer().hasPermission("venturechat.commandspy")) {
|
||||||
@ -304,22 +254,6 @@ public class VentureChatPlayer {
|
|||||||
return this.commandSpy;
|
return this.commandSpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCommandSpy(boolean commandSpy) {
|
|
||||||
this.commandSpy = commandSpy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isQuickChat() {
|
|
||||||
return this.quickChat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuickChat(boolean quickChat) {
|
|
||||||
this.quickChat = quickChat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChatChannel getQuickChannel() {
|
|
||||||
return this.quickChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setQuickChannel(ChatChannel channel) {
|
public boolean setQuickChannel(ChatChannel channel) {
|
||||||
if(channel != null) {
|
if(channel != null) {
|
||||||
this.quickChannel = channel;
|
this.quickChannel = channel;
|
||||||
@ -328,39 +262,10 @@ public class VentureChatPlayer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
/**
|
|
||||||
* Not needed and never resets to it's original null value after being set once.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean hasQuickChannel() {
|
|
||||||
return this.quickChannel != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getReplyPlayer() {
|
|
||||||
return this.replyPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReplyPlayer(UUID replyPlayer) {
|
|
||||||
this.replyPlayer = replyPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasReplyPlayer() {
|
public boolean hasReplyPlayer() {
|
||||||
return this.replyPlayer != null;
|
return this.replyPlayer != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPartyChat() {
|
|
||||||
return this.partyChat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPartyChat(boolean partyChat) {
|
|
||||||
this.partyChat = partyChat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<ChatChannel, Long> getCooldowns() {
|
|
||||||
return this.cooldowns;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean addCooldown(ChatChannel channel, long time) {
|
public boolean addCooldown(ChatChannel channel, long time) {
|
||||||
if(channel != null && time > 0) {
|
if(channel != null && time > 0) {
|
||||||
cooldowns.put(channel, time);
|
cooldowns.put(channel, time);
|
||||||
@ -381,10 +286,6 @@ public class VentureChatPlayer {
|
|||||||
return channel != null && this.cooldowns != null ? this.cooldowns.containsKey(channel) : false;
|
return channel != null && this.cooldowns != null ? this.cooldowns.containsKey(channel) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<ChatChannel, List<Long>> getSpam() {
|
|
||||||
return this.spam;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasSpam(ChatChannel channel) {
|
public boolean hasSpam(ChatChannel channel) {
|
||||||
return channel != null && this.spam != null ? this.spam.containsKey(channel) : false;
|
return channel != null && this.spam != null ? this.spam.containsKey(channel) : false;
|
||||||
}
|
}
|
||||||
@ -397,18 +298,6 @@ public class VentureChatPlayer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setModified(boolean modified) {
|
|
||||||
this.modified = modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean wasModified() {
|
|
||||||
return this.modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ChatMessage> getMessages() {
|
|
||||||
return this.messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMessage(ChatMessage message) {
|
public void addMessage(ChatMessage message) {
|
||||||
if(this.messages.size() >= 100) {
|
if(this.messages.size() >= 100) {
|
||||||
this.messages.remove(0);
|
this.messages.remove(0);
|
||||||
@ -419,19 +308,4 @@ public class VentureChatPlayer {
|
|||||||
public void clearMessages() {
|
public void clearMessages() {
|
||||||
this.messages.clear();
|
this.messages.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJsonFormat() {
|
|
||||||
return this.jsonFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJsonFormat() {
|
|
||||||
this.jsonFormat = "Default";
|
|
||||||
for(JsonFormat j : JsonFormat.getJsonFormats()) {
|
|
||||||
if(this.getPlayer().hasPermission("venturechat.json." + j.getName())) {
|
|
||||||
if(JsonFormat.getJsonFormat(this.getJsonFormat()).getPriority() > j.getPriority()) {
|
|
||||||
this.jsonFormat = j.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.proxy;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@ -9,7 +9,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
@ -27,6 +26,7 @@ import net.md_5.bungee.config.YamlConfiguration;
|
|||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatProxyFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatProxyFlatFileController;
|
||||||
import venture.Aust1n46.chat.service.UUIDService;
|
import venture.Aust1n46.chat.service.UUIDService;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VentureChat Minecraft plugin for BungeeCord.
|
* VentureChat Minecraft plugin for BungeeCord.
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.proxy;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.proxy;
|
||||||
|
|
||||||
public class VentureChatProxyServer {
|
public class VentureChatProxyServer {
|
||||||
private String name;
|
private String name;
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.proxy;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.proxy;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@ -29,11 +29,11 @@ import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
|||||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
|
||||||
import net.md_5.bungee.config.Configuration;
|
import net.md_5.bungee.config.Configuration;
|
||||||
import net.md_5.bungee.config.ConfigurationProvider;
|
import net.md_5.bungee.config.ConfigurationProvider;
|
||||||
import net.md_5.bungee.config.YamlConfiguration;
|
import net.md_5.bungee.config.YamlConfiguration;
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatProxyFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatProxyFlatFileController;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VentureChat Minecraft plugin for Velocity.
|
* VentureChat Minecraft plugin for Velocity.
|
225
src/main/java/venture/Aust1n46/chat/service/ConfigService.java
Normal file
225
src/main/java/venture/Aust1n46/chat/service/ConfigService.java
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
package venture.Aust1n46.chat.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.model.Alias;
|
||||||
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
|
import venture.Aust1n46.chat.model.GuiSlot;
|
||||||
|
import venture.Aust1n46.chat.model.JsonAttribute;
|
||||||
|
import venture.Aust1n46.chat.model.JsonFormat;
|
||||||
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class ConfigService {
|
||||||
|
@Inject
|
||||||
|
private VentureChat plugin;
|
||||||
|
|
||||||
|
private final HashMap<String, ChatChannel> chatChannels = new HashMap<String, ChatChannel>();
|
||||||
|
private final HashMap<String, JsonFormat> jsonFormats = new HashMap<String, JsonFormat>();
|
||||||
|
private final List<Alias> aliases = new ArrayList<>();
|
||||||
|
private final List<GuiSlot> guiSlots = new ArrayList<>();
|
||||||
|
private boolean aliasesRegisteredAsCommands;
|
||||||
|
private ChatChannel defaultChatChannel;
|
||||||
|
private String defaultColor;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public void postConstruct() {
|
||||||
|
aliasesRegisteredAsCommands = true;
|
||||||
|
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
||||||
|
for (String key : cs.getKeys(false)) {
|
||||||
|
String color = cs.getString(key + ".color", "white");
|
||||||
|
String chatColor = cs.getString(key + ".chatcolor", "white");
|
||||||
|
String name = key;
|
||||||
|
String permission = cs.getString(key + ".permissions", "None");
|
||||||
|
String speakPermission = cs.getString(key + ".speak_permissions", "None");
|
||||||
|
boolean mutable = cs.getBoolean(key + ".mutable", false);
|
||||||
|
boolean filter = cs.getBoolean(key + ".filter", true);
|
||||||
|
boolean bungee = cs.getBoolean(key + ".bungeecord", false);
|
||||||
|
String format = cs.getString(key + ".format", "Default");
|
||||||
|
boolean defaultChannel = cs.getBoolean(key + ".default", false);
|
||||||
|
String alias = cs.getString(key + ".alias", "None");
|
||||||
|
double distance = cs.getDouble(key + ".distance", (double) 0);
|
||||||
|
int cooldown = cs.getInt(key + ".cooldown", 0);
|
||||||
|
boolean autojoin = cs.getBoolean(key + ".autojoin", false);
|
||||||
|
String prefix = cs.getString(key + ".channel_prefix");
|
||||||
|
ChatChannel chatChannel = new ChatChannel(name, color, chatColor, permission, speakPermission, mutable, filter, defaultChannel, alias, distance, autojoin, bungee,
|
||||||
|
cooldown, prefix, format);
|
||||||
|
chatChannels.put(name.toLowerCase(), chatChannel);
|
||||||
|
chatChannels.put(alias.toLowerCase(), chatChannel);
|
||||||
|
if (defaultChannel) {
|
||||||
|
defaultChatChannel = chatChannel;
|
||||||
|
defaultColor = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Error handling for missing default channel in the config.
|
||||||
|
if (defaultChatChannel == null) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&e - &cNo default channel found!"));
|
||||||
|
defaultChatChannel = new ChatChannel("MissingDefault", "red", "red", "None", "None", false, true, true, "md", 0, true, false, 0, "&f[&cMissingDefault&f]",
|
||||||
|
"{venturechat_channel_prefix} {vault_prefix}{player_displayname}&c:");
|
||||||
|
defaultColor = defaultChatChannel.getColor();
|
||||||
|
chatChannels.put("missingdefault", defaultChatChannel);
|
||||||
|
chatChannels.put("md", defaultChatChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonFormats.clear();
|
||||||
|
ConfigurationSection jsonFormatSection = plugin.getConfig().getConfigurationSection("jsonformatting");
|
||||||
|
for (String jsonFormat : jsonFormatSection.getKeys(false)) {
|
||||||
|
int priority = jsonFormatSection.getInt(jsonFormat + ".priority", 0);
|
||||||
|
List<JsonAttribute> jsonAttributes = new ArrayList<>();
|
||||||
|
ConfigurationSection jsonAttributeSection = jsonFormatSection.getConfigurationSection(jsonFormat + ".json_attributes");
|
||||||
|
if (jsonAttributeSection != null) {
|
||||||
|
for (String attribute : jsonAttributeSection.getKeys(false)) {
|
||||||
|
List<String> hoverText = jsonAttributeSection.getStringList(attribute + ".hover_text");
|
||||||
|
String clickAction = jsonAttributeSection.getString(attribute + ".click_action", "");
|
||||||
|
String clickText = jsonAttributeSection.getString(attribute + ".click_text", "");
|
||||||
|
jsonAttributes.add(new JsonAttribute(attribute, hoverText, clickAction, clickText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonFormats.put(jsonFormat.toLowerCase(), new JsonFormat(jsonFormat, priority, jsonAttributes));
|
||||||
|
}
|
||||||
|
|
||||||
|
aliases.clear();
|
||||||
|
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("alias");
|
||||||
|
for (String key : configurationSection.getKeys(false)) {
|
||||||
|
String name = key;
|
||||||
|
int arguments = configurationSection.getInt(key + ".arguments", 0);
|
||||||
|
List<String> components = configurationSection.getStringList(key + ".components");
|
||||||
|
String permissions = configurationSection.getString(key + ".permissions", "None");
|
||||||
|
aliases.add(new Alias(name, arguments, components, permissions));
|
||||||
|
}
|
||||||
|
|
||||||
|
guiSlots.clear();
|
||||||
|
cs = plugin.getConfig().getConfigurationSection("venturegui");
|
||||||
|
for (String key : cs.getKeys(false)) {
|
||||||
|
String name = key;
|
||||||
|
String icon = cs.getString(key + ".icon");
|
||||||
|
int durability = cs.getInt(key + ".durability");
|
||||||
|
String text = cs.getString(key + ".text");
|
||||||
|
String permission = cs.getString(key + ".permission");
|
||||||
|
String command = cs.getString(key + ".command");
|
||||||
|
int slot = cs.getInt(key + ".slot");
|
||||||
|
guiSlots.add(new GuiSlot(name, icon, durability, text, permission, command, slot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean areAliasesRegisteredAsCommands() {
|
||||||
|
return aliasesRegisteredAsCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of chat channels.
|
||||||
|
*
|
||||||
|
* @return {@link Collection}<{@link ChatChannel}>
|
||||||
|
*/
|
||||||
|
public Collection<ChatChannel> getChatChannels() {
|
||||||
|
return new HashSet<ChatChannel>(chatChannels.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a chat channel by name.
|
||||||
|
*
|
||||||
|
* @param channelName name of channel to get.
|
||||||
|
* @return {@link ChatChannel}
|
||||||
|
*/
|
||||||
|
public ChatChannel getChannel(String channelName) {
|
||||||
|
return chatChannels.get(channelName.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel exists.
|
||||||
|
*
|
||||||
|
* @param channelName name of channel to check.
|
||||||
|
* @return true if channel exists, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isChannel(String channelName) {
|
||||||
|
return getChannel(channelName) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isListening(VentureChatPlayer ventureChatPlayer, String channel) {
|
||||||
|
if (ventureChatPlayer.isOnline()) {
|
||||||
|
if (isChannel(channel)) {
|
||||||
|
ChatChannel chatChannel = getChannel(channel);
|
||||||
|
if (chatChannel.hasPermission()) {
|
||||||
|
if (!ventureChatPlayer.getPlayer().hasPermission(chatChannel.getPermission())) {
|
||||||
|
if (ventureChatPlayer.getCurrentChannel().equals(chatChannel)) {
|
||||||
|
ventureChatPlayer.setCurrentChannel(getDefaultChannel());
|
||||||
|
}
|
||||||
|
ventureChatPlayer.removeListening(channel);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ventureChatPlayer.isListening(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default chat channel color.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getDefaultColor() {
|
||||||
|
return defaultColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link ChatChannel}
|
||||||
|
*/
|
||||||
|
public ChatChannel getDefaultChannel() {
|
||||||
|
return defaultChatChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of chat channels with autojoin set to true.
|
||||||
|
*
|
||||||
|
* @return {@link List}<{@link ChatChannel}>
|
||||||
|
*/
|
||||||
|
public List<ChatChannel> getAutojoinList() {
|
||||||
|
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
||||||
|
for (ChatChannel c : chatChannels.values()) {
|
||||||
|
if (c.getAutojoin()) {
|
||||||
|
joinlist.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return joinlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Collection<JsonFormat> getJsonFormats() {
|
||||||
|
return jsonFormats.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonFormat getJsonFormat(String name) {
|
||||||
|
return jsonFormats.get(name.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Alias> getAliases() {
|
||||||
|
return aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GuiSlot> getGuiSlots() {
|
||||||
|
return guiSlots;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isProxyEnabled() {
|
||||||
|
try {
|
||||||
|
return plugin.getServer().spigot().getConfig().getBoolean("settings.bungeecord")
|
||||||
|
|| plugin.getServer().spigot().getPaperConfig().getBoolean("settings.velocity-support.enabled");
|
||||||
|
} catch (NoSuchMethodError exception) { // Thrown if server isn't Paper.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,9 +7,9 @@ import org.bukkit.Bukkit;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.proxy.VentureChatProxySource;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.proxy.VentureChatProxySource;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class UUIDService {
|
public class UUIDService {
|
||||||
|
@ -14,8 +14,8 @@ import com.google.inject.Singleton;
|
|||||||
import com.zaxxer.hikari.HikariConfig;
|
import com.zaxxer.hikari.HikariConfig;
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes and handles writing to the chat logging database.
|
* Initializes and handles writing to the chat logging database.
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package venture.Aust1n46.chat.service;
|
package venture.Aust1n46.chat.service;
|
||||||
|
|
||||||
import static mineverse.Aust1n46.chat.utilities.FormatUtils.BUKKIT_COLOR_CODE_PREFIX;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.BUKKIT_COLOR_CODE_PREFIX;
|
||||||
import static mineverse.Aust1n46.chat.utilities.FormatUtils.BUKKIT_COLOR_CODE_PREFIX_CHAR;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.BUKKIT_COLOR_CODE_PREFIX_CHAR;
|
||||||
import static mineverse.Aust1n46.chat.utilities.FormatUtils.BUKKIT_HEX_COLOR_CODE_PREFIX;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.BUKKIT_HEX_COLOR_CODE_PREFIX;
|
||||||
import static mineverse.Aust1n46.chat.utilities.FormatUtils.DEFAULT_COLOR_CODE;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.DEFAULT_COLOR_CODE;
|
||||||
import static mineverse.Aust1n46.chat.utilities.FormatUtils.HEX_COLOR_CODE_PREFIX;
|
import static venture.Aust1n46.chat.utilities.FormatUtils.HEX_COLOR_CODE_PREFIX;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -28,12 +28,12 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import mineverse.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.model.JsonAttribute;
|
import venture.Aust1n46.chat.model.JsonAttribute;
|
||||||
import venture.Aust1n46.chat.model.JsonFormat;
|
import venture.Aust1n46.chat.model.JsonFormat;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
import venture.Aust1n46.chat.utilities.VersionHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class containing chat formatting methods.
|
* Class containing chat formatting methods.
|
||||||
@ -50,6 +50,8 @@ public class VentureChatFormatService {
|
|||||||
private VentureChat plugin;
|
private VentureChat plugin;
|
||||||
@Inject
|
@Inject
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
|
@Inject
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a message to Minecraft JSON formatting while applying the
|
* Converts a message to Minecraft JSON formatting while applying the
|
||||||
@ -61,7 +63,7 @@ public class VentureChatFormatService {
|
|||||||
* @return {@link String}
|
* @return {@link String}
|
||||||
*/
|
*/
|
||||||
public String convertToJson(VentureChatPlayer sender, String format, String chat) {
|
public String convertToJson(VentureChatPlayer sender, String format, String chat) {
|
||||||
JsonFormat JSONformat = JsonFormat.getJsonFormat(sender.getJsonFormat());
|
JsonFormat JSONformat = configService.getJsonFormat(sender.getJsonFormat());
|
||||||
String f = escapeJsonChars(format);
|
String f = escapeJsonChars(format);
|
||||||
String c = escapeJsonChars(chat);
|
String c = escapeJsonChars(chat);
|
||||||
String json = "[\"\",{\"text\":\"\",\"extra\":[";
|
String json = "[\"\",{\"text\":\"\",\"extra\":[";
|
||||||
@ -105,7 +107,8 @@ public class VentureChatFormatService {
|
|||||||
indexStart = matcher.start();
|
indexStart = matcher.start();
|
||||||
indexEnd = matcher.end();
|
indexEnd = matcher.end();
|
||||||
placeholder = remaining.substring(indexStart, indexEnd);
|
placeholder = remaining.substring(indexStart, indexEnd);
|
||||||
formattedPlaceholder = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), placeholder));
|
formattedPlaceholder = FormatUtils
|
||||||
|
.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), placeholder));
|
||||||
temp += convertToJsonColors(lastCode + remaining.substring(0, indexStart)) + ",";
|
temp += convertToJsonColors(lastCode + remaining.substring(0, indexStart)) + ",";
|
||||||
lastCode = getLastCode(lastCode + remaining.substring(0, indexStart));
|
lastCode = getLastCode(lastCode + remaining.substring(0, indexStart));
|
||||||
String action = "";
|
String action = "";
|
||||||
@ -122,8 +125,8 @@ public class VentureChatFormatService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hover.isEmpty()) {
|
if (!hover.isEmpty()) {
|
||||||
hover = FormatUtils.FormatStringAll(
|
hover = FormatUtils.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(),
|
||||||
PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1)));
|
hover.substring(0, hover.length() - 1)));
|
||||||
}
|
}
|
||||||
temp += convertToJsonColors(lastCode + formattedPlaceholder,
|
temp += convertToJsonColors(lastCode + formattedPlaceholder,
|
||||||
",\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + text
|
",\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + text
|
||||||
@ -416,8 +419,7 @@ public class VentureChatFormatService {
|
|||||||
",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/vchatgui " + sender + " " + channelName
|
",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/vchatgui " + sender + " " + channelName
|
||||||
+ " " + hash
|
+ " " + hash
|
||||||
+ "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
+ "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":["
|
||||||
+ convertToJsonColors(
|
+ convertToJsonColors(FormatUtils.FormatStringAll(plugin.getConfig().getString("guitext")))
|
||||||
FormatUtils.FormatStringAll(plugin.getConfig().getString("guitext")))
|
|
||||||
+ "]}}")
|
+ "]}}")
|
||||||
+ "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
@ -459,17 +461,50 @@ public class VentureChatFormatService {
|
|||||||
splitComponents(finalList, o, c);
|
splitComponents(finalList, o, c);
|
||||||
for (Object component : finalList) {
|
for (Object component : finalList) {
|
||||||
try {
|
try {
|
||||||
|
if (VersionHandler.is1_8() || VersionHandler.is1_9() || VersionHandler.is1_10()
|
||||||
|
|| VersionHandler.is1_11() || VersionHandler.is1_12() || VersionHandler.is1_13()
|
||||||
|
|| VersionHandler.is1_14() || VersionHandler.is1_15() || VersionHandler.is1_16()
|
||||||
|
|| VersionHandler.is1_17()) {
|
||||||
String text = (String) component.getClass().getMethod("getText").invoke(component);
|
String text = (String) component.getClass().getMethod("getText").invoke(component);
|
||||||
Object chatModifier = component.getClass().getMethod("getChatModifier").invoke(component);
|
Object chatModifier = component.getClass().getMethod("getChatModifier").invoke(component);
|
||||||
String color = chatModifier.getClass().getMethod("getColor").invoke(chatModifier).toString();
|
Object color = chatModifier.getClass().getMethod("getColor").invoke(chatModifier);
|
||||||
|
String colorString = "white";
|
||||||
|
if (color != null) {
|
||||||
|
colorString = color.getClass().getMethod("b").invoke(color).toString();
|
||||||
|
}
|
||||||
boolean bold = (boolean) chatModifier.getClass().getMethod("isBold").invoke(chatModifier);
|
boolean bold = (boolean) chatModifier.getClass().getMethod("isBold").invoke(chatModifier);
|
||||||
boolean strikethrough = (boolean) chatModifier.getClass().getMethod("isStrikethrough").invoke(chatModifier);
|
boolean strikethrough = (boolean) chatModifier.getClass().getMethod("isStrikethrough")
|
||||||
|
.invoke(chatModifier);
|
||||||
boolean italic = (boolean) chatModifier.getClass().getMethod("isItalic").invoke(chatModifier);
|
boolean italic = (boolean) chatModifier.getClass().getMethod("isItalic").invoke(chatModifier);
|
||||||
boolean underlined = (boolean) chatModifier.getClass().getMethod("isUnderlined").invoke(chatModifier);
|
boolean underlined = (boolean) chatModifier.getClass().getMethod("isUnderlined")
|
||||||
boolean obfuscated = (boolean) chatModifier.getClass().getMethod("isRandom").invoke(chatModifier);
|
.invoke(chatModifier);
|
||||||
|
boolean obfuscated = (boolean) chatModifier.getClass().getMethod("isRandom")
|
||||||
|
.invoke(chatModifier);
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("text", text);
|
jsonObject.put("text", text);
|
||||||
jsonObject.put("color", color);
|
jsonObject.put("color", colorString);
|
||||||
|
jsonObject.put("bold", bold);
|
||||||
|
jsonObject.put("strikethrough", strikethrough);
|
||||||
|
jsonObject.put("italic", italic);
|
||||||
|
jsonObject.put("underlined", underlined);
|
||||||
|
jsonObject.put("obfuscated", obfuscated);
|
||||||
|
stringbuilder.append(jsonObject.toJSONString() + ",");
|
||||||
|
} else {
|
||||||
|
String text = (String) component.getClass().getMethod("getString").invoke(component);
|
||||||
|
Object chatModifier = component.getClass().getMethod("c").invoke(component);
|
||||||
|
Object color = chatModifier.getClass().getMethod("a").invoke(chatModifier);
|
||||||
|
String colorString = "white";
|
||||||
|
if (color != null) {
|
||||||
|
colorString = color.getClass().getMethod("b").invoke(color).toString();
|
||||||
|
}
|
||||||
|
boolean bold = (boolean) chatModifier.getClass().getMethod("b").invoke(chatModifier);
|
||||||
|
boolean italic = (boolean) chatModifier.getClass().getMethod("c").invoke(chatModifier);
|
||||||
|
boolean strikethrough = (boolean) chatModifier.getClass().getMethod("d").invoke(chatModifier);
|
||||||
|
boolean underlined = (boolean) chatModifier.getClass().getMethod("e").invoke(chatModifier);
|
||||||
|
boolean obfuscated = (boolean) chatModifier.getClass().getMethod("f").invoke(chatModifier);
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("text", text);
|
||||||
|
jsonObject.put("color", colorString);
|
||||||
jsonObject.put("bold", bold);
|
jsonObject.put("bold", bold);
|
||||||
jsonObject.put("strikethrough", strikethrough);
|
jsonObject.put("strikethrough", strikethrough);
|
||||||
jsonObject.put("italic", italic);
|
jsonObject.put("italic", italic);
|
||||||
@ -477,7 +512,7 @@ public class VentureChatFormatService {
|
|||||||
jsonObject.put("obfuscated", obfuscated);
|
jsonObject.put("obfuscated", obfuscated);
|
||||||
stringbuilder.append(jsonObject.toJSONString() + ",");
|
stringbuilder.append(jsonObject.toJSONString() + ",");
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
} catch (Exception e) {
|
||||||
return "\"extra\":[{\"text\":\"Something went wrong. Could not access color.\",\"color\":\"red\"}]";
|
return "\"extra\":[{\"text\":\"Something went wrong. Could not access color.\",\"color\":\"red\"}]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -500,29 +535,22 @@ public class VentureChatFormatService {
|
|||||||
for (Object component : finalList) {
|
for (Object component : finalList) {
|
||||||
if (VersionHandler.is1_7()) {
|
if (VersionHandler.is1_7()) {
|
||||||
stringbuilder.append((String) component.getClass().getMethod("e").invoke(component));
|
stringbuilder.append((String) component.getClass().getMethod("e").invoke(component));
|
||||||
} else {
|
} else if (VersionHandler.is1_8() || VersionHandler.is1_9() || VersionHandler.is1_10()
|
||||||
|
|| VersionHandler.is1_11() || VersionHandler.is1_12() || VersionHandler.is1_13()
|
||||||
|
|| VersionHandler.is1_14() || VersionHandler.is1_15() || VersionHandler.is1_16()
|
||||||
|
|| VersionHandler.is1_17()) {
|
||||||
stringbuilder.append((String) component.getClass().getMethod("getText").invoke(component));
|
stringbuilder.append((String) component.getClass().getMethod("getText").invoke(component));
|
||||||
|
} else {
|
||||||
|
stringbuilder.append((String) component.getClass().getMethod("getString").invoke(component));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// if(plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
|
||||||
// System.out.println("my string");
|
|
||||||
// System.out.println("my string");
|
|
||||||
// System.out.println("my string");
|
|
||||||
// System.out.println("my string");
|
|
||||||
// System.out.println("my string");
|
|
||||||
// System.out.println(stringbuilder.toString());
|
|
||||||
// }
|
|
||||||
return stringbuilder.toString();
|
return stringbuilder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void splitComponents(List<Object> finalList, Object o, Class<?> c) throws Exception {
|
private void splitComponents(List<Object> finalList, Object o, Class<?> c) throws Exception {
|
||||||
// for(Method m : c.getMethods()) {
|
|
||||||
// System.out.println(m.getName());
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (VersionHandler.is1_7() || VersionHandler.is1_8() || VersionHandler.is1_9() || VersionHandler.is1_10()
|
if (VersionHandler.is1_7() || VersionHandler.is1_8() || VersionHandler.is1_9() || VersionHandler.is1_10()
|
||||||
|| VersionHandler.is1_11() || VersionHandler.is1_12() || VersionHandler.is1_13()
|
|| VersionHandler.is1_11() || VersionHandler.is1_12() || VersionHandler.is1_13()
|
||||||
|| (VersionHandler.is1_14() && !VersionHandler.is1_14_4())) {
|
|| (VersionHandler.is1_14() && !VersionHandler.is1_14_4())) {
|
||||||
@ -535,7 +563,8 @@ public class VentureChatFormatService {
|
|||||||
finalList.add(component);
|
finalList.add(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (VersionHandler.is1_14_4() || VersionHandler.is1_15() || VersionHandler.is1_16()
|
||||||
|
|| VersionHandler.is1_17()) {
|
||||||
ArrayList<?> list = (ArrayList<?>) c.getMethod("getSiblings").invoke(o, new Object[0]);
|
ArrayList<?> list = (ArrayList<?>) c.getMethod("getSiblings").invoke(o, new Object[0]);
|
||||||
for (Object component : list) {
|
for (Object component : list) {
|
||||||
ArrayList<?> innerList = (ArrayList<?>) c.getMethod("getSiblings").invoke(component, new Object[0]);
|
ArrayList<?> innerList = (ArrayList<?>) c.getMethod("getSiblings").invoke(component, new Object[0]);
|
||||||
@ -545,6 +574,16 @@ public class VentureChatFormatService {
|
|||||||
finalList.add(component);
|
finalList.add(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ArrayList<?> list = (ArrayList<?>) c.getMethod("b").invoke(o, new Object[0]);
|
||||||
|
for (Object component : list) {
|
||||||
|
ArrayList<?> innerList = (ArrayList<?>) c.getMethod("b").invoke(component, new Object[0]);
|
||||||
|
if (innerList.size() > 0) {
|
||||||
|
splitComponents(finalList, component, c);
|
||||||
|
} else {
|
||||||
|
finalList.add(component);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,18 +627,19 @@ public class VentureChatFormatService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Sound getSound(String soundName) {
|
private Sound getSound(String soundName) {
|
||||||
if(Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList()).contains(soundName)) {
|
if (Arrays.asList(Sound.values()).stream().map(Sound::toString).collect(Collectors.toList())
|
||||||
|
.contains(soundName)) {
|
||||||
return Sound.valueOf(soundName);
|
return Sound.valueOf(soundName);
|
||||||
}
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&c - Message sound invalid!"));
|
Bukkit.getConsoleSender()
|
||||||
|
.sendMessage(FormatUtils.FormatStringAll("&8[&eVentureChat&8]&c - Message sound invalid!"));
|
||||||
return getDefaultMessageSound();
|
return getDefaultMessageSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Sound getDefaultMessageSound() {
|
private Sound getDefaultMessageSound() {
|
||||||
if (VersionHandler.is1_7() || VersionHandler.is1_8()) {
|
if (VersionHandler.is1_7() || VersionHandler.is1_8()) {
|
||||||
return Sound.valueOf(DEFAULT_LEGACY_MESSAGE_SOUND);
|
return Sound.valueOf(DEFAULT_LEGACY_MESSAGE_SOUND);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return Sound.valueOf(DEFAULT_MESSAGE_SOUND);
|
return Sound.valueOf(DEFAULT_MESSAGE_SOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
|
||||||
import venture.Aust1n46.chat.model.SynchronizedVentureChatPlayer;
|
import venture.Aust1n46.chat.model.SynchronizedVentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API class for looking up wrapped {@link VentureChatPlayer} objects from
|
* API class for looking up wrapped {@link VentureChatPlayer} objects from
|
||||||
@ -17,7 +17,7 @@ import venture.Aust1n46.chat.model.SynchronizedVentureChatPlayer;
|
|||||||
*
|
*
|
||||||
* @author Aust1n46
|
* @author Aust1n46
|
||||||
*/
|
*/
|
||||||
public final class VentureChatPlayerApiService {
|
public class VentureChatPlayerApiService {
|
||||||
private static HashMap<UUID, VentureChatPlayer> playerMap = new HashMap<UUID, VentureChatPlayer>();
|
private static HashMap<UUID, VentureChatPlayer> playerMap = new HashMap<UUID, VentureChatPlayer>();
|
||||||
private static HashMap<String, UUID> namesMap = new HashMap<String, UUID>();
|
private static HashMap<String, UUID> namesMap = new HashMap<String, UUID>();
|
||||||
private static HashMap<UUID, VentureChatPlayer> onlinePlayerMap = new HashMap<UUID, VentureChatPlayer>();
|
private static HashMap<UUID, VentureChatPlayer> onlinePlayerMap = new HashMap<UUID, VentureChatPlayer>();
|
||||||
@ -102,7 +102,7 @@ public final class VentureChatPlayerApiService {
|
|||||||
* @param player {@link Player} object.
|
* @param player {@link Player} object.
|
||||||
* @return {@link VentureChatPlayer}
|
* @return {@link VentureChatPlayer}
|
||||||
*/
|
*/
|
||||||
public VentureChatPlayer getOnlineMineverseChatPlayer(Player player) {
|
public VentureChatPlayer getOnlineMineverseChatPlayer(final Player player) {
|
||||||
return getOnlineMineverseChatPlayer(player.getUniqueId());
|
return getOnlineMineverseChatPlayer(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +132,6 @@ public final class VentureChatPlayerApiService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<String> getNetworkPlayerNames() {
|
public List<String> getNetworkPlayerNames() {
|
||||||
return networkPlayerNames;
|
return networkPlayerNames;
|
||||||
}
|
}
|
||||||
@ -149,11 +148,6 @@ public final class VentureChatPlayerApiService {
|
|||||||
proxyPlayerMap.put(smcp.getUUID(), smcp);
|
proxyPlayerMap.put(smcp.getUUID(), smcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Deprecated
|
|
||||||
// public static void clearBungeePlayerMap() {
|
|
||||||
// clearProxyPlayerMap();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void clearProxyPlayerMap() {
|
public void clearProxyPlayerMap() {
|
||||||
proxyPlayerMap.clear();
|
proxyPlayerMap.clear();
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package mineverse.Aust1n46.chat.utilities;
|
package venture.Aust1n46.chat.utilities;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
import venture.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
|
|
||||||
public class FormatUtils {
|
public class FormatUtils {
|
||||||
public static final char BUKKIT_COLOR_CODE_PREFIX_CHAR = '\u00A7';
|
public static final char BUKKIT_COLOR_CODE_PREFIX_CHAR = '\u00A7';
|
||||||
@ -19,6 +19,8 @@ public class FormatUtils {
|
|||||||
public static final long MILLISECONDS_PER_MINUTE = 60000;
|
public static final long MILLISECONDS_PER_MINUTE = 60000;
|
||||||
public static final long MILLISECONDS_PER_SECOND = 1000;
|
public static final long MILLISECONDS_PER_SECOND = 1000;
|
||||||
|
|
||||||
|
public static final int LINE_LENGTH = 40;
|
||||||
|
|
||||||
private static final Pattern LEGACY_CHAT_COLOR_DIGITS_PATTERN = Pattern.compile("&([0-9])");
|
private static final Pattern LEGACY_CHAT_COLOR_DIGITS_PATTERN = Pattern.compile("&([0-9])");
|
||||||
private static final Pattern LEGACY_CHAT_COLOR_PATTERN = Pattern.compile(
|
private static final Pattern LEGACY_CHAT_COLOR_PATTERN = Pattern.compile(
|
||||||
"(?<!(&x(&[a-fA-F0-9]){5}))(?<!(&x(&[a-fA-F0-9]){4}))(?<!(&x(&[a-fA-F0-9]){3}))(?<!(&x(&[a-fA-F0-9]){2}))(?<!(&x(&[a-fA-F0-9]){1}))(?<!(&x))(&)([0-9a-fA-F])");
|
"(?<!(&x(&[a-fA-F0-9]){5}))(?<!(&x(&[a-fA-F0-9]){4}))(?<!(&x(&[a-fA-F0-9]){3}))(?<!(&x(&[a-fA-F0-9]){2}))(?<!(&x(&[a-fA-F0-9]){1}))(?<!(&x))(&)([0-9a-fA-F])");
|
@ -1,4 +1,4 @@
|
|||||||
package mineverse.Aust1n46.chat.versions;
|
package venture.Aust1n46.chat.utilities;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
@ -1,24 +1,28 @@
|
|||||||
package venture.Aust1n46.chat.initiators.listeners;
|
package venture.Aust1n46.chat.initiators.listeners;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.Logger;
|
import venture.Aust1n46.chat.Logger;
|
||||||
import venture.Aust1n46.chat.VentureChat;
|
|
||||||
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
import venture.Aust1n46.chat.controllers.PluginMessageController;
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatSpigotFlatFileController;
|
||||||
|
import venture.Aust1n46.chat.initiators.application.VentureChat;
|
||||||
|
import venture.Aust1n46.chat.model.ChatChannel;
|
||||||
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
import venture.Aust1n46.chat.model.VentureChatPlayer;
|
||||||
|
import venture.Aust1n46.chat.service.ConfigService;
|
||||||
import venture.Aust1n46.chat.service.UUIDService;
|
import venture.Aust1n46.chat.service.UUIDService;
|
||||||
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
import venture.Aust1n46.chat.service.VentureChatPlayerApiService;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
public class LoginListenerTest {
|
public class LoginListenerTest {
|
||||||
@Mock
|
@Mock
|
||||||
private VentureChat plugin;
|
private VentureChat plugin;
|
||||||
@ -31,6 +35,8 @@ public class LoginListenerTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private VentureChatPlayerApiService playerApiService;
|
private VentureChatPlayerApiService playerApiService;
|
||||||
@Mock
|
@Mock
|
||||||
|
private ConfigService configService;
|
||||||
|
@Mock
|
||||||
private Logger log;
|
private Logger log;
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private LoginListener loginListener;
|
private LoginListener loginListener;
|
||||||
@ -38,9 +44,13 @@ public class LoginListenerTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private PlayerQuitEvent mockPlayerQuitEvent;
|
private PlayerQuitEvent mockPlayerQuitEvent;
|
||||||
@Mock
|
@Mock
|
||||||
|
private PlayerJoinEvent mockPlayerJoinEvent;
|
||||||
|
@Mock
|
||||||
private Player mockPlayer;
|
private Player mockPlayer;
|
||||||
@Mock
|
@Mock
|
||||||
private VentureChatPlayer mockVentureChatPlayer;
|
private VentureChatPlayer mockVentureChatPlayer;
|
||||||
|
@Mock
|
||||||
|
private ChatChannel mockDefaultChannel;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPlayerQuit() {
|
public void testPlayerQuit() {
|
||||||
@ -50,7 +60,28 @@ public class LoginListenerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPlayerJoin_successful() {
|
public void testPlayerQuit_playerNull() {
|
||||||
|
when(mockPlayerQuitEvent.getPlayer()).thenReturn(mockPlayer);
|
||||||
|
when(playerApiService.getOnlineMineverseChatPlayer(mockPlayer)).thenReturn(null);
|
||||||
|
loginListener.onPlayerQuit(mockPlayerQuitEvent);
|
||||||
|
assertDoesNotThrow(() -> loginListener.onPlayerQuit(mockPlayerQuitEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPlayerJoin_existingPlayer_NoProxy() {
|
||||||
|
when(mockPlayerJoinEvent.getPlayer()).thenReturn(mockPlayer);
|
||||||
|
when(configService.getDefaultChannel()).thenReturn(mockDefaultChannel);
|
||||||
|
when(mockPlayer.getName()).thenReturn("Aust1n46");
|
||||||
|
when(configService.isProxyEnabled()).thenReturn(false);
|
||||||
|
loginListener.onPlayerJoin(mockPlayerJoinEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPlayerJoin_existingPlayer_Proxy() {
|
||||||
|
when(mockPlayerJoinEvent.getPlayer()).thenReturn(mockPlayer);
|
||||||
|
when(configService.getDefaultChannel()).thenReturn(mockDefaultChannel);
|
||||||
|
when(mockPlayer.getName()).thenReturn("Aust1n46");
|
||||||
|
when(configService.isProxyEnabled()).thenReturn(true);
|
||||||
|
loginListener.onPlayerJoin(mockPlayerJoinEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user