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) {
|
private void handleChat(AsyncPlayerChatEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!Utils.checkAuth(player)) {
|
if (Utils.checkAuth(player))
|
||||||
String cmd = event.getMessage().split(" ")[0];
|
return;
|
||||||
if (cmd.startsWith("/")) {
|
|
||||||
if (Settings.allowCommands.contains(cmd)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Settings.isChatAllowed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
if (plugin.database.isAuthAvailable(player.getName().toLowerCase())) {
|
if (Settings.isChatAllowed) {
|
||||||
m.send(player, "login_msg");
|
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 {
|
} else {
|
||||||
if (Settings.emailRegistration) {
|
m.send(player, "reg_msg");
|
||||||
m.send(player, "reg_email_msg");
|
|
||||||
} else {
|
|
||||||
m.send(player, "reg_msg");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
String cmd = event.getMessage().split(" ")[0];
|
String cmd = event.getMessage().split(" ")[0].toLowerCase();
|
||||||
if (Settings.useEssentialsMotd && cmd.equalsIgnoreCase("/motd"))
|
if (Settings.useEssentialsMotd && cmd.equals("/motd"))
|
||||||
return;
|
return;
|
||||||
if (Settings.allowCommands.contains(cmd))
|
if (Settings.allowCommands.contains(cmd))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1,22 +1,16 @@
|
|||||||
package fr.xephi.authme.settings;
|
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.AuthMe;
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.datasource.DataSource.DataSourceType;
|
import fr.xephi.authme.datasource.DataSource.DataSourceType;
|
||||||
import fr.xephi.authme.security.HashAlgorithm;
|
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 {
|
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\\");
|
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
|
||||||
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
|
||||||
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
|
||||||
allowCommands = configFile.getStringList("settings.restrictions.allowCommands");
|
allowCommands = new ArrayList<>();
|
||||||
if (configFile.contains("allowCommands")) {
|
for (String cmd : configFile.getStringList("settings.restrictions.allowCommands")) {
|
||||||
if (!allowCommands.contains("/login"))
|
allowCommands.add(cmd.toLowerCase());
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
|
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");
|
rakamakUsers = configFile.getString("Converter.Rakamak.fileName", "users.rak");
|
||||||
rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak");
|
rakamakUsersIp = configFile.getString("Converter.Rakamak.ipFileName", "UsersIp.rak");
|
||||||
rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false);
|
rakamakUseIp = configFile.getBoolean("Converter.Rakamak.useIp", false);
|
||||||
@ -491,8 +486,8 @@ public final class Settings extends YamlConfiguration {
|
|||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
if (!contains("DataSource.mySQLQueryCache")) {
|
if (!contains("DataSource.mySQLQueryCache")) {
|
||||||
set("DataSource.mySQLWebsite", false);
|
set("DataSource.mySQLWebsite", false);
|
||||||
changes = true;
|
changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes) {
|
if (changes) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user