Add embeds footer text to custom translations. #3
21 arquivos alterados com 49 adições e 139 exclusões
Beta 3
commit
b92922ace3
32
build.gradle
32
build.gradle
|
|
@ -1,19 +1,22 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "fabric-loom" version "0.6-SNAPSHOT"
|
id "fabric-loom" version "0.8-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url 'https://jitpack.io' }
|
maven {
|
||||||
|
name 'm2-dv8tion'
|
||||||
|
url 'https://m2.dv8tion.net/releases'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = 16
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = 16
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
|
@ -29,15 +32,15 @@ dependencies {
|
||||||
implementation include("com.jagrosh:jda-utilities-menu:3.0.5")
|
implementation include("com.jagrosh:jda-utilities-menu:3.0.5")
|
||||||
implementation include("com.jagrosh:jda-utilities-examples:3.0.5")
|
implementation include("com.jagrosh:jda-utilities-examples:3.0.5")
|
||||||
implementation include("com.jagrosh:jda-utilities-doc:3.0.5")
|
implementation include("com.jagrosh:jda-utilities-doc:3.0.5")
|
||||||
implementation include('net.dv8tion:JDA:4.2.0_231') {
|
implementation include('net.dv8tion:JDA:4.3.0_310') {
|
||||||
exclude module: 'opus-java'
|
exclude module: 'opus-java'
|
||||||
}
|
}
|
||||||
implementation include('org.apache.logging.log4j:log4j-slf4j-impl:2.8.1')
|
//implementation include('org.apache.logging.log4j:log4j-slf4j-impl:2.14.1')
|
||||||
|
|
||||||
include "net.sf.trove4j:trove4j:3.0.3"
|
include "net.sf.trove4j:trove4j:3.0.3"
|
||||||
include 'org.slf4j:slf4j-api:1.7.25'
|
//include 'org.slf4j:slf4j-api:1.7.25'
|
||||||
include 'org.apache.commons:commons-collections4:4.1'
|
include 'org.apache.commons:commons-collections4:4.1'
|
||||||
include 'com.neovisionaries:nv-websocket-client:2.10'
|
include 'com.neovisionaries:nv-websocket-client:2.14'
|
||||||
include 'com.squareup.okhttp3:okhttp:3.13.0'
|
include 'com.squareup.okhttp3:okhttp:3.13.0'
|
||||||
include 'com.squareup.okio:okio:1.17.2'
|
include 'com.squareup.okio:okio:1.17.2'
|
||||||
include 'com.fasterxml.jackson.core:jackson-databind:2.10.1'
|
include 'com.fasterxml.jackson.core:jackson-databind:2.10.1'
|
||||||
|
|
@ -52,16 +55,11 @@ compileJava {
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
filesMatching("fabric.mod.json") {
|
||||||
include "fabric.mod.json"
|
expand "version": project.version
|
||||||
expand "version": project.version
|
}
|
||||||
}
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude "fabric.mod.json"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
minecraft_version=21w10a
|
minecraft_version=1.17.1
|
||||||
yarn_mappings=21w10a+build.10
|
yarn_mappings=1.17.1+build.10
|
||||||
loader_version=0.11.3
|
loader_version=0.11.6
|
||||||
mod_version=0.2.3
|
mod_version=0.2.4
|
||||||
maven_group=com.awakenedredstone
|
maven_group=com.awakenedredstone
|
||||||
archives_base_name=autowhitelist
|
archives_base_name=autowhitelist
|
||||||
|
|
||||||
fabric_version=0.32.2+1.17
|
fabric_version=0.36.1+1.17
|
||||||
|
|
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
externo
BIN
gradle/wrapper/gradle-wrapper.jar
externo
Arquivo binário não exibido.
2
gradle/wrapper/gradle-wrapper.properties
externo
2
gradle/wrapper/gradle-wrapper.properties
externo
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
||||||
2
gradlew
externo
2
gradlew
externo
|
|
@ -130,7 +130,7 @@ fi
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
|
|
||||||
21
gradlew.bat
externo
21
gradlew.bat
externo
|
|
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
@ -54,7 +54,7 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
|
@ -64,21 +64,6 @@ echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
|
|
@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ import static com.awakenedredstone.autowhitelist.lang.JigsawLanguage.translation
|
||||||
|
|
||||||
public class AutoWhitelist implements ModInitializer {
|
public class AutoWhitelist implements ModInitializer {
|
||||||
|
|
||||||
public static Thread scheduledUpdateThread;
|
|
||||||
|
|
||||||
public static MinecraftServer server;
|
public static MinecraftServer server;
|
||||||
|
|
||||||
public static final Config config = new Config();
|
public static final Config config = new Config();
|
||||||
|
|
@ -62,7 +60,7 @@ public class AutoWhitelist implements ModInitializer {
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
for (GameProfile profile : profiles) {
|
for (GameProfile profile : profiles) {
|
||||||
GameProfile profile1 = server.getUserCache().getByUuid(profile.getId());
|
GameProfile profile1 = server.getUserCache().getByUuid(profile.getId()).orElse(null);
|
||||||
try {
|
try {
|
||||||
if (profile1 == null) {
|
if (profile1 == null) {
|
||||||
removePlayer((ExtendedGameProfile) profile);
|
removePlayer((ExtendedGameProfile) profile);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import static com.awakenedredstone.autowhitelist.util.Debugger.analyzeTimings;
|
||||||
public class AutoWhitelistCommand {
|
public class AutoWhitelistCommand {
|
||||||
|
|
||||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
||||||
dispatcher.register(CommandManager.literal("auto-whitelist").requires((source) -> {
|
dispatcher.register(CommandManager.literal("autowhitelist").requires((source) -> {
|
||||||
return source.hasPermissionLevel(4);
|
return source.hasPermissionLevel(4);
|
||||||
}).then((CommandManager.literal("reload").executes((source) -> {
|
}).then((CommandManager.literal("reload").executes((source) -> {
|
||||||
executeReload(source.getSource());
|
executeReload(source.getSource());
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,14 @@ import net.minecraft.text.LiteralText;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
private ConfigData configData;
|
private ConfigData configData;
|
||||||
private final File configFile = new File(getConfigDirectory(), "AutoWhitelist.json");
|
private final File configFile = new File(getConfigDirectory(), "AutoWhitelist.json");
|
||||||
private final int configVersion = 2;
|
private final float configVersion = 2.1f;
|
||||||
|
|
||||||
public File getConfigDirectory() {
|
public File getConfigDirectory() {
|
||||||
return new File(".", "config");
|
return new File(".", "config");
|
||||||
|
|
@ -29,19 +30,11 @@ public class Config {
|
||||||
StringReader stringReader = new StringReader(json);
|
StringReader stringReader = new StringReader(json);
|
||||||
|
|
||||||
JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
|
JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
|
||||||
if (jsonObject.get("version") == null || jsonObject.get("version").getAsInt() != configVersion) {
|
if (jsonObject.get("version") == null || jsonObject.get("version").getAsFloat() != configVersion) {
|
||||||
Files.copy(configFile.toPath(), new File(getConfigDirectory(), "AutoWhitelist_old.json").toPath());
|
|
||||||
JsonObject newJson = new JsonObject();
|
|
||||||
|
|
||||||
newJson.add("version", new JsonPrimitive(configVersion));
|
jsonObject.add("owners", new JsonArray());
|
||||||
newJson.add("whitelistScheduledVerificationSeconds", jsonObject.get("whitelist-auto-update-delay-seconds"));
|
|
||||||
newJson.add("prefix", jsonObject.get("prefix"));
|
|
||||||
newJson.add("token", jsonObject.get("token"));
|
|
||||||
newJson.add("clientId", jsonObject.get("application-id"));
|
|
||||||
newJson.add("discordServerId", jsonObject.get("discord-server-id"));
|
|
||||||
newJson.add("whitelist", jsonObject.get("whitelist"));
|
|
||||||
|
|
||||||
JsonHelper.writeJsonToFile(newJson, configFile);
|
JsonHelper.writeJsonToFile(jsonObject, configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
configData = AutoWhitelist.GSON.fromJson(stringReader, ConfigData.class);
|
configData = AutoWhitelist.GSON.fromJson(stringReader, ConfigData.class);
|
||||||
|
|
@ -74,6 +67,7 @@ public class Config {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.add("version", new JsonPrimitive(configVersion));
|
json.add("version", new JsonPrimitive(configVersion));
|
||||||
json.add("whitelistScheduledVerificationSeconds", new JsonPrimitive(60L));
|
json.add("whitelistScheduledVerificationSeconds", new JsonPrimitive(60L));
|
||||||
|
json.add("owners", new JsonArray());
|
||||||
json.add("prefix", new JsonPrimitive("np!"));
|
json.add("prefix", new JsonPrimitive("np!"));
|
||||||
json.add("token", new JsonPrimitive("bot-token"));
|
json.add("token", new JsonPrimitive("bot-token"));
|
||||||
json.add("clientId", new JsonPrimitive("client-id"));
|
json.add("clientId", new JsonPrimitive("client-id"));
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ import java.util.Map;
|
||||||
|
|
||||||
public class ConfigData {
|
public class ConfigData {
|
||||||
|
|
||||||
public long whitelistScheduledVerificationSeconds;
|
public short whitelistScheduledVerificationSeconds;
|
||||||
|
public String[] owners;
|
||||||
public String prefix;
|
public String prefix;
|
||||||
public String token;
|
public String token;
|
||||||
public String clientId;
|
public String clientId;
|
||||||
|
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
package com.awakenedredstone.autowhitelist.database;
|
|
||||||
|
|
||||||
import com.awakenedredstone.autowhitelist.AutoWhitelist;
|
|
||||||
import com.awakenedredstone.autowhitelist.util.ExtendedGameProfile;
|
|
||||||
import com.awakenedredstone.autowhitelist.whitelist.ExtendedWhitelistEntry;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class SQLite {
|
|
||||||
private static Connection connection;
|
|
||||||
|
|
||||||
public void connect() {
|
|
||||||
File dir = new File("./config/AutoWhitelist");
|
|
||||||
if(!dir.exists() || !dir.isDirectory()) {
|
|
||||||
//AutoWhitelist.LOGGER.info("Could not find database. A new one will be created.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File("./config/AutoWhitelist/users.db");
|
|
||||||
if (!file.exists()) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
String url = "jdbc:sqlite:config/AutoWhitelist/users.db";
|
|
||||||
connection = DriverManager.getConnection(url);
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
AutoWhitelist.LOGGER.error("Failed to load old database", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
databaseChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void databaseChange() {
|
|
||||||
if (connection == null) {
|
|
||||||
AutoWhitelist.LOGGER.error("Connection to database not existent. Unable to query data.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM `data`");
|
|
||||||
ResultSet results = statement.executeQuery();
|
|
||||||
ArrayList<ExtendedGameProfile> players = new ArrayList<>();
|
|
||||||
while (results.next()) {
|
|
||||||
players.add(new ExtendedGameProfile(UUID.fromString(results.getString("UUID")), results.getString("USERNAME"), results.getString("TEAM"), results.getString("ID")));
|
|
||||||
}
|
|
||||||
AutoWhitelist.server.getPlayerManager().getWhitelist().values().clear();
|
|
||||||
players.forEach(v -> AutoWhitelist.server.getPlayerManager().getWhitelist().add(new ExtendedWhitelistEntry(v)));
|
|
||||||
connection.close();
|
|
||||||
new File("./config/AutoWhitelist/users.db").delete();
|
|
||||||
new File("./config/AutoWhitelist").delete();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
AutoWhitelist.LOGGER.error("Failed to get the data from the old database", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -87,6 +87,8 @@ public class Bot implements Runnable {
|
||||||
instance = this;
|
instance = this;
|
||||||
} catch (LoginException e) {
|
} catch (LoginException e) {
|
||||||
AutoWhitelist.LOGGER.error("Failed to start bot, please verify the token.");
|
AutoWhitelist.LOGGER.error("Failed to start bot, please verify the token.");
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
AutoWhitelist.LOGGER.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ public class BotEventListener extends ListenerAdapter {
|
||||||
CommandClientBuilder builder = new CommandClientBuilder();
|
CommandClientBuilder builder = new CommandClientBuilder();
|
||||||
builder.setPrefix(prefix);
|
builder.setPrefix(prefix);
|
||||||
builder.setOwnerId("387745099204919297");
|
builder.setOwnerId("387745099204919297");
|
||||||
|
builder.setCoOwnerIds(AutoWhitelist.getConfigData().owners);
|
||||||
builder.setHelpConsumer(generateHelpConsumer());
|
builder.setHelpConsumer(generateHelpConsumer());
|
||||||
builder.addCommands(
|
builder.addCommands(
|
||||||
new RegisterCommand(),
|
new RegisterCommand(),
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,7 @@ import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import com.awakenedredstone.autowhitelist.lang.TranslatableText;
|
import com.awakenedredstone.autowhitelist.lang.TranslatableText;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.awakenedredstone.autowhitelist.discord.Bot.whitelistDataMap;
|
import static com.awakenedredstone.autowhitelist.discord.Bot.whitelistDataMap;
|
||||||
|
|
@ -105,7 +102,7 @@ public class RegisterCommand extends Command {
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
GameProfile profile = server.getUserCache().findByName(arg);
|
GameProfile profile = server.getUserCache().findByName(arg).orElse(null);
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
BotHelper.sendFeedbackMessage(channel, new TranslatableText("command.fail.title"), new TranslatableText("command.register.fail.account_data", arg), BotHelper.MessageType.ERROR);
|
BotHelper.sendFeedbackMessage(channel, new TranslatableText("command.fail.title"), new TranslatableText("command.register.fail.account_data", arg), BotHelper.MessageType.ERROR);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ public class BotStatusCommand extends DeveloperCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(CommandEvent event) {
|
protected void execute(CommandEvent event) {
|
||||||
if (event.getChannelType() != ChannelType.PRIVATE) return;
|
|
||||||
analyzeTimings("BotStatusCommand#execute", () -> {
|
analyzeTimings("BotStatusCommand#execute", () -> {
|
||||||
|
|
||||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
|
|
@ -31,7 +30,7 @@ public class BotStatusCommand extends DeveloperCommand {
|
||||||
"\n" + "**Rest ping:** " + restPing + " ms";
|
"\n" + "**Rest ping:** " + restPing + " ms";
|
||||||
|
|
||||||
embedBuilder.addField("Discord timings", output, false);
|
embedBuilder.addField("Discord timings", output, false);
|
||||||
event.getChannel().sendMessage(embedBuilder.build()).queue();
|
event.getChannel().sendMessageEmbeds(embedBuilder.build()).queue();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,11 @@ public class ServerStatusCommand extends DeveloperCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(CommandEvent event) {
|
protected void execute(CommandEvent event) {
|
||||||
if (event.getChannelType() != ChannelType.PRIVATE) return;
|
|
||||||
|
|
||||||
analyzeTimings("ServerStatusCommand#execute", () -> {
|
analyzeTimings("ServerStatusCommand#execute", () -> {
|
||||||
MinecraftServer server = AutoWhitelist.server;
|
MinecraftServer server = AutoWhitelist.server;
|
||||||
PlayerManager playerManager = server.getPlayerManager();
|
PlayerManager playerManager = server.getPlayerManager();
|
||||||
|
|
||||||
long l = Util.getMeasuringTimeMs() - server.getServerStartTime();
|
long l = Util.getMeasuringTimeMs() - server.getTimeReference();
|
||||||
double MSPT = MathHelper.average(server.lastTickLengths) * 1.0E-6D;
|
double MSPT = MathHelper.average(server.lastTickLengths) * 1.0E-6D;
|
||||||
double TPS = 1000.0D / Math.max(50, MSPT);
|
double TPS = 1000.0D / Math.max(50, MSPT);
|
||||||
double MAX_POSSIBLE_TPS = 1000.0D / MSPT;
|
double MAX_POSSIBLE_TPS = 1000.0D / MSPT;
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ import com.jagrosh.jdautilities.command.CommandEvent;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.entities.ChannelType;
|
import net.dv8tion.jda.api.entities.ChannelType;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import oshi.SystemInfo;
|
|
||||||
import oshi.hardware.Processor;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -24,7 +22,6 @@ public class StatusCommand extends DeveloperCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(CommandEvent event) {
|
protected void execute(CommandEvent event) {
|
||||||
if (event.getChannelType() != ChannelType.PRIVATE) return;
|
|
||||||
analyzeTimings("StatusCommand#execute", () -> {
|
analyzeTimings("StatusCommand#execute", () -> {
|
||||||
Runtime runtime = Runtime.getRuntime();
|
Runtime runtime = Runtime.getRuntime();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.awakenedredstone.autowhitelist.server;
|
||||||
|
|
||||||
import com.awakenedredstone.autowhitelist.AutoWhitelist;
|
import com.awakenedredstone.autowhitelist.AutoWhitelist;
|
||||||
import com.awakenedredstone.autowhitelist.commands.AutoWhitelistCommand;
|
import com.awakenedredstone.autowhitelist.commands.AutoWhitelistCommand;
|
||||||
import com.awakenedredstone.autowhitelist.database.SQLite;
|
|
||||||
import com.awakenedredstone.autowhitelist.discord.Bot;
|
import com.awakenedredstone.autowhitelist.discord.Bot;
|
||||||
import com.awakenedredstone.autowhitelist.lang.JigsawLanguage;
|
import com.awakenedredstone.autowhitelist.lang.JigsawLanguage;
|
||||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||||
|
|
@ -29,8 +28,6 @@ public class AutoWhitelistServer implements DedicatedServerModInitializer {
|
||||||
ServerLifecycleEvents.SERVER_STOPPING.register((server -> Bot.stopBot()));
|
ServerLifecycleEvents.SERVER_STOPPING.register((server -> Bot.stopBot()));
|
||||||
ServerLifecycleEvents.SERVER_STARTED.register((server -> {
|
ServerLifecycleEvents.SERVER_STARTED.register((server -> {
|
||||||
AutoWhitelist.server = server;
|
AutoWhitelist.server = server;
|
||||||
new SQLite().connect();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
{
|
{
|
||||||
InputStream inputStream = AutoWhitelistServer.class.getResource("/messages.json").openStream();
|
InputStream inputStream = AutoWhitelistServer.class.getResource("/messages.json").openStream();
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ public class ExtendedWhitelist extends Whitelist {
|
||||||
super(file);
|
super(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
protected ServerConfigEntry<GameProfile> fromJson(JsonObject json) {
|
protected ServerConfigEntry<GameProfile> fromJson(JsonObject json) {
|
||||||
ExtendedWhitelistEntry entry = new ExtendedWhitelistEntry(json);
|
ExtendedWhitelistEntry entry = new ExtendedWhitelistEntry(json);
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,14 @@ public class ExtendedWhitelistEntry extends WhitelistEntry {
|
||||||
if (json.has("uuid") && json.has("name") && json.has("discordId") && json.has("team")) {
|
if (json.has("uuid") && json.has("name") && json.has("discordId") && json.has("team")) {
|
||||||
String string = json.get("uuid").getAsString();
|
String string = json.get("uuid").getAsString();
|
||||||
|
|
||||||
UUID uUID2;
|
UUID uuid;
|
||||||
try {
|
try {
|
||||||
uUID2 = UUID.fromString(string);
|
uuid = UUID.fromString(string);
|
||||||
} catch (Throwable var4) {
|
} catch (Throwable var4) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ExtendedGameProfile(uUID2, json.get("name").getAsString(), json.get("team").getAsString(), json.get("discordId").getAsString());
|
return new ExtendedGameProfile(uuid, json.get("name").getAsString(), json.get("team").getAsString(), json.get("discordId").getAsString());
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"command.register.success.title": "Welcome to the group!",
|
"command.register.success.title": "Welcome to the group!",
|
||||||
"command.register.success.message": "Your Minecraft account has been added to the whitelist.\nPlease remember that snapshots are buggy and unstable, so **please** verify before reporting them.\n\n_Please don't mess with what PhoenixSC is working on, you can get your entry removed._",
|
"command.register.success.message": "Your Minecraft account has been added to the whitelist.\nPlease verify before reporting bugs, it probably isn't caused by the mod.\n\n_Please remember that you can always get your entry removed if you break any rule._",
|
||||||
"command.register.last_steps.title": "Finishing some last things.",
|
"command.register.last_steps.title": "Finishing some last things.",
|
||||||
"command.register.last_steps.message": "You request has been accepted.\nPlease wait while I add you to the server whitelist.\nI'll let you know when everything is done.",
|
"command.register.last_steps.message": "You request has been accepted.\nPlease wait while I add you to the server whitelist.\nI'll let you know when everything is done.",
|
||||||
"command.register.username_already_registered.title": "This username is already registered.",
|
"command.register.username_already_registered.title": "This username is already registered.",
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
"command.few_args.title": "Not enough arguments.",
|
"command.few_args.title": "Not enough arguments.",
|
||||||
"command.few_args.message": "You didn't put the minimum amount of arguments required.\nCheck the help command to see the command usage.",
|
"command.few_args.message": "You didn't put the minimum amount of arguments required.\nCheck the help command to see the command usage.",
|
||||||
"command.too_many_args.title": "Too many arguments.",
|
"command.too_many_args.title": "Too many arguments.",
|
||||||
"command.too_many_args.message": "You put too many arguments on the command.\nCheck the help command to see the command usage.",
|
"command.too_many_args.message": "You have put too many arguments on the command.\nCheck the help command to see the command usage.",
|
||||||
"command.feedback.received.title": "Command feedback.",
|
"command.feedback.received.title": "Command feedback.",
|
||||||
"command.feedback.received.message": "Your request has been received and is being processed, if you don't get another feedback message in the next minute than please contact a moderator.",
|
"command.feedback.received.message": "Your request has been received and is being processed, if you don't get another feedback message in the next minute than please contact a moderator.",
|
||||||
|
|
||||||
|
|
|
||||||
Referência em uma nova issue