mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
Move main classes for proxies.
This commit is contained in:
parent
d7a55622be
commit
096da4db4d
@ -2,7 +2,7 @@ package venture.Aust1n46.chat;
|
|||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
|
|
||||||
import venture.Aust1n46.chat.proxy.VentureChatBungee;
|
import venture.Aust1n46.chat.initiators.application.VentureChatBungee;
|
||||||
|
|
||||||
public class VentureChatBungeePluginModule extends AbstractModule {
|
public class VentureChatBungeePluginModule extends AbstractModule {
|
||||||
private final VentureChatBungee plugin;
|
private final VentureChatBungee plugin;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package venture.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.initiators.application;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@ -28,6 +28,9 @@ 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.VentureChatBungeePluginModule;
|
import venture.Aust1n46.chat.VentureChatBungeePluginModule;
|
||||||
import venture.Aust1n46.chat.controllers.VentureChatProxyFlatFileController;
|
import venture.Aust1n46.chat.controllers.VentureChatProxyFlatFileController;
|
||||||
|
import venture.Aust1n46.chat.proxy.VentureChatProxy;
|
||||||
|
import venture.Aust1n46.chat.proxy.VentureChatProxyServer;
|
||||||
|
import venture.Aust1n46.chat.proxy.VentureChatProxySource;
|
||||||
import venture.Aust1n46.chat.service.proxy.ProxyUuidService;
|
import venture.Aust1n46.chat.service.proxy.ProxyUuidService;
|
||||||
import venture.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package venture.Aust1n46.chat.proxy;
|
package venture.Aust1n46.chat.initiators.application;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@ -33,6 +33,9 @@ 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.proxy.VentureChatProxy;
|
||||||
|
import venture.Aust1n46.chat.proxy.VentureChatProxyServer;
|
||||||
|
import venture.Aust1n46.chat.proxy.VentureChatProxySource;
|
||||||
import venture.Aust1n46.chat.utilities.FormatUtils;
|
import venture.Aust1n46.chat.utilities.FormatUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,7 +45,8 @@ import venture.Aust1n46.chat.utilities.FormatUtils;
|
|||||||
*/
|
*/
|
||||||
public class VentureChatVelocity implements VentureChatProxySource {
|
public class VentureChatVelocity implements VentureChatProxySource {
|
||||||
private final ProxyServer proxyServer;
|
private final ProxyServer proxyServer;
|
||||||
private final ChannelIdentifier channelIdentifier = MinecraftChannelIdentifier.create(VentureChatProxy.PLUGIN_MESSAGING_CHANNEL_NAMESPACE, VentureChatProxy.PLUGIN_MESSAGING_CHANNEL_NAME);
|
private final ChannelIdentifier channelIdentifier = MinecraftChannelIdentifier.create(VentureChatProxy.PLUGIN_MESSAGING_CHANNEL_NAMESPACE,
|
||||||
|
VentureChatProxy.PLUGIN_MESSAGING_CHANNEL_NAME);
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@ -81,8 +85,7 @@ public class VentureChatVelocity implements VentureChatProxySource {
|
|||||||
Files.copy(getClass().getClassLoader().getResourceAsStream("velocityconfig.yml"), config.toPath());
|
Files.copy(getClass().getClassLoader().getResourceAsStream("velocityconfig.yml"), config.toPath());
|
||||||
}
|
}
|
||||||
velocityConfig = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(dataFolder, "velocityconfig.yml"));
|
velocityConfig = ConfigurationProvider.getProvider(YamlConfiguration.class).load(new File(dataFolder, "velocityconfig.yml"));
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +105,11 @@ public class VentureChatVelocity implements VentureChatProxySource {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPlayerQuit(DisconnectEvent event) {
|
public void onPlayerQuit(DisconnectEvent event) {
|
||||||
// Delay sending plugin message to make sure disconnecting player is truly disconnected.
|
// Delay sending plugin message to make sure disconnecting player is truly
|
||||||
|
// disconnected.
|
||||||
proxyServer.getScheduler().buildTask(this, () -> {
|
proxyServer.getScheduler().buildTask(this, () -> {
|
||||||
updatePlayerNames();
|
updatePlayerNames();
|
||||||
})
|
}).delay(1, TimeUnit.SECONDS).schedule();
|
||||||
.delay(1, TimeUnit.SECONDS)
|
|
||||||
.schedule();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePlayerNames() {
|
private void updatePlayerNames() {
|
||||||
@ -124,11 +126,9 @@ public class VentureChatVelocity implements VentureChatProxySource {
|
|||||||
sendPluginMessage(send.getName(), outstream.toByteArray());
|
sendPluginMessage(send.getName(), outstream.toByteArray());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} catch (IllegalStateException e) {
|
||||||
catch(IllegalStateException e) {
|
|
||||||
sendConsoleMessage("Velocity being finicky with DisconnectEvent.");
|
sendConsoleMessage("Velocity being finicky with DisconnectEvent.");
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,9 @@ public class VentureChatVelocity implements VentureChatProxySource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VentureChatProxyServer> getServers() {
|
public List<VentureChatProxyServer> getServers() {
|
||||||
return proxyServer.getAllServers().stream().map(velocityServer -> new VentureChatProxyServer(velocityServer.getServerInfo().getName(), velocityServer.getPlayersConnected().isEmpty())).collect(Collectors.toList());
|
return proxyServer.getAllServers().stream()
|
||||||
|
.map(velocityServer -> new VentureChatProxyServer(velocityServer.getServerInfo().getName(), velocityServer.getPlayersConnected().isEmpty()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,4 +1,4 @@
|
|||||||
name: VentureChat
|
name: VentureChat
|
||||||
main: venture.Aust1n46.chat.proxy.VentureChatBungee
|
main: venture.Aust1n46.chat.initiators.application.VentureChatBungee
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
author: Aust1n46
|
author: Aust1n46
|
||||||
|
@ -1 +1 @@
|
|||||||
{"id":"venturechat","name":"VentureChat","version":"${project.version}","description":"#1 Channels Chat plugin! Spigot + Bungee. Supports PlaceholderAPI + JSON formatting. Moderation GUI!","authors":["Aust1n46"],"dependencies":[],"main":"mineverse.Aust1n46.chat.proxy.VentureChatVelocity"}
|
{"id":"venturechat","name":"VentureChat","version":"${project.version}","description":"#1 Channels Chat plugin! Spigot + Bungee. Supports PlaceholderAPI + JSON formatting. Moderation GUI!","authors":["Aust1n46"],"dependencies":[],"main":"venture.Aust1n46.chat.initiators.application.VentureChatVelocity"}
|
Loading…
x
Reference in New Issue
Block a user