This commit is contained in:
Gabriele C 2015-09-15 19:07:34 +02:00
parent cdfdc06312
commit 4fca6108d9
17 changed files with 30 additions and 40 deletions

View File

@ -70,7 +70,7 @@ public class AuthMe extends JavaPlugin {
public Location essentialsSpawn; public Location essentialsSpawn;
public MultiverseCore multiverse; public MultiverseCore multiverse;
public LookupService lookupService; public LookupService lookupService;
public boolean CombatTag = false; public boolean combatTag = false;
public boolean legacyChestShop = false; public boolean legacyChestShop = false;
public boolean antibotMod = false; public boolean antibotMod = false;
public boolean delayedAntiBot = true; public boolean delayedAntiBot = true;
@ -194,7 +194,7 @@ public class AuthMe extends JavaPlugin {
// Do backup on start if enabled // Do backup on start if enabled
if (Settings.isBackupActivated && Settings.isBackupOnStart) { if (Settings.isBackupActivated && Settings.isBackupOnStart) {
// Do backup and check return value! // Do backup and check return value!
if (new PerformBackup(this).DoBackup()) { if (new PerformBackup(this).doBackup()) {
ConsoleLogger.info("Backup performed correctly"); ConsoleLogger.info("Backup performed correctly");
} else { } else {
ConsoleLogger.showError("Error while performing the backup!"); ConsoleLogger.showError("Error while performing the backup!");
@ -313,7 +313,7 @@ public class AuthMe extends JavaPlugin {
// Do backup on stop if enabled // Do backup on stop if enabled
if (Settings.isBackupActivated && Settings.isBackupOnStop) { if (Settings.isBackupActivated && Settings.isBackupOnStop) {
Boolean Backup = new PerformBackup(this).DoBackup(); Boolean Backup = new PerformBackup(this).doBackup();
if (Backup) if (Backup)
ConsoleLogger.info("Backup performed correctly."); ConsoleLogger.info("Backup performed correctly.");
else ConsoleLogger.showError("Error while performing the backup!"); else ConsoleLogger.showError("Error while performing the backup!");
@ -502,7 +502,7 @@ public class AuthMe extends JavaPlugin {
// Check the presence of CombatTag // Check the presence of CombatTag
public void checkCombatTag() { public void checkCombatTag() {
this.CombatTag = server.getPluginManager().isPluginEnabled("CombatTag"); this.combatTag = server.getPluginManager().isPluginEnabled("CombatTag");
} }
// Check if a player/command sender have a permission // Check if a player/command sender have a permission

View File

@ -30,7 +30,7 @@ public class PerformBackup {
this.setInstance(instance); this.setInstance(instance);
} }
public boolean DoBackup() { public boolean doBackup() {
switch (Settings.getDataSource) { switch (Settings.getDataSource) {
case FILE: case FILE:

View File

@ -38,12 +38,12 @@ public class Utils {
} }
} }
public void setGroup(Player player, groupType group) { public void setGroup(Player player, GroupType group) {
setGroup(player.getName(), group); setGroup(player.getName(), group);
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void setGroup(String player, groupType group) { public void setGroup(String player, GroupType group) {
if (!Settings.isPermissionCheckEnabled) if (!Settings.isPermissionCheckEnabled)
return; return;
if (plugin.permission == null) if (plugin.permission == null)
@ -172,7 +172,7 @@ public class Utils {
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
} }
public enum groupType { public enum GroupType {
UNREGISTERED, UNREGISTERED,
REGISTERED, REGISTERED,
NOTLOGGEDIN, NOTLOGGEDIN,

View File

@ -3,7 +3,7 @@ package fr.xephi.authme.commands;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils; import fr.xephi.authme.Utils;
import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.Utils.GroupType;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
@ -464,7 +464,7 @@ public class AdminCommand implements CommandExecutor {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
Player target = Bukkit.getPlayer(name); Player target = Bukkit.getPlayer(name);
PlayerCache.getInstance().removePlayer(name); PlayerCache.getInstance().removePlayer(name);
Utils.getInstance().setGroup(name, groupType.UNREGISTERED); Utils.getInstance().setGroup(name, GroupType.UNREGISTERED);
if (target != null) { if (target != null) {
if (target.isOnline()) { if (target.isOnline()) {
if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) { if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) {

View File

@ -16,7 +16,7 @@ import org.bukkit.scheduler.BukkitTask;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils; import fr.xephi.authme.Utils;
import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.Utils.GroupType;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.backup.JsonCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
@ -82,7 +82,7 @@ public class UnregisterCommand implements CommandExecutor {
player.saveData(); player.saveData();
PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase());
if (!Settings.getRegisteredGroup.isEmpty()) if (!Settings.getRegisteredGroup.isEmpty())
Utils.getInstance().setGroup(player, groupType.UNREGISTERED); Utils.getInstance().setGroup(player, GroupType.UNREGISTERED);
LimboCache.getInstance().addLimboPlayer(player); LimboCache.getInstance().addLimboPlayer(player);
int delay = Settings.getRegistrationTimeout * 20; int delay = Settings.getRegistrationTimeout * 20;
int interval = Settings.getWarnMessageInterval; int interval = Settings.getWarnMessageInterval;
@ -97,7 +97,7 @@ public class UnregisterCommand implements CommandExecutor {
return true; return true;
} }
if (!Settings.unRegisteredGroup.isEmpty()) { if (!Settings.unRegisteredGroup.isEmpty()) {
Utils.getInstance().setGroup(player, Utils.groupType.UNREGISTERED); Utils.getInstance().setGroup(player, Utils.GroupType.UNREGISTERED);
} }
PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase());
// check if Player cache File Exist and delete it, preventing // check if Player cache File Exist and delete it, preventing

View File

@ -2,7 +2,6 @@ package fr.xephi.authme.converter;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
@ -70,10 +69,9 @@ public class CrazyLoginConverter implements Converter {
} }
users.close(); users.close();
ConsoleLogger.info("CrazyLogin database has been imported correctly"); ConsoleLogger.info("CrazyLogin database has been imported correctly");
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
ConsoleLogger.showError("Can't open the crazylogin database file! Does it exist?");
} }
} }

View File

@ -3,7 +3,6 @@ package fr.xephi.authme.converter;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
@ -79,10 +78,9 @@ public class FlatToSql implements Converter {
sql.close(); sql.close();
br.close(); br.close();
ConsoleLogger.info("The FlatFile has been converted to authme.sql file"); ConsoleLogger.info("The FlatFile has been converted to authme.sql file");
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
ConsoleLogger.showError("Can't open the flat database file! Does it exist?");
} }
} }
} }

View File

@ -2,7 +2,6 @@ package fr.xephi.authme.converter;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
@ -90,12 +89,10 @@ public class FlatToSqlite implements Converter {
close(); close();
sender.sendMessage("The FlatFile has been converted to " + database + ".db file"); sender.sendMessage("The FlatFile has been converted to " + database + ".db file");
return; return;
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
sender.sendMessage("Can't open the flat database file! Does it exist?");
} }
sender.sendMessage("Errors appears while trying to convert to SQLite");
return; return;
} }

View File

@ -100,12 +100,9 @@ public class RakamakConverter implements Converter {
} }
ConsoleLogger.info("Rakamak database has been imported correctly"); ConsoleLogger.info("Rakamak database has been imported correctly");
sender.sendMessage("Rakamak database has been imported correctly"); sender.sendMessage("Rakamak database has been imported correctly");
} catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage());
sender.sendMessage("Error file not found");
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
sender.sendMessage("Error IOException"); sender.sendMessage("Can't open the rakamak database file! Does it exist?");
} }
} }
} }

