3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-09-19 10:30:05 +02:00
ViaBackwards/velocity/src/main/java/nl/matsv/viabackwards/VelocityPlugin.java

74 Zeilen
2.4 KiB
Java

/*
2021-03-20 23:12:25 +01:00
* ViaBackwards - https://github.com/ViaVersion/ViaBackwards
* Copyright (C) 2016-2021 ViaVersion and contributors
*
2021-03-20 23:12:25 +01:00
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
2021-03-20 23:12:25 +01:00
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
2021-03-20 23:12:25 +01:00
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package nl.matsv.viabackwards;
import com.google.inject.Inject;
import com.velocitypowered.api.event.PostOrder;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Dependency;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import nl.matsv.viabackwards.api.ViaBackwardsPlatform;
2021-02-18 14:34:33 +01:00
import nl.matsv.viabackwards.utils.VersionInfo;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.sponge.util.LoggerWrapper;
import java.io.File;
import java.nio.file.Path;
import java.util.logging.Logger;
@Plugin(id = "viabackwards",
name = "ViaBackwards",
version = VersionInfo.VERSION,
authors = {"Matsv", "KennyTV", "Gerrygames", "creeper123123321", "ForceUpdate1"},
2019-06-09 17:23:25 +02:00
description = "Allow older Minecraft versions to connect to a newer server version.",
dependencies = {@Dependency(id = "viaversion")}
)
public class VelocityPlugin implements ViaBackwardsPlatform {
private Logger logger;
@Inject
private org.slf4j.Logger loggerSlf4j;
@Inject
@DataDirectory
private Path configPath;
@Subscribe(order = PostOrder.LATE)
public void onProxyStart(ProxyInitializeEvent e) {
// Setup Logger
this.logger = new LoggerWrapper(loggerSlf4j);
Via.getManager().addEnableListener(() -> this.init(configPath.resolve("config.yml").toFile()));
}
@Override
public void disable() {
// Not possible
}
@Override
public File getDataFolder() {
return configPath.toFile();
}
@Override
public Logger getLogger() {
return logger;
}
}