This commit is contained in:
KennyTV 2020-11-24 11:49:13 +01:00 committed by Nassim
parent cf8d11d530
commit b84bc7668a
8 changed files with 3489 additions and 28 deletions

View File

@ -1,15 +1,18 @@
object Versions {
// Common
const val netty = "4.0.20.Final"
const val guava = "17.0"
const val jUnit = "5.6.3"
const val bungeeChat = "1.16-R0.5-SNAPSHOT"
// Common compiled
const val adventure = "4.5.1"
const val gson = "2.8.6"
const val fastUtil = "8.3.1"
const val openNBT = "1.2-SNAPSHOT"
const val gson = "2.8.6"
const val javassist = "3.27.0-GA"
// Common provided
const val netty = "4.0.20.Final"
const val guava = "17.0"
const val snakeYaml = "1.18"
const val jetbrainsAnnotations = "19.0.0"
const val jetbrainsAnnotations = "20.1.0"
const val jUnit = "5.6.3"
// Platforms
const val spigot = "1.16.5-R0.1-SNAPSHOT"

View File

@ -32,14 +32,8 @@ private fun ShadowJar.configureRelocations() {
relocate("javassist", "us.myles.viaversion.libs.javassist")
relocate("com.google.gson", "us.myles.viaversion.libs.gson")
relocate("com.github.steveice10.opennbt", "us.myles.viaversion.libs.opennbt")
relocate("net.md_5.bungee", "us.myles.viaversion.libs.bungeecordchat") {
include("net.md_5.bungee.api.chat.*")
include("net.md_5.bungee.api.chat.hover.content.*")
include("net.md_5.bungee.api.ChatColor")
include("net.md_5.bungee.api.ChatMessageType")
include("net.md_5.bungee.chat.*")
}
relocate("it.unimi.dsi.fastutil", "us.myles.viaversion.libs.fastutil")
relocate("net.kyori", "us.myles.viaversion.libs.kyori")
}
private fun ShadowJar.configureExcludes() {

View File

@ -8,13 +8,23 @@ blossom {
}
dependencies {
api("net.md-5", "bungeecord-chat", Versions.bungeeChat) {
exclude("com.google.guava")
}
api("it.unimi.dsi", "fastutil", Versions.fastUtil)
api("com.github.steveice10", "opennbt", Versions.openNBT)
api("com.google.code.gson", "gson", Versions.gson)
api("net.kyori", "adventure-api", Versions.adventure) {
exclude("org.checkerframework")
}
api("net.kyori", "adventure-text-serializer-gson", Versions.adventure) {
exclude("net.kyori", "adventure-api")
exclude("net.kyori", "adventure-bom")
exclude("com.google.code.gson", "gson")
}
api("net.kyori", "adventure-text-serializer-legacy", Versions.adventure) {
exclude("net.kyori", "adventure-api")
exclude("net.kyori", "adventure-bom")
}
compileOnlyApi("org.yaml", "snakeyaml", Versions.snakeYaml)
compileOnlyApi("io.netty", "netty-all", Versions.netty)
compileOnlyApi("com.google.guava", "guava", Versions.guava)

View File

@ -79,7 +79,7 @@ public class MappingData extends us.myles.ViaVersion.api.data.MappingData {
try {
String[] lines;
try (Reader reader = new InputStreamReader(MappingData.class.getClassLoader()
.getResourceAsStream("mojang-translations/en_US.properties"), StandardCharsets.UTF_8)) {
.getResourceAsStream("assets/viaversion/data/en_US.properties"), StandardCharsets.UTF_8)) {
lines = CharStreams.toString(reader).split("\n");
}
for (String line : lines) {

View File

@ -15,10 +15,10 @@ public class ChatColorUtil {
private static int ordinalCounter;
static {
addColorOrindal('0', '9');
addColorOrindal('a', 'f');
addColorOrindal('k', 'o');
addColorOrindal('r');
addColorOrdinal('0', '9');
addColorOrdinal('a', 'f');
addColorOrdinal('k', 'o');
addColorOrdinal('r');
}
public static boolean isColorCode(char c) {
@ -44,13 +44,13 @@ public class ChatColorUtil {
return STRIP_COLOR_PATTERN.matcher(input).replaceAll("");
}
private static void addColorOrindal(int from, int to) {
private static void addColorOrdinal(int from, int to) {
for (int c = from; c <= to; c++) {
addColorOrindal(c);
addColorOrdinal(c);
}
}
private static void addColorOrindal(int colorChar) {
private static void addColorOrdinal(int colorChar) {
COLOR_ORDINALS.put(colorChar, ordinalCounter++);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,7 @@ import java.util.concurrent.TimeUnit;
url = "https://viaversion.com"
)
public class VelocityPlugin implements ViaPlatform<Player> {
public static final LegacyComponentSerializer COMPONENT_SERIALIZER = LegacyComponentSerializer.builder().character('§').extractUrls().build();
public static ProxyServer PROXY;
@Inject
@ -154,7 +155,7 @@ public class VelocityPlugin implements ViaPlatform<Player> {
@Override
public void sendMessage(UUID uuid, String message) {
PROXY.getPlayer(uuid).ifPresent(it -> it.sendMessage(LegacyComponentSerializer.legacySection().deserialize(message)));
PROXY.getPlayer(uuid).ifPresent(player -> player.sendMessage(COMPONENT_SERIALIZER.deserialize(message)));
}
@Override

View File

@ -2,7 +2,7 @@ package us.myles.ViaVersion.velocity.command;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import us.myles.ViaVersion.VelocityPlugin;
import us.myles.ViaVersion.api.command.ViaCommandSender;
import java.util.UUID;
@ -21,7 +21,7 @@ public class VelocityCommandSender implements ViaCommandSender {
@Override
public void sendMessage(String msg) {
source.sendMessage(LegacyComponentSerializer.legacySection().deserialize(msg));
source.sendMessage(VelocityPlugin.COMPONENT_SERIALIZER.deserialize(msg));
}
@Override