ViaFabric platform

This commit is contained in:
creeper123123321 2019-06-09 12:23:25 -03:00 committed by creeper123123321
parent 0c7c7ba05c
commit 3acba1b8e2
9 changed files with 214 additions and 4 deletions

View File

@ -104,6 +104,12 @@
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-fabric</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-sponge</artifactId>
@ -116,4 +122,4 @@
<version>${project.parent.version}</version>
</dependency>
</dependencies>
</project>
</project>

View File

@ -1,6 +1,6 @@
name: ViaBackwards
version: ${project.version}
description: Allows 1.9.x on a 1.10 Spigot server
description: Allow older Minecraft versions to connect to a newer server version.
main: nl.matsv.viabackwards.BukkitPlugin
authors: [Matsv]

62
fabric/pom.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016 Matsv
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<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">
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>2.4.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>viabackwards-fabric</artifactId>
<repositories>
<repository>
<id>fabric-repo</id>
<url>https://maven.fabricmc.net/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.fabricmc</groupId>
<artifactId>fabric-loader</artifactId>
<version>0.4.8+build.154</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2016 Matsv
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package nl.matsv.viabackwards;
import lombok.Getter;
import net.fabricmc.loader.api.FabricLoader;
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
import nl.matsv.viabackwards.fabric.util.LoggerWrapper;
import org.apache.logging.log4j.LogManager;
import java.util.logging.Logger;
public class ViaFabricAddon implements ViaBackwardsPlatform, Runnable {
@Getter
private final Logger logger = new LoggerWrapper(LogManager.getLogger("ViaRewind"));
@Override
public void run() {
this.init();
}
@Override
public void disable() {
// Not possible
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2016 Matsv
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package nl.matsv.viabackwards.fabric.util;
import java.text.MessageFormat;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
public class LoggerWrapper extends Logger {
private final org.apache.logging.log4j.Logger base;
public LoggerWrapper(org.apache.logging.log4j.Logger logger) {
super("logger", null);
this.base = logger;
}
public void log(LogRecord record) {
this.log(record.getLevel(), record.getMessage());
}
public void log(Level level, String msg) {
if (level == Level.FINE) {
this.base.debug(msg);
} else if (level == Level.WARNING) {
this.base.warn(msg);
} else if (level == Level.SEVERE) {
this.base.error(msg);
} else if (level == Level.INFO) {
this.base.info(msg);
} else {
this.base.trace(msg);
}
}
public void log(Level level, String msg, Object param1) {
if (level == Level.FINE) {
this.base.debug(msg, param1);
} else if (level == Level.WARNING) {
this.base.warn(msg, param1);
} else if (level == Level.SEVERE) {
this.base.error(msg, param1);
} else if (level == Level.INFO) {
this.base.info(msg, param1);
} else {
this.base.trace(msg, param1);
}
}
public void log(Level level, String msg, Object[] params) {
log(level, MessageFormat.format(msg, params));
}
public void log(Level level, String msg, Throwable params) {
if (level == Level.FINE) {
this.base.debug(msg, params);
} else if (level == Level.WARNING) {
this.base.warn(msg, params);
} else if (level == Level.SEVERE) {
this.base.error(msg, params);
} else if (level == Level.INFO) {
this.base.info(msg, params);
} else {
this.base.trace(msg, params);
}
}
}

View File

@ -0,0 +1,29 @@
{
"schemaVersion": 1,
"id": "viabackwards",
"name": "ViaBackwards",
"version": "${project.version}",
"description": "Allow older Minecraft versions to connect to a newer server version.",
"license": "MIT",
"contact": {
"homepage": "https://github.com/ViaVersion/ViaBackwards",
"issues": "https://github.com/ViaVersion/ViaBackwards/issues",
"sources": "https://github.com/ViaVersion/ViaBackwards"
},
"environment": "*",
"authors": [
"Matsv"
],
"entrypoints": {
"viafabric:via_api_initialized": [
"nl.matsv.viabackwards.ViaFabricAddon"
]
},
"requires": {
"fabricloader": ">=0.4.0",
"viafabric": "*"
},
"recommended": {
"viarewind": "*"
}
}

View File

@ -27,6 +27,7 @@
<module>core</module>
<module>bukkit</module>
<module>bungee</module>
<module>fabric</module>
<module>sponge</module>
<module>velocity</module>
<module>all</module>

View File

@ -27,7 +27,7 @@ import java.util.logging.Logger;
name = "ViaBackwards",
version = VersionInfo.VERSION,
authors = {"Matsv"},
description = "Allow older Minecraft versions to connect to an newer server version.",
description = "Allow older Minecraft versions to connect to a newer server version.",
dependencies = {@Dependency(id = "viaversion")}
)
public class SpongePlugin implements ViaBackwardsPlatform {

View File

@ -27,7 +27,7 @@ import java.util.logging.Logger;
name = "ViaBackwards",
version = VersionInfo.VERSION,
authors = {"Matsv"},
description = "Allow older Minecraft versions to connect to an newer server version.",
description = "Allow older Minecraft versions to connect to a newer server version.",
dependencies = {@Dependency(id = "viaversion")}
)
public class VelocityPlugin implements ViaBackwardsPlatform {