Update 2.7.11b1

This commit is contained in:
Xephi 2013-03-12 17:20:33 +01:00
parent 1caab050b6
commit 0dd048774e
8 changed files with 103 additions and 67 deletions

View File

@ -28,7 +28,7 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<version>2.7.10-SNAPSHOT</version> <version>2.7.11b1</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>

View File

@ -41,7 +41,7 @@ import uk.org.whoami.authme.cache.auth.PlayerCache;
import uk.org.whoami.authme.cache.limbo.LimboCache; import uk.org.whoami.authme.cache.limbo.LimboCache;
import uk.org.whoami.authme.cache.limbo.LimboPlayer; import uk.org.whoami.authme.cache.limbo.LimboPlayer;
import uk.org.whoami.authme.datasource.DataSource; import uk.org.whoami.authme.datasource.DataSource;
import uk.org.whoami.authme.events.AuthMeTeleportEvent; import uk.org.whoami.authme.events.RegisterTeleportEvent;
import uk.org.whoami.authme.security.PasswordSecurity; import uk.org.whoami.authme.security.PasswordSecurity;
import uk.org.whoami.authme.security.RandomString; import uk.org.whoami.authme.security.RandomString;
import uk.org.whoami.authme.settings.Messages; import uk.org.whoami.authme.settings.Messages;
@ -195,6 +195,29 @@ public class RegisterCommand implements CommandExecutor {
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg.getTaskId()); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg.getTaskId());
LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().deleteLimboPlayer(name);
if (Settings.isTeleportToSpawnEnabled) {
World world = player.getWorld();
Location loca = world.getSpawnLocation();
if (plugin.mv != null) {
try {
loca = plugin.mv.getMVWorldManager().getMVWorld(world).getSpawnLocation();
} catch (NullPointerException npe) {
} catch (ClassCastException cce) {
} catch (NoClassDefFoundError ncdfe) {
}
}
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
plugin.getServer().getPluginManager().callEvent(tpEvent);
if(!tpEvent.isCancelled()) {
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {
tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load();
}
player.teleport(tpEvent.getTo());
}
}
this.isFirstTimeJoin = true; this.isFirstTimeJoin = true;
player.saveData(); player.saveData();
if (!Settings.noConsoleSpam) if (!Settings.noConsoleSpam)
@ -260,7 +283,7 @@ public class RegisterCommand implements CommandExecutor {
} }
} }
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, loca); RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
plugin.getServer().getPluginManager().callEvent(tpEvent); plugin.getServer().getPluginManager().callEvent(tpEvent);
if(!tpEvent.isCancelled()) { if(!tpEvent.isCancelled()) {
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) { if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {

View File

@ -0,0 +1,29 @@
package uk.org.whoami.authme.events;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class RegisterTeleportEvent extends CustomEvent {
private Player player;
private Location to;
private Location from;
public RegisterTeleportEvent(Player player, Location to) {
this.player = player;
this.from = player.getLocation();
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;
}
}

View File

@ -98,7 +98,7 @@ public class AuthMePlayerListener implements Listener {
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player) ) { if (Utils.getInstance().isUnrestricted(player)) {
return; return;
} }
@ -700,7 +700,7 @@ public class AuthMePlayerListener implements Listener {
if((cur - lastLogin < timeout || timeout == 0) && !auth.getIp().equals("198.18.0.1") ) { if((cur - lastLogin < timeout || timeout == 0) && !auth.getIp().equals("198.18.0.1") ) {
if (auth.getNickname().equalsIgnoreCase(name) && auth.getIp().equals(ip) ) { if (auth.getNickname().equalsIgnoreCase(name) && auth.getIp().equals(ip) ) {
Bukkit.getServer().getPluginManager().callEvent(new SessionEvent(auth, true)); plugin.getServer().getPluginManager().callEvent(new SessionEvent(auth, true));
if(PlayerCache.getInstance().getAuth(name) != null) { if(PlayerCache.getInstance().getAuth(name) != null) {
PlayerCache.getInstance().updatePlayer(auth); PlayerCache.getInstance().updatePlayer(auth);
} else { } else {
@ -709,10 +709,15 @@ public class AuthMePlayerListener implements Listener {
player.sendMessage(m._("valid_session")); player.sendMessage(m._("valid_session"));
return; return;
} else { } else {
int gM = gameMode.get(name); if(Settings.sessionExpireOnIpChange && !player.isOnline()) {
player.setGameMode(GameMode.getByValue(gM)); PlayerCache.getInstance().removePlayer(name);
player.kickPlayer(m._("unvalid_session")); LimboCache.getInstance().addLimboPlayer(player , utils.removeAll(player));
return; } else {
int gM = gameMode.get(name);
player.setGameMode(GameMode.getByValue(gM));
player.kickPlayer(m._("unvalid_session"));
return;
}
} }
} else { } else {
@ -741,7 +746,7 @@ public class AuthMePlayerListener implements Listener {
try { try {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour(), 36, 4); ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour(), 36, 4);
Bukkit.getServer().getPluginManager().callEvent(ev); plugin.getServer().getPluginManager().callEvent(ev);
if (ev.isCancelled()) { if (ev.isCancelled()) {
if (!Settings.noConsoleSpam) if (!Settings.noConsoleSpam)
ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ...");
@ -820,7 +825,7 @@ public class AuthMePlayerListener implements Listener {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
if(Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { if(Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) {
RestoreInventoryEvent ev = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); RestoreInventoryEvent ev = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
Bukkit.getServer().getPluginManager().callEvent(ev); plugin.getServer().getPluginManager().callEvent(ev);
if (!ev.isCancelled()) { if (!ev.isCancelled()) {
API.setPlayerInventory(player, limbo.getInventory(), limbo.getArmour()); API.setPlayerInventory(player, limbo.getInventory(), limbo.getArmour());
} }
@ -847,6 +852,7 @@ public class AuthMePlayerListener implements Listener {
} }
if (gameMode.containsKey(name)) gameMode.remove(name); if (gameMode.containsKey(name)) gameMode.remove(name);
player.saveData(); player.saveData();
} }
@EventHandler(priority=EventPriority.MONITOR) @EventHandler(priority=EventPriority.MONITOR)
@ -883,7 +889,7 @@ public class AuthMePlayerListener implements Listener {
if (Settings.protectInventoryBeforeLogInEnabled.booleanValue()) { if (Settings.protectInventoryBeforeLogInEnabled.booleanValue()) {
try { try {
RestoreInventoryEvent ev = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); RestoreInventoryEvent ev = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
Bukkit.getServer().getPluginManager().callEvent(ev); plugin.getServer().getPluginManager().callEvent(ev);
if (!ev.isCancelled()) { if (!ev.isCancelled()) {
API.setPlayerInventory(player, ev.getInventory(), ev.getArmor()); API.setPlayerInventory(player, ev.getInventory(), ev.getArmor());
} }

View File

@ -41,16 +41,11 @@ public class PhpBB {
return md5(password); return md5(password);
} }
private String unique_id() {
return unique_id("c");
}
// global $config; // global $config;
// private boolean dss_seeded = false; // private boolean dss_seeded = false;
private String unique_id(String extra) { private String unique_id() {
// TODO Generate something random here. return new RandomString(16).nextString();
return "1234567890abcdef";
} }

View File

@ -60,7 +60,7 @@ public final class Settings extends YamlConfiguration {
isForceSurvivalModeEnabled, isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled, isForceSurvivalModeEnabled, isResetInventoryIfCreative, isCachingEnabled, isKickOnWrongPasswordEnabled,
getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, isBackupOnStart, getEnablePasswordVerifier, protectInventoryBeforeLogInEnabled, isBackupActivated, isBackupOnStart,
isBackupOnStop, enablePasspartu, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, isBackupOnStop, enablePasspartu, isStopEnabled, reloadSupport, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts,
useCaptcha, emailRegistration, multiverse, notifications, chestshop, bungee, banUnsafeIp, doubleEmailCheck; useCaptcha, emailRegistration, multiverse, notifications, chestshop, bungee, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange;
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort, public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort,
@ -219,6 +219,7 @@ public void loadConfigOptions() {
getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds"); getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds");
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false); doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
saveDefaults(); saveDefaults();
} }
@ -338,19 +339,18 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds"); getForcedWorlds = (List<String>) configFile.getList("settings.restrictions.ForceSpawnOnTheseWorlds");
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false); doubleEmailCheck = configFile.getBoolean("settings.registration.doubleEmailCheck", false);
sessionExpireOnIpChange = configFile.getBoolean("settings.sessions.sessionExpireOnIpChange", false);
} }
public void mergeConfig() { public void mergeConfig() {
if (contains("settings.restrictions.allowedPluginTeleportHandler")) { if (contains("settings.restrictions.allowedPluginTeleportHandler"))
set("settings.restrictions.allowedPluginTeleportHandler", null); set("settings.restrictions.allowedPluginTeleportHandler", null);
}
if(!contains("DataSource.mySQLColumnEmail")) { if(!contains("DataSource.mySQLColumnEmail"))
set("DataSource.mySQLColumnEmail","email"); set("DataSource.mySQLColumnEmail","email");
}
if(contains("Email.GmailAccount")) { if(contains("Email.GmailAccount")) {
set("Email.mailAccount", getString("Email.GmailAccount")); set("Email.mailAccount", getString("Email.GmailAccount"));
@ -362,77 +362,59 @@ public void mergeConfig() {
set("Email.GmailPassword", null); set("Email.GmailPassword", null);
} }
if(!contains("Email.RecoveryPasswordLength")) { if(!contains("Email.RecoveryPasswordLength"))
set("Email.RecoveryPasswordLength", 8); set("Email.RecoveryPasswordLength", 8);
}
if(!contains("Email.mailPort")) { if(!contains("Email.mailPort"))
set("Email.mailPort", 465); set("Email.mailPort", 465);
}
if(!contains("Email.mailSMTP")) { if(!contains("Email.mailSMTP"))
set("Email.mailSMTP", "smtp.gmail.com"); set("Email.mailSMTP", "smtp.gmail.com");
}
if(!contains("Email.mailAccount")) { if(!contains("Email.mailAccount"))
set("Email.mailAccount", ""); set("Email.mailAccount", "");
}
if(!contains("Email.mailPassword")) { if(!contains("Email.mailPassword"))
set("Email.mailPassword", ""); set("Email.mailPassword", "");
}
if(!contains("ExternalBoardOptions.mySQLOtherUsernameColumns")) { if(!contains("ExternalBoardOptions.mySQLOtherUsernameColumns"))
set("ExternalBoardOptions.mySQLOtherUsernameColumns", new ArrayList<String>()); set("ExternalBoardOptions.mySQLOtherUsernameColumns", new ArrayList<String>());
}
if(!contains("settings.restrictions.displayOtherAccounts")) { if(!contains("settings.restrictions.displayOtherAccounts"))
set("settings.restrictions.displayOtherAccounts", true); set("settings.restrictions.displayOtherAccounts", true);
}
if(!contains("DataSource.mySQLColumnId")) { if(!contains("DataSource.mySQLColumnId"))
set("DataSource.mySQLColumnId", "id"); set("DataSource.mySQLColumnId", "id");
}
if(!contains("Email.mailSenderName")) { if(!contains("Email.mailSenderName"))
set("Email.mailSenderName", ""); set("Email.mailSenderName", "");
}
if(!contains("Xenoforo.predefinedSalt")) { if(!contains("Xenoforo.predefinedSalt"))
set("Xenoforo.predefinedSalt", ""); set("Xenoforo.predefinedSalt", "");
}
if(!contains("Security.captcha.useCaptcha")) { if(!contains("Security.captcha.useCaptcha"))
set("Security.captcha.useCaptcha", false); set("Security.captcha.useCaptcha", false);
}
if(!contains("Security.captcha.maxLoginTry")) { if(!contains("Security.captcha.maxLoginTry"))
set("Security.captcha.maxLoginTry", 5); set("Security.captcha.maxLoginTry", 5);
}
if(!contains("Security.captcha.captchaLength")) { if(!contains("Security.captcha.captchaLength"))
set("Security.captcha.captchaLength", 5); set("Security.captcha.captchaLength", 5);
}
if(!contains("Email.mailSubject")) { if(!contains("Email.mailSubject"))
set("Email.mailSubject", ""); set("Email.mailSubject", "");
}
if(!contains("Email.mailText")) { if(!contains("Email.mailText"))
set("Email.mailText", "Dear <playername>, \n\n This is your new AuthMe password for the server : \n\n <servername> \n\n <generatedpass>\n\n Do not forget to change password after login! \n /changepassword <generatedpass> newPassword"); set("Email.mailText", "Dear <playername>, \n\n This is your new AuthMe password for the server : \n\n <servername> \n\n <generatedpass>\n\n Do not forget to change password after login! \n /changepassword <generatedpass> newPassword");
}
if(!contains("settings.registration.enableEmailRegistrationSystem")) { if(!contains("settings.registration.enableEmailRegistrationSystem"))
set("settings.registration.enableEmailRegistrationSystem", false); set("settings.registration.enableEmailRegistrationSystem", false);
}
if(!contains("settings.security.doubleMD5SaltLength")) { if(!contains("settings.security.doubleMD5SaltLength"))
set("settings.security.doubleMD5SaltLength", 8); set("settings.security.doubleMD5SaltLength", 8);
}
if(!contains("Email.maxRegPerEmail")) { if(!contains("Email.maxRegPerEmail"))
set("Email.maxRegPerEmail", 1); set("Email.maxRegPerEmail", 1);
}
if(!contains("Hooks.multiverse")) { if(!contains("Hooks.multiverse")) {
set("Hooks.multiverse", true); set("Hooks.multiverse", true);
@ -441,17 +423,17 @@ public void mergeConfig() {
set("Hooks.bungeecord", false); set("Hooks.bungeecord", false);
} }
if(!contains("settings.restrictions.ForceSpawnOnTheseWorlds")) { if(!contains("settings.restrictions.ForceSpawnOnTheseWorlds"))
set("settings.restrictions.ForceSpawnOnTheseWorlds", new ArrayList<String>()); set("settings.restrictions.ForceSpawnOnTheseWorlds", new ArrayList<String>());
}
if(!contains("settings.restrictions.banUnsafedIP")) { if(!contains("settings.restrictions.banUnsafedIP"))
set("settings.restrictions.banUnsafedIP", false); set("settings.restrictions.banUnsafedIP", false);
}
if(!contains("settings.registration.doubleEmailCheck")) { if(!contains("settings.registration.doubleEmailCheck"))
set("settings.registration.doubleEmailCheck", false); set("settings.registration.doubleEmailCheck", false);
}
if(!contains("settings.sessions.sessionExpireOnIpChange"))
set("settings.sessions.sessionExpireOnIpChange", false);
plugin.getLogger().info("Merge new Config Options if needed.."); plugin.getLogger().info("Merge new Config Options if needed..");
plugin.saveConfig(); plugin.saveConfig();

View File

@ -25,6 +25,7 @@ settings:
sessions: sessions:
enabled: false enabled: false
timeout: 10 timeout: 10
sessionExpireOnIpChange: false
restrictions: restrictions:
allowChat: false allowChat: false
allowCommands: allowCommands:

View File

@ -3,7 +3,7 @@ author: darkwarriros,Xephi
website: http://www.multiplayer-italia.com/ website: http://www.multiplayer-italia.com/
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player. description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
main: uk.org.whoami.authme.AuthMe main: uk.org.whoami.authme.AuthMe
version: 2.7.10b2 version: 2.7.11b1
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag] softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag]
commands: commands:
register: register: