Update 2.7.13

This commit is contained in:
Xephi 2013-04-02 03:20:16 +02:00
parent c18131408d
commit 5dcfd31cc6
15 changed files with 219 additions and 35 deletions

View File

@ -28,7 +28,7 @@
</plugin>
</plugins>
</build>
<version>2.7.12b3</version>
<version>2.7.13</version>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>

View File

@ -31,6 +31,7 @@ import uk.org.whoami.authme.security.RandomString;
import uk.org.whoami.authme.settings.Messages;
import uk.org.whoami.authme.settings.PlayersLogs;
import uk.org.whoami.authme.settings.Settings;
import uk.org.whoami.authme.settings.Spawn;
public class Management {
@ -78,6 +79,8 @@ public class Management {
} catch (NoClassDefFoundError ncdfe) {
}
}
if (Spawn.getInstance().getLocation() != null)
spawnLoc = Spawn.getInstance().getLocation();
if (PlayerCache.getInstance().isAuthenticated(name)) {
return m._("logged_in");
@ -140,9 +143,9 @@ public class Management {
this.utils.addNormal(player, limbo.getGroup());
if ((Settings.isTeleportToSpawnEnabled.booleanValue()) && (!Settings.isForceSpawnLocOnJoinEnabled.booleanValue() && Settings.getForcedWorlds.contains(player.getWorld().getName())))
if ((Settings.isTeleportToSpawnEnabled) && (!Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())))
{
if ((Settings.isSaveQuitLocationEnabled.booleanValue()) && (this.database.getAuth(name).getQuitLocY() != 0))
if ((Settings.isSaveQuitLocationEnabled) && (this.database.getAuth(name).getQuitLocY() != 0))
{
this.utils.packCoords(this.database.getAuth(name).getQuitLocX(), this.database.getAuth(name).getQuitLocY(), this.database.getAuth(name).getQuitLocZ(), player);
}
@ -160,7 +163,7 @@ public class Management {
}
}
else if (Settings.isForceSpawnLocOnJoinEnabled.booleanValue() && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
else if (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, true);
pm.callEvent(tpEvent);
if(!tpEvent.isCancelled()) {
@ -170,7 +173,7 @@ public class Management {
player.teleport(tpEvent.getTo());
}
}
else if ((Settings.isSaveQuitLocationEnabled.booleanValue()) && (this.database.getAuth(name).getQuitLocY() != 0))
else if ((Settings.isSaveQuitLocationEnabled) && (this.database.getAuth(name).getQuitLocY() != 0))
{
this.utils.packCoords(this.database.getAuth(name).getQuitLocX(), this.database.getAuth(name).getQuitLocY(), this.database.getAuth(name).getQuitLocZ(), player);
}
@ -188,7 +191,7 @@ public class Management {
player.setGameMode(GameMode.getByValue(limbo.getGameMode()));
if (Settings.protectInventoryBeforeLogInEnabled.booleanValue() && player.hasPlayedBefore()) {
if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) {
RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@ -235,7 +238,7 @@ public class Management {
player.sendMessage(m._("login"));
displayOtherAccounts(auth);
if(!Settings.noConsoleSpam)
ConsoleLogger.info(player.getDisplayName() + " logged in!");
ConsoleLogger.info(player.getName() + " logged in!");
if(plugin.notifications != null) {
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " logged in!"));
}
@ -243,10 +246,12 @@ public class Management {
} else {
if (!Settings.noConsoleSpam)
ConsoleLogger.info(player.getDisplayName() + " used the wrong password");
ConsoleLogger.info(player.getName() + " used the wrong password");
if (Settings.isKickOnWrongPasswordEnabled) {
try {
int gm = AuthMePlayerListener.gameMode.get(name);
player.setGameMode(GameMode.getByValue(gm));
} catch (NullPointerException npe) {}
player.kickPlayer(m._("wrong_pwd"));
} else {
return (m._("wrong_pwd"));
@ -266,9 +271,9 @@ public class Management {
this.utils.addNormal(player, limbo.getGroup());
if ((Settings.isTeleportToSpawnEnabled.booleanValue()) && (!Settings.isForceSpawnLocOnJoinEnabled.booleanValue() && Settings.getForcedWorlds.contains(player.getWorld().getName())))
if ((Settings.isTeleportToSpawnEnabled) && (!Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())))
{
if ((Settings.isSaveQuitLocationEnabled.booleanValue()) && (this.database.getAuth(name).getQuitLocY() != 0)) {
if ((Settings.isSaveQuitLocationEnabled) && (this.database.getAuth(name).getQuitLocY() != 0)) {
Location quitLoc = new Location(player.getWorld(), this.database.getAuth(name).getQuitLocX() + 0.5D, this.database.getAuth(name).getQuitLocY() + 0.5D, this.database.getAuth(name).getQuitLocZ() + 0.5D);
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, quitLoc);
pm.callEvent(tpEvent);
@ -292,7 +297,7 @@ public class Management {
}
}
else if (Settings.isForceSpawnLocOnJoinEnabled.booleanValue() && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
else if (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawnLoc, true);
pm.callEvent(tpEvent);
@ -303,7 +308,7 @@ public class Management {
player.teleport(tpEvent.getTo());
}
}
else if ((Settings.isSaveQuitLocationEnabled.booleanValue()) && (this.database.getAuth(name).getQuitLocY() != 0)) {
else if ((Settings.isSaveQuitLocationEnabled) && (this.database.getAuth(name).getQuitLocY() != 0)) {
Location quitLoc = new Location(player.getWorld(), this.database.getAuth(name).getQuitLocX() + 0.5D, this.database.getAuth(name).getQuitLocY() + 0.5D, this.database.getAuth(name).getQuitLocZ() + 0.5D);
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, quitLoc);
pm.callEvent(tpEvent);
@ -329,7 +334,7 @@ public class Management {
player.setGameMode(GameMode.getByValue(limbo.getGameMode()));
if (Settings.protectInventoryBeforeLogInEnabled.booleanValue() && player.hasPlayedBefore()) {
if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) {
RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@ -373,7 +378,7 @@ public class Management {
player.sendMessage(m._("login"));
displayOtherAccounts(auth);
if(!Settings.noConsoleSpam)
ConsoleLogger.info(player.getDisplayName() + " logged in!");
ConsoleLogger.info(player.getName() + " logged in!");
if(plugin.notifications != null) {
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " logged in!"));
}

View File

@ -150,13 +150,12 @@ public class Utils {
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(pl, loc);
AuthMe.getInstance().getServer().getPluginManager().callEvent(tpEvent);
if(!tpEvent.isCancelled()) {
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded())
tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).load();
}
pl.teleport(tpEvent.getTo());
}
id = Bukkit.getScheduler().runTaskTimerAsynchronously(AuthMe.authme, new Runnable()
id = Bukkit.getScheduler().runTaskTimer(AuthMe.authme, new Runnable()
{
@Override
public void run() {

View File

@ -48,6 +48,7 @@ import uk.org.whoami.authme.datasource.DataSource;
import uk.org.whoami.authme.security.PasswordSecurity;
import uk.org.whoami.authme.settings.Messages;
import uk.org.whoami.authme.settings.Settings;
import uk.org.whoami.authme.settings.Spawn;
import uk.org.whoami.authme.settings.SpoutCfg;
public class AdminCommand implements CommandExecutor {
@ -345,7 +346,33 @@ public class AdminCommand implements CommandExecutor {
} catch (IOException e) {
e.printStackTrace();
} catch (NullPointerException ex) {
System.out.println(ex.getMessage());
ConsoleLogger.showError(ex.getMessage());
}
} else if (args[0].equalsIgnoreCase("setspawn")) {
try {
if (sender instanceof Player) {
if (Spawn.getInstance().setSpawn(((Player) sender).getLocation()))
sender.sendMessage("[AuthMe] Correctly define new spawn");
else sender.sendMessage("[AuthMe] SetSpawn fail , please retry");
} else {
sender.sendMessage("[AuthMe] Please use that command in game");
}
} catch (NullPointerException ex) {
ConsoleLogger.showError(ex.getMessage());
}
} else if (args[0].equalsIgnoreCase("spawn")) {
try {
if (sender instanceof Player) {
if (Spawn.getInstance().getLocation() != null)
((Player) sender).teleport(Spawn.getInstance().getLocation());
else sender.sendMessage("[AuthMe] Spawn fail , please try to define the spawn");
} else {
sender.sendMessage("[AuthMe] Please use that command in game");
}
} catch (NullPointerException ex) {
ConsoleLogger.showError(ex.getMessage());
}
} else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {

View File

@ -64,14 +64,6 @@ public class ChangePasswordCommand implements CommandExecutor {
return true;
}
//
// Check to prevent Changing Password if is active VBullettin system
//
if(!Settings.getMySQLColumnSalt.isEmpty()) {
player.sendMessage(m._("You can Change Your Password on Forum panel!"));
return true;
}
if (args.length != 2) {
player.sendMessage(m._("usage_changepassword"));
return true;

View File

@ -18,6 +18,7 @@ package uk.org.whoami.authme.commands;
import me.muizers.Notifications.Notification;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -39,6 +40,7 @@ import uk.org.whoami.authme.events.AuthMeTeleportEvent;
import uk.org.whoami.authme.settings.Messages;
import uk.org.whoami.authme.settings.PlayersLogs;
import uk.org.whoami.authme.settings.Settings;
import uk.org.whoami.authme.settings.Spawn;
import uk.org.whoami.authme.task.MessageTask;
import uk.org.whoami.authme.task.TimeoutTask;
@ -93,7 +95,10 @@ public class LogoutCommand implements CommandExecutor {
playerBackup.createCache(name, playerData, LimboCache.getInstance().getLimboPlayer(name).getGroup(),LimboCache.getInstance().getLimboPlayer(name).getOperator());
}
if (Settings.isTeleportToSpawnEnabled) {
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, player.getWorld().getSpawnLocation());
Location spawnLoc = player.getWorld().getSpawnLocation();
if (Spawn.getInstance().getLocation() != null)
spawnLoc = Spawn.getInstance().getLocation();
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawnLoc);
plugin.getServer().getPluginManager().callEvent(tpEvent);
if(!tpEvent.isCancelled()) {
if (!tpEvent.getTo().getWorld().getChunkAt(tpEvent.getTo()).isLoaded()) {

View File

@ -46,6 +46,7 @@ import uk.org.whoami.authme.security.RandomString;
import uk.org.whoami.authme.settings.Messages;
import uk.org.whoami.authme.settings.PlayersLogs;
import uk.org.whoami.authme.settings.Settings;
import uk.org.whoami.authme.settings.Spawn;
import uk.org.whoami.authme.task.MessageTask;
import uk.org.whoami.authme.task.TimeoutTask;
@ -208,6 +209,9 @@ public class RegisterCommand implements CommandExecutor {
}
}
if (Spawn.getInstance().getLocation() != null)
loca = Spawn.getInstance().getLocation();
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
plugin.getServer().getPluginManager().callEvent(tpEvent);
if(!tpEvent.isCancelled()) {
@ -282,6 +286,8 @@ public class RegisterCommand implements CommandExecutor {
}
}
if (Spawn.getInstance().getLocation() != null)
loca = Spawn.getInstance().getLocation();
RegisterTeleportEvent tpEvent = new RegisterTeleportEvent(player, loca);
plugin.getServer().getPluginManager().callEvent(tpEvent);
if(!tpEvent.isCancelled()) {

View File

@ -20,6 +20,7 @@ import java.security.NoSuchAlgorithmException;
import me.muizers.Notifications.Notification;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -35,10 +36,12 @@ import uk.org.whoami.authme.cache.auth.PlayerCache;
import uk.org.whoami.authme.cache.backup.FileCache;
import uk.org.whoami.authme.cache.limbo.LimboCache;
import uk.org.whoami.authme.datasource.DataSource;
import uk.org.whoami.authme.events.SpawnTeleportEvent;
import uk.org.whoami.authme.security.PasswordSecurity;
import uk.org.whoami.authme.settings.Messages;
import uk.org.whoami.authme.settings.PlayersLogs;
import uk.org.whoami.authme.settings.Settings;
import uk.org.whoami.authme.settings.Spawn;
import uk.org.whoami.authme.task.MessageTask;
import uk.org.whoami.authme.task.TimeoutTask;
@ -129,6 +132,27 @@ public class UnregisterCommand implements CommandExecutor {
if(plugin.notifications != null) {
plugin.notifications.showNotification(new Notification("[AuthMe] " + player.getName() + " unregistered himself!"));
}
if (Settings.isTeleportToSpawnEnabled) {
Location spawn = player.getWorld().getSpawnLocation();
if (plugin.mv != null) {
try {
spawn = plugin.mv.getMVWorldManager().getMVWorld(player.getWorld()).getSpawnLocation();
} catch (NullPointerException npe) {
} catch (ClassCastException cce) {
} catch (NoClassDefFoundError ncdfe) {
}
}
if (Spawn.getInstance().getLocation() != null)
spawn = Spawn.getInstance().getLocation();
SpawnTeleportEvent tpEvent = new SpawnTeleportEvent(player, player.getLocation(), spawn, false);
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());
}
}
return true;
} else {
player.sendMessage(m._("wrong_pwd"));

View File

@ -11,8 +11,8 @@ public class ConsoleFilter implements Filter {
public boolean isLoggable(LogRecord record) {
String logM = record.getMessage().toLowerCase();
if (!logM.contains("issued server command:")) return true;
if (!logM.contains("/login") && !logM.contains("/l") && !logM.contains("/reg") && !logM.contains("/changepassword") && !logM.contains("/unregister")
&& !logM.contains("/authme register") && !logM.contains("/authme changepassword")&& !logM.contains("/authme reg")&& !logM.contains("/authme cp")) return true;
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ")&& !logM.contains("/authme reg ")&& !logM.contains("/authme cp ")) return true;
String playername = record.getMessage().split(" ")[0];
record.setMessage(playername + " issued an AuthMe command!");
return true;

View File

@ -67,6 +67,7 @@ import uk.org.whoami.authme.plugin.manager.CombatTagComunicator;
import uk.org.whoami.authme.settings.Messages;
import uk.org.whoami.authme.settings.PlayersLogs;
import uk.org.whoami.authme.settings.Settings;
import uk.org.whoami.authme.settings.Spawn;
import uk.org.whoami.authme.task.MessageTask;
import uk.org.whoami.authme.task.TimeoutTask;
@ -556,6 +557,8 @@ public class AuthMePlayerListener implements Listener {
} catch (NoClassDefFoundError ncdfe) {
}
}
if (Spawn.getInstance().getLocation() != null)
spawn = Spawn.getInstance().getLocation();
if ((spawn.distance(player.getLocation()) > radius) ) {
event.getPlayer().teleport(spawn);
@ -661,6 +664,8 @@ public class AuthMePlayerListener implements Listener {
Player player = event.getPlayer();
World world = player.getWorld();
Location spawnLoc = world.getSpawnLocation();
if (Spawn.getInstance().getLocation() != null)
spawnLoc = Spawn.getInstance().getLocation();
gm = player.getGameMode().getValue();
final String name = player.getName().toLowerCase();
gameMode.put(name, gm);

View File

@ -45,7 +45,12 @@ public class PhpBB {
// private boolean dss_seeded = false;
private String unique_id() {
return new RandomString(16).nextString();
return unique_id("c");
}
private String unique_id(String extra) {
//TODO: Maybe check the salt?
return "1234567890abcdef";
}

View File

@ -643,6 +643,6 @@ public void mergeConfig() {
}
public enum messagesLang {
en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw
en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi
}
}

View File

@ -0,0 +1,68 @@
package uk.org.whoami.authme.settings;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
public class Spawn extends CustomConfiguration {
private static Spawn spawn;
private static List<String> emptyList = new ArrayList<String>();
public Spawn() {
super(new File("./plugins/AuthMe/spawn.yml"));
spawn = this;
load();
save();
saveDefault();
}
private void saveDefault() {
if (!contains("spawn")) {
set("spawn", emptyList);
set("spawn.world", "");
set("spawn.x", "");
set("spawn.y", "");
set("spawn.z", "");
set("spawn.yaw", "");
set("spawn.pitch", "");
save();
}
}
public static Spawn getInstance() {
if (spawn == null) {
spawn = new Spawn();
}
return spawn;
}
public boolean setSpawn(Location location) {
try {
set("spawn.world", location.getWorld().getName());
set("spawn.x", location.getX());
set("spawn.y", location.getY());
set("spawn.z", location.getZ());
set("spawn.yaw", location.getYaw());
set("spawn.pitch", location.getPitch());
save();
return true;
} catch (NullPointerException npe) {
return false;
}
}
public Location getLocation() {
try {
if (this.getString("spawn.world").isEmpty() || this.getString("spawn.world") == "") return null;
Location location = new Location(Bukkit.getWorld(this.getString("spawn.world")), this.getDouble("spawn.x"), this.getDouble("spawn.y"), this.getDouble("spawn.z"), Float.parseFloat(this.getString("spawn.yaw")), Float.parseFloat(this.getString("spawn.pitch")));
return location;
} catch (NullPointerException npe) {
return null;
}
}
}

View File

@ -0,0 +1,42 @@
unknown_user: '&fKäyttäjä ei ole tietokannassa!'
unsafe_spawn: '&fHengenvaarallinen poistumispaikka! Siirsimme sinut spawnille!'
not_logged_in: '&cEt ole kirjautunut sisään!'
reg_voluntarily: '&fNyt voit rekisteröidä pelaajasi serverillemme: "/register salasana salasana"'
usage_log: '&cKäyttö: /login salasana'
wrong_pwd: '&cVäärä salasana'
unregistered: '&cOnnistuneesti poistettu pelaajatili!'
reg_disabled: '&cRekisteröinti suljettu!'
valid_session: '&cSession kirjautuminen!'
login: '&cKirjauduit onnistuneesti'
vb_nonActiv: '&fKäyttäjäsi ei ole vahvistettu!'
user_regged: '&cPelaaja on jo rekisteröity'
usage_reg: '&cKäyttö: /register salasana salasana'
max_reg: '&fSinulla ei ole oikeuksia tehdä enempää pelaajatilejä!'
no_perm: '&cEi oikeuksia'
error: '&fVirhe: Ota yhteys operaattoriin!'
login_msg: '&cKirjaudu palvelimmelle "/login salasana"'
reg_msg: '&cRekisteröidy palvelimellemme "/register salasana salasana"'
usage_unreg: '&cKäyttö: /unregister password'
pwd_changed: '&cSalasana vaihdettu!!'
user_unknown: '&cSalasanat eivät täsmää'
password_error: '&fSalasanat eivät vastaa'
unvalid_session: '&fSession Dataes doesnt corrispond Plaese wait the end of session'
reg_only: '&fMene sivustolle: http://example.com rekisteröityäksesi!'
logged_in: '&cOlet jo kirjautunut!'
logout: '&cKirjauduit ulos palvelimelta.'
same_nick: '&COlet jo serverillä! &COdota clientin aikakatkaisua tai ota yhteyttä operaattoriin.'
registered: '&cRekisteröidyit onnistuneesti!'
pass_len: '&fSalasanasi on liian pitkä tai lyhyt.'
reload: '&fConfigit ja plugin uudelleenladattu'
timeout: '&fKirjautumisaika meni umpeen.'
usage_changepassword: '&fKäyttö: /changepassword vanhaSalasana uusiSalasana'
name_len: '&cPelaajanimesi on liian lyhyt tai pitkä'
regex: '&cPelaajanimesi sisältää luvattomia merkkejä. Hyväksytyt merkit: REG_EX'
add_email: '&cLisää sähköpostisi : /email add sähköpostisi varmistasähköpostisi'
bad_database_email: '[AuthMe] Tämä /email komento on vain käytössä MySQLlän kanssa. Ota yhteys operaattoriin'
recovery_email: '&cUnohtuiko salasana?'
usage_captcha: '&cKäyttö: /captcha <theCaptcha>'
wrong_captcha: '&cVäärä varmistus, käytä : /captcha THE_CAPTCHA'
valid_captcha: '&cSinun varmistus epäonnistui.!'

View File

@ -3,7 +3,7 @@ author: darkwarriros,Xephi
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.
main: uk.org.whoami.authme.AuthMe
version: 2.7.12b3
version: 2.7.13
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag]
commands:
register:
@ -126,3 +126,9 @@ permissions:
authme.captcha:
description: Captcha
default: true
authme.admin.setspawn:
description: Set the AuthMe spawn point
default: op
authme.admin.spawn:
description: Teleport to AuthMe spawn point
default: op