View File

@ -136,7 +136,7 @@ public class AuthMeEntityListener implements Listener {
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void EntityRegainHealthEvent(EntityRegainHealthEvent event) { public void entityRegainHealthEvent(EntityRegainHealthEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (!(entity instanceof Player)) { if (!(entity instanceof Player)) {
return; return;

View File

@ -60,7 +60,7 @@ public class AuthMeServerListener implements Listener {
ConsoleLogger.info("ChestShop has been disabled, unhook!"); ConsoleLogger.info("ChestShop has been disabled, unhook!");
} }
if (pluginName.equalsIgnoreCase("CombatTag")) { if (pluginName.equalsIgnoreCase("CombatTag")) {
plugin.CombatTag = false; plugin.combatTag = false;
ConsoleLogger.info("CombatTag has been disabled, unhook!"); ConsoleLogger.info("CombatTag has been disabled, unhook!");
} }
if (pluginName.equalsIgnoreCase("Vault")) { if (pluginName.equalsIgnoreCase("Vault")) {

View File

@ -22,7 +22,7 @@ public abstract class CombatTagComunicator {
* @return true if the player is an NPC * @return true if the player is an NPC
*/ */
public static boolean isNPC(Entity player) { public static boolean isNPC(Entity player) {
if (!AuthMe.getInstance().CombatTag) if (!AuthMe.getInstance().combatTag)
return false; return false;
try { try {
if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) { if (Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null) {

View File

@ -15,7 +15,7 @@ import org.bukkit.scheduler.BukkitTask;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils; import fr.xephi.authme.Utils;
import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.Utils.GroupType;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.backup.DataFileCache; import fr.xephi.authme.cache.backup.DataFileCache;
@ -151,7 +151,7 @@ public class AsyncronousJoin {
}); });
} }
if (!Settings.unRegisteredGroup.isEmpty()) { if (!Settings.unRegisteredGroup.isEmpty()) {
utils.setGroup(player, Utils.groupType.UNREGISTERED); utils.setGroup(player, Utils.GroupType.UNREGISTERED);
} }
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
return; return;
@ -216,9 +216,9 @@ public class AsyncronousJoin {
if (!LimboCache.getInstance().hasLimboPlayer(name)) if (!LimboCache.getInstance().hasLimboPlayer(name))
LimboCache.getInstance().addLimboPlayer(player); LimboCache.getInstance().addLimboPlayer(player);
if (database.isAuthAvailable(name)) { if (database.isAuthAvailable(name)) {
utils.setGroup(player, groupType.NOTLOGGEDIN); utils.setGroup(player, GroupType.NOTLOGGEDIN);
} else { } else {
utils.setGroup(player, groupType.UNREGISTERED); utils.setGroup(player, GroupType.UNREGISTERED);
} }
sched.scheduleSyncDelayedTask(plugin, new Runnable() { sched.scheduleSyncDelayedTask(plugin, new Runnable() {

View File

@ -9,7 +9,7 @@ import org.bukkit.potion.PotionEffectType;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils; import fr.xephi.authme.Utils;
import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.Utils.GroupType;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.backup.JsonCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
@ -166,7 +166,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
Utils.forceGM(player); Utils.forceGM(player);
// Restore Permission Group // Restore Permission Group
Utils.getInstance().setGroup(player, groupType.LOGGEDIN); Utils.getInstance().setGroup(player, GroupType.LOGGEDIN);
// Cleanup no longer used temporary data // Cleanup no longer used temporary data
LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().deleteLimboPlayer(name);

View File

@ -6,7 +6,7 @@ import org.bukkit.scheduler.BukkitScheduler;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils; import fr.xephi.authme.Utils;
import fr.xephi.authme.Utils.groupType; import fr.xephi.authme.Utils.GroupType;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.backup.DataFileCache; import fr.xephi.authme.cache.backup.DataFileCache;
@ -79,7 +79,7 @@ public class AsyncronousLogout {
if (LimboCache.getInstance().hasLimboPlayer(name)) if (LimboCache.getInstance().hasLimboPlayer(name))
LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().deleteLimboPlayer(name);
LimboCache.getInstance().addLimboPlayer(player); LimboCache.getInstance().addLimboPlayer(player);
utils.setGroup(player, groupType.NOTLOGGEDIN); utils.setGroup(player, GroupType.NOTLOGGEDIN);
if (Settings.protectInventoryBeforeLogInEnabled) { if (Settings.protectInventoryBeforeLogInEnabled) {
player.getInventory().clear(); player.getInventory().clear();
// create cache file for handling lost of inventories on unlogged in // create cache file for handling lost of inventories on unlogged in

View File

@ -31,7 +31,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
public void run() { public void run() {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
if (!Settings.getRegisteredGroup.isEmpty()) { if (!Settings.getRegisteredGroup.isEmpty()) {
Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED);
} }
m.send(player, "vb_nonActiv"); m.send(player, "vb_nonActiv");
int time = Settings.getRegistrationTimeout * 20; int time = Settings.getRegistrationTimeout * 20;

View File

@ -108,7 +108,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
} }
if (!Settings.getRegisteredGroup.isEmpty()) { if (!Settings.getRegisteredGroup.isEmpty()) {
Utils.getInstance().setGroup(player, Utils.groupType.REGISTERED); Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED);
} }
m.send(player, "registered"); m.send(player, "registered");
if (!Settings.getmailAccount.isEmpty()) if (!Settings.getmailAccount.isEmpty())