mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-31 07:39:42 +01:00
cleanup command pre process
This commit is contained in:
parent
e60a5190f9
commit
da9cfc93d3
@ -66,35 +66,30 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
private void handleChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!Utils.checkAuth(player)) {
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
if (cmd.startsWith("/")) {
|
||||
if (Settings.allowCommands.contains(cmd)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (Settings.isChatAllowed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
if (Utils.checkAuth(player))
|
||||
return;
|
||||
|
||||
if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) {
|
||||
m.send(player, "login_msg");
|
||||
if (Settings.isChatAllowed) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
|
||||
if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (Settings.emailRegistration) {
|
||||
m.send(player, "reg_email_msg");
|
||||
} else {
|
||||
if (Settings.emailRegistration) {
|
||||
m.send(player, "reg_email_msg");
|
||||
} else {
|
||||
m.send(player, "reg_msg");
|
||||
}
|
||||
m.send(player, "reg_msg");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd"))
|
||||
String cmd = event.getMessage().split(" ")[0].toLowerCase();
|
||||
if (Settings.useEssentialsMotd && cmd.equals("/motd"))
|
||||
return;
|
||||
if (Settings.allowCommands.contains(cmd))
|
||||
return;
|
||||
|
@ -1,22 +1,16 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.datasource.DataSource.DataSourceType;
|
||||
import fr.xephi.authme.security.HashAlgorithm;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public final class Settings extends YamlConfiguration {
|
||||
|
||||
@ -193,21 +187,22 @@ public final class Settings extends YamlConfiguration {
|
||||
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
|
||||
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
||||
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
||||
allowCommands = configFile.getStringList("settings.restrictions.allowCommands");
|
||||
if (configFile.contains("allowCommands")) {
|
||||
if (!allowCommands.contains("/login"))
|
||||
allowCommands.add("/login");
|
||||
if (!allowCommands.contains("/register"))
|
||||
allowCommands.add("/register");
|
||||
if (!allowCommands.contains("/l"))
|
||||
allowCommands.add("/l");
|
||||
if (!allowCommands.contains("/reg"))
|
||||
allowCommands.add("/reg");
|
||||
if (!allowCommands.contains("/email"))
|
||||
allowCommands.add("/email");
|
||||
if (!allowCommands.contains("/captcha"))
|
||||
allowCommands.add("/captcha");
|
||||
allowCommands = new ArrayList<>();
|
||||
for (String cmd : configFile.getStringList("settings.restrictions.allowCommands")) {
|
||||
allowCommands.add(cmd.toLowerCase());
|
||||
}
|
||||
if (!allowCommands.contains("/login"))
|
||||
allowCommands.add("/login");
|
||||
if (!allowCommands.contains("/register"))
|
||||
allowCommands.add("/register");
|
||||
if (!allowCommands.contains("/l"))
|
||||
allowCommands.add("/l");
|
||||
if (!allowCommands.contains("/reg"))
|
||||
allowCommands.add("/reg");
|
||||
if (!allowCommands.contains("/email"))
|
||||
allowCommands.add("/email");
|
||||
if (!allowCommands.contains("/captcha"))
|
||||
allowCommands.add("/captcha");
|
||||
rakamakUsers = configFile.getString("Converter.Rakamak.fileName", "users.rak");
|
||||
rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak");
|
||||
rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false);
|
||||
@ -491,8 +486,8 @@ public final class Settings extends YamlConfiguration {
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("DataSource.mySQLQueryCache")) {
|
||||
set("DataSource.mySQLWebsite", false);
|
||||
changes = true;
|
||||
set("DataSource.mySQLWebsite", false);
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
|
Loading…
Reference in New Issue
Block a user