mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-09 12:10:56 +01:00
commit
032361b733
45
pom.xml
45
pom.xml
@ -119,16 +119,10 @@
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mcstats.org Metrics Repo -->
|
||||
<!-- Essentials Repo -->
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault Repo -->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
<id>ess-repo</id>
|
||||
<url>http://repo.ess3.net/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- Citizens 2.X Repo -->
|
||||
@ -137,24 +131,12 @@
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
|
||||
<!-- Essentials Repo -->
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>http://repo.ess3.net/content/groups/essentials</url>
|
||||
</repository>
|
||||
|
||||
<!-- CombatTagPlus Repo -->
|
||||
<repository>
|
||||
<id>minelink-thirdparty</id>
|
||||
<url>http://repo.minelink.net/content/repositories/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- XAuth Repo -->
|
||||
<repository>
|
||||
<id>luricos-releases</id>
|
||||
<url>http://repo.luricos.de/content/repositories/bukkit-plugins</url>
|
||||
</repository>
|
||||
|
||||
<!-- Attribute Repo -->
|
||||
<repository>
|
||||
<id>comphenix-snapshots</id>
|
||||
@ -167,6 +149,24 @@
|
||||
<url>http://repo.onarandombox.com/content/repositories/multiverse</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault Repo -->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mcstats.org Metrics Repo -->
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- XAuth Repo -->
|
||||
<repository>
|
||||
<id>luricos-releases</id>
|
||||
<url>http://repo.luricos.de/content/repositories/bukkit-plugins</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -248,6 +248,7 @@
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
@ -300,7 +301,7 @@
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
<artifactId>Essentials</artifactId>
|
||||
<version>2.13-SNAPSHOT</version>
|
||||
<version>2.14-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -12,8 +12,6 @@ import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
@ -80,7 +78,6 @@ public class AuthMe extends JavaPlugin {
|
||||
public DataSource database = null;
|
||||
private Settings settings;
|
||||
private Messages m;
|
||||
public PlayersLogs pllog;
|
||||
public OtherAccounts otherAccounts;
|
||||
public static Server server;
|
||||
public static Logger authmeLogger = Logger.getLogger("AuthMe");
|
||||
@ -97,9 +94,9 @@ public class AuthMe extends JavaPlugin {
|
||||
public Essentials ess;
|
||||
public API api;
|
||||
public Management management;
|
||||
public HashMap<String, Integer> captcha = new HashMap<String, Integer>();
|
||||
public HashMap<String, String> cap = new HashMap<String, String>();
|
||||
public HashMap<String, String> realIp = new HashMap<String, String>();
|
||||
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<String, Integer>();
|
||||
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<String, String>();
|
||||
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<String, String>();
|
||||
public MultiverseCore multiverse = null;
|
||||
public Location essentialsSpawn;
|
||||
public LookupService ls = null;
|
||||
@ -151,8 +148,6 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
m = Messages.getInstance();
|
||||
|
||||
pllog = PlayersLogs.getInstance();
|
||||
|
||||
otherAccounts = OtherAccounts.getInstance();
|
||||
|
||||
server = getServer();
|
||||
@ -208,13 +203,13 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
setupDatabase();
|
||||
|
||||
dataManager = new DataManager(this, database);
|
||||
dataManager = new DataManager(this);
|
||||
|
||||
// Setup API
|
||||
api = new API(this, database);
|
||||
api = new API(this);
|
||||
|
||||
// Setup Management
|
||||
management = new Management(database, this);
|
||||
management = new Management(this);
|
||||
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
if (Settings.bungee) {
|
||||
@ -222,33 +217,34 @@ public class AuthMe extends JavaPlugin {
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
|
||||
}
|
||||
|
||||
pm.registerEvents(new AuthMePlayerListener(this, database), this);
|
||||
pm.registerEvents(new AuthMeBlockListener(database, this), this);
|
||||
pm.registerEvents(new AuthMeEntityListener(database, this), this);
|
||||
pm.registerEvents(new AuthMePlayerListener(this), this);
|
||||
pm.registerEvents(new AuthMeBlockListener(this), this);
|
||||
pm.registerEvents(new AuthMeEntityListener(this), this);
|
||||
pm.registerEvents(new AuthMeServerListener(this), this);
|
||||
if (ChestShop != 0) {
|
||||
pm.registerEvents(new AuthMeChestShopListener(database, this), this);
|
||||
pm.registerEvents(new AuthMeChestShopListener(this), this);
|
||||
ConsoleLogger.info("Successfully hook with ChestShop!");
|
||||
}
|
||||
|
||||
this.getCommand("authme").setExecutor(new AdminCommand(this, database));
|
||||
this.getCommand("authme").setExecutor(new AdminCommand(this));
|
||||
this.getCommand("register").setExecutor(new RegisterCommand(this));
|
||||
this.getCommand("login").setExecutor(new LoginCommand(this));
|
||||
this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(database, this));
|
||||
this.getCommand("logout").setExecutor(new LogoutCommand(this, database));
|
||||
this.getCommand("unregister").setExecutor(new UnregisterCommand(this, database));
|
||||
this.getCommand("changepassword").setExecutor(new ChangePasswordCommand(this));
|
||||
this.getCommand("logout").setExecutor(new LogoutCommand(this));
|
||||
this.getCommand("unregister").setExecutor(new UnregisterCommand(this));
|
||||
this.getCommand("passpartu").setExecutor(new PasspartuCommand(this));
|
||||
this.getCommand("email").setExecutor(new EmailCommand(this, database));
|
||||
this.getCommand("email").setExecutor(new EmailCommand(this));
|
||||
this.getCommand("captcha").setExecutor(new CaptchaCommand(this));
|
||||
this.getCommand("converter").setExecutor(new ConverterCommand(this, database));
|
||||
this.getCommand("converter").setExecutor(new ConverterCommand(this));
|
||||
|
||||
if (!Settings.isForceSingleSessionEnabled) {
|
||||
ConsoleLogger.showError("BECAREFUL !!! By disabling ForceSingleSession, your server protection is set to LOW");
|
||||
}
|
||||
|
||||
PlayersLogs.getInstance();
|
||||
|
||||
if (Settings.reloadSupport)
|
||||
try {
|
||||
onReload();
|
||||
int playersOnline = 0;
|
||||
try {
|
||||
if (Bukkit.class.getMethod("getOnlinePlayers", new Class<?>[0]).getReturnType() == Collection.class)
|
||||
@ -261,7 +257,7 @@ public class AuthMe extends JavaPlugin {
|
||||
database.purgeLogged();
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
} else PlayersLogs.getInstance().loadPlayers();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
@ -432,27 +428,6 @@ public class AuthMe extends JavaPlugin {
|
||||
ConsoleLogger.info("Authme " + this.getDescription().getVersion() + " disabled");
|
||||
}
|
||||
|
||||
private void onReload() {
|
||||
try {
|
||||
if (Bukkit.getServer().getOnlinePlayers() != null) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (database.isLogged(player.getName().toLowerCase())) {
|
||||
String name = player.getName().toLowerCase();
|
||||
PlayerAuth pAuth = database.getAuth(name);
|
||||
if (pAuth == null)
|
||||
break;
|
||||
PlayerAuth auth = new PlayerAuth(name, pAuth.getHash(), pAuth.getIp(), new Date().getTime(), pAuth.getEmail());
|
||||
database.updateSession(auth);
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
} catch (Exception ex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static AuthMe getInstance() {
|
||||
return authme;
|
||||
}
|
||||
@ -460,7 +435,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public void savePlayer(Player player)
|
||||
throws IllegalStateException, NullPointerException {
|
||||
try {
|
||||
if ((citizens.isNPC(player, this)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) {
|
||||
if ((citizens.isNPC(player)) || (Utils.getInstance().isUnrestricted(player)) || (CombatTagComunicator.isNPC(player))) {
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -566,8 +541,8 @@ public class AuthMe extends JavaPlugin {
|
||||
Location spawnLoc = world.getSpawnLocation();
|
||||
for (int i = spawnPriority.length - 1; i >= 0; i--) {
|
||||
String s = spawnPriority[i];
|
||||
if (s.equalsIgnoreCase("default") && getDefaultSpawn(world) != null)
|
||||
spawnLoc = getDefaultSpawn(world);
|
||||
if (s.equalsIgnoreCase("default") && getDefaultSpawn() != null)
|
||||
spawnLoc = getDefaultSpawn();
|
||||
if (s.equalsIgnoreCase("multiverse") && getMultiverseSpawn(world) != null)
|
||||
spawnLoc = getMultiverseSpawn(world);
|
||||
if (s.equalsIgnoreCase("essentials") && getEssentialsSpawn() != null)
|
||||
@ -580,8 +555,8 @@ public class AuthMe extends JavaPlugin {
|
||||
return spawnLoc;
|
||||
}
|
||||
|
||||
private Location getDefaultSpawn(World world) {
|
||||
return world.getSpawnLocation();
|
||||
private Location getDefaultSpawn() {
|
||||
return this.getServer().getWorld(Settings.defaultWorld).getSpawnLocation();
|
||||
}
|
||||
|
||||
private Location getMultiverseSpawn(World world) {
|
||||
@ -607,7 +582,7 @@ public class AuthMe extends JavaPlugin {
|
||||
return Spawn.getInstance().getFirstSpawn();
|
||||
if (Spawn.getInstance().getSpawn() != null)
|
||||
return Spawn.getInstance().getSpawn();
|
||||
return null;
|
||||
return this.getServer().getWorld(Settings.defaultWorld).getSpawnLocation();
|
||||
}
|
||||
|
||||
public void downloadGeoIp() {
|
||||
|
@ -8,23 +8,19 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
public class DataManager {
|
||||
|
||||
public AuthMe plugin;
|
||||
public DataSource database;
|
||||
|
||||
public DataManager(AuthMe plugin, DataSource database) {
|
||||
public DataManager(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
33
src/main/java/fr/xephi/authme/ImageGenerator.java
Normal file
33
src/main/java/fr/xephi/authme/ImageGenerator.java
Normal file
@ -0,0 +1,33 @@
|
||||
package fr.xephi.authme;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class ImageGenerator {
|
||||
|
||||
private String pass;
|
||||
private AuthMe plugin;
|
||||
|
||||
public ImageGenerator(AuthMe plugin, String pass) {
|
||||
this.pass = pass;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public BufferedImage generateImage() {
|
||||
BufferedImage image = new BufferedImage(200, 60, BufferedImage.TYPE_BYTE_INDEXED);
|
||||
Graphics2D graphics = image.createGraphics();
|
||||
graphics.setColor(Color.BLACK);
|
||||
graphics.fillRect(0, 0, 200, 40);
|
||||
GradientPaint gradientPaint = new GradientPaint(10, 5, Color.WHITE, 20, 10, Color.WHITE, true);
|
||||
graphics.setPaint(gradientPaint);
|
||||
Font font = new Font("Comic Sans MS", Font.BOLD, 30);
|
||||
graphics.setFont(font);
|
||||
graphics.drawString(pass, 5, 30);
|
||||
graphics.dispose();
|
||||
image.flush();
|
||||
return image;
|
||||
}
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
package fr.xephi.authme;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
import javax.activation.DataSource;
|
||||
import javax.activation.FileDataSource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.mail.BodyPart;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.Multipart;
|
||||
@ -46,9 +51,8 @@ public class SendMailSSL {
|
||||
final String subject = Settings.getMailSubject;
|
||||
final String smtp = Settings.getmailSMTP;
|
||||
final String password = Settings.getmailPassword;
|
||||
final String mailText = Settings.getMailText;
|
||||
final String mailText = Settings.getMailText.replace("<playername>", auth.getNickname()).replace("<servername>", plugin.getServer().getServerName()).replace("<generatedpass>", newPass);
|
||||
final String mail = auth.getEmail();
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@ -74,10 +78,26 @@ public class SendMailSSL {
|
||||
messageBodyPart.setText(mailText);
|
||||
Multipart multipart = new MimeMultipart();
|
||||
multipart.addBodyPart(messageBodyPart);
|
||||
|
||||
// Generate an image ?
|
||||
File file = null;
|
||||
if (Settings.generateImage) {
|
||||
ImageGenerator gen = new ImageGenerator(plugin, newPass);
|
||||
file = new File(plugin.getDataFolder() + File.separator + auth.getNickname() + "_new_pass.jpg");
|
||||
ImageIO.write(gen.generateImage(), "jpg", file);
|
||||
messageBodyPart = new MimeBodyPart();
|
||||
DataSource source = new FileDataSource(file);
|
||||
messageBodyPart.setDataHandler(new DataHandler(source));
|
||||
messageBodyPart.setFileName(auth.getNickname() + "_new_pass.jpg");
|
||||
multipart.addBodyPart(messageBodyPart);
|
||||
}
|
||||
|
||||
message.setContent(multipart);
|
||||
Transport transport = session.getTransport("smtp");
|
||||
transport.connect(smtp, acc, password);
|
||||
transport.sendMessage(message, message.getAllRecipients());
|
||||
if (file != null)
|
||||
file.delete();
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Some error occured while trying to send a mail to " + mail);
|
||||
|
@ -13,7 +13,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -23,16 +22,13 @@ public class API {
|
||||
public static final String newline = System.getProperty("line.separator");
|
||||
public static API singleton;
|
||||
public AuthMe plugin;
|
||||
public DataSource database;
|
||||
|
||||
public API(AuthMe plugin, DataSource database) {
|
||||
public API(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
public API(Server serv) {
|
||||
this.plugin = (AuthMe) serv.getPluginManager().getPlugin("AuthMe");
|
||||
this.database = this.plugin.database;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +46,7 @@ public class API {
|
||||
return null;
|
||||
}
|
||||
AuthMe authme = (AuthMe) p;
|
||||
singleton = (new API(authme, authme.database));
|
||||
singleton = (new API(authme));
|
||||
return singleton;
|
||||
}
|
||||
|
||||
@ -67,25 +63,13 @@ public class API {
|
||||
return PlayerCache.getInstance().isAuthenticated(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
* @return true if player is a npc
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isaNPC(Player player) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
return true;
|
||||
return CombatTagComunicator.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player
|
||||
* @return true if player is a npc
|
||||
*/
|
||||
public boolean isNPC(Player player) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return true;
|
||||
return CombatTagComunicator.isNPC(player);
|
||||
}
|
||||
@ -131,7 +115,7 @@ public class API {
|
||||
*/
|
||||
public boolean isRegistered(String playerName) {
|
||||
String player = playerName.toLowerCase();
|
||||
return database.isAuthAvailable(player);
|
||||
return plugin.database.isAuthAvailable(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +127,7 @@ public class API {
|
||||
if (!isRegistered(playerName))
|
||||
return false;
|
||||
String player = playerName.toLowerCase();
|
||||
PlayerAuth auth = database.getAuth(player);
|
||||
PlayerAuth auth = plugin.database.getAuth(player);
|
||||
try {
|
||||
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
@ -166,7 +150,7 @@ public class API {
|
||||
return false;
|
||||
}
|
||||
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com");
|
||||
if (!database.saveAuth(auth)) {
|
||||
if (!plugin.database.saveAuth(auth)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -43,4 +43,8 @@ public class PlayerCache {
|
||||
return cache.size();
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, PlayerAuth> getCache() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class LimboCache {
|
||||
boolean flying = false;
|
||||
|
||||
if (playerData.doesCacheExist(player)) {
|
||||
StoreInventoryEvent event = new StoreInventoryEvent(player, playerData);
|
||||
final StoreInventoryEvent event = new StoreInventoryEvent(player, playerData);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) {
|
||||
inv = event.getInventory();
|
||||
@ -90,6 +90,9 @@ public class LimboCache {
|
||||
player.sendMessage("Your inventory has been cleaned!");
|
||||
}
|
||||
}
|
||||
if (gameMode == GameMode.CREATIVE) {
|
||||
flying = false;
|
||||
}
|
||||
gameMode = GameMode.SURVIVAL;
|
||||
}
|
||||
if (player.isDead()) {
|
||||
|
@ -33,7 +33,6 @@ import fr.xephi.authme.Utils.groupType;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
@ -46,10 +45,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
|
||||
public AuthMe plugin;
|
||||
private Messages m = Messages.getInstance();
|
||||
public DataSource database;
|
||||
|
||||
public AdminCommand(AuthMe plugin, DataSource database) {
|
||||
this.database = database;
|
||||
public AdminCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -107,7 +104,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -(Integer.parseInt(args[1])));
|
||||
long until = calendar.getTimeInMillis();
|
||||
List<String> purged = database.autoPurgeDatabase(until);
|
||||
List<String> purged = plugin.database.autoPurgeDatabase(until);
|
||||
sender.sendMessage("Deleted " + purged.size() + " user accounts");
|
||||
if (Settings.purgeEssentialsFile && plugin.ess != null)
|
||||
plugin.dataManager.purgeEssentials(purged);
|
||||
@ -161,8 +158,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (database.getAuth(args[1].toLowerCase()) != null) {
|
||||
PlayerAuth player = database.getAuth(args[1].toLowerCase());
|
||||
if (plugin.database.getAuth(args[1].toLowerCase()) != null) {
|
||||
PlayerAuth player = plugin.database.getAuth(args[1].toLowerCase());
|
||||
long lastLogin = player.getLastLogin();
|
||||
Date d = new Date(lastLogin);
|
||||
final long diff = System.currentTimeMillis() - lastLogin;
|
||||
@ -195,13 +192,13 @@ public class AdminCommand implements CommandExecutor {
|
||||
PlayerAuth pAuth = null;
|
||||
String message = "[AuthMe] ";
|
||||
try {
|
||||
pAuth = database.getAuth(arguments[1].toLowerCase());
|
||||
pAuth = plugin.database.getAuth(arguments[1].toLowerCase());
|
||||
} catch (NullPointerException npe) {
|
||||
fSender.sendMessage("[AuthMe] This player is unknown");
|
||||
return;
|
||||
}
|
||||
if (pAuth != null) {
|
||||
List<String> accountList = database.getAllAuthsByName(pAuth);
|
||||
List<String> accountList = plugin.database.getAllAuthsByName(pAuth);
|
||||
if (accountList.isEmpty() || accountList == null) {
|
||||
fSender.sendMessage("[AuthMe] This player is unknown");
|
||||
return;
|
||||
@ -238,7 +235,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
public void run() {
|
||||
String message = "[AuthMe] ";
|
||||
if (arguments[1] != null) {
|
||||
List<String> accountList = database.getAllAuthsByIp(arguments[1]);
|
||||
List<String> accountList = plugin.database.getAllAuthsByIp(arguments[1]);
|
||||
if (accountList.isEmpty() || accountList == null) {
|
||||
fSender.sendMessage("[AuthMe] Please put a valid IP");
|
||||
return;
|
||||
@ -275,7 +272,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
}
|
||||
try {
|
||||
String name = args[1].toLowerCase();
|
||||
if (database.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(sender, "user_regged");
|
||||
return true;
|
||||
}
|
||||
@ -284,7 +281,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
|
||||
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
else auth.setSalt("");
|
||||
if (!database.saveAuth(auth)) {
|
||||
if (!plugin.database.saveAuth(auth)) {
|
||||
m.send(sender, "error");
|
||||
return true;
|
||||
}
|
||||
@ -301,7 +298,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
String playername = args[1].toLowerCase();
|
||||
PlayerAuth getAuth = database.getAuth(playername);
|
||||
PlayerAuth getAuth = plugin.database.getAuth(playername);
|
||||
if (getAuth == null) {
|
||||
m.send(sender, "unknown_user");
|
||||
return true;
|
||||
@ -314,13 +311,13 @@ public class AdminCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
String playername = args[1].toLowerCase();
|
||||
PlayerAuth getAuth = database.getAuth(playername);
|
||||
PlayerAuth getAuth = plugin.database.getAuth(playername);
|
||||
if (getAuth == null) {
|
||||
m.send(sender, "unknown_user");
|
||||
return true;
|
||||
}
|
||||
getAuth.setEmail(args[2]);
|
||||
if (!database.updateEmail(getAuth)) {
|
||||
if (!plugin.database.updateEmail(getAuth)) {
|
||||
m.send(sender, "error");
|
||||
return true;
|
||||
}
|
||||
@ -358,7 +355,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
for (OfflinePlayer off : plugin.getServer().getBannedPlayers()) {
|
||||
bannedPlayers.add(off.getName().toLowerCase());
|
||||
}
|
||||
database.purgeBanned(bannedPlayers);
|
||||
plugin.database.purgeBanned(bannedPlayers);
|
||||
if (Settings.purgeEssentialsFile && plugin.ess != null)
|
||||
plugin.dataManager.purgeEssentials(bannedPlayers);
|
||||
if (Settings.purgePlayerDat)
|
||||
@ -406,8 +403,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
PlayerAuth auth = null;
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
auth = PlayerCache.getInstance().getAuth(name);
|
||||
} else if (database.isAuthAvailable(name)) {
|
||||
auth = database.getAuth(name);
|
||||
} else if (plugin.database.isAuthAvailable(name)) {
|
||||
auth = plugin.database.getAuth(name);
|
||||
}
|
||||
if (auth == null) {
|
||||
m.send(sender, "unknown_user");
|
||||
@ -416,9 +413,9 @@ public class AdminCommand implements CommandExecutor {
|
||||
auth.setHash(hash);
|
||||
if (PasswordSecurity.userSalt.containsKey(name)) {
|
||||
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
database.updateSalt(auth);
|
||||
plugin.database.updateSalt(auth);
|
||||
}
|
||||
if (!database.updatePassword(auth)) {
|
||||
if (!plugin.database.updatePassword(auth)) {
|
||||
m.send(sender, "error");
|
||||
return true;
|
||||
}
|
||||
@ -435,11 +432,11 @@ public class AdminCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
String name = args[1].toLowerCase();
|
||||
if (!database.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
m.send(sender, "user_unknown");
|
||||
return true;
|
||||
}
|
||||
if (!database.removeAuth(name)) {
|
||||
if (!plugin.database.removeAuth(name)) {
|
||||
m.send(sender, "error");
|
||||
return true;
|
||||
}
|
||||
@ -484,7 +481,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
}
|
||||
try {
|
||||
String name = args[1].toLowerCase();
|
||||
PlayerAuth auth = database.getAuth(name);
|
||||
PlayerAuth auth = plugin.database.getAuth(name);
|
||||
if (auth == null) {
|
||||
sender.sendMessage("The player " + name + " is not registered ");
|
||||
return true;
|
||||
@ -493,7 +490,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
auth.setQuitLocY(0);
|
||||
auth.setQuitLocZ(0);
|
||||
auth.setWorld("world");
|
||||
database.updateQuitLoc(auth);
|
||||
plugin.database.updateQuitLoc(auth);
|
||||
sender.sendMessage(name + " 's last pos location is now reset");
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError("An error occured while trying to reset location or player do not exist, please see below: ");
|
||||
@ -539,7 +536,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
sender.sendMessage("Usage : /authme resetPosition <playerName>");
|
||||
return true;
|
||||
}
|
||||
PlayerAuth auth = database.getAuth(args[1]);
|
||||
PlayerAuth auth = plugin.database.getAuth(args[1]);
|
||||
if (auth == null) {
|
||||
m.send(sender, "unknown_user");
|
||||
return true;
|
||||
@ -548,7 +545,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
auth.setQuitLocY(0D);
|
||||
auth.setQuitLocZ(0D);
|
||||
auth.setWorld("world");
|
||||
database.updateQuitLoc(auth);
|
||||
plugin.database.updateQuitLoc(auth);
|
||||
sender.sendMessage("[AuthMe] Successfully reset position for " + auth.getNickname());
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("forcelogin")) {
|
||||
|
@ -11,7 +11,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -19,11 +18,9 @@ import fr.xephi.authme.settings.Settings;
|
||||
public class ChangePasswordCommand implements CommandExecutor {
|
||||
|
||||
private Messages m = Messages.getInstance();
|
||||
private DataSource database;
|
||||
public AuthMe plugin;
|
||||
|
||||
public ChangePasswordCommand(DataSource database, AuthMe plugin) {
|
||||
this.database = database;
|
||||
public ChangePasswordCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -79,11 +76,11 @@ public class ChangePasswordCommand implements CommandExecutor {
|
||||
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
|
||||
auth.setSalt(PasswordSecurity.userSalt.get(name));
|
||||
else auth.setSalt("");
|
||||
if (!database.updatePassword(auth)) {
|
||||
if (!plugin.database.updatePassword(auth)) {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
database.updateSalt(auth);
|
||||
plugin.database.updateSalt(auth);
|
||||
PlayerCache.getInstance().updatePlayer(auth);
|
||||
m.send(player, "pwd_changed");
|
||||
ConsoleLogger.info(player.getName() + " changed his password");
|
||||
|
@ -16,18 +16,15 @@ import fr.xephi.authme.converter.RoyalAuthConverter;
|
||||
import fr.xephi.authme.converter.SqlToFlat;
|
||||
import fr.xephi.authme.converter.vAuthConverter;
|
||||
import fr.xephi.authme.converter.xAuthConverter;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
public class ConverterCommand implements CommandExecutor {
|
||||
|
||||
private AuthMe plugin;
|
||||
private Messages m = Messages.getInstance();
|
||||
private DataSource database;
|
||||
|
||||
public ConverterCommand(AuthMe plugin, DataSource database) {
|
||||
public ConverterCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,22 +58,22 @@ public class ConverterCommand implements CommandExecutor {
|
||||
converter = new FlatToSqlite(sender);
|
||||
break;
|
||||
case xauth:
|
||||
converter = new xAuthConverter(plugin, database, sender);
|
||||
converter = new xAuthConverter(plugin, sender);
|
||||
break;
|
||||
case crazylogin:
|
||||
converter = new CrazyLoginConverter(plugin, database, sender);
|
||||
converter = new CrazyLoginConverter(plugin, sender);
|
||||
break;
|
||||
case rakamak:
|
||||
converter = new RakamakConverter(plugin, database, sender);
|
||||
converter = new RakamakConverter(plugin, sender);
|
||||
break;
|
||||
case royalauth:
|
||||
converter = new RoyalAuthConverter(plugin);
|
||||
break;
|
||||
case vauth:
|
||||
converter = new vAuthConverter(plugin, database, sender);
|
||||
converter = new vAuthConverter(plugin, sender);
|
||||
break;
|
||||
case sqltoflat:
|
||||
converter = new SqlToFlat(plugin, database, sender);
|
||||
converter = new SqlToFlat(plugin, sender);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -11,7 +11,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
@ -24,12 +23,10 @@ import fr.xephi.authme.settings.Settings;
|
||||
public class EmailCommand implements CommandExecutor {
|
||||
|
||||
public AuthMe plugin;
|
||||
private DataSource data;
|
||||
private Messages m = Messages.getInstance();
|
||||
|
||||
public EmailCommand(AuthMe plugin, DataSource data) {
|
||||
public EmailCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,7 +57,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(args[1]).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return true;
|
||||
}
|
||||
@ -76,7 +73,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
auth.setEmail(args[1]);
|
||||
if (!data.updateEmail(auth)) {
|
||||
if (!plugin.database.updateEmail(auth)) {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
@ -86,7 +83,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "email_confirm");
|
||||
} else {
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
m.send(player, "reg_email_msg");
|
||||
@ -98,7 +95,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && data.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.authmePermissible(sender, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(args[2]).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return true;
|
||||
}
|
||||
@ -118,7 +115,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
auth.setEmail(args[2]);
|
||||
if (!data.updateEmail(auth)) {
|
||||
if (!plugin.database.updateEmail(auth)) {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
@ -128,7 +125,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
} else if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "email_confirm");
|
||||
} else {
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
m.send(player, "reg_email_msg");
|
||||
@ -144,7 +141,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
m.send(player, "error");
|
||||
return true;
|
||||
}
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
m.send(player, "logged_in");
|
||||
return true;
|
||||
@ -156,8 +153,8 @@ public class EmailCommand implements CommandExecutor {
|
||||
PlayerAuth auth = null;
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
auth = PlayerCache.getInstance().getAuth(name);
|
||||
} else if (data.isAuthAvailable(name)) {
|
||||
auth = data.getAuth(name);
|
||||
} else if (plugin.database.isAuthAvailable(name)) {
|
||||
auth = plugin.database.getAuth(name);
|
||||
} else {
|
||||
m.send(player, "unknown_user");
|
||||
return true;
|
||||
@ -172,7 +169,7 @@ public class EmailCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
auth.setHash(hashnew);
|
||||
data.updatePassword(auth);
|
||||
plugin.database.updatePassword(auth);
|
||||
plugin.mail.main(auth, thePass);
|
||||
m.send(player, "email_send");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
|
@ -6,23 +6,15 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
public class LogoutCommand implements CommandExecutor {
|
||||
|
||||
private Messages m = Messages.getInstance();
|
||||
private AuthMe plugin;
|
||||
private DataSource database;
|
||||
private Utils utils = Utils.getInstance();
|
||||
private FileCache playerBackup;
|
||||
|
||||
public LogoutCommand(AuthMe plugin, DataSource database) {
|
||||
public LogoutCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.playerBackup = new FileCache(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,6 @@ import fr.xephi.authme.Utils.groupType;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
@ -32,12 +31,10 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
|
||||
private Messages m = Messages.getInstance();
|
||||
public AuthMe plugin;
|
||||
private DataSource database;
|
||||
private FileCache playerCache;
|
||||
|
||||
public UnregisterCommand(AuthMe plugin, DataSource database) {
|
||||
public UnregisterCommand(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.playerCache = new FileCache(plugin);
|
||||
}
|
||||
|
||||
@ -67,7 +64,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
}
|
||||
try {
|
||||
if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) {
|
||||
if (!database.removeAuth(name)) {
|
||||
if (!plugin.database.removeAuth(name)) {
|
||||
player.sendMessage("error");
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -23,10 +24,9 @@ public class CrazyLoginConverter implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public CrazyLoginConverter(AuthMe instance, DataSource database,
|
||||
CommandSender sender) {
|
||||
public CrazyLoginConverter(AuthMe instance, CommandSender sender) {
|
||||
this.instance = instance;
|
||||
this.database = database;
|
||||
this.database = instance.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,9 @@ public class RakamakConverter implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public RakamakConverter(AuthMe instance, DataSource database,
|
||||
CommandSender sender) {
|
||||
public RakamakConverter(AuthMe instance, CommandSender sender) {
|
||||
this.instance = instance;
|
||||
this.database = database;
|
||||
this.database = instance.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@ public class SqlToFlat implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public SqlToFlat(AuthMe plugin, DataSource database, CommandSender sender) {
|
||||
public SqlToFlat(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.database = plugin.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -12,17 +12,16 @@ public class vAuthConverter implements Converter {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public vAuthConverter(AuthMe plugin, DataSource database,
|
||||
CommandSender sender) {
|
||||
public vAuthConverter(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.database = plugin.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
new vAuthFileReader(plugin, database, sender).convert();
|
||||
new vAuthFileReader(plugin, sender).convert();
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(e.getMessage());
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
|
@ -19,10 +19,9 @@ public class vAuthFileReader {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public vAuthFileReader(AuthMe plugin, DataSource database,
|
||||
CommandSender sender) {
|
||||
public vAuthFileReader(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.database = plugin.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -3,18 +3,14 @@ package fr.xephi.authme.converter;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
|
||||
public class xAuthConverter implements Converter {
|
||||
|
||||
public AuthMe plugin;
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public xAuthConverter(AuthMe plugin, DataSource database,
|
||||
CommandSender sender) {
|
||||
public xAuthConverter(AuthMe plugin, CommandSender sender) {
|
||||
this.plugin = plugin;
|
||||
this.database = database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@ -22,7 +18,7 @@ public class xAuthConverter implements Converter {
|
||||
public void run() {
|
||||
try {
|
||||
Class.forName("de.luricos.bukkit.xAuth.xAuth");
|
||||
xAuthToFlat converter = new xAuthToFlat(plugin, database, sender);
|
||||
xAuthToFlat converter = new xAuthToFlat(plugin, sender);
|
||||
converter.convert();
|
||||
} catch (ClassNotFoundException ce) {
|
||||
sender.sendMessage("xAuth has not been found, please put xAuth.jar in your plugin folder and restart!");
|
||||
|
@ -23,10 +23,9 @@ public class xAuthToFlat {
|
||||
public DataSource database;
|
||||
public CommandSender sender;
|
||||
|
||||
public xAuthToFlat(AuthMe instance, DataSource database,
|
||||
CommandSender sender) {
|
||||
public xAuthToFlat(AuthMe instance, CommandSender sender) {
|
||||
this.instance = instance;
|
||||
this.database = database;
|
||||
this.database = instance.database;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import java.util.List;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
@ -648,17 +649,17 @@ public class FlatFile implements DataSource {
|
||||
|
||||
@Override
|
||||
public boolean isLogged(String user) {
|
||||
return PlayersLogs.getInstance().players.contains(user.toLowerCase());
|
||||
return PlayerCache.getInstance().isAuthenticated(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogged(String user) {
|
||||
PlayersLogs.getInstance().addPlayer(user.toLowerCase());
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnlogged(String user) {
|
||||
PlayersLogs.getInstance().removePlayer(user.toLowerCase());
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,6 +12,7 @@ import java.util.List;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.MiniConnectionPoolManager.TimeoutException;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -74,8 +75,8 @@ public class SQLite implements DataSource {
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void connect() throws ClassNotFoundException,
|
||||
SQLException {
|
||||
private synchronized void connect()
|
||||
throws ClassNotFoundException, SQLException {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
ConsoleLogger.info("SQLite driver loaded");
|
||||
this.con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
|
||||
@ -508,17 +509,17 @@ public class SQLite implements DataSource {
|
||||
|
||||
@Override
|
||||
public boolean isLogged(String user) {
|
||||
return PlayersLogs.getInstance().players.contains(user.toLowerCase());
|
||||
return PlayerCache.getInstance().isAuthenticated(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLogged(String user) {
|
||||
PlayersLogs.getInstance().addPlayer(user.toLowerCase());
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnlogged(String user) {
|
||||
PlayersLogs.getInstance().removePlayer(user.toLowerCase());
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,40 @@
|
||||
package fr.xephi.authme.events;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* Called if a player is teleported to the authme first spawn
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class FirstSpawnTeleportEvent extends CustomEvent {
|
||||
|
||||
private Player player;
|
||||
private Location to;
|
||||
private Location from;
|
||||
|
||||
public FirstSpawnTeleportEvent(Player player, Location from, Location to) {
|
||||
this.player = player;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public void setTo(Location to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public Location getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public Location getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
}
|
@ -9,16 +9,14 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeBlockListener implements Listener {
|
||||
|
||||
private DataSource data;
|
||||
public AuthMe instance;
|
||||
|
||||
public AuthMeBlockListener(DataSource data, AuthMe instance) {
|
||||
this.data = data;
|
||||
public AuthMeBlockListener(AuthMe instance) {
|
||||
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@ -39,7 +37,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -64,7 +62,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -11,16 +11,13 @@ import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeChestShopListener implements Listener {
|
||||
|
||||
public DataSource database;
|
||||
public AuthMe plugin;
|
||||
|
||||
public AuthMeChestShopListener(DataSource database, AuthMe plugin) {
|
||||
this.database = database;
|
||||
public AuthMeChestShopListener(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@ -41,7 +38,7 @@ public class AuthMeChestShopListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!database.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
@ -15,21 +15,18 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMeEntityListener implements Listener {
|
||||
|
||||
private DataSource data;
|
||||
public AuthMe instance;
|
||||
|
||||
public AuthMeEntityListener(DataSource data, AuthMe instance) {
|
||||
this.data = data;
|
||||
public AuthMeEntityListener(AuthMe instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -44,7 +41,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.citizens.isNPC(entity, instance))
|
||||
if (instance.citizens.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -57,7 +54,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -67,7 +64,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -79,7 +76,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.citizens.isNPC(entity, instance))
|
||||
if (instance.citizens.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -89,7 +86,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -97,36 +94,36 @@ public class AuthMeEntityListener implements Listener {
|
||||
event.setTarget(null);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onDmg(EntityDamageByEntityEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
public void onDmg(EntityDamageByEntityEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = event.getDamager();
|
||||
|
||||
if (entity == null || !(entity instanceof Player)) {
|
||||
|
||||
Entity entity = event.getDamager();
|
||||
|
||||
if (entity == null || !(entity instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) entity;
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
|
||||
Player player = (Player) entity;
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -137,7 +134,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.citizens.isNPC(entity, instance))
|
||||
if (instance.citizens.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -147,7 +144,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -168,7 +165,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.citizens.isNPC(entity, instance))
|
||||
if (instance.citizens.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -178,7 +175,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -205,14 +202,14 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.citizens.isNPC(player, instance))
|
||||
if (instance.citizens.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -237,14 +234,14 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.citizens.isNPC(player, instance))
|
||||
if (instance.citizens.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!instance.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -43,25 +43,21 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AuthMePlayerListener implements Listener {
|
||||
|
||||
public static GameMode gm = GameMode.SURVIVAL;
|
||||
public static ConcurrentHashMap<String, GameMode> gameMode = new ConcurrentHashMap<String, GameMode>();
|
||||
public static ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<String, String>();
|
||||
private Messages m = Messages.getInstance();
|
||||
public AuthMe plugin;
|
||||
private DataSource data;
|
||||
public static ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<String, Boolean>();
|
||||
private List<String> antibot = new ArrayList<String>();
|
||||
|
||||
public AuthMePlayerListener(AuthMe plugin, DataSource data) {
|
||||
public AuthMePlayerListener(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -78,7 +74,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
if (!Settings.isForcedRegistrationEnabled)
|
||||
return;
|
||||
|
||||
@ -114,7 +110,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -151,7 +147,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -188,7 +184,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -225,7 +221,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -263,7 +259,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -300,7 +296,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String cmd = event.getMessage().split(" ")[0];
|
||||
|
||||
if (data.isAuthAvailable(name)) {
|
||||
if (plugin.database.isAuthAvailable(name)) {
|
||||
m.send(player, "login_msg");
|
||||
} else {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
@ -328,7 +324,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -337,7 +333,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -405,9 +401,9 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (player == null)
|
||||
return;
|
||||
final String name = player.getName().toLowerCase();
|
||||
boolean isAuthAvailable = data.isAuthAvailable(name);
|
||||
boolean isAuthAvailable = plugin.database.isAuthAvailable(name);
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -429,7 +425,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (Settings.isKickNonRegisteredEnabled) {
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
event.setKickMessage(m.send("reg_only")[0]);
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
return;
|
||||
@ -580,7 +576,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
plugin.management.performQuit(player, false);
|
||||
|
||||
if (data.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
||||
if (plugin.database.getAuth(name) != null && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
|
||||
event.setQuitMessage(null);
|
||||
}
|
||||
|
||||
@ -616,14 +612,14 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -644,14 +640,14 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -673,14 +669,14 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -702,14 +698,14 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -727,7 +723,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -735,7 +731,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -755,14 +751,14 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -786,7 +782,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -807,7 +803,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
return;
|
||||
}
|
||||
if (!data.isAuthAvailable(name)) {
|
||||
if (!plugin.database.isAuthAvailable(name)) {
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
}
|
||||
@ -827,21 +823,21 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player))
|
||||
return;
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
if (!Settings.isForcedRegistrationEnabled)
|
||||
return;
|
||||
|
||||
Location spawn = plugin.getSpawnLocation(player);
|
||||
if (Settings.isSaveQuitLocationEnabled && data.isAuthAvailable(name)) {
|
||||
if (Settings.isSaveQuitLocationEnabled && plugin.database.isAuthAvailable(name)) {
|
||||
final PlayerAuth auth = new PlayerAuth(name, spawn.getX(), spawn.getY(), spawn.getZ(), spawn.getWorld().getName());
|
||||
try {
|
||||
data.updateQuitLoc(auth);
|
||||
plugin.database.updateQuitLoc(auth);
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
}
|
||||
@ -855,8 +851,6 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
if (event.getPlayer() == null || event == null)
|
||||
return;
|
||||
if (!Settings.isForceSurvivalModeEnabled)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@ -868,18 +862,19 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player))
|
||||
return;
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin))
|
||||
if (plugin.getCitizensCommunicator().isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
if (!data.isAuthAvailable(name))
|
||||
if (!plugin.database.isAuthAvailable(name))
|
||||
if (!Settings.isForcedRegistrationEnabled)
|
||||
return;
|
||||
|
||||
if (causeByAuthMe.containsKey(name) && causeByAuthMe.get(name))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class CitizensCommunicator {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public boolean isNPC(final Entity player, AuthMe instance) {
|
||||
public boolean isNPC(final Entity player) {
|
||||
if (!this.instance.isCitizensActive)
|
||||
return false;
|
||||
try {
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.process.join.AsyncronousJoin;
|
||||
import fr.xephi.authme.process.login.AsyncronousLogin;
|
||||
import fr.xephi.authme.process.logout.AsyncronousLogout;
|
||||
@ -22,13 +21,11 @@ import fr.xephi.authme.settings.Settings;
|
||||
*/
|
||||
public class Management {
|
||||
|
||||
public DataSource database;
|
||||
public AuthMe plugin;
|
||||
public static RandomString rdm = new RandomString(Settings.captchaLength);
|
||||
public PluginManager pm;
|
||||
|
||||
public Management(DataSource database, AuthMe plugin) {
|
||||
this.database = database;
|
||||
public Management(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
this.pm = plugin.getServer().getPluginManager();
|
||||
}
|
||||
@ -39,7 +36,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, database).process();
|
||||
new AsyncronousLogin(player, password, forceLogin, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -50,7 +47,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousRegister(player, password, email, plugin, database).process();
|
||||
new AsyncronousRegister(player, password, email, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -60,7 +57,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousLogout(player, plugin, database).process();
|
||||
new AsyncronousLogout(player, plugin, plugin.database).process();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -70,7 +67,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousQuit(player, plugin, database, isKick).process();
|
||||
new AsyncronousQuit(player, plugin, plugin.database, isKick).process();
|
||||
}
|
||||
|
||||
});
|
||||
@ -81,7 +78,7 @@ public class Management {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
new AsyncronousJoin(player, plugin, database).process();
|
||||
new AsyncronousJoin(player, plugin, plugin.database).process();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -22,12 +22,14 @@ import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.events.FirstSpawnTeleportEvent;
|
||||
import fr.xephi.authme.events.ProtectInventoryEvent;
|
||||
import fr.xephi.authme.events.SpawnTeleportEvent;
|
||||
import fr.xephi.authme.listener.AuthMePlayerListener;
|
||||
import fr.xephi.authme.plugin.manager.CombatTagComunicator;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
|
||||
@ -53,7 +55,7 @@ public class AsyncronousJoin {
|
||||
AuthMePlayerListener.gameMode.put(name, player.getGameMode());
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -149,7 +151,7 @@ public class AsyncronousJoin {
|
||||
return;
|
||||
}
|
||||
if (!Settings.noTeleport)
|
||||
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
|
||||
if (!needFirstspawn() && Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
@ -216,7 +218,7 @@ public class AsyncronousJoin {
|
||||
public void run() {
|
||||
if (player.isOp())
|
||||
player.setOp(false);
|
||||
if (!Settings.isMovementAllowed) {
|
||||
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
}
|
||||
@ -249,6 +251,31 @@ public class AsyncronousJoin {
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
}
|
||||
|
||||
private boolean needFirstspawn() {
|
||||
if (database.isAuthAvailable(player.getName().toLowerCase()) && player.hasPlayedBefore())
|
||||
return false;
|
||||
else {
|
||||
if (Spawn.getInstance().getFirstSpawn() == null || Spawn.getInstance().getFirstSpawn().getWorld() == null)
|
||||
return false;
|
||||
final Location loc = Spawn.getInstance().getFirstSpawn();
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FirstSpawnTeleportEvent tpEvent = new FirstSpawnTeleportEvent(player, player.getLocation(), loc);
|
||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
||||
if (!tpEvent.isCancelled()) {
|
||||
if (player != null && player.isOnline() && tpEvent.getTo() != null && tpEvent.getTo().getWorld() != null) {
|
||||
player.teleport(tpEvent.getTo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void placePlayerSafely(final Player player,
|
||||
final Location spawnLoc) {
|
||||
Location loc = null;
|
||||
@ -258,14 +285,16 @@ public class AsyncronousJoin {
|
||||
return;
|
||||
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())))
|
||||
return;
|
||||
if (!database.isAuthAvailable(player.getName().toLowerCase()) || !player.hasPlayedBefore())
|
||||
return;
|
||||
Block b = player.getLocation().getBlock();
|
||||
if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL || b.getType() == Material.LAVA || b.getType() == Material.STATIONARY_LAVA) {
|
||||
if (b.getType() == Material.PORTAL || b.getType() == Material.ENDER_PORTAL) {
|
||||
m.send(player, "unsafe_spawn");
|
||||
if (spawnLoc.getWorld() != null)
|
||||
loc = spawnLoc;
|
||||
} else {
|
||||
Block c = player.getLocation().add(0D, 1D, 0D).getBlock();
|
||||
if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL || c.getType() == Material.LAVA || c.getType() == Material.STATIONARY_LAVA) {
|
||||
if (c.getType() == Material.PORTAL || c.getType() == Material.ENDER_PORTAL) {
|
||||
m.send(player, "unsafe_spawn");
|
||||
if (spawnLoc.getWorld() != null)
|
||||
loc = spawnLoc;
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
import fr.xephi.authme.Utils.groupType;
|
||||
import fr.xephi.authme.api.API;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
@ -53,8 +52,13 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
protected void restoreOpState() {
|
||||
player.setOp(limbo.getOperator());
|
||||
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
|
||||
player.setAllowFlight(limbo.isFlying());
|
||||
player.setFlying(limbo.isFlying());
|
||||
if (limbo.getGameMode() != GameMode.CREATIVE) {
|
||||
player.setAllowFlight(limbo.isFlying());
|
||||
player.setFlying(limbo.isFlying());
|
||||
} else {
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,8 +124,8 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
* ProtectInventoryEvent after Teleporting Also it's the current
|
||||
* world inventory !
|
||||
*/
|
||||
player.setGameMode(limbo.getGameMode());
|
||||
if (!Settings.forceOnlyAfterLogin) {
|
||||
player.setGameMode(limbo.getGameMode());
|
||||
// Inventory - Make it after restore GameMode , cause we need to
|
||||
// restore the
|
||||
// right inventory in the right gamemode
|
||||
@ -146,7 +150,8 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
} else {
|
||||
teleportBackFromSpawn();
|
||||
}
|
||||
} else if (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
|
||||
} else
|
||||
if (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
|
||||
teleportToSpawn();
|
||||
} else if (Settings.isSaveQuitLocationEnabled && auth.getQuitLocY() != 0) {
|
||||
packQuitLocation();
|
||||
|
@ -51,8 +51,10 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
if (Settings.applyBlindEffect)
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
player.setOp(false);
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
if (!Settings.isMovementAllowed) {
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
}
|
||||
// Player is now logout... Time to fire event !
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class AsyncronousQuit {
|
||||
|
||||
public void process() {
|
||||
final Player player = p;
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AsyncronousRegister {
|
||||
@ -64,9 +65,7 @@ public class AsyncronousRegister {
|
||||
|
||||
else if (database.isAuthAvailable(name)) {
|
||||
m.send(player, "user_regged");
|
||||
if (plugin.pllog.getStringList("players").contains(name)) {
|
||||
plugin.pllog.getStringList("players").remove(name);
|
||||
}
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||
import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.events.RegisterTeleportEvent;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
@ -71,7 +72,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
try {
|
||||
plugin.pllog.removePlayer(name);
|
||||
PlayersLogs.getInstance().save();
|
||||
if (player.isInsideVehicle())
|
||||
player.getVehicle().eject();
|
||||
} catch (NullPointerException npe) {
|
||||
|
@ -2,8 +2,14 @@ package fr.xephi.authme.settings;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
@ -11,19 +17,27 @@ import java.util.List;
|
||||
public class PlayersLogs extends CustomConfiguration {
|
||||
|
||||
private static PlayersLogs pllog = null;
|
||||
public List<String> players;
|
||||
|
||||
public PlayersLogs() {
|
||||
super(new File("." + File.separator + "plugins" + File.separator + "AuthMe" + File.separator + "players.yml"));
|
||||
pllog = this;
|
||||
load();
|
||||
save();
|
||||
players = this.getStringList("players");
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
set("players", new ArrayList<String>());
|
||||
save();
|
||||
public void loadPlayers() {
|
||||
DataSource database = AuthMe.getInstance().database;
|
||||
List<String> list = this.getStringList("players");
|
||||
if (list == null || list.isEmpty())
|
||||
return;
|
||||
for (String s : list) {
|
||||
PlayerAuth auth = database.getAuth(s);
|
||||
if (auth == null)
|
||||
continue;
|
||||
auth.setLastLogin(new Date().getTime());
|
||||
database.updateSession(auth);
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayersLogs getInstance() {
|
||||
@ -33,21 +47,18 @@ public class PlayersLogs extends CustomConfiguration {
|
||||
return pllog;
|
||||
}
|
||||
|
||||
public void addPlayer(String user) {
|
||||
players = this.getStringList("players");
|
||||
if (!players.contains(user.toLowerCase())) {
|
||||
players.add(user.toLowerCase());
|
||||
set("players", players);
|
||||
save();
|
||||
public void savePlayerLogs() {
|
||||
List<String> players = new ArrayList<String>();
|
||||
for (String s : PlayerCache.getInstance().getCache().keySet()) {
|
||||
players.add(s);
|
||||
}
|
||||
this.set("players", players);
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void removePlayer(String user) {
|
||||
players = this.getStringList("players");
|
||||
if (players.contains(user.toLowerCase())) {
|
||||
players.remove(user.toLowerCase());
|
||||
set("players", players);
|
||||
save();
|
||||
}
|
||||
public void clear() {
|
||||
this.set("players", new ArrayList<String>());
|
||||
this.save();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public final class Settings extends YamlConfiguration {
|
||||
purgePermissions, enableProtection, enableAntiBot, recallEmail,
|
||||
useWelcomeMessage, broadcastWelcomeMessage, forceRegKick,
|
||||
forceRegLogin, checkVeryGames, delayJoinMessage, noTeleport,
|
||||
applyBlindEffect, customAttributes;
|
||||
applyBlindEffect, customAttributes, generateImage;
|
||||
|
||||
public static String getNickRegex, getUnloggedinGroup, getMySQLHost,
|
||||
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
|
||||
@ -269,6 +269,7 @@ public final class Settings extends YamlConfiguration {
|
||||
forceRegisterCommands = (List<String>) configFile.getList("settings.forceRegisterCommands", new ArrayList<String>());
|
||||
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
||||
generateImage = configFile.getBoolean("Email.generateImage", true);
|
||||
|
||||
// Load the welcome message
|
||||
getWelcomeMessage(plugin);
|
||||
@ -435,6 +436,7 @@ public final class Settings extends YamlConfiguration {
|
||||
forceRegisterCommands = (List<String>) configFile.getList("settings.forceRegisterCommands", new ArrayList<String>());
|
||||
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>());
|
||||
customAttributes = configFile.getBoolean("Hooks.customAttributes");
|
||||
generateImage = configFile.getBoolean("Email.generateImage", true);
|
||||
|
||||
// Reload the welcome message
|
||||
getWelcomeMessage(AuthMe.getInstance());
|
||||
@ -587,6 +589,10 @@ public final class Settings extends YamlConfiguration {
|
||||
}
|
||||
if (contains("Hooks.notifications"))
|
||||
set("Hooks.notifications", null);
|
||||
if (!contains("Email.generateImage")) {
|
||||
set("Email.generateImage", true);
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
plugin.getLogger().warning("Merge new Config Options - I'm not an error, please don't report me");
|
||||
|
@ -1,57 +1,59 @@
|
||||
unknown_user: '使用者名稱不在資料庫內'
|
||||
unsafe_spawn: '退出的位置是不安全的,你被傳送到重生點'
|
||||
not_logged_in: '&c您還未登入!'
|
||||
reg_voluntarily: '您可以在本伺服器創一個屬於您的密碼 ,指令:"/register <密碼> 確認密碼"'
|
||||
usage_log: '&c正確用法為:使用"/login <密碼>"來登入'
|
||||
wrong_pwd: '&c密碼錯誤!'
|
||||
unregistered: '&a此密碼尚未被註冊!'
|
||||
reg_disabled: '&c註冊被禁用'
|
||||
unknown_user: "&b【AuthMe】&6沒有在資料庫內找到該玩家。"
|
||||
unsafe_spawn: '&b【AuthMe】&6你登出的地點不安全,已傳送你到安全的地點。'
|
||||
not_logged_in: '&b【AuthMe】&6你還沒有登入!'
|
||||
reg_voluntarily: '&b【AuthMe】&6使用 &c"/register <密碼> <確認密碼>" &6來註冊你的暱稱'
|
||||
usage_log: '&b【AuthMe】&6用法: &c"/login <密碼>"'
|
||||
wrong_pwd: '&b【AuthMe】&6密碼錯誤!'
|
||||
unregistered: '&b【AuthMe】&6你還沒有註冊!'
|
||||
reg_disabled: '&b【AuthMe】&6已關閉註冊功能'
|
||||
password_error_nick: '&fYou can''t use your name as password'
|
||||
password_error_unsafe: '&fYou can''t use unsafe passwords'
|
||||
valid_session: '&c"會議"登入'
|
||||
login: '&a登入成功!'
|
||||
vb_nonActiv: '你的帳號沒有被繳活,請查看你的電子信箱!'
|
||||
user_regged: '&c此密碼已被註冊,請重新註冊您的新密碼!'
|
||||
usage_reg: '&c正確用法為:使用"/register <密碼> <確認密碼>"來註冊你的密碼'
|
||||
max_reg: '你的密碼註冊數量已滿,無法繼續註冊!'
|
||||
no_perm: '&c你沒有權限!'
|
||||
error: '發生未知錯誤,請通知管理員!'
|
||||
login_msg: '&c請使用"/login <密碼>"來登入'
|
||||
reg_msg: '&c初次登入請使用"/register <密碼> <確認密碼>"來註冊!'
|
||||
usage_unreg: '&c正確用法為:使用"/unregister <密碼>"來取消現有密碼'
|
||||
pwd_changed: '&c密碼變更成功!'
|
||||
user_unknown: '&c此用戶名並未被註冊!'
|
||||
password_error: <密碼>與<錯認密碼>不相同!
|
||||
invalid_session: 'Session Dataes doesnt corrispond Plaese wait the end of session'
|
||||
reg_only: 'Registered players only! Please visit http://example.com to register'
|
||||
logged_in: '&c您已經登入了!'
|
||||
logout: '&a登出成功!'
|
||||
same_nick: '與別人的密碼重複!'
|
||||
registered: '&a註冊成功!'
|
||||
pass_len: '您的密碼未到達最小長度(4),或超過最大長度(20)'
|
||||
reload: '伺服器已重新配置數據庫'
|
||||
timeout: '登入超時了!'
|
||||
usage_changepassword: '正確用法為:使用"/changepassword <舊密碼> <新密碼>"來更換密碼'
|
||||
name_len: '&cYour nickname is too Short or too long'
|
||||
regex: '&cYour nickname contains illegal characters. Allowed chars: REG_EX'
|
||||
add_email: '&cPlease add your email with : /email add yourEmail confirmEmail'
|
||||
bad_database_email: '[AuthMe] This /email command only available with MySQL and SQLite, contact an Admin'
|
||||
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
|
||||
usage_captcha: '&cYou need to type a captcha, please type: /captcha <theCaptcha>'
|
||||
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
|
||||
valid_captcha: '&cYour captcha is valid !'
|
||||
kick_forvip: '&cA VIP Player join the full server!'
|
||||
kick_fullserver: '&cThe server is actually full, Sorry!'
|
||||
usage_email_add: '&fUsage: /email add <email> <confirmeEmail> '
|
||||
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'
|
||||
valid_session: '&b【AuthMe】&6憑證登入'
|
||||
login: '&b【AuthMe】&6密碼正確,你已成功登入!'
|
||||
vb_nonActiv: '&b【AuthMe】&6你的帳號還沒有經過驗證! 檢查看看你的電子信箱 (Email) 吧!'
|
||||
user_regged: '&b【AuthMe】&6這個帳號已經被註冊過了!'
|
||||
usage_reg: '&b【AuthMe】&6用法: &c"/register <密碼> <確認密碼>"'
|
||||
max_reg: '&b【AuthMe】&6你註冊的帳號數量已達到最大。'
|
||||
no_perm: '&b【AuthMe】&6你沒有使用該指令的權限。'
|
||||
error: '&b【AuthMe】&6發生錯誤,請聯繫管理員'
|
||||
login_msg: '&b【AuthMe】&6請使用 &c"/login <密碼>" &6來登入。'
|
||||
reg_msg: '&b【AuthMe】&6請使用 "&c/register <密碼> <確認密碼>" 來註冊。'
|
||||
reg_email_msg: '&b【AuthMe】&6請使用 &c"/register <email> <重複Email>" 來註冊'
|
||||
usage_unreg: '&b【AuthMe】&6用法: &c"/unregister <密碼>"'
|
||||
pwd_changed: '&b【AuthMe】&6密碼變更成功!'
|
||||
user_unknown: '&b【AuthMe】&6這個帳號還沒有註冊過'
|
||||
password_error: '&b【AuthMe】&6兩次輸入的密碼不一致!'
|
||||
invalid_session: '&b【AuthMe】&6憑證日期不相符!'
|
||||
reg_only: '&b【AuthMe】&6請訪問 http://example.com 進行註冊'
|
||||
logged_in: '&b【AuthMe】&6你已經登入了!'
|
||||
logout: '&b【AuthMe】&6你已成功登出'
|
||||
same_nick: '&b【AuthMe】&6有同樣帳號的玩家在線上!'
|
||||
registered: '&b【AuthMe】&6你已成功註冊'
|
||||
pass_len: '&b【AuthMe】&6你的密碼 超過最大字數 / 小於最小字數'
|
||||
reload: '&b【AuthMe】&6已重新讀取設定檔及資料庫'
|
||||
timeout: '&b【AuthMe】&6超過登入時間,請再試一次'
|
||||
usage_changepassword: '&b【AuthMe】&6用法: &c"/changepassword <舊密碼> <新密碼>"'
|
||||
name_len: '&b【AuthMe】&6你的暱稱 太長 / 太短 了!'
|
||||
regex: '&b【AuthMe】&6暱稱裡包含不能使用的字符'
|
||||
add_email: '&b【AuthMe】&6請使用 &c"/email add <你的Email> <再次輸入你的Email>" &6來增加Email'
|
||||
bad_database_email: '&b【AuthMe】&6這個 &c"/email" &6指令只適用於有使用MySQL和SQLite的時候,請聯繫管理員'
|
||||
recovery_email: '&b【AuthMe】&6忘記密碼了嗎? 使用 &c"/email recovery <你的Email>"'
|
||||
usage_captcha: '&b【AuthMe】&6請用 &c"/captcha <theCaptcha>" &6來輸入你的驗證碼'
|
||||
wrong_captcha: '&b【AuthMe】&6錯誤的驗證碼'
|
||||
valid_captcha: '&b【AuthMe】&6驗證碼無效!'
|
||||
kick_forvip: '&&b【AuthMe】&6VIP玩家只能在伺服器滿人時登入伺服器!'
|
||||
kick_fullserver: '&b【AuthMe】&6伺服器已經滿了,請等等再試一次'
|
||||
usage_email_add: '&b【AuthMe】&6用法: &c"/email add <你的Email> <重複輸入你的Email>"'
|
||||
usage_email_change: '&b【AuthMe】&6用法: &c"/email change <現在的Email> <要替換的Email>"'
|
||||
usage_email_recovery: '&b【AuthMe】&6用法: &c"/email recovery <你的Email>"'
|
||||
new_email_invalid: '&b【AuthMe】&6新的Email無效!'
|
||||
old_email_invalid: '&b【AuthMe】&6舊的Email無效!'
|
||||
email_invalid: '&b【AuthMe】&6無效的Email!'
|
||||
email_added: '&b【AuthMe】&6已添加Email!'
|
||||
email_confirm: '&b【AuthMe】&6驗證你的Email!'
|
||||
email_changed: '&b【AuthMe】&6Email已變更!'
|
||||
email_send: '&b【AuthMe】&6已經送出要求至你的Email!'
|
||||
email_exists: '&b【AuthMe】&6這個帳戶已經有設定電子郵件了'
|
||||
country_banned: '你所在的地區無法進入此伺服器'
|
||||
antibot_auto_enabled: '&b【AuthMe】&6AntiBotMod已自動啟用!'
|
||||
antibot_auto_disabled: '&b【AuthMe】&6AntiBotMod將會於 &c%m &6分鐘後自動關閉'
|
||||
|
Loading…
Reference in New Issue
Block a user