mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-22 16:48:21 +01:00
Fix useWelcomeMessage + implement broadcast conf
This commit is contained in:
parent
2e5da58aca
commit
fec466dd29
2
pom.xml
2
pom.xml
@ -24,7 +24,7 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<version>3.3.1-DEV-1</version>
|
||||
<version>3.3.2-DEV-1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -433,8 +433,13 @@ public class AuthMe extends JavaPlugin {
|
||||
ess = null;
|
||||
}
|
||||
if (this.getServer().getPluginManager().getPlugin("EssentialsSpawn") != null && this.getServer().getPluginManager().getPlugin("EssentialsSpawn").isEnabled()) {
|
||||
this.essentialsSpawn = new EssSpawn().getLocation();
|
||||
ConsoleLogger.info("Hook with EssentialsSpawn plugin");
|
||||
try {
|
||||
essentialsSpawn = new EssSpawn().getLocation();
|
||||
ConsoleLogger.info("Hook with EssentialsSpawn plugin");
|
||||
} catch (Exception e) {
|
||||
essentialsSpawn = null;
|
||||
ConsoleLogger.showError("Error while reading /plugins/Essentials/spawn.yml file ");
|
||||
}
|
||||
} else {
|
||||
ess = null;
|
||||
}
|
||||
|
@ -418,10 +418,18 @@ public class Management extends Thread {
|
||||
// The Loginevent now fires (as intended) after everything is processed
|
||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||
player.saveData();
|
||||
|
||||
|
||||
// Login is finish, display welcome message
|
||||
for (String s : Settings.welcomeMsg)
|
||||
player.sendMessage(plugin.replaceAllInfos(s, player));
|
||||
if(Settings.useWelcomeMessage)
|
||||
if(Settings.broadcastWelcomeMessage) {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
Bukkit.getServer().broadcastMessage(s);
|
||||
}
|
||||
} else {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
player.sendMessage(plugin.replaceAllInfos(s, player));
|
||||
}
|
||||
}
|
||||
|
||||
// Login is now finish , we can force all commands
|
||||
forceCommands();
|
||||
|
@ -262,8 +262,16 @@ public class RegisterCommand implements CommandExecutor {
|
||||
player.saveData();
|
||||
|
||||
// Register is finish and player is logged, display welcome message
|
||||
for (String s : Settings.welcomeMsg)
|
||||
player.sendMessage(plugin.replaceAllInfos(s, player));
|
||||
if(Settings.useWelcomeMessage)
|
||||
if(Settings.broadcastWelcomeMessage) {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
Bukkit.getServer().broadcastMessage(s);
|
||||
}
|
||||
} else {
|
||||
for (String s : Settings.welcomeMsg) {
|
||||
player.sendMessage(plugin.replaceAllInfos(s, player));
|
||||
}
|
||||
}
|
||||
|
||||
// Register is now finish , we can force all commands
|
||||
forceCommands(player);
|
||||
|
@ -26,6 +26,7 @@ public class EssSpawn extends CustomConfiguration {
|
||||
|
||||
public Location getLocation() {
|
||||
try {
|
||||
if (!this.contains("spawns.default.world")) return null;
|
||||
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world") == "") return null;
|
||||
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
|
||||
return location;
|
||||
|
@ -58,7 +58,8 @@ public final class Settings extends YamlConfiguration {
|
||||
useCaptcha, emailRegistration, multiverse, notifications, chestshop, bungee, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange,
|
||||
disableSocialSpy, useMultiThreading, forceOnlyAfterLogin, useEssentialsMotd,
|
||||
usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgeLimitedCreative,
|
||||
purgeAntiXray, purgePermissions, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage;
|
||||
purgeAntiXray, purgePermissions, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
||||
broadcastWelcomeMessage;
|
||||
|
||||
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort,
|
||||
getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLTablename,
|
||||
@ -233,6 +234,7 @@ public void loadConfigOptions() {
|
||||
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
||||
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
||||
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||
|
||||
// Load the welcome message
|
||||
getWelcomeMessage(plugin);
|
||||
@ -383,6 +385,7 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
||||
unsafePasswords = (List<String>) configFile.getList("settings.security.unsafePasswords", new ArrayList<String>());
|
||||
countriesBlacklist = (List<String>) configFile.getList("Protection.countriesBlacklist", new ArrayList<String>());
|
||||
broadcastWelcomeMessage = configFile.getBoolean("settings.broadcastWelcomeMessage", false);
|
||||
|
||||
// Reload the welcome message
|
||||
getWelcomeMessage(AuthMe.getInstance());
|
||||
@ -516,6 +519,8 @@ public void mergeConfig() {
|
||||
countriesBlacklist.add("A1");
|
||||
set("Protection.countriesBlacklist", countriesBlacklist);
|
||||
}
|
||||
if(!contains("settings.broadcastWelcomeMessage"))
|
||||
set("settings.broadcastWelcomeMessage", false);
|
||||
|
||||
plugin.getLogger().warning("Merge new Config Options if needed..");
|
||||
plugin.getLogger().warning("Please check your config.yml file!");
|
||||
@ -696,6 +701,10 @@ public void mergeConfig() {
|
||||
}
|
||||
|
||||
private static void getWelcomeMessage(AuthMe plugin) {
|
||||
welcomeMsg = new ArrayList<String>();
|
||||
if(!useWelcomeMessage) {
|
||||
return;
|
||||
}
|
||||
if (!(new File(plugin.getDataFolder() + File.separator + "welcome.txt").exists())) {
|
||||
try {
|
||||
FileWriter fw = new FileWriter(plugin.getDataFolder() + File.separator + "welcome.txt", true);
|
||||
@ -708,20 +717,18 @@ public void mergeConfig() {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
List<String> msg = new ArrayList<String>();
|
||||
try {
|
||||
FileReader fr = new FileReader(plugin.getDataFolder() + File.separator + "welcome.txt");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
String line = "";
|
||||
while((line = br.readLine()) != null) {
|
||||
msg.add(line);
|
||||
welcomeMsg.add(line);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
welcomeMsg = msg;
|
||||
}
|
||||
|
||||
public enum messagesLang {
|
||||
|
@ -237,6 +237,8 @@ settings:
|
||||
# {IP} : player ip, {LOGINS} : number of players logged, {WORLD} : player current world, {SERVER} : server name
|
||||
# {VERSION} : get current bukkit version, {COUNTRY} : player country
|
||||
useWelcomeMessage: true
|
||||
# Do we need to broadcast the welcome message to all server or only to the player? set true for server or false for player
|
||||
broadcastWelcomeMessage: false
|
||||
ExternalBoardOptions:
|
||||
# MySQL column for the salt , needed for some forum/cms support
|
||||
mySQLColumnSalt: ''
|
||||
|
@ -12,7 +12,7 @@ vb_nonActiv: '&f你的帐号还未激活,请查看你的邮箱!'
|
||||
user_regged: '&c此用户已经在此服务器注册过'
|
||||
usage_reg: '&c正确用法:“/register <密码> <再输入一次以确定密码>”'
|
||||
max_reg: '&f你不允许再为你的IP在服务器注册更多用户了!'
|
||||
reg_email_msg: '&cPlease register with "/register <email> <confirmEmail>"'
|
||||
reg_email_msg: '&c请输入 "/register <邮箱> <确认电子邮件>"'
|
||||
no_perm: '&c没有权限'
|
||||
error: '&f发现错误,请联系管理员'
|
||||
login_msg: '&c请输入“/login <密码>”以登录'
|
||||
@ -21,7 +21,7 @@ usage_unreg: '&c正确用法:“/unregister <密码>”'
|
||||
pwd_changed: '&c密码已成功修改!'
|
||||
user_unknown: '&c此用户名还未注册过'
|
||||
password_error: '&f密码不相同'
|
||||
unvalid_session: '&fSession Dataes doesnt corrispond Plaese wait the end of session'
|
||||
unvalid_session: '&f登陆数据异常,请等待登陆结束'
|
||||
reg_only: '&f只允许注册过的玩家进服!请到http://example.com以注册'
|
||||
logged_in: '&c你已经登陆过了!'
|
||||
logout: '&c已成功登出!'
|
||||
@ -30,7 +30,7 @@ registered: '&c已成功注册!'
|
||||
pass_len: '&你的密码没有达到要求!'
|
||||
reload: '&f配置以及数据已经重新加载完毕'
|
||||
timeout: '&f给你登录的时间已经过了'
|
||||
usage_changepassword: '&f正确用法:“/changepassword oldPassword ne”'
|
||||
usage_changepassword: '&f正确用法:“/changepassword 旧密码 新密码”'
|
||||
name_len: '&c你的用户名太短或者太长了'
|
||||
regex: '&c你的用户名包含非法字母,用户名里允许的字母: REG_EX'
|
||||
add_email: '&c请输入“/email add <你的邮箱> <再输入一次以确认>”以把你的邮箱添加到此帐号'
|
||||
@ -39,18 +39,18 @@ recovery_email: '&c忘了你的密码?请输入:“/email recovery <你的
|
||||
usage_captcha: '&c正确用法:/captcha <验证码>'
|
||||
wrong_captcha: '&c错误的验证码,请输入:“/captcha <验证码>”'
|
||||
valid_captcha: '&c你的验证码是有效的!'
|
||||
kick_forvip: '&cA VIP Player join the full server!'
|
||||
kick_fullserver: '&cThe server is actually full, Sorry!'
|
||||
usage_email_add: '&fUsage: /email add <email> <confirmEmail> '
|
||||
usage_email_change: '&fUsage: /email change <oldEmail> <newEmail> '
|
||||
usage_email_recovery: '&fUsage: /email recovery <email>'
|
||||
new_email_invalid: '[AuthMe] New email invalid!'
|
||||
old_email_invalid: '[AuthMe] Old email invalid!'
|
||||
email_invalid: '[AuthMe] Invalid Email'
|
||||
email_added: '[AuthMe] Email Added !'
|
||||
email_confirm: '[AuthMe] Confirm your Email !'
|
||||
email_changed: '[AuthMe] Email Change !'
|
||||
email_send: '[AuthMe] Recovery Email Send !'
|
||||
country_banned: 'Your country is banned from this server'
|
||||
antibot_auto_enabled: '[AuthMe] AntiBotMod automatically enabled due to massive connections!'
|
||||
antibot_auto_disabled: '[AuthMe] AntiBotMod automatically disabled after %m Minutes, hope invasion stopped'
|
||||
kick_forvip: '&cA VIP玩家加入了已满的服务器!'
|
||||
kick_fullserver: '&c抱歉,服务器已满!'
|
||||
usage_email_add: '&f用法: /email add <邮箱> <确认电子邮件> '
|
||||
usage_email_change: '&f用法: /email change <旧邮箱> <新邮箱> '
|
||||
usage_email_recovery: '&f用法: /email recovery <邮箱>'
|
||||
new_email_invalid: '[AuthMe] 新邮箱无效!'
|
||||
old_email_invalid: '[AuthMe] 旧邮箱无效!'
|
||||
email_invalid: '[AuthMe] 无效的邮箱'
|
||||
email_added: '[AuthMe] 邮箱已添加 !'
|
||||
email_confirm: '[AuthMe] 确认你的邮箱 !'
|
||||
email_changed: '[AuthMe] 邮箱已改变 !'
|
||||
email_send: '[AuthMe] 恢复邮件已发送 !'
|
||||
country_banned: '这个服务器禁止该国家登陆'
|
||||
antibot_auto_enabled: '[AuthMe] 防机器人程序由于大量异常连接而启用'
|
||||
antibot_auto_disabled: '[AuthMe] 防机器人程序由于异常连接减少而在 %m 分钟后停止'
|
||||
|
@ -3,7 +3,7 @@ author: Xephi59
|
||||
website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
||||
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
|
||||
main: fr.xephi.authme.AuthMe
|
||||
version: 3.3.1
|
||||
version: 3.3.2-DEV-1
|
||||
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
||||
commands:
|
||||
register:
|
||||
|
Loading…
Reference in New Issue
Block a user