mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-22 18:25:27 +01:00
Update 3.3.6 - Emergency Fix
//Changes 3.3.6:// * **Emergency fix: Email recovery method are now fixed and safety to use** * Support all craftbukkit builds * Now Support our sponsor ipClean feature ( Get player real ip through their servers ) * Now Cache correctly Item Custom Names and Lores * Fix FlatToSQL converter * Add /authme getip <playername> command, perm : authme.admin.getip * Implement correctly XenForo Support * Fix maxregperip * Fix maxloginperip * Add ForceCommandsAsConsole config * Preparation for next features, coming soon !
This commit is contained in:
parent
8c3dc12658
commit
864661c797
2
pom.xml
2
pom.xml
@ -24,7 +24,7 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<version>3.3.5</version>
|
||||
<version>3.3.6</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -66,6 +66,7 @@ import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.plugin.manager.EssSpawn;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.OtherAccounts;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
@ -79,6 +80,7 @@ public class AuthMe extends JavaPlugin {
|
||||
private Settings settings;
|
||||
private Messages m;
|
||||
public PlayersLogs pllog;
|
||||
public OtherAccounts otherAccounts;
|
||||
public static Server server;
|
||||
public static Logger authmeLogger = Logger.getLogger("AuthMe");
|
||||
public static AuthMe authme;
|
||||
@ -134,6 +136,8 @@ public class AuthMe extends JavaPlugin {
|
||||
m = Messages.getInstance();
|
||||
|
||||
pllog = PlayersLogs.getInstance();
|
||||
|
||||
otherAccounts = OtherAccounts.getInstance();
|
||||
|
||||
server = getServer();
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!args[1].equalsIgnoreCase(auth.getEmail())) {
|
||||
if (!args[1].equalsIgnoreCase(auth.getEmail()) || args[1].equalsIgnoreCase("your@email.com") || auth.getEmail().equalsIgnoreCase("your@email.com")) {
|
||||
m._(player, "email_invalid");
|
||||
return true;
|
||||
}
|
||||
@ -195,7 +195,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
m._(sender, "error");
|
||||
}
|
||||
} else {
|
||||
m._(player, "reg_email_msg");
|
||||
m._(player, "reg_email_msg");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -144,7 +144,7 @@ public class AsyncronousLogin {
|
||||
player.setNoDamageTicks(0);
|
||||
m._(player, "login");
|
||||
|
||||
displayOtherAccounts(auth);
|
||||
displayOtherAccounts(auth, player);
|
||||
|
||||
if (!Settings.noConsoleSpam)
|
||||
ConsoleLogger.info(player.getName() + " logged in!");
|
||||
@ -156,6 +156,7 @@ public class AsyncronousLogin {
|
||||
// makes player isLoggedin via API
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
database.setLogged(name);
|
||||
plugin.otherAccounts.addPlayer(player.getUniqueId());
|
||||
|
||||
// As the scheduling executes the Task most likely after the current task, we schedule it in the end
|
||||
// so that we can be sure, and have not to care if it might be processed in other order.
|
||||
@ -187,7 +188,7 @@ public class AsyncronousLogin {
|
||||
}
|
||||
}
|
||||
|
||||
public void displayOtherAccounts(PlayerAuth auth) {
|
||||
public void displayOtherAccounts(PlayerAuth auth, Player p) {
|
||||
if (!Settings.displayOtherAccounts) {
|
||||
return;
|
||||
}
|
||||
@ -195,6 +196,7 @@ public class AsyncronousLogin {
|
||||
return;
|
||||
}
|
||||
List<String> auths = this.database.getAllAuthsByName(auth);
|
||||
//List<String> uuidlist = plugin.otherAccounts.getAllPlayersByUUID(player.getUniqueId());
|
||||
if (auths.isEmpty() || auths == null) {
|
||||
return;
|
||||
}
|
||||
@ -202,6 +204,7 @@ public class AsyncronousLogin {
|
||||
return;
|
||||
}
|
||||
String message = "[AuthMe] ";
|
||||
//String uuidaccounts = "[AuthMe] PlayerNames has %size% links to this UUID : ";
|
||||
int i = 0;
|
||||
for (String account : auths) {
|
||||
i++;
|
||||
@ -212,11 +215,23 @@ public class AsyncronousLogin {
|
||||
message = message + ".";
|
||||
}
|
||||
}
|
||||
/*TODO: Active uuid system
|
||||
i = 0;
|
||||
for (String account : uuidlist) {
|
||||
i++;
|
||||
uuidaccounts = uuidaccounts + account;
|
||||
if (i != auths.size()) {
|
||||
uuidaccounts = uuidaccounts + ", ";
|
||||
} else {
|
||||
uuidaccounts = uuidaccounts + ".";
|
||||
}
|
||||
}*/
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (plugin.authmePermissible(player, "authme.seeOtherAccounts")) {
|
||||
player.sendMessage("[AuthMe] The player " + auth.getNickname() + " has "
|
||||
+ auths.size() + " accounts");
|
||||
player.sendMessage(message);
|
||||
//player.sendMessage(uuidaccounts.replace("%size%", ""+uuidlist.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,9 +53,11 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
player.setFlying(limbo.isFlying());
|
||||
}
|
||||
}
|
||||
|
||||
protected void packQuitLocation() {
|
||||
Utils.getInstance().packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player);
|
||||
}
|
||||
|
||||
protected void teleportBackFromSpawn() {
|
||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, limbo.getLoc());
|
||||
pm.callEvent(tpEvent);
|
||||
@ -67,6 +69,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
player.teleport(fLoc);
|
||||
}
|
||||
}
|
||||
|
||||
protected void teleportToSpawn() {
|
||||
Location spawnL = plugin.getSpawnLocation(player);
|
||||
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnL, true);
|
||||
@ -79,6 +82,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
player.teleport(fLoc);
|
||||
}
|
||||
}
|
||||
|
||||
protected void restoreInventory() {
|
||||
RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
@ -86,12 +90,16 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
API.setPlayerInventory(player, event.getInventory(), event.getArmor());
|
||||
}
|
||||
}
|
||||
|
||||
protected void forceCommands() {
|
||||
for (String command : Settings.forceCommands) {
|
||||
try {
|
||||
player.performCommand(command.replace("%p", player.getName()));
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
for (String command : Settings.forceCommandsAsConsole) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), command.replace("%p", player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,6 +147,7 @@ public class AsyncronousRegister {
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
database.setLogged(name);
|
||||
}
|
||||
plugin.otherAccounts.addPlayer(player.getUniqueId());
|
||||
ProcessSyncronousPasswordRegister syncronous = new ProcessSyncronousPasswordRegister(player, plugin);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, syncronous);
|
||||
return;
|
||||
|
@ -5,7 +5,6 @@ import me.muizers.Notifications.Notification;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -48,7 +47,6 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg);
|
||||
|
||||
if (Settings.isTeleportToSpawnEnabled) {
|
||||
World world = player.getWorld();
|
||||
Location loca = plugin.getSpawnLocation(player);
|
||||
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
|
||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||
|
@ -5,7 +5,6 @@ import me.muizers.Notifications.Notification;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
@ -80,7 +79,6 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
if (limbo != null) {
|
||||
player.setGameMode(limbo.getGameMode());
|
||||
if (Settings.isTeleportToSpawnEnabled) {
|
||||
World world = player.getWorld();
|
||||
Location loca = plugin.getSpawnLocation(player);
|
||||
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
|
||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||
|
58
src/main/java/fr/xephi/authme/settings/OtherAccounts.java
Normal file
58
src/main/java/fr/xephi/authme/settings/OtherAccounts.java
Normal file
@ -0,0 +1,58 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class OtherAccounts extends CustomConfiguration {
|
||||
private static OtherAccounts others = null;
|
||||
|
||||
public OtherAccounts() {
|
||||
super(new File("./plugins/AuthMe/otheraccounts.yml"));
|
||||
others = this;
|
||||
load();
|
||||
save();
|
||||
}
|
||||
|
||||
public void clear(UUID uuid) {
|
||||
set(uuid.toString(), new ArrayList<String>());
|
||||
save();
|
||||
}
|
||||
|
||||
public static OtherAccounts getInstance() {
|
||||
if (others == null) {
|
||||
others = new OtherAccounts();
|
||||
}
|
||||
return others;
|
||||
}
|
||||
|
||||
public void addPlayer(UUID uuid) {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
if (!this.getStringList(uuid.toString()).contains(player.getName())) {
|
||||
this.getStringList(uuid.toString()).add(player.getName());
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(UUID uuid) {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (player == null) return;
|
||||
if (this.getStringList(uuid.toString()).contains(player.getName())) {
|
||||
this.getStringList(uuid.toString()).remove(player.getName());
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getAllPlayersByUUID(UUID uuid) {
|
||||
return this.getStringList(uuid.toString());
|
||||
}
|
||||
}
|
@ -38,6 +38,7 @@ public final class Settings extends YamlConfiguration {
|
||||
public static List<String> countries = null;
|
||||
public static List<String> countriesBlacklist = null;
|
||||
public static List<String> forceCommands = null;
|
||||
public static List<String> forceCommandsAsConsole = null;
|
||||
private AuthMe plugin;
|
||||
private final File file;
|
||||
public static DataSourceType getDataSource;
|
||||
@ -229,6 +230,7 @@ public void loadConfigOptions() {
|
||||
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
|
||||
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
|
||||
forceCommands = (List<String>) configFile.getList("settings.forceCommands", new ArrayList<String>());
|
||||
forceCommandsAsConsole = (List<String>) configFile.getList("settings.forceCommandsAsConsole", new ArrayList<String>());
|
||||
recallEmail = configFile.getBoolean("Email.recallPlayers", false);
|
||||
delayRecall = configFile.getInt("Email.delayRecall", 5);
|
||||
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
||||
@ -387,6 +389,7 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
antiBotSensibility = configFile.getInt("Protection.antiBotSensibility", 5);
|
||||
antiBotDuration = configFile.getInt("Protection.antiBotDuration", 10);
|
||||
forceCommands = (List<String>) configFile.getList("settings.forceCommands", new ArrayList<String>());
|
||||
forceCommandsAsConsole = (List<String>) configFile.getList("settings.forceCommandsAsConsole", new ArrayList<String>());
|
||||
recallEmail = configFile.getBoolean("Email.recallPlayers", false);
|
||||
delayRecall = configFile.getInt("Email.delayRecall", 5);
|
||||
useWelcomeMessage = configFile.getBoolean("settings.useWelcomeMessage", true);
|
||||
@ -439,6 +442,10 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
set("settings.forceCommands", new ArrayList<String>());
|
||||
changes = true;
|
||||
}
|
||||
if(!contains("settings.forceCommandsAsConsole")) {
|
||||
set("settings.forceCommandsAsConsole", new ArrayList<String>());
|
||||
changes = true;
|
||||
}
|
||||
if(!contains("Email.recallPlayers")) {
|
||||
set("Email.recallPlayers", false);
|
||||
changes = true;
|
||||
|
@ -244,6 +244,8 @@ settings:
|
||||
messagesLanguage: en
|
||||
# Force these commands after /login, without any '/', use %p for replace with player name
|
||||
forceCommands: []
|
||||
# Force these commands after /login as a server console, without any '/', use %p for replace with player name
|
||||
forceCommandsAsConsole: []
|
||||
# Do we need to display the welcome message (welcome.txt) after a register or a login?
|
||||
# You can use colors in this welcome.txt + some replaced strings :
|
||||
# {PLAYER} : player name, {ONLINE} : display number of online players, {MAXPLAYERS} : display server slots,
|
||||
|
0
src/main/resources/otheraccounts.yml
Normal file
0
src/main/resources/otheraccounts.yml
Normal file
@ -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.5
|
||||
version: 3.3.6
|
||||
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
||||
commands:
|
||||
register:
|
||||
|
Loading…
Reference in New Issue
Block a user