diff --git a/pom.xml b/pom.xml
index 6fc8ce544..7c560341f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
- 3.3.5
+ 3.3.6
org.bukkit
diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java
index 310031c53..fe253e49a 100644
--- a/src/main/java/fr/xephi/authme/AuthMe.java
+++ b/src/main/java/fr/xephi/authme/AuthMe.java
@@ -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();
diff --git a/src/main/java/fr/xephi/authme/commands/EmailCommand.java b/src/main/java/fr/xephi/authme/commands/EmailCommand.java
index 7c14ff463..da1a0bc8f 100644
--- a/src/main/java/fr/xephi/authme/commands/EmailCommand.java
+++ b/src/main/java/fr/xephi/authme/commands/EmailCommand.java
@@ -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;
diff --git a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java
index df88c5f5b..278cee3f3 100644
--- a/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java
+++ b/src/main/java/fr/xephi/authme/process/login/AsyncronousLogin.java
@@ -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 auths = this.database.getAllAuthsByName(auth);
+ //List 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()));
}
}
}
diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java
index 1cce8f48c..9da361747 100644
--- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java
+++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java
@@ -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
diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java
index ae4fe1c37..768d3e53f 100644
--- a/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java
+++ b/src/main/java/fr/xephi/authme/process/register/AsyncronousRegister.java
@@ -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;
diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java
index a28c8a701..eabf68dfc 100644
--- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java
+++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousEmailRegister.java
@@ -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);
diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java
index bb4d719aa..8faac8154 100644
--- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java
+++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java
@@ -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);
diff --git a/src/main/java/fr/xephi/authme/settings/OtherAccounts.java b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java
new file mode 100644
index 000000000..2c95e5187
--- /dev/null
+++ b/src/main/java/fr/xephi/authme/settings/OtherAccounts.java
@@ -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());
+ 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 getAllPlayersByUUID(UUID uuid) {
+ return this.getStringList(uuid.toString());
+ }
+}
diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java
index fc5406f6b..5eb5b57b2 100644
--- a/src/main/java/fr/xephi/authme/settings/Settings.java
+++ b/src/main/java/fr/xephi/authme/settings/Settings.java
@@ -38,6 +38,7 @@ public final class Settings extends YamlConfiguration {
public static List countries = null;
public static List countriesBlacklist = null;
public static List forceCommands = null;
+ public static List 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) configFile.getList("settings.forceCommands", new ArrayList());
+ forceCommandsAsConsole = (List) configFile.getList("settings.forceCommandsAsConsole", new ArrayList());
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) configFile.getList("settings.forceCommands", new ArrayList());
+ forceCommandsAsConsole = (List) configFile.getList("settings.forceCommandsAsConsole", new ArrayList());
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());
changes = true;
}
+ if(!contains("settings.forceCommandsAsConsole")) {
+ set("settings.forceCommandsAsConsole", new ArrayList());
+ changes = true;
+ }
if(!contains("Email.recallPlayers")) {
set("Email.recallPlayers", false);
changes = true;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 4bd42f4d6..744878b91 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -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,
diff --git a/src/main/resources/otheraccounts.yml b/src/main/resources/otheraccounts.yml
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 2946d0bed..e4092e345 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -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: