rework internals
This commit is contained in:
parent
4aa4726a4e
commit
d087d47d5c
28
api/pom.xml
28
api/pom.xml
|
|
@ -13,33 +13,12 @@
|
||||||
<groupId>com.alttd.chat</groupId>
|
<groupId>com.alttd.chat</groupId>
|
||||||
<artifactId>Chat</artifactId>
|
<artifactId>Chat</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>chat-api</artifactId>
|
<artifactId>chat-api</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<build>
|
|
||||||
<defaultGoal>clean package</defaultGoal>
|
|
||||||
<finalName>${project.name}</finalName>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.7.0</version>
|
|
||||||
<configuration>
|
|
||||||
<source>11</source>
|
|
||||||
<target>11</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main</directory>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.luckperms</groupId>
|
<groupId>net.luckperms</groupId>
|
||||||
|
|
@ -52,6 +31,11 @@
|
||||||
<artifactId>configurate-yaml</artifactId>
|
<artifactId>configurate-yaml</artifactId>
|
||||||
<version>3.7.1</version>
|
<version>3.7.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.kyori</groupId>
|
||||||
|
<artifactId>adventure-text-minimessage</artifactId>
|
||||||
|
<version>4.1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.velocitychat;
|
package com.alttd.chat;
|
||||||
|
|
||||||
import com.alttd.velocitychat.database.DatabaseConnection;
|
import com.alttd.chat.database.DatabaseConnection;
|
||||||
import net.luckperms.api.LuckPerms;
|
import net.luckperms.api.LuckPerms;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.alttd.velocitychat;
|
package com.alttd.chat;
|
||||||
|
|
||||||
import com.alttd.velocitychat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.alttd.velocitychat.database.DatabaseConnection;
|
import com.alttd.chat.database.DatabaseConnection;
|
||||||
import net.luckperms.api.LuckPerms;
|
import net.luckperms.api.LuckPerms;
|
||||||
import net.luckperms.api.LuckPermsProvider;
|
import net.luckperms.api.LuckPermsProvider;
|
||||||
import net.luckperms.api.model.group.Group;
|
import net.luckperms.api.model.group.Group;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.config;
|
package com.alttd.chat.config;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.database;
|
package com.alttd.chat.database;
|
||||||
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.alttd.velocitychat.database;
|
package com.alttd.chat.database;
|
||||||
|
|
||||||
import com.alttd.velocitychat.objects.Party;
|
import com.alttd.chat.objects.Party;
|
||||||
import com.alttd.velocitychat.objects.PartyUser;
|
import com.alttd.chat.objects.PartyUser;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.objects;
|
package com.alttd.chat.objects;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.velocitychat.objects;
|
package com.alttd.chat.objects;
|
||||||
|
|
||||||
import com.alttd.velocitychat.database.Queries;
|
import com.alttd.chat.database.Queries;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.velocitychat.objects;
|
package com.alttd.chat.objects;
|
||||||
|
|
||||||
import com.alttd.velocitychat.database.Queries;
|
import com.alttd.chat.database.Queries;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.objects;
|
package com.alttd.chat.objects;
|
||||||
|
|
||||||
public class Regex {
|
public class Regex {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.objects;
|
package com.alttd.chat.objects;
|
||||||
|
|
||||||
public enum RegexType {
|
public enum RegexType {
|
||||||
REPLACE("replace"),
|
REPLACE("replace"),
|
||||||
|
|
|
||||||
58
pom.xml
58
pom.xml
|
|
@ -17,37 +17,33 @@
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<distributionManagement>
|
||||||
<pluginManagement>
|
<repository>
|
||||||
<plugins>
|
<id>Alttd-Nexus</id>
|
||||||
<plugin>
|
<url>http://leo:8081/snapshots/</url>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</repository>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
</distributionManagement>
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
<!--<build>
|
||||||
<source>${java.version}</source>
|
<defaultGoal>install</defaultGoal>
|
||||||
<target>${java.version}</target>
|
<finalName>${project.artifactId}</finalName>
|
||||||
</configuration>
|
<plugins>
|
||||||
</plugin>
|
<plugin>
|
||||||
<plugin>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<version>2.8.2</version>
|
||||||
<version>3.2.4</version>
|
<executions>
|
||||||
<executions>
|
<execution>
|
||||||
<execution>
|
<id>default-deploy</id>
|
||||||
<phase>package</phase>
|
<phase>deploy</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>deploy</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
</execution>
|
||||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
</executions>
|
||||||
</configuration>
|
</plugin>
|
||||||
</execution>
|
</plugins>
|
||||||
</executions>
|
</build>-->
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>api</module>
|
<module>api</module>
|
||||||
|
|
|
||||||
79
velocity/dependency-reduced-pom.xml
Normal file
79
velocity/dependency-reduced-pom.xml
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>Chat</artifactId>
|
||||||
|
<groupId>com.alttd.chat</groupId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>velocity-chat</artifactId>
|
||||||
|
<build>
|
||||||
|
<defaultGoal>clean package</defaultGoal>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<finalName>${project.name}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>3.2.4</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>net.kyori:adventure-text-minimessage</include>
|
||||||
|
<include>com.alttd.chat:chat-api</include>
|
||||||
|
</includes>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/*.MF</exclude>
|
||||||
|
</excludes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.velocitypowered</groupId>
|
||||||
|
<artifactId>velocity-api</artifactId>
|
||||||
|
<version>1.1.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.luckperms</groupId>
|
||||||
|
<artifactId>api</artifactId>
|
||||||
|
<version>5.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.inject</groupId>
|
||||||
|
<artifactId>guice</artifactId>
|
||||||
|
<version>4.1.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.49</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
|
</properties>
|
||||||
|
</project>
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<groupId>com.alttd.chat</groupId>
|
<groupId>com.alttd.chat</groupId>
|
||||||
<artifactId>Chat</artifactId>
|
<artifactId>Chat</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>velocity-chat</artifactId>
|
<artifactId>velocity-chat</artifactId>
|
||||||
|
|
@ -25,47 +26,36 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
|
||||||
<source>11</source>
|
|
||||||
<target>11</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.4</version>
|
<version>3.2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<includes>
|
||||||
|
<include>net.kyori:adventure-text-minimessage</include>
|
||||||
|
<include>com.alttd.chat:chat-api</include>
|
||||||
|
</includes>
|
||||||
|
<excludes>
|
||||||
|
<exclude>META-INF/*.MF</exclude>
|
||||||
|
</excludes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
|
||||||
<filters>
|
|
||||||
<filter>
|
|
||||||
<artifact>net.kyori:*</artifact>
|
|
||||||
<excludes>
|
|
||||||
<exclude>META-INF/*.MF</exclude>
|
|
||||||
</excludes>
|
|
||||||
</filter>
|
|
||||||
</filters>
|
|
||||||
<artifactSet>
|
|
||||||
<includes>
|
|
||||||
<include>net.kyori:adventure-text-minimessage</include>
|
|
||||||
</includes>
|
|
||||||
<excludes>
|
|
||||||
<exclude>META-INF/*.MF</exclude>
|
|
||||||
</excludes>
|
|
||||||
</artifactSet>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main</directory>
|
<directory>src/main/resources</directory>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -84,11 +74,6 @@
|
||||||
<version>5.3</version>
|
<version>5.3</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-text-minimessage</artifactId>
|
|
||||||
<version>4.1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alttd.chat</groupId>
|
<groupId>com.alttd.chat</groupId>
|
||||||
<artifactId>chat-api</artifactId>
|
<artifactId>chat-api</artifactId>
|
||||||
|
|
@ -101,6 +86,12 @@
|
||||||
<version>4.1.0</version>
|
<version>4.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.49</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
package com.alttd.velocitychat;
|
package com.alttd.chat;
|
||||||
|
|
||||||
import com.alttd.chat.ChatAPI;
|
import com.alttd.chat.commands.GlobalAdminChat;
|
||||||
import com.alttd.chat.ChatImplementation;
|
import com.alttd.chat.commands.GlobalChat;
|
||||||
import com.alttd.velocitychat.commands.GlobalAdminChat;
|
import com.alttd.chat.commands.GlobalChatToggle;
|
||||||
import com.alttd.velocitychat.commands.GlobalChat;
|
|
||||||
import com.alttd.velocitychat.commands.GlobalChatToggle;
|
|
||||||
import com.alttd.chat.database.DatabaseConnection;
|
import com.alttd.chat.database.DatabaseConnection;
|
||||||
import com.alttd.velocitychat.handlers.ChatHandler;
|
import com.alttd.chat.handlers.ChatHandler;
|
||||||
import com.alttd.velocitychat.listeners.ChatListener;
|
import com.alttd.chat.listeners.ChatListener;
|
||||||
import com.alttd.velocitychat.listeners.PluginMessageListener;
|
import com.alttd.chat.listeners.PluginMessageListener;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||||
|
|
@ -28,9 +26,9 @@ import java.nio.file.Path;
|
||||||
authors = {"destro174", "teri"},
|
authors = {"destro174", "teri"},
|
||||||
dependencies = {@Dependency(id = "luckperms")}
|
dependencies = {@Dependency(id = "luckperms")}
|
||||||
)
|
)
|
||||||
public class ChatPlugin {
|
public class VelocityChat {
|
||||||
|
|
||||||
private static ChatPlugin plugin;
|
private static VelocityChat plugin;
|
||||||
private final ProxyServer server;
|
private final ProxyServer server;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final Path dataDirectory;
|
private final Path dataDirectory;
|
||||||
|
|
@ -43,7 +41,7 @@ public class ChatPlugin {
|
||||||
MinecraftChannelIdentifier.from("customplugin:mychannel");
|
MinecraftChannelIdentifier.from("customplugin:mychannel");
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ChatPlugin(ProxyServer proxyServer, Logger proxyLogger, @DataDirectory Path proxydataDirectory) {
|
public VelocityChat(ProxyServer proxyServer, Logger proxyLogger, @DataDirectory Path proxydataDirectory) {
|
||||||
plugin = this;
|
plugin = this;
|
||||||
server = proxyServer;
|
server = proxyServer;
|
||||||
logger = proxyLogger;
|
logger = proxyLogger;
|
||||||
|
|
@ -71,7 +69,7 @@ public class ChatPlugin {
|
||||||
return dataDirectory.toFile();
|
return dataDirectory.toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatPlugin getPlugin() {
|
public static VelocityChat getPlugin() {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.api;
|
package com.alttd.chat.api;
|
||||||
|
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.api;
|
package com.alttd.chat.api;
|
||||||
|
|
||||||
|
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.velocitychat.commands;
|
package com.alttd.chat.commands;
|
||||||
|
|
||||||
import com.alttd.velocitychat.api.GlobalAdminChatEvent;
|
import com.alttd.chat.api.GlobalAdminChatEvent;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.commands;
|
package com.alttd.chat.commands;
|
||||||
|
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.velocitychat.commands;
|
package com.alttd.chat.commands;
|
||||||
|
|
||||||
import com.alttd.velocitychat.ChatPlugin;
|
import com.alttd.chat.VelocityChat;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
|
@ -24,7 +24,7 @@ public class GlobalChatToggle {
|
||||||
.then(RequiredArgumentBuilder
|
.then(RequiredArgumentBuilder
|
||||||
.<CommandSource, String>argument("message", StringArgumentType.greedyString())
|
.<CommandSource, String>argument("message", StringArgumentType.greedyString())
|
||||||
.executes(context -> {
|
.executes(context -> {
|
||||||
LuckPerms luckPerms = ChatPlugin.getPlugin().API().getLuckPerms();
|
LuckPerms luckPerms = VelocityChat.getPlugin().API().getLuckPerms();
|
||||||
Player player = (Player) context;
|
Player player = (Player) context;
|
||||||
luckPerms.getUserManager().modifyUser(player.getUniqueId(), user -> {
|
luckPerms.getUserManager().modifyUser(player.getUniqueId(), user -> {
|
||||||
if(player.hasPermission(Config.GCPERMISSION)) { //TODO THIS MUST BE A CONSTANT FROM CONFIG?
|
if(player.hasPermission(Config.GCPERMISSION)) { //TODO THIS MUST BE A CONSTANT FROM CONFIG?
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.alttd.velocitychat.commands;
|
package com.alttd.chat.commands;
|
||||||
|
|
||||||
import com.alttd.velocitychat.ChatPlugin;
|
import com.alttd.chat.VelocityChat;
|
||||||
import com.alttd.velocitychat.api.PrivateMessageEvent;
|
import com.alttd.chat.api.PrivateMessageEvent;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
|
|
@ -39,7 +39,7 @@ public class Message {
|
||||||
Player receiver = playerOptional.get();
|
Player receiver = playerOptional.get();
|
||||||
proxyServer.getEventManager().fire(new PrivateMessageEvent(context.getSource(), receiver, context.getArgument("message", String.class))).thenAccept((event) -> {
|
proxyServer.getEventManager().fire(new PrivateMessageEvent(context.getSource(), receiver, context.getArgument("message", String.class))).thenAccept((event) -> {
|
||||||
if(event.getResult() == ResultedEvent.GenericResult.allowed()) {
|
if(event.getResult() == ResultedEvent.GenericResult.allowed()) {
|
||||||
ChatPlugin.getPlugin().getChatHandler().privateMessage(event);
|
VelocityChat.getPlugin().getChatHandler().privateMessage(event);
|
||||||
}
|
}
|
||||||
// event has finished firing
|
// event has finished firing
|
||||||
// do some logic dependent on the result
|
// do some logic dependent on the result
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.alttd.velocitychat.config;
|
package com.alttd.chat.config;
|
||||||
|
|
||||||
import com.alttd.chat.config.Config;
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.alttd.velocitychat.handlers;
|
package com.alttd.chat.handlers;
|
||||||
|
|
||||||
import com.alttd.velocitychat.ChatPlugin;
|
import com.alttd.chat.VelocityChat;
|
||||||
import com.alttd.velocitychat.api.PrivateMessageEvent;
|
import com.alttd.chat.api.PrivateMessageEvent;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.alttd.chat.objects.ChatPlayer;
|
import com.alttd.chat.objects.ChatPlayer;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
|
|
@ -101,7 +101,7 @@ public class ChatHandler {
|
||||||
|
|
||||||
Component component = miniMessage.parse(Config.GCFORMAT, map);
|
Component component = miniMessage.parse(Config.GCFORMAT, map);
|
||||||
|
|
||||||
for(Player p: ChatPlugin.getPlugin().getProxy().getAllPlayers()) {
|
for(Player p: VelocityChat.getPlugin().getProxy().getAllPlayers()) {
|
||||||
if(p.hasPermission(Config.GCPERMISSION));
|
if(p.hasPermission(Config.GCPERMISSION));
|
||||||
p.sendMessage(component);
|
p.sendMessage(component);
|
||||||
//TODO send global chat with format from config
|
//TODO send global chat with format from config
|
||||||
|
|
@ -129,7 +129,7 @@ public class ChatHandler {
|
||||||
public String getPrefix(Player player, boolean highest) {
|
public String getPrefix(Player player, boolean highest) {
|
||||||
// TODO cache these components on load, and return them here?
|
// TODO cache these components on load, and return them here?
|
||||||
StringBuilder prefix = new StringBuilder();
|
StringBuilder prefix = new StringBuilder();
|
||||||
LuckPerms luckPerms = ChatPlugin.getPlugin().API().getLuckPerms();
|
LuckPerms luckPerms = VelocityChat.getPlugin().API().getLuckPerms();
|
||||||
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
|
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
|
||||||
if(user == null) return "";
|
if(user == null) return "";
|
||||||
if(!highest) {
|
if(!highest) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.alttd.velocitychat.listeners;
|
package com.alttd.chat.listeners;
|
||||||
|
|
||||||
import com.alttd.velocitychat.ChatPlugin;
|
import com.alttd.chat.VelocityChat;
|
||||||
import com.alttd.velocitychat.api.GlobalAdminChatEvent;
|
import com.alttd.chat.api.GlobalAdminChatEvent;
|
||||||
import com.alttd.velocitychat.api.PrivateMessageEvent;
|
import com.alttd.chat.api.PrivateMessageEvent;
|
||||||
import com.alttd.chat.config.Config;
|
import com.alttd.chat.config.Config;
|
||||||
import com.velocitypowered.api.command.CommandSource;
|
import com.velocitypowered.api.command.CommandSource;
|
||||||
import com.velocitypowered.api.event.PostOrder;
|
import com.velocitypowered.api.event.PostOrder;
|
||||||
|
|
@ -17,10 +17,10 @@ import java.util.Map;
|
||||||
// TODO code CLEANUP
|
// TODO code CLEANUP
|
||||||
public class ChatListener {
|
public class ChatListener {
|
||||||
|
|
||||||
private ChatPlugin plugin;
|
private VelocityChat plugin;
|
||||||
|
|
||||||
public ChatListener() {
|
public ChatListener() {
|
||||||
plugin = ChatPlugin.getPlugin();
|
plugin = VelocityChat.getPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.FIRST)
|
@Subscribe(order = PostOrder.FIRST)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.alttd.velocitychat.listeners;
|
package com.alttd.chat.listeners;
|
||||||
|
|
||||||
import com.alttd.velocitychat.ChatPlugin;
|
import com.alttd.chat.VelocityChat;
|
||||||
import com.alttd.chat.objects.ChatPlayer;
|
import com.alttd.chat.objects.ChatPlayer;
|
||||||
import com.velocitypowered.api.event.PostOrder;
|
import com.velocitypowered.api.event.PostOrder;
|
||||||
import com.velocitypowered.api.event.Subscribe;
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
|
|
@ -11,11 +11,11 @@ public class PlayerListener {
|
||||||
|
|
||||||
@Subscribe(order = PostOrder.FIRST)
|
@Subscribe(order = PostOrder.FIRST)
|
||||||
public void onPlayerLogin(LoginEvent event) {
|
public void onPlayerLogin(LoginEvent event) {
|
||||||
ChatPlugin.getPlugin().getChatHandler().addPlayer(new ChatPlayer(event.getPlayer().getUniqueId()));
|
VelocityChat.getPlugin().getChatHandler().addPlayer(new ChatPlayer(event.getPlayer().getUniqueId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void quitEvent(DisconnectEvent event) {
|
public void quitEvent(DisconnectEvent event) {
|
||||||
ChatPlugin.getPlugin().getChatHandler().removePlayer(event.getPlayer().getUniqueId());
|
VelocityChat.getPlugin().getChatHandler().removePlayer(event.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.alttd.chat.listeners;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
|
import com.velocitypowered.api.event.Subscribe;
|
||||||
|
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||||
|
import com.velocitypowered.api.proxy.Player;
|
||||||
|
import com.velocitypowered.api.proxy.ServerConnection;
|
||||||
|
import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
|
||||||
|
|
||||||
|
public class PluginMessageListener {
|
||||||
|
|
||||||
|
private final ChannelIdentifier identifier;
|
||||||
|
|
||||||
|
public PluginMessageListener(ChannelIdentifier identifier){
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onPluginMessageEvent(PluginMessageEvent event){
|
||||||
|
if(event.getIdentifier().equals(identifier)){
|
||||||
|
event.setResult(PluginMessageEvent.ForwardResult.handled());
|
||||||
|
|
||||||
|
if(event.getSource() instanceof Player){
|
||||||
|
|
||||||
|
}
|
||||||
|
if(event.getSource() instanceof ServerConnection){
|
||||||
|
// Read the data written to the message
|
||||||
|
ByteArrayDataInput in = ByteStreams.newDataInput(event.getData());
|
||||||
|
String message = in.readUTF();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.alttd.velocitychat.util;
|
package com.alttd.chat.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user