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>
|
||||
<artifactId>Chat</artifactId>
|
||||
<version>1.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>chat-api</artifactId>
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>net.luckperms</groupId>
|
||||
|
|
@ -52,6 +31,11 @@
|
|||
<artifactId>configurate-yaml</artifactId>
|
||||
<version>3.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</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 java.util.UUID;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.alttd.velocitychat;
|
||||
package com.alttd.chat;
|
||||
|
||||
import com.alttd.velocitychat.config.Config;
|
||||
import com.alttd.velocitychat.database.DatabaseConnection;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.alttd.chat.database.DatabaseConnection;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
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.collect.Lists;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.alttd.velocitychat.database;
|
||||
package com.alttd.chat.database;
|
||||
|
||||
|
||||
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.velocitychat.objects.PartyUser;
|
||||
import com.alttd.chat.objects.Party;
|
||||
import com.alttd.chat.objects.PartyUser;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.alttd.velocitychat.objects;
|
||||
package com.alttd.chat.objects;
|
||||
|
||||
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.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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.alttd.velocitychat.objects;
|
||||
package com.alttd.chat.objects;
|
||||
|
||||
public class Regex {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.alttd.velocitychat.objects;
|
||||
package com.alttd.chat.objects;
|
||||
|
||||
public enum RegexType {
|
||||
REPLACE("replace"),
|
||||
|
|
|
|||
58
pom.xml
58
pom.xml
|
|
@ -17,37 +17,33 @@
|
|||
<maven.compiler.source>11</maven.compiler.source>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>Alttd-Nexus</id>
|
||||
<url>http://leo:8081/snapshots/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<!--<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
<phase>deploy</phase>
|
||||
<goals>
|
||||
<goal>deploy</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>-->
|
||||
|
||||
<modules>
|
||||
<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>
|
||||
<artifactId>Chat</artifactId>
|
||||
<version>1.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>velocity-chat</artifactId>
|
||||
|
|
@ -25,47 +26,36 @@
|
|||
<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>
|
||||
<version>3.8.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<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>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</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>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main</directory>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
@ -84,11 +74,6 @@
|
|||
<version>5.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alttd.chat</groupId>
|
||||
<artifactId>chat-api</artifactId>
|
||||
|
|
@ -101,6 +86,12 @@
|
|||
<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>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
package com.alttd.velocitychat;
|
||||
package com.alttd.chat;
|
||||
|
||||
import com.alttd.chat.ChatAPI;
|
||||
import com.alttd.chat.ChatImplementation;
|
||||
import com.alttd.velocitychat.commands.GlobalAdminChat;
|
||||
import com.alttd.velocitychat.commands.GlobalChat;
|
||||
import com.alttd.velocitychat.commands.GlobalChatToggle;
|
||||
import com.alttd.chat.commands.GlobalAdminChat;
|
||||
import com.alttd.chat.commands.GlobalChat;
|
||||
import com.alttd.chat.commands.GlobalChatToggle;
|
||||
import com.alttd.chat.database.DatabaseConnection;
|
||||
import com.alttd.velocitychat.handlers.ChatHandler;
|
||||
import com.alttd.velocitychat.listeners.ChatListener;
|
||||
import com.alttd.velocitychat.listeners.PluginMessageListener;
|
||||
import com.alttd.chat.handlers.ChatHandler;
|
||||
import com.alttd.chat.listeners.ChatListener;
|
||||
import com.alttd.chat.listeners.PluginMessageListener;
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||
|
|
@ -28,9 +26,9 @@ import java.nio.file.Path;
|
|||
authors = {"destro174", "teri"},
|
||||
dependencies = {@Dependency(id = "luckperms")}
|
||||
)
|
||||
public class ChatPlugin {
|
||||
public class VelocityChat {
|
||||
|
||||
private static ChatPlugin plugin;
|
||||
private static VelocityChat plugin;
|
||||
private final ProxyServer server;
|
||||
private final Logger logger;
|
||||
private final Path dataDirectory;
|
||||
|
|
@ -43,7 +41,7 @@ public class ChatPlugin {
|
|||
MinecraftChannelIdentifier.from("customplugin:mychannel");
|
||||
|
||||
@Inject
|
||||
public ChatPlugin(ProxyServer proxyServer, Logger proxyLogger, @DataDirectory Path proxydataDirectory) {
|
||||
public VelocityChat(ProxyServer proxyServer, Logger proxyLogger, @DataDirectory Path proxydataDirectory) {
|
||||
plugin = this;
|
||||
server = proxyServer;
|
||||
logger = proxyLogger;
|
||||
|
|
@ -71,7 +69,7 @@ public class ChatPlugin {
|
|||
return dataDirectory.toFile();
|
||||
}
|
||||
|
||||
public static ChatPlugin getPlugin() {
|
||||
public static VelocityChat getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.alttd.velocitychat.api;
|
||||
package com.alttd.chat.api;
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -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.mojang.brigadier.arguments.StringArgumentType;
|
||||
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.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.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
|
|
@ -24,7 +24,7 @@ public class GlobalChatToggle {
|
|||
.then(RequiredArgumentBuilder
|
||||
.<CommandSource, String>argument("message", StringArgumentType.greedyString())
|
||||
.executes(context -> {
|
||||
LuckPerms luckPerms = ChatPlugin.getPlugin().API().getLuckPerms();
|
||||
LuckPerms luckPerms = VelocityChat.getPlugin().API().getLuckPerms();
|
||||
Player player = (Player) context;
|
||||
luckPerms.getUserManager().modifyUser(player.getUniqueId(), user -> {
|
||||
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.velocitychat.api.PrivateMessageEvent;
|
||||
import com.alttd.chat.VelocityChat;
|
||||
import com.alttd.chat.api.PrivateMessageEvent;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
|
|
@ -39,7 +39,7 @@ public class Message {
|
|||
Player receiver = playerOptional.get();
|
||||
proxyServer.getEventManager().fire(new PrivateMessageEvent(context.getSource(), receiver, context.getArgument("message", String.class))).thenAccept((event) -> {
|
||||
if(event.getResult() == ResultedEvent.GenericResult.allowed()) {
|
||||
ChatPlugin.getPlugin().getChatHandler().privateMessage(event);
|
||||
VelocityChat.getPlugin().getChatHandler().privateMessage(event);
|
||||
}
|
||||
// event has finished firing
|
||||
// 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 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.velocitychat.api.PrivateMessageEvent;
|
||||
import com.alttd.chat.VelocityChat;
|
||||
import com.alttd.chat.api.PrivateMessageEvent;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.alttd.chat.objects.ChatPlayer;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
|
|
@ -101,7 +101,7 @@ public class ChatHandler {
|
|||
|
||||
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));
|
||||
p.sendMessage(component);
|
||||
//TODO send global chat with format from config
|
||||
|
|
@ -129,7 +129,7 @@ public class ChatHandler {
|
|||
public String getPrefix(Player player, boolean highest) {
|
||||
// TODO cache these components on load, and return them here?
|
||||
StringBuilder prefix = new StringBuilder();
|
||||
LuckPerms luckPerms = ChatPlugin.getPlugin().API().getLuckPerms();
|
||||
LuckPerms luckPerms = VelocityChat.getPlugin().API().getLuckPerms();
|
||||
User user = luckPerms.getUserManager().getUser(player.getUniqueId());
|
||||
if(user == null) return "";
|
||||
if(!highest) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.alttd.velocitychat.listeners;
|
||||
package com.alttd.chat.listeners;
|
||||
|
||||
import com.alttd.velocitychat.ChatPlugin;
|
||||
import com.alttd.velocitychat.api.GlobalAdminChatEvent;
|
||||
import com.alttd.velocitychat.api.PrivateMessageEvent;
|
||||
import com.alttd.chat.VelocityChat;
|
||||
import com.alttd.chat.api.GlobalAdminChatEvent;
|
||||
import com.alttd.chat.api.PrivateMessageEvent;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.event.PostOrder;
|
||||
|
|
@ -17,10 +17,10 @@ import java.util.Map;
|
|||
// TODO code CLEANUP
|
||||
public class ChatListener {
|
||||
|
||||
private ChatPlugin plugin;
|
||||
private VelocityChat plugin;
|
||||
|
||||
public ChatListener() {
|
||||
plugin = ChatPlugin.getPlugin();
|
||||
plugin = VelocityChat.getPlugin();
|
||||
}
|
||||
|
||||
@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.velocitypowered.api.event.PostOrder;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
|
|
@ -11,11 +11,11 @@ public class PlayerListener {
|
|||
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public void onPlayerLogin(LoginEvent event) {
|
||||
ChatPlugin.getPlugin().getChatHandler().addPlayer(new ChatPlayer(event.getPlayer().getUniqueId()));
|
||||
VelocityChat.getPlugin().getChatHandler().addPlayer(new ChatPlayer(event.getPlayer().getUniqueId()));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
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.HashMap;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user