Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 0 additions & 173 deletions README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.Title;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;

import java.net.InetSocketAddress;
import java.time.Instant;
Expand Down Expand Up @@ -40,11 +42,24 @@ public String getName() {
return handle.getName();
}

@Override
public boolean hasPermission(String permission) {
return handle.hasPermission(permission);
}

@Override
public void sendMessage(String message) {
handle.sendMessage(message);
}

@Override
public void sendUrlButton(String text, String url) {
TextComponent component = new TextComponent(text);
component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));

handle.sendMessage(component);
}

@Override
public void sendTitle(String title, String subtitle, int fadeIn, int duration, int fadeOut) {
handle.sendTitle(new BungeeTitle().title(title).subTitle(subtitle).fadeIn(fadeIn).fadeOut(fadeOut).stay(duration));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class LangLoader {
public static final String CONFIG_LANGUAGE_KEY = "language";

/** Bundled language codes shipped in the jar. Each has a resource at lang/{code}.yml */
public static final List<String> BUNDLED_LANGS = List.of("default", "en", "de", "fr", "it", "pl", "ro", "rs", "tr", "ua");
public static final List<String> BUNDLED_LANGS = List.of("default", "en", "de", "fr", "it", "pl", "ro", "rs", "tr", "ua", "nl", "th");

/** Fallback file used when a key is missing in the selected language. */
public static final String DEFAULT_LANG_FILE = "default.yml";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ public final SignInLocation getSigninLocation() {

public abstract String getName();

public abstract void sendMessage(String message);
public abstract boolean hasPermission(String permission);

public abstract void sendMessage(String message);

public abstract void sendUrlButton(String text, String url);

public abstract void sendTitle(String title, String subtitle, int fadeIn, int duration, int fadeOut);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import dev.siea.discord2fa.common.versioning.UpdateCheckResult;
import dev.siea.discord2fa.common.versioning.UpdateChecker;

import java.awt.*;
import java.nio.file.Path;
import java.time.Instant;
import java.util.Arrays;
Expand All @@ -34,6 +35,7 @@ public abstract class BaseServer {
private final DiscordBot discordBot;
private final ServerConfig serverConfig;
private final MessageProvider messageProvider;
private boolean isUpToDate;

/** Executor for blocking DB work so it doesn't block the server thread. */
private final ExecutorService dbExecutor = Executors.newSingleThreadExecutor(r -> {
Expand Down Expand Up @@ -157,6 +159,12 @@ public final boolean shouldSkipVerificationBlocking(CommonPlayer player) {
*/
protected final void addPlayer(CommonPlayer player, Runnable onSkippedVerification) {
if (player == null) return;

if (player.hasPermission("discord2fa.admin")) {
player.sendMessage("&cA new version of Discord2FA is available!");
player.sendUrlButton("§b[DOWNLOAD]", "https://modrinth.com/plugin/discord2fa");
}

SignInLocation current = player.getSigninLocation();

if (!discordBot.isConnected() || databaseAdapter == null) return;
Expand Down Expand Up @@ -339,8 +347,22 @@ else if (result.isNewerThanLatest()) {
logger.warn("You are using an experimental build of Discord2FA (version " + PluginVersion.get() + "). Latest release is " + result.getLatestReleaseVersion() + ".");
} else if (result.isUpToDate()) {
logger.info("You are running the latest release of Discord2FA.");
isUpToDate = true;
} else {
logger.warn("You are " + result.getVersionsBehind() + " version(s) behind (Current version: " + PluginVersion.get() + "). Download the latest at " + result.getDownloadUrl());
isUpToDate = false;
}
}

/**
* Checks for updates and logs the result to the permitted Player. Called automatically from the constructor.
* Version is read from the JAR manifest (Implementation-Version).
*/
private void sendAdminUpdateAlert(CommonPlayer player){
if (!isUpToDate){
player.sendMessage(messageProvider.get("outdatedPlugin"));
}else{
return;
}
}

Expand Down
40 changes: 21 additions & 19 deletions common/src/main/resources/lang/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,31 @@
# ----------------------- Discord Messages -----------------------
verify:
title: "Vérifier la connexion"
text: "Quelqu'un s'est connecté à votre compte depuis un nouvel endroit (%ip%)"
footer: "Si ce n'est pas vous, changez immédiatement votre mot de passe !"
text: "Quelqu'un s'est connecté à votre compte depuis un nouvel emplacement (%ip%)"
footer: "Si ce n'était pas vous, changez immédiatement votre mot de passe."
VerifyButton: "Vérifier"
DenyButton: "Refuser"

link:
title: "Liez votre compte !"
text: "Vous voulez rendre votre compte minecraft plus sécurisé ? Liez le avec votre dev.siea.discord2fa.discord !"
footer: "Cliquez sur le bouton dessous pour lier votre compte !"
linkButton: "Lien"
title: "Liez votre compte!"
text: "Vous souhaitez rendre votre compte Minecraft plus sécurisé ? Liez-le à votre Discord."
footer: "Cliquez sur le bouton ci-dessous pour lier votre compte."
linkButton: "Lier"

codeMessage: "Votre code de vérification est : %code%"
acceptMessage: "Vous avez accepté la vérification !"
denyMessage: "Vous avez refusé la vérification !"
alreadyLinking: "Vous avez déjà réçu un code de vérification !"
acceptMessage: "Vous avez accepté la vérification."
denyMessage: "Vous avez refusé la vérification."
alreadyLinking: "Un code de vérification vous a déjà été envoyé."

# ----------------------- In-game Messages -----------------------
invalidCode: "&cCode invalide !"
linkSuccess: "&aVous avez lié votre compte avec succès"
noCode: "&cVous devez fournir un code !"
verifyTitle: "&cVérifiez votre compte !"
notLinked: "&cVous n'êtes pas lié !"
unlinkSuccess: "&aVotre compte n'est plus lié avec succès !"
verifyDenied: "&cVérification refusée !"
verifySuccess: "&aVous avez vérifié votre compte avec succès !"
alreadyLinked: "&cVotre compte est déjà lié !"
invalidCode: "&cCode invalide!"
linkSuccess: "&aVotre compte a été lié avec succès."
noCode: "&cVous devez fournir un code!"
verifyTitle: "&cVérifiez votre compte!"
notLinked: "&cVotre compte n'est pas lié!"
unlinkSuccess: "&aVotre compte a été délié avec succès."
verifyDenied: "&cVérification refusée!"
verifySuccess: "&aVotre compte a été vérifié avec succès."
alreadyLinked: "&cVotre compte est déjà lié!"

forceLink: "&eBonjour &a%player%&e, avant de commencer, vous allez devoir lier votre compte minecraft à votre compte dev.siea.discord2fa.discord. Pour cela, veuillez rejoindre notre serveur dev.siea.discord2fa.discord et suivez les instructions dans la liste des instructions"
forceLink: "&eBonjour &a%player%&e, avant de continuer, vous devez lier votre compte Minecraft à votre compte Discord. Pour ce faire, veuillez rejoindre notre serveur dev.siea.discord2fa.discord et suivre les instructions qui y sont indiquées."
39 changes: 39 additions & 0 deletions common/src/main/resources/lang/th.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#################################################################
# -------------------------- Thai ----------------------------- #
# ---------------------- By: Nariza Limeen -------------------------- #
#################################################################

# ----------------------- Discord Messages -----------------------
verify:
title: "ยืนยันการเข้าสู่ระบบ"
text: "มีคนเข้าสู่บัญชีของคุณจากตำแหน่งใหม่ (%ip%)"
footer: "ถ้าไม่ใช่คุณ โปรดเปลี่ยนรหัสผ่านทันที!"
VerifyButton: "ยืนยัน"
DenyButton: "ปฏิเสธ"

link:
title: "เชื่อมบัญชีของคุณ!"
text: "ต้องการทำให้บัญชี Minecraft ของคุณปลอดภัยยิ่งขึ้นหรือไม่? เชื่อมต่อกับ Discord ของคุณ!"
footer: "คลิกปุ่มด้านล่างเพื่อเชื่อมบัญชีของคุณ!"
linkButton: "เชื่อมต่อ"

requestExpired: "คำขอยืนยันนี้หมดอายุแล้ว."
codeMessage: "รหัสยืนยันของคุณคือ: %code%"
acceptMessage: "คุณได้ยอมรับการยืนยันแล้ว!"
denyMessage: "คุณได้ปฏิเสธการยืนยัน!"
alreadyLinking: "คุณได้รับรหัสยืนยันไปแล้ว!"
alreadyLinkedDiscord: "บัญชีของคุณถูกเชื่อมไว้แล้ว!"

# ----------------------- In-game Messages -----------------------
notVerified: "&cคุณต้องยืนยันก่อน."
invalidCode: "&cรหัสไม่ถูกต้อง!"
linkSuccess: "&aคุณเชื่อมบัญชีของคุณสำเร็จแล้ว"
noCode: "&cคุณต้องระบุรหัส!"
verifyTitle: "&cยืนยันบัญชีของคุณ!"
notLinked: "&cคุณยังไม่ได้เชื่อมบัญชี!"
unlinkSuccess: "&aคุณได้ยกเลิกการเชื่อมบัญชีสำเร็จแล้ว!"
verifyDenied: "&cการยืนยันถูกปฏิเสธ!"
verifySuccess: "&aคุณได้ยืนยันบัญชีสำเร็จแล้ว!"
alreadyLinked: "&cบัญชีของคุณถูกเชื่อมไว้แล้ว!"

forceLink: "&eสวัสดี &a%player%&e ก่อนที่คุณจะดำเนินการต่อ คุณต้องเชื่อมบัญชี Minecraft ของคุณกับบัญชี Discord ก่อน โปรดเข้าร่วมเซิร์ฟเวอร์ dev.siea.discord2fa.discord ของเราและทำตามคำแนะนำที่ระบุไว้ที่นั่น."
2 changes: 1 addition & 1 deletion gameserver/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ==============================
# Language Settings
# ==============================
# Available options: EN, DE, FR, IT, PL, RO, RS, TR, UA, ES, HI, RU, NL
# Available options: EN, DE, FR, IT, PL, RO, RS, TR, UA, ES, HI, RU, NL, TH
language: en


Expand Down
2 changes: 1 addition & 1 deletion proxyserver/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ==============================
# Language Settings
# ==============================
# Available options: EN, DE, FR, IT, PL, RO, RS, TR, UA, ES, HI, RU, NL
# Available options: EN, DE, FR, IT, PL, RO, RS, TR, UA, ES, HI, RU, NL, TH
language: en


Expand Down
Loading