mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-18 08:15:12 +01:00
#495 - Done
This commit is contained in:
parent
e8a9b5c2e2
commit
4f76398ce8
@ -227,9 +227,7 @@ public class AuthMe extends JavaPlugin {
|
||||
try {
|
||||
setupDatabase();
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
ConsoleLogger.showError("Fatal error occurred during database connection! Authme initialization ABORTED!");
|
||||
ConsoleLogger.writeStackTrace(e.getMessage() + "\nFatal error occurred during database connection! Authme initialization ABORTED!" , e);
|
||||
stopOrUnload();
|
||||
return;
|
||||
}
|
||||
@ -452,9 +450,8 @@ public class AuthMe extends JavaPlugin {
|
||||
settings = new Settings(this);
|
||||
Settings.reload();
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError("Can't load the configuration file... Something went wrong. "
|
||||
+ "To avoid security issues the server will shut down!");
|
||||
ConsoleLogger.writeStackTrace("Can't load the configuration file... Something went wrong. "
|
||||
+ "To avoid security issues the server will shut down!", e);
|
||||
server.shutdown();
|
||||
return true;
|
||||
}
|
||||
@ -516,8 +513,7 @@ public class AuthMe extends JavaPlugin {
|
||||
ConsoleLogger.info("Metrics started successfully!");
|
||||
} catch (Exception e) {
|
||||
// Failed to submit the metrics data
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError("Can't start Metrics! The plugin will work anyway...");
|
||||
ConsoleLogger.writeStackTrace("Can't start Metrics! The plugin will work anyway...", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,10 +74,11 @@ public final class ConsoleLogger {
|
||||
*
|
||||
* @param ex Exception
|
||||
*/
|
||||
public static void writeStackTrace(Exception ex) {
|
||||
public static void writeStackTrace(String message , Throwable ex) {
|
||||
if (!Settings.useLogging) {
|
||||
return;
|
||||
}
|
||||
writeLog(message);
|
||||
writeLog(Throwables.getStackTraceAsString(ex));
|
||||
}
|
||||
}
|
||||
|
@ -26,8 +26,7 @@ public class ReloadCommand implements ExecutableCommand {
|
||||
plugin.setupDatabase();
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage("Error occurred during reload of AuthMe: aborting");
|
||||
ConsoleLogger.showError("Fatal error occurred! AuthMe instance ABORTED!");
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace("Fatal error occurred! AuthMe instance ABORTED!", e);
|
||||
plugin.stopOrUnload();
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,7 @@ public class RoyalAuthConverter implements Converter {
|
||||
PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com", o.getName());
|
||||
data.saveAuth(auth);
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError("Error while trying to import " + o.getName() + " RoyalAuth datas");
|
||||
ConsoleLogger.writeStackTrace("Error while trying to import " + o.getName() + " RoyalAuth datas", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class vAuthFileReader {
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace("Error while trying to import some vAuth datas", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class CacheDataSource implements DataSource {
|
||||
exec.shutdown();
|
||||
exec.awaitTermination(8, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace("Error while closing CacheDataSource.", e);
|
||||
}
|
||||
source.close();
|
||||
}
|
||||
|
@ -257,8 +257,7 @@ public class MySQL implements DataSource {
|
||||
ResultSet rs = pst.executeQuery();
|
||||
return rs.next();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -276,8 +275,7 @@ public class MySQL implements DataSource {
|
||||
!columnSalt.isEmpty() ? rs.getString(columnSalt) : null);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -322,8 +320,7 @@ public class MySQL implements DataSource {
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
return null;
|
||||
}
|
||||
return pAuth;
|
||||
@ -525,8 +522,7 @@ public class MySQL implements DataSource {
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -589,8 +585,7 @@ public class MySQL implements DataSource {
|
||||
}
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -623,8 +618,7 @@ public class MySQL implements DataSource {
|
||||
pst.setLong(1, until);
|
||||
result = pst.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -647,8 +641,7 @@ public class MySQL implements DataSource {
|
||||
st.executeUpdate();
|
||||
st.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -680,8 +673,7 @@ public class MySQL implements DataSource {
|
||||
pst.executeUpdate();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -702,8 +694,7 @@ public class MySQL implements DataSource {
|
||||
pst.close();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -722,8 +713,7 @@ public class MySQL implements DataSource {
|
||||
rs.close();
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return countIp;
|
||||
}
|
||||
@ -739,8 +729,7 @@ public class MySQL implements DataSource {
|
||||
pst.close();
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -750,9 +739,8 @@ public class MySQL implements DataSource {
|
||||
try {
|
||||
reloadArguments();
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
ConsoleLogger.showError("Can't reconnect to MySQL database... Please check your MySQL configuration!");
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
AuthMe.getInstance().stopOrUnload();
|
||||
}
|
||||
}
|
||||
@ -778,8 +766,7 @@ public class MySQL implements DataSource {
|
||||
rs.close();
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -798,8 +785,7 @@ public class MySQL implements DataSource {
|
||||
rs.close();
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -818,8 +804,7 @@ public class MySQL implements DataSource {
|
||||
rs.close();
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return countEmail;
|
||||
}
|
||||
@ -834,8 +819,7 @@ public class MySQL implements DataSource {
|
||||
}
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -854,8 +838,7 @@ public class MySQL implements DataSource {
|
||||
ResultSet rs = pst.executeQuery();
|
||||
isLogged = rs.next() && (rs.getInt(columnLogged) == 1);
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return isLogged;
|
||||
}
|
||||
@ -870,8 +853,7 @@ public class MySQL implements DataSource {
|
||||
pst.executeUpdate();
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -885,8 +867,7 @@ public class MySQL implements DataSource {
|
||||
pst.executeUpdate();
|
||||
pst.close();
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -900,8 +881,7 @@ public class MySQL implements DataSource {
|
||||
pst.executeUpdate();
|
||||
pst.close();
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -917,8 +897,7 @@ public class MySQL implements DataSource {
|
||||
rs.close();
|
||||
st.close();
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -932,8 +911,7 @@ public class MySQL implements DataSource {
|
||||
pst.setString(2, oldOne);
|
||||
pst.executeUpdate();
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -978,8 +956,7 @@ public class MySQL implements DataSource {
|
||||
rs.close();
|
||||
st.close();
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return auths;
|
||||
}
|
||||
@ -1022,8 +999,7 @@ public class MySQL implements DataSource {
|
||||
auths.add(pAuth);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
}
|
||||
return auths;
|
||||
}
|
||||
|
@ -170,8 +170,7 @@ public class SQLite implements DataSource {
|
||||
!columnSalt.isEmpty() ? rs.getString(columnSalt) : null);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.writeStackTrace(ex.getMessage(), ex);
|
||||
} finally {
|
||||
close(rs);
|
||||
close(pst);
|
||||
|
@ -135,8 +135,7 @@ public class ModuleManager {
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
ConsoleLogger.writeStackTrace(ex);
|
||||
ConsoleLogger.showError("Cannot load " + pathToJar.getName() + " jar file !");
|
||||
ConsoleLogger.writeStackTrace("Cannot load " + pathToJar.getName() + " jar file !", ex);
|
||||
} finally {
|
||||
try {
|
||||
if (jarFile != null) {
|
||||
|
@ -49,6 +49,13 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
|
||||
}
|
||||
|
||||
protected void restoreSpeedEffect() {
|
||||
if (Settings.isRemoveSpeedEnabled) {
|
||||
player.setWalkSpeed(0.0F);
|
||||
player.setFlySpeed(0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method run.
|
||||
*
|
||||
@ -77,6 +84,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
if (Settings.applyBlindEffect)
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
player.setOp(false);
|
||||
restoreSpeedEffect();
|
||||
// Player is now logout... Time to fire event !
|
||||
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));
|
||||
if (Settings.bungee)
|
||||
|
@ -81,8 +81,7 @@ public class AsyncRegister {
|
||||
passwordRegister();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError(e.getMessage());
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace(e.getMessage(), e);
|
||||
m.send(player, MessageKey.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,7 @@ public abstract class CustomConfiguration extends YamlConfiguration {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.showError("Failed to load config from JAR");
|
||||
ConsoleLogger.writeStackTrace("Failed to load config from JAR", e);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -313,8 +313,7 @@ public final class Settings {
|
||||
try {
|
||||
return Files.toString(EMAIL_FILE, Charsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.showError("Error loading email text: " + StringUtils.formatException(e));
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace("Error loading email text: " + StringUtils.formatException(e), e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -129,8 +129,7 @@ public class NewSetting {
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.showError("Could not save config file - " + StringUtils.formatException(e));
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace("Could not save config file - " + StringUtils.formatException(e), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class GeoLiteAPI {
|
||||
plugin.getLogger().info(LICENSE);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
// TODO ljacqu 20151123: Log the exception instead of just swallowing it
|
||||
ConsoleLogger.writeStackTrace("Could not find/download GeoLiteAPI", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class GeoLiteAPI {
|
||||
output.close();
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
ConsoleLogger.writeStackTrace("Could not download GeoLiteAPI", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user