Merge master into Spigot rename

This commit is contained in:
DoctorMacc 2020-06-21 16:21:47 -04:00
commit 427f4ef83d
40 changed files with 525 additions and 114 deletions

View file

@ -44,6 +44,7 @@ import org.geysermc.platform.bungeecord.command.GeyserBungeeCommandManager;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.util.UUID;
import java.util.logging.Level;
@ -134,4 +135,9 @@ public class GeyserBungeePlugin extends Plugin implements GeyserBootstrap {
public IGeyserPingPassthrough getGeyserPingPassthrough() {
return geyserBungeePingPassthrough;
}
@Override
public Path getConfigFolder() {
return getDataFolder().toPath();
}
}

View file

@ -45,6 +45,7 @@ import us.myles.ViaVersion.api.Via;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.UUID;
import java.util.logging.Level;
@ -162,6 +163,11 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
return this.geyserWorldManager;
}
@Override
public Path getConfigFolder() {
return getDataFolder().toPath();
}
public boolean isCompatible(String version, String whichVersion) {
int[] currentVersion = parseVersion(version);
int[] otherVersion = parseVersion(whichVersion);
@ -195,4 +201,5 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
}
return temp;
}
}

View file

@ -129,6 +129,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
return node.getNode("allow-third-party-ears").getBoolean(false);
}
@Override
public boolean isShowCooldown() {
return node.getNode("show-cooldown").getBoolean(true);
}
@Override
public String getDefaultLocale() {
return node.getNode("default-locale").getString("en_us");

View file

@ -50,6 +50,7 @@ import org.spongepowered.api.plugin.Plugin;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.util.UUID;
@Plugin(id = "geyser", name = GeyserConnector.NAME + "-Sponge", version = GeyserConnector.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
@ -147,6 +148,11 @@ public class GeyserSpongePlugin implements GeyserBootstrap {
return geyserSpongePingPassthrough;
}
@Override
public Path getConfigFolder() {
return configDir.toPath();
}
@Listener
public void onServerStart(GameStartedServerEvent event) {
onEnable();

View file

@ -37,6 +37,8 @@ import org.geysermc.platform.standalone.command.GeyserCommandManager;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;
public class GeyserStandaloneBootstrap implements GeyserBootstrap {
@ -100,4 +102,10 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
public IGeyserPingPassthrough getGeyserPingPassthrough() {
return geyserPingPassthrough;
}
@Override
public Path getConfigFolder() {
// Return the current working directory
return Paths.get(System.getProperty("user.dir"));
}
}

View file

@ -82,7 +82,7 @@ public class GeyserStandaloneLogger extends SimpleTerminalConsole implements org
@Override
public void info(String message) {
log.info(printConsole(ChatColor.WHITE + message, colored));
log.info(printConsole(ChatColor.RESET + ChatColor.BOLD + message, colored));
}
@Override

View file

@ -34,6 +34,7 @@ import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.ProxyServer;
import lombok.Getter;
import org.geysermc.common.PlatformType;
import org.geysermc.connector.configuration.GeyserConfiguration;
import org.geysermc.connector.GeyserConnector;
@ -48,6 +49,8 @@ import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;
@Plugin(id = "geyser", name = GeyserConnector.NAME + "-Velocity", version = GeyserConnector.VERSION, url = "https://geysermc.org", authors = "GeyserMC")
@ -69,14 +72,16 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
private GeyserConnector connector;
@Getter
private final Path configFolder = Paths.get("plugins/" + GeyserConnector.NAME + "-Velocity/");
@Override
public void onEnable() {
File configDir = new File("plugins/" + GeyserConnector.NAME + "-Velocity/");
try {
if (!configDir.exists())
configDir.mkdir();
File configFile = FileUtils.fileOrCopiedFromResource(new File(configDir, "config.yml"), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()));
if (!configFolder.toFile().exists())
//noinspection ResultOfMethodCallIgnored
configFolder.toFile().mkdirs();
File configFile = FileUtils.fileOrCopiedFromResource(configFolder.resolve("config.yml").toFile(), "config.yml", (x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()));
this.geyserConfig = FileUtils.loadConfig(configFile, GeyserVelocityConfiguration.class);
} catch (IOException ex) {
logger.warn("Failed to read/create config.yml! Make sure it's up to date and/or readable+writable!", ex);
@ -101,7 +106,7 @@ public class GeyserVelocityPlugin implements GeyserBootstrap {
return;
}
geyserConfig.loadFloodgate(this, proxyServer, configDir);
geyserConfig.loadFloodgate(this, proxyServer, configFolder.toFile());
this.connector = GeyserConnector.start(PlatformType.VELOCITY, this);