initial commit
This commit is contained in:
commit
6d6134e670
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="Network" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="sonatype" />
|
||||
<option name="name" value="sonatype" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="papermc-repo" />
|
||||
<option name="name" value="papermc-repo" />
|
||||
<option name="url" value="https://repo.papermc.io/repository/maven-public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MaterialThemeProjectNewConfig">
|
||||
<option name="metadata">
|
||||
<MTProjectMetadataState>
|
||||
<option name="userId" value="-7d1c0107:190d4cbe4c4:-7f47" />
|
||||
</MTProjectMetadataState>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="2">
|
||||
<item index="0" class="java.lang.String" itemvalue="com.jonahseguin.drink.annotation.Command" />
|
||||
<item index="1" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Network.iml" filepath="$PROJECT_DIR$/Network.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>PAPER</platformType>
|
||||
<platformType>ADVENTURE</platformType>
|
||||
</autoDetectTypes>
|
||||
<projectReimportVersion>1</projectReimportVersion>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,66 @@
|
|||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.atmospheregames</groupId>
|
||||
<artifactId>Network</artifactId>
|
||||
<name>Network</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc-repo</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
|
@ -0,0 +1,90 @@
|
|||
<?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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.atmospheregames</groupId>
|
||||
<artifactId>Network</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Network</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<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>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc-repo</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jonahseguin</groupId>
|
||||
<artifactId>drink</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,52 @@
|
|||
package org.atmospheregames.network;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jonahseguin.drink.CommandService;
|
||||
import com.jonahseguin.drink.Drink;
|
||||
import lombok.Getter;
|
||||
import org.atmospheregames.network.command.NetworkCommand;
|
||||
import org.atmospheregames.network.heartbeat.HeartbeatThread;
|
||||
import org.atmospheregames.network.redis.RedisClient;
|
||||
import org.atmospheregames.network.tps.TPSRunnable;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class Network extends JavaPlugin {
|
||||
|
||||
@Getter private final CommandService commandService = Drink.get(this);
|
||||
|
||||
@Getter private TPSRunnable tpsRunnable;
|
||||
@Getter private RedisClient redisClient;
|
||||
@Getter private HeartbeatThread heartbeatThread;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, tpsRunnable = new TPSRunnable(), 0L, 1L);
|
||||
|
||||
this.redisClient = new RedisClient(this);
|
||||
this.heartbeatThread = new HeartbeatThread(this);
|
||||
this.heartbeatThread.start();
|
||||
|
||||
commandService.register(new NetworkCommand(this), "network");
|
||||
commandService.registerCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
sendServerUpdateMessage(false);
|
||||
redisClient.destroy();
|
||||
}
|
||||
|
||||
public void sendServerUpdateMessage(boolean online) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
|
||||
jsonObject.addProperty("server", getConfig().getString("SERVER-NAME"));
|
||||
jsonObject.addProperty("online", online);
|
||||
jsonObject.addProperty("whitelisted", Bukkit.getServer().hasWhitelist());
|
||||
jsonObject.addProperty("onlinePlayers", Bukkit.getOnlinePlayers().size());
|
||||
jsonObject.addProperty("onlinePlayerLimit", Bukkit.getMaxPlayers());
|
||||
jsonObject.addProperty("ticksPerSecond", tpsRunnable.getTPS());
|
||||
|
||||
redisClient.write(jsonObject);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.atmospheregames.network.command;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jonahseguin.drink.annotation.Command;
|
||||
import com.jonahseguin.drink.annotation.Sender;
|
||||
import org.atmospheregames.network.Network;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class NetworkCommand {
|
||||
|
||||
private final Network plugin;
|
||||
|
||||
public NetworkCommand(Network plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Command(name = "info", desc = "Find information about a server", usage = "<server>")
|
||||
public void networkInfo(@Sender CommandSender sender, String target) {
|
||||
JsonObject object = plugin.getRedisClient().getRedisListener().getCachedMessages().get(target);
|
||||
|
||||
if(object == null) {
|
||||
sender.sendMessage("Failed to find a server with the name: " + target);
|
||||
return;
|
||||
}
|
||||
|
||||
sender.sendMessage("Server Information: " + target);
|
||||
sender.sendMessage(object.get("online").getAsString());
|
||||
sender.sendMessage(object.get("whitelisted").getAsString());
|
||||
sender.sendMessage(object.get("onlinePlayers").getAsString());
|
||||
sender.sendMessage(object.get("onlinePlayerLimit").getAsString());
|
||||
sender.sendMessage(object.get("ticksPerSecond").getAsString());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.atmospheregames.network.heartbeat;
|
||||
|
||||
import org.atmospheregames.network.Network;
|
||||
|
||||
public class HeartbeatThread extends Thread {
|
||||
|
||||
private final Network plugin;
|
||||
|
||||
public HeartbeatThread(Network plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(true) {
|
||||
plugin.sendServerUpdateMessage(true);
|
||||
try {
|
||||
sleep(5000);
|
||||
} catch (InterruptedException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.atmospheregames.network.redis;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.Getter;
|
||||
import org.atmospheregames.network.Network;
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
public class RedisClient {
|
||||
|
||||
private static final String CHANNEL = "NETWORK";
|
||||
@Getter private final RedisListener redisListener;
|
||||
private final JedisPool jedisPool;
|
||||
|
||||
public RedisClient(Network plugin) {
|
||||
this.jedisPool = new JedisPool(plugin.getConfig().getString("REDIS.HOSTNAME"), plugin.getConfig().getInt("REDIS.PORT"));
|
||||
this.redisListener = new RedisListener();
|
||||
|
||||
Jedis jedis = jedisPool.getResource();
|
||||
|
||||
//jedis.auth
|
||||
|
||||
new Thread(() -> jedis.subscribe(redisListener, CHANNEL)).start();
|
||||
System.out.println("[Redis] Connected to redis successfully.");
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
jedisPool.destroy();
|
||||
}
|
||||
|
||||
public void write(JsonObject json) {
|
||||
try(Jedis jedis = jedisPool.getResource()) {
|
||||
jedis.publish(CHANNEL, json.toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package org.atmospheregames.network.redis;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import lombok.Getter;
|
||||
import org.atmospheregames.network.util.Style;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import redis.clients.jedis.JedisPubSub;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RedisListener extends JedisPubSub {
|
||||
|
||||
@Getter private final Map<String, JsonObject> cachedMessages = new HashMap<>();
|
||||
private final JsonParser parser = new JsonParser();
|
||||
|
||||
@Override
|
||||
public void onMessage(String channel, String message) {
|
||||
JsonObject object = parser.parse(message).getAsJsonObject();
|
||||
String serverName = object.get("server").getAsString();
|
||||
|
||||
cachedMessages.put(serverName, object);
|
||||
|
||||
|
||||
|
||||
// do shit with recieved message.
|
||||
|
||||
/*
|
||||
proposed logic: if message states is offline, print offline message
|
||||
if method states is online, print online message.
|
||||
|
||||
problem being: we only want to do each one of these once.
|
||||
|
||||
*/
|
||||
|
||||
if(object.get("server").getAsString().equals("hub")) {
|
||||
// run blacklist commands remotely
|
||||
|
||||
}
|
||||
|
||||
if(!object.get("online").getAsBoolean()) {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!player.hasPermission("network.servermonitor"))
|
||||
continue;
|
||||
|
||||
player.sendMessage(Style.translate("&6[Server Monitor] &fThe server &e" + serverName + " &fhas gone &coffline"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.atmospheregames.network.tps;
|
||||
public class TPSRunnable implements Runnable {
|
||||
|
||||
public int TICK_COUNT = 0;
|
||||
public long[] TICKS = new long[600];
|
||||
|
||||
/**
|
||||
* Get the ticks per second of the server
|
||||
* Calls TPSRunnable#getTPS(..) with 20 as default parameter
|
||||
*
|
||||
* @return the current ticks per second of the server
|
||||
*/
|
||||
public double getTPS() {
|
||||
return getTPS(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ticks per second of the server
|
||||
*
|
||||
* @param ticks the amount of ticks to check for
|
||||
* @return the current ticks per second of the server
|
||||
*/
|
||||
public double getTPS(int ticks) {
|
||||
if (TICK_COUNT < ticks) {
|
||||
return 20.0D;
|
||||
}
|
||||
|
||||
final int target = (TICK_COUNT - 1 - ticks) % TICKS.length;
|
||||
final long elapsed = System.currentTimeMillis() - TICKS[target];
|
||||
|
||||
return ticks / (elapsed / 1000.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
TICKS[(TICK_COUNT % TICKS.length)] = System.currentTimeMillis();
|
||||
TICK_COUNT += 1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package org.atmospheregames.network.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Zion
|
||||
* @project Network
|
||||
* @date 14/06/2024
|
||||
*/
|
||||
public class Style {
|
||||
public static final String BLUE = ChatColor.BLUE.toString();
|
||||
public static final String AQUA = ChatColor.AQUA.toString();
|
||||
public static final String YELLOW = ChatColor.YELLOW.toString();
|
||||
public static final String RED = ChatColor.RED.toString();
|
||||
public static final String GRAY = ChatColor.GRAY.toString();
|
||||
public static final String GOLD = ChatColor.GOLD.toString();
|
||||
public static final String GREEN = ChatColor.GREEN.toString();
|
||||
public static final String WHITE = ChatColor.WHITE.toString();
|
||||
public static final String BLACK = ChatColor.BLACK.toString();
|
||||
public static final String BOLD = ChatColor.BOLD.toString();
|
||||
public static final String ITALIC = ChatColor.ITALIC.toString();
|
||||
public static final String UNDER_LINE = ChatColor.UNDERLINE.toString();
|
||||
public static final String STRIKE_THROUGH = ChatColor.STRIKETHROUGH.toString();
|
||||
public static final String RESET = ChatColor.RESET.toString();
|
||||
public static final String MAGIC = ChatColor.MAGIC.toString();
|
||||
public static final String DBLUE = ChatColor.DARK_BLUE.toString();
|
||||
public static final String DAQUA = ChatColor.DARK_AQUA.toString();
|
||||
public static final String DGRAY = ChatColor.DARK_GRAY.toString();
|
||||
public static final String DGREEN = ChatColor.DARK_GREEN.toString();
|
||||
public static final String DPURPLE = ChatColor.DARK_PURPLE.toString();
|
||||
public static final String DRED = ChatColor.DARK_RED.toString();
|
||||
public static final String PURPLE = ChatColor.DARK_PURPLE.toString();
|
||||
public static final String PINK = ChatColor.LIGHT_PURPLE.toString();
|
||||
public static final String MENU_BAR = ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "------------------------";
|
||||
public static final String CHAT_BAR = ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "------------------------------------------------";
|
||||
public static final String SMALL_CHAT_BAR = ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "-----------------";
|
||||
public static final String SB_BAR = ChatColor.GRAY.toString() + ChatColor.STRIKETHROUGH + "----------------------";
|
||||
|
||||
public static String translate(String input) {
|
||||
return ChatColor.translateAlternateColorCodes('&', input);
|
||||
}
|
||||
|
||||
public static List<String> translate(String[] inputs) {
|
||||
List<String> toReturn = new ArrayList<>();
|
||||
|
||||
Arrays.stream(inputs).forEach(string -> {
|
||||
Style.translate(string);
|
||||
toReturn.add(string);
|
||||
});
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static List<String> translate(List<String> inputs) {
|
||||
List<String> toReturn = new ArrayList<>();
|
||||
|
||||
inputs.forEach(string -> {
|
||||
Style.translate(string);
|
||||
toReturn.add(string);
|
||||
});
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static String strip(String input) {
|
||||
return ChatColor.stripColor(input);
|
||||
}
|
||||
|
||||
public static List<String> strip(String[] inputs) {
|
||||
List<String> toReturn = new ArrayList<>();
|
||||
|
||||
Arrays.stream(inputs).forEach(string -> {
|
||||
Style.strip(string);
|
||||
toReturn.add(string);
|
||||
});
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static List<String> strip(List<String> inputs) {
|
||||
List<String> toReturn = new ArrayList<>();
|
||||
|
||||
inputs.forEach(string -> {
|
||||
Style.strip(string);
|
||||
toReturn.add(string);
|
||||
});
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
REDIS:
|
||||
HOSTNAME: "172.17.0.1"
|
||||
PORT: 6379
|
||||
|
||||
SERVER-NAME: "Hub-01"
|
|
@ -0,0 +1,4 @@
|
|||
name: Network
|
||||
version: '${project.version}'
|
||||
main: org.atmospheregames.network.Network
|
||||
api-version: '1.20'
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
REDIS:
|
||||
HOSTNAME: "172.17.0.1"
|
||||
PORT: 6379
|
||||
|
||||
SERVER-NAME: "Hub-01"
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
name: Network
|
||||
version: '1.0-SNAPSHOT'
|
||||
main: org.atmospheregames.network.Network
|
||||
api-version: '1.20'
|
|
@ -0,0 +1,3 @@
|
|||
artifactId=Network
|
||||
groupId=org.atmospheregames
|
||||
version=1.0-SNAPSHOT
|
|
@ -0,0 +1,7 @@
|
|||
org\atmospheregames\network\redis\RedisClient.class
|
||||
org\atmospheregames\network\redis\RedisListener.class
|
||||
org\atmospheregames\network\tps\TPSRunnable.class
|
||||
org\atmospheregames\network\heartbeat\HeartbeatThread.class
|
||||
org\atmospheregames\network\util\Style.class
|
||||
org\atmospheregames\network\command\NetworkCommand.class
|
||||
org\atmospheregames\network\Network.class
|
|
@ -0,0 +1,7 @@
|
|||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\heartbeat\HeartbeatThread.java
|
||||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\command\NetworkCommand.java
|
||||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\util\Style.java
|
||||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\redis\RedisClient.java
|
||||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\tps\TPSRunnable.java
|
||||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\Network.java
|
||||
F:\Atmosphere Games\Network\src\main\java\org\atmospheregames\network\redis\RedisListener.java
|
Binary file not shown.
Loading…
Reference in New Issue