geforkt von Mirrors/Velocity
Convert into a multi-module project.
For now, the API module only contains a few assorted utilities. More will be added later.
Dieser Commit ist enthalten in:
Ursprung
f9fd58eea5
Commit
bbf861d3bc
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -1,7 +1,7 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker {
|
docker {
|
||||||
image 'gradle:jdk8-slim'
|
image 'openjdk:8-jdk-slim'
|
||||||
args '-v gradle-cache:/home/gradle/.gradle:rw'
|
args '-v gradle-cache:/home/gradle/.gradle:rw'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ pipeline {
|
|||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh './gradlew shadowJar'
|
sh './gradlew shadowJar'
|
||||||
archiveArtifacts 'build/libs/*.jar'
|
archiveArtifacts 'proxy/build/libs/*-all.jar'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
|
29
api/build.gradle
Normale Datei
29
api/build.gradle
Normale Datei
@ -0,0 +1,29 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'com.github.johnrengelman.shadow' version '2.0.4'
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile 'com.google.code.gson:gson:2.8.5'
|
||||||
|
compile 'com.google.guava:guava:25.1-jre'
|
||||||
|
compile 'net.kyori:text:1.12-1.6.0-SNAPSHOT'
|
||||||
|
compile 'com.moandjiezana.toml:toml4j:0.7.2'
|
||||||
|
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
|
||||||
|
testCompile "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar) {
|
||||||
|
classifier 'javadoc'
|
||||||
|
from javadoc
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
classifier 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives javadocJar
|
||||||
|
archives shadowJar
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
5
api/src/main/java/com/velocitypowered/api/package-info.java
Normale Datei
5
api/src/main/java/com/velocitypowered/api/package-info.java
Normale Datei
@ -0,0 +1,5 @@
|
|||||||
|
package com.velocitypowered.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Welcome to the Velocity API documentation.
|
||||||
|
*/
|
@ -1,14 +1,22 @@
|
|||||||
package com.velocitypowered.proxy.data;
|
package com.velocitypowered.api.servers;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ServerInfo represents a server that a player can connect to. This object is immutable and safe for concurrent access.
|
||||||
|
*/
|
||||||
public final class ServerInfo {
|
public final class ServerInfo {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final InetSocketAddress address;
|
private final InetSocketAddress address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new ServerInfo object.
|
||||||
|
* @param name the name for the server
|
||||||
|
* @param address the address of the server to connect to
|
||||||
|
*/
|
||||||
public ServerInfo(String name, InetSocketAddress address) {
|
public ServerInfo(String name, InetSocketAddress address) {
|
||||||
this.name = Preconditions.checkNotNull(name, "name");
|
this.name = Preconditions.checkNotNull(name, "name");
|
||||||
this.address = Preconditions.checkNotNull(address, "address");
|
this.address = Preconditions.checkNotNull(address, "address");
|
@ -1,12 +1,12 @@
|
|||||||
package com.velocitypowered.proxy.util;
|
package com.velocitypowered.api.util;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for handling legacy Minecraft color codes. Generally, you should prefer JSON-based components, but for
|
* LegacyChatColorUtils contains utilities for handling legacy Minecraft color codes. Generally, you should prefer
|
||||||
* convenience Velocity provides these utilities.
|
* JSON-based components, but for convenience Velocity provides a limited set of tools to handle Minecraft color codes.
|
||||||
*/
|
*/
|
||||||
public enum LegacyChatColorUtils {
|
public enum LegacyChatColorUtils {
|
||||||
;
|
;
|
@ -1,5 +1,6 @@
|
|||||||
package com.velocitypowered.proxy.util;
|
package com.velocitypowered.api.util;
|
||||||
|
|
||||||
|
import com.velocitypowered.api.util.LegacyChatColorUtils;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
88
build.gradle
88
build.gradle
@ -1,78 +1,32 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'com.github.johnrengelman.shadow' version '2.0.4'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'com.velocitypowered'
|
allprojects {
|
||||||
version '1.0-SNAPSHOT'
|
group 'com.velocitypowered'
|
||||||
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
// dependency versions
|
// dependency versions
|
||||||
junitVersion = '5.3.0-M1'
|
junitVersion = '5.3.0-M1'
|
||||||
log4jVersion = '2.11.0'
|
log4jVersion = '2.11.0'
|
||||||
nettyVersion = '4.1.28.Final'
|
nettyVersion = '4.1.28.Final'
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
maven {
|
|
||||||
url 'https://oss.sonatype.org/content/groups/public/'
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
repositories {
|
||||||
compile 'com.google.code.gson:gson:2.8.5'
|
mavenLocal()
|
||||||
compile 'com.google.guava:guava:25.1-jre'
|
mavenCentral()
|
||||||
compile "io.netty:netty-codec:${nettyVersion}"
|
maven {
|
||||||
compile "io.netty:netty-codec-http:${nettyVersion}"
|
url 'https://oss.sonatype.org/content/groups/public/'
|
||||||
compile "io.netty:netty-handler:${nettyVersion}"
|
}
|
||||||
compile "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
|
||||||
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
|
||||||
compile 'net.kyori:text:1.12-1.6.0-SNAPSHOT'
|
|
||||||
compile "org.apache.logging.log4j:log4j-api:${log4jVersion}"
|
|
||||||
compile "org.apache.logging.log4j:log4j-core:${log4jVersion}"
|
|
||||||
compile 'com.moandjiezana.toml:toml4j:0.7.2'
|
|
||||||
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
|
|
||||||
testCompile "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava {
|
|
||||||
options.compilerArgs += ['-proc:none']
|
|
||||||
}
|
|
||||||
|
|
||||||
compileTestJava {
|
|
||||||
options.compilerArgs += ['-proc:none']
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes 'Main-Class': 'com.velocitypowered.proxy.Velocity'
|
|
||||||
attributes 'Implementation-Version': project.version
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
test {
|
||||||
reports {
|
reports {
|
||||||
junitXml.enabled = true
|
junitXml.enabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar) {
|
|
||||||
classifier 'javadoc'
|
|
||||||
from javadoc
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
classifier 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
artifacts {
|
|
||||||
archives javadocJar
|
|
||||||
archives shadowJar
|
|
||||||
archives sourcesJar
|
|
||||||
}
|
|
36
proxy/build.gradle
Normale Datei
36
proxy/build.gradle
Normale Datei
@ -0,0 +1,36 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
id 'com.github.johnrengelman.shadow' version '2.0.4'
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.compilerArgs += ['-proc:none']
|
||||||
|
}
|
||||||
|
|
||||||
|
compileTestJava {
|
||||||
|
options.compilerArgs += ['-proc:none']
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'Main-Class': 'com.velocitypowered.proxy.Velocity'
|
||||||
|
attributes 'Implementation-Version': project.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(':velocity-api')
|
||||||
|
compile "io.netty:netty-codec:${nettyVersion}"
|
||||||
|
compile "io.netty:netty-codec-http:${nettyVersion}"
|
||||||
|
compile "io.netty:netty-handler:${nettyVersion}"
|
||||||
|
compile "io.netty:netty-transport-native-epoll:${nettyVersion}"
|
||||||
|
compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64"
|
||||||
|
compile "org.apache.logging.log4j:log4j-api:${log4jVersion}"
|
||||||
|
compile "org.apache.logging.log4j:log4j-core:${log4jVersion}"
|
||||||
|
testCompile "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
|
||||||
|
testCompile "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives shadowJar
|
||||||
|
}
|
@ -5,7 +5,7 @@ import com.google.gson.GsonBuilder;
|
|||||||
import com.velocitypowered.network.ConnectionManager;
|
import com.velocitypowered.network.ConnectionManager;
|
||||||
import com.velocitypowered.proxy.config.VelocityConfiguration;
|
import com.velocitypowered.proxy.config.VelocityConfiguration;
|
||||||
import com.velocitypowered.proxy.connection.http.NettyHttpClient;
|
import com.velocitypowered.proxy.connection.http.NettyHttpClient;
|
||||||
import com.velocitypowered.proxy.data.ServerInfo;
|
import com.velocitypowered.api.servers.ServerInfo;
|
||||||
import com.velocitypowered.proxy.util.AddressUtil;
|
import com.velocitypowered.proxy.util.AddressUtil;
|
||||||
import com.velocitypowered.proxy.util.EncryptionUtils;
|
import com.velocitypowered.proxy.util.EncryptionUtils;
|
||||||
import com.velocitypowered.proxy.util.ServerMap;
|
import com.velocitypowered.proxy.util.ServerMap;
|
||||||
@ -21,7 +21,6 @@ import java.nio.file.NoSuchFileException;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class VelocityServer {
|
public class VelocityServer {
|
@ -3,7 +3,7 @@ package com.velocitypowered.proxy.config;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.moandjiezana.toml.Toml;
|
import com.moandjiezana.toml.Toml;
|
||||||
import com.velocitypowered.proxy.util.AddressUtil;
|
import com.velocitypowered.proxy.util.AddressUtil;
|
||||||
import com.velocitypowered.proxy.util.LegacyChatColorUtils;
|
import com.velocitypowered.api.util.LegacyChatColorUtils;
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
import net.kyori.text.serializer.ComponentSerializers;
|
import net.kyori.text.serializer.ComponentSerializers;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
@ -11,7 +11,7 @@ import com.velocitypowered.proxy.protocol.packets.Handshake;
|
|||||||
import com.velocitypowered.proxy.protocol.packets.ServerLogin;
|
import com.velocitypowered.proxy.protocol.packets.ServerLogin;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||||
import com.velocitypowered.proxy.protocol.StateRegistry;
|
import com.velocitypowered.proxy.protocol.StateRegistry;
|
||||||
import com.velocitypowered.proxy.data.ServerInfo;
|
import com.velocitypowered.api.servers.ServerInfo;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
||||||
import io.netty.channel.*;
|
import io.netty.channel.*;
|
@ -2,7 +2,7 @@ package com.velocitypowered.proxy.connection.client;
|
|||||||
|
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.backend.ServerConnection;
|
import com.velocitypowered.proxy.connection.backend.ServerConnection;
|
||||||
import com.velocitypowered.proxy.data.ServerInfo;
|
import com.velocitypowered.api.servers.ServerInfo;
|
||||||
import com.velocitypowered.proxy.data.scoreboard.Objective;
|
import com.velocitypowered.proxy.data.scoreboard.Objective;
|
||||||
import com.velocitypowered.proxy.data.scoreboard.Score;
|
import com.velocitypowered.proxy.data.scoreboard.Score;
|
||||||
import com.velocitypowered.proxy.data.scoreboard.Scoreboard;
|
import com.velocitypowered.proxy.data.scoreboard.Scoreboard;
|
@ -9,7 +9,7 @@ import com.velocitypowered.proxy.connection.MinecraftConnection;
|
|||||||
import com.velocitypowered.proxy.connection.backend.ServerConnection;
|
import com.velocitypowered.proxy.connection.backend.ServerConnection;
|
||||||
import com.velocitypowered.proxy.protocol.packets.ClientSettings;
|
import com.velocitypowered.proxy.protocol.packets.ClientSettings;
|
||||||
import com.velocitypowered.proxy.util.ThrowableUtils;
|
import com.velocitypowered.proxy.util.ThrowableUtils;
|
||||||
import com.velocitypowered.proxy.data.ServerInfo;
|
import com.velocitypowered.api.servers.ServerInfo;
|
||||||
import com.velocitypowered.proxy.protocol.packets.Disconnect;
|
import com.velocitypowered.proxy.protocol.packets.Disconnect;
|
||||||
import net.kyori.text.Component;
|
import net.kyori.text.Component;
|
||||||
import net.kyori.text.TextComponent;
|
import net.kyori.text.TextComponent;
|
||||||
@ -21,7 +21,6 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
@ -10,10 +10,8 @@ import com.velocitypowered.proxy.protocol.packets.*;
|
|||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
import com.velocitypowered.proxy.connection.backend.ServerConnection;
|
import com.velocitypowered.api.servers.ServerInfo;
|
||||||
import com.velocitypowered.proxy.data.ServerInfo;
|
|
||||||
import com.velocitypowered.proxy.util.EncryptionUtils;
|
import com.velocitypowered.proxy.util.EncryptionUtils;
|
||||||
import com.velocitypowered.proxy.util.UuidUtils;
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.kyori.text.TextComponent;
|
import net.kyori.text.TextComponent;
|
||||||
import net.kyori.text.format.TextColor;
|
import net.kyori.text.format.TextColor;
|
@ -2,7 +2,7 @@ package com.velocitypowered.proxy.util;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.velocitypowered.proxy.data.ServerInfo;
|
import com.velocitypowered.api.servers.ServerInfo;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
@ -1 +1,6 @@
|
|||||||
rootProject.name = 'velocity'
|
rootProject.name = 'velocity'
|
||||||
|
include 'api'
|
||||||
|
include 'proxy'
|
||||||
|
findProject(':api')?.name = 'velocity-api'
|
||||||
|
findProject(':proxy')?.name = 'velocity-proxy'
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
# What port should the proxy be bound to? By default, we'll bind to all addresses on port 25577.
|
|
||||||
bind = "0.0.0.0:25577"
|
|
||||||
|
|
||||||
# What should be the MOTD? Legacy color codes and JSON are accepted.
|
|
||||||
motd = "&3A Velocity Server"
|
|
||||||
|
|
||||||
# What should we display for the maximum number of players? (Velocity does not support a cap
|
|
||||||
# on the number of players online.)
|
|
||||||
show-max-players = 500
|
|
||||||
|
|
||||||
# Should we authenticate players with Mojang? By default, this is on.
|
|
||||||
online-mode = true
|
|
||||||
|
|
||||||
# Should we forward IP addresses and other data to backend servers?
|
|
||||||
# Available options:
|
|
||||||
# - "none": No forwarding will be done. All players will appear to be connecting from the proxy
|
|
||||||
# and will have offline-mode UUIDs.
|
|
||||||
# - "legacy": Forward player IPs and UUIDs in BungeeCord-compatible fashion. Use this if you run
|
|
||||||
# servers using Minecraft 1.12 or lower.
|
|
||||||
# - "modern": Forward player IPs and UUIDs as part of the login process using Velocity's native
|
|
||||||
# forwarding. Only applicable for Minecraft 1.13 or higher.
|
|
||||||
ip-forwarding = "modern"
|
|
||||||
|
|
||||||
[servers]
|
|
||||||
# Configure your servers here.
|
|
||||||
lobby = "127.0.0.1:30066"
|
|
||||||
factions = "127.0.0.1:30067"
|
|
||||||
minigames = "127.0.0.1:30068"
|
|
||||||
|
|
||||||
# In what order we should try servers when a player logs in or is kicked from a server.
|
|
||||||
try = [
|
|
||||||
"lobby"
|
|
||||||
]
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren