mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-09-07 04:38:03 +02:00
commit
f3c2967e83
132
pom.xml
132
pom.xml
@ -2,41 +2,41 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<groupId>fr.xephi.authme.AuthMe</groupId>
|
||||
<artifactId>AuthMe</artifactId>
|
||||
<version>5.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<name>AuthMeReloaded</name>
|
||||
<description>Authentication plugin for CraftBukkit/Spigot!</description>
|
||||
<url>http://dev.bukkit.org/bukkit-plugins/authme-reloaded/</url>
|
||||
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
|
||||
<!-- Change Compiler Version (JDK) HERE! -->
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
|
||||
|
||||
<!-- Change MC Version HERE! -->
|
||||
<bukkitVersion>1.8.7-R0.1-SNAPSHOT</bukkitVersion>
|
||||
|
||||
|
||||
<mainClass>${project.groupId}.${project.artifactId}</mainClass>
|
||||
</properties>
|
||||
|
||||
|
||||
<!-- Official Build Server ALLERT: sometimes jenkins is offline, no panic! -->
|
||||
<ciManagement>
|
||||
<system>jenkins</system>
|
||||
<url>http://ci.xephi.fr</url>
|
||||
</ciManagement>
|
||||
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>https://github.com/Xephi/AuthMeReloaded/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@ -48,10 +48,10 @@
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- <plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
<artifactId>maven-replacer-plugin</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<artifactId>replacer</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
@ -64,12 +64,12 @@
|
||||
<file>target/classes/plugin.yml</file>
|
||||
<replacements>
|
||||
<replacement>
|
||||
<token>${version}</token>
|
||||
<value>${version}</value>
|
||||
<token>maven-version</token>
|
||||
<value>${project.version}</value>
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</plugin> -->
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
@ -81,107 +81,96 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<repositories>
|
||||
|
||||
|
||||
<!-- SpigotMC Repo (Bukkit and SpigotAPI) -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Vault Repo -->
|
||||
|
||||
<!-- Vault Repo (Already in ess repo!) -->
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<!-- Citizens 2.X Repo -->
|
||||
<repository>
|
||||
<id>everything</id>
|
||||
<id>citizens-repo</id>
|
||||
<url>http://repo.citizensnpcs.co</url>
|
||||
</repository>
|
||||
|
||||
<!-- EssentialsX Repo -->
|
||||
|
||||
<!-- Essentials Repo -->
|
||||
<repository>
|
||||
<id>ess-repo</id>
|
||||
<url>http://repo.ess3.net/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<!-- CombatTagPlus Repo -->
|
||||
<repository>
|
||||
<id>minelink-thirdparty</id>
|
||||
<url>http://repo.minelink.net/content/repositories/public</url>
|
||||
</repository>
|
||||
|
||||
<!-- CombatTag Repo, Unofficial (needs replacement) -->
|
||||
|
||||
<!-- CombatTag Repo, Unofficial (needs replacement) UPDATE: this server is OFFLINE
|
||||
<repository>
|
||||
<id>techcable-repo</id>
|
||||
<url>http://repo.techcable.net/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
</repository> -->
|
||||
|
||||
<!-- XAuth Repo -->
|
||||
<repository>
|
||||
<id>bukkit-plugins-releases</id>
|
||||
<name>repo.luricos.de releases</name>
|
||||
<id>luricos-releases</id>
|
||||
<url>http://repo.luricos.de/content/repositories/releases/</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<!-- SpoutCraft Repo -->
|
||||
<repository>
|
||||
<id>sonatype-nexus-releases</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype-nexus-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<!-- <snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots> -->
|
||||
</repository>
|
||||
<!-- End of Spout Repo -->
|
||||
|
||||
|
||||
<!-- Attribute Repo -->
|
||||
<repository>
|
||||
<id>comphenix-snapshots</id>
|
||||
<name>Comphenix Maven Snapshots</name>
|
||||
<url>http://repo.comphenix.net/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<!-- Multiverse Repo -->
|
||||
<repository>
|
||||
<id>onarandombox</id>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
|
||||
</repositories>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- Maven Dependencies -->
|
||||
|
||||
|
||||
<!-- MySql Library -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.35</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SQLite Library -->
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.8.10.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Database Library -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.187</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Java Email API -->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
@ -193,14 +182,14 @@
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.5.0-b01</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Maxmind GeoIp API -->
|
||||
<dependency>
|
||||
<groupId>com.maxmind.geoip</groupId>
|
||||
<artifactId>geoip-api</artifactId>
|
||||
<version>1.2.14</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Spigot-Api, http://www.spigotmc.org/ Based on the Bukkit project,
|
||||
http://bukkit.org/ -->
|
||||
<dependency>
|
||||
@ -208,7 +197,8 @@
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>${bukkitVersion}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Attribute -->
|
||||
<dependency>
|
||||
<groupId>com.comphenix.attribute</groupId>
|
||||
<artifactId>AttributeStorage</artifactId>
|
||||
@ -224,12 +214,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Vault, http://dev.bukkit.org/bukkit-plugins/vault/ -->
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>Vault</artifactId>
|
||||
<version>1.5.4</version>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
@ -241,7 +231,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Citizens 2.X, NPC plugin, http://dev.bukkit.org/bukkit-plugins/citizens/ -->
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
@ -258,7 +248,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Multi World plugin, http://www.spigotmc.org/resources/multiverse-core.390/ -->
|
||||
<dependency>
|
||||
<groupId>com.onarandombox.multiversecore</groupId>
|
||||
@ -277,7 +267,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Essentials plugin -->
|
||||
<dependency>
|
||||
<groupId>net.ess3</groupId>
|
||||
@ -294,7 +284,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Anti PvPLogging plugin, https://github.com/MinelinkNetwork/CombatTagPlus -->
|
||||
<dependency>
|
||||
<groupId>net.minelink</groupId>
|
||||
@ -311,12 +301,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Anti PvPLogging plugin, http://www.spigotmc.org/resources/combat-tag.3182/ -->
|
||||
<dependency>
|
||||
<groupId>com.trc202</groupId>
|
||||
<artifactId>combattag</artifactId>
|
||||
<version>6.4.1-SNAPSHOT</version>
|
||||
<artifactId>CombatTag</artifactId>
|
||||
<version>6.2.1-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
@ -328,7 +318,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- XAuth, another authentication plugin, required by the database converter -->
|
||||
<dependency>
|
||||
<groupId>de.luricos.bukkit</groupId>
|
||||
@ -345,7 +335,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Spout API, https://spoutcraft.org/downloads/ -->
|
||||
<dependency>
|
||||
<groupId>org.spoutcraft</groupId>
|
||||
@ -362,7 +352,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Local Dependencies -->
|
||||
|
||||
<!-- It doesn't have a Maven Repo, http://dev.bukkit.org/bukkit-plugins/chestshop/ -->
|
||||
@ -383,7 +373,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Citizens 1.X (No API) -->
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
@ -392,7 +382,7 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/Citizens.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Old version of xAuth by Cypherx -->
|
||||
<dependency>
|
||||
<groupId>com.cypherx</groupId>
|
||||
@ -401,7 +391,7 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/xAuth.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- A SpoutApi Plugin, http://dev.bukkit.org/bukkit-plugins/notifications/ -->
|
||||
<dependency>
|
||||
<groupId>me.muizers</groupId>
|
||||
@ -410,6 +400,6 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/Notifications.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -4,12 +4,16 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.mail.BodyPart;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.Multipart;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeBodyPart;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@ -37,20 +41,16 @@ public class SendMailSSL {
|
||||
sendername = Settings.getmailSenderName;
|
||||
}
|
||||
|
||||
String port = String.valueOf(Settings.getMailPort);
|
||||
Properties props = new Properties();
|
||||
props.put("mail.smtp.host", Settings.getmailSMTP);
|
||||
props.put("mail.smtp.socketFactory.port", String.valueOf(Settings.getMailPort));
|
||||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
||||
props.put("mail.smtp.auth", "true");
|
||||
props.put("mail.smtp.port", String.valueOf(Settings.getMailPort));
|
||||
props.put("mail.smtp.port", port);
|
||||
props.put("mail.smtp.starttls.enable", true);
|
||||
|
||||
try {
|
||||
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
|
||||
Session session = Session.getInstance(props, null);
|
||||
|
||||
protected PasswordAuthentication getPasswordAuthentication() {
|
||||
return new PasswordAuthentication(Settings.getmailAccount, Settings.getmailPassword);
|
||||
}
|
||||
});
|
||||
final Message message = new MimeMessage(session);
|
||||
try {
|
||||
message.setFrom(new InternetAddress(Settings.getmailAccount, sendername));
|
||||
@ -60,26 +60,34 @@ public class SendMailSSL {
|
||||
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(auth.getEmail()));
|
||||
message.setSubject(Settings.getMailSubject);
|
||||
message.setSentDate(new Date());
|
||||
BodyPart messageBodyPart = new MimeBodyPart();
|
||||
String text = Settings.getMailText;
|
||||
text = text.replace("<playername>", auth.getNickname());
|
||||
text = text.replace("<servername>", plugin.getServer().getServerName());
|
||||
text = text.replace("<generatedpass>", newPass);
|
||||
message.setContent(text, "text/html");
|
||||
messageBodyPart.setText(text);
|
||||
|
||||
Multipart multipart = new MimeMultipart();
|
||||
|
||||
multipart.addBodyPart(messageBodyPart);
|
||||
|
||||
messageBodyPart = new MimeBodyPart();
|
||||
|
||||
multipart.addBodyPart(messageBodyPart);
|
||||
message.setContent(multipart);
|
||||
final Transport transport = session.getTransport("smtp");
|
||||
transport.connect(Settings.getmailSMTP, Settings.getmailAccount, Settings.getmailPassword);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Transport.send(message);
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError("Some error appears while trying to send mail to " + auth.getEmail());
|
||||
transport.sendMessage(message, message.getAllRecipients());
|
||||
} catch (MessagingException e) {
|
||||
System.out.println("Some error occured while trying to send a mail to " + auth.getEmail());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
if (!Settings.noConsoleSpam)
|
||||
ConsoleLogger.info("Email sent to : " + auth.getNickname());
|
||||
} catch (Exception e) {
|
||||
ConsoleLogger.showError("Some error appears while trying to send mail to " + auth.getEmail());
|
||||
System.out.println("Some error occured while trying to send a mail to " + auth.getEmail());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package fr.xephi.authme.cache.limbo;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -83,6 +84,10 @@ public class LimboPlayer {
|
||||
}
|
||||
|
||||
public void setTimeoutTaskId(BukkitTask i) {
|
||||
if (this.timeoutTaskId != null) {
|
||||
if (Bukkit.getScheduler().isCurrentlyRunning(this.timeoutTaskId.getTaskId()) || Bukkit.getScheduler().isQueued(this.timeoutTaskId.getTaskId()))
|
||||
Bukkit.getScheduler().cancelTask(this.timeoutTaskId.getTaskId());
|
||||
}
|
||||
this.timeoutTaskId = i;
|
||||
}
|
||||
|
||||
@ -91,6 +96,10 @@ public class LimboPlayer {
|
||||
}
|
||||
|
||||
public void setMessageTaskId(BukkitTask messageTaskId) {
|
||||
if (this.messageTaskId != null) {
|
||||
if (Bukkit.getScheduler().isCurrentlyRunning(this.messageTaskId.getTaskId()) || Bukkit.getScheduler().isQueued(this.messageTaskId.getTaskId()))
|
||||
Bukkit.getScheduler().cancelTask(this.messageTaskId.getTaskId());
|
||||
}
|
||||
this.messageTaskId = messageTaskId;
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) {
|
||||
} else
|
||||
if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) {
|
||||
if (args.length != 3) {
|
||||
sender.sendMessage("Usage: /authme register playername password");
|
||||
return true;
|
||||
@ -394,7 +395,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
|
||||
} else
|
||||
if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
|
||||
if (args.length != 3) {
|
||||
sender.sendMessage("Usage: /authme changepassword playername newpassword");
|
||||
return true;
|
||||
@ -460,10 +462,10 @@ public class AdminCommand implements CommandExecutor {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = sender.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
if (Settings.applyBlindEffect)
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
m.send(target, "unregistered");
|
||||
|
@ -2,8 +2,6 @@ package fr.xephi.authme.commands;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -29,6 +27,7 @@ import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
public class UnregisterCommand implements CommandExecutor {
|
||||
|
||||
@ -93,10 +92,10 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = sender.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
m.send(player, "unregistered");
|
||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||
if (plugin.notifications != null) {
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -86,7 +85,6 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
|
||||
String msg = event.getMessage();
|
||||
// WorldEdit GUI Shit
|
||||
if (msg.equalsIgnoreCase("/worldedit cui"))
|
||||
return;
|
||||
|
||||
@ -403,7 +401,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
final Player player = event.getPlayer();
|
||||
if (player == null)
|
||||
return;
|
||||
final String name = player.getName().toLowerCase();
|
||||
@ -447,18 +445,31 @@ public class AuthMePlayerListener implements Listener {
|
||||
if (Settings.isSessionsEnabled)
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
if (!Settings.sessionExpireOnIpChange)
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
}
|
||||
});
|
||||
|
||||
// Check if forceSingleSession is set to true, so kick player that has
|
||||
// joined with same nick of online player
|
||||
if (player.isOnline() && Settings.isForceSingleSessionEnabled) {
|
||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
|
||||
event.setKickMessage(m.send("same_nick")[0]);
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
utils.addNormal(player, limbo.getGroup());
|
||||
LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase());
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
Utils.getInstance().addNormal(player, limbo.getGroup());
|
||||
LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -569,27 +580,6 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void placePlayerSafely(Player player, Location spawnLoc) {
|
||||
if (!Settings.noTeleport)
|
||||
return;
|
||||
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())))
|
||||
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) {
|
||||
m.send(player, "unsafe_spawn");
|
||||
if (spawnLoc.getWorld() != null)
|
||||
player.teleport(spawnLoc);
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
m.send(player, "unsafe_spawn");
|
||||
if (spawnLoc.getWorld() != null)
|
||||
player.teleport(spawnLoc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
if (event.getPlayer() == null) {
|
||||
@ -616,7 +606,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if ((Settings.isForceSingleSessionEnabled) && (event.getReason().contains("You logged in from another location"))) {
|
||||
if ((!Settings.isForceSingleSessionEnabled) && (event.getReason().contains(m.getString("same_nick")))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ public class AsyncronousJoin {
|
||||
int time = Settings.getRegistrationTimeout * 20;
|
||||
int msgInterval = Settings.getWarnMessageInterval;
|
||||
if (time != 0) {
|
||||
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), time);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), time);
|
||||
if (!LimboCache.getInstance().hasLimboPlayer(name))
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
@ -302,11 +302,12 @@ public class AsyncronousJoin {
|
||||
}
|
||||
|
||||
});
|
||||
BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, msgInterval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
}
|
||||
|
||||
private void placePlayerSafely(final Player player, final Location spawnLoc) {
|
||||
private void placePlayerSafely(final Player player,
|
||||
final Location spawnLoc) {
|
||||
Location loc = null;
|
||||
if (spawnLoc == null)
|
||||
return;
|
||||
|
@ -3,8 +3,6 @@ package fr.xephi.authme.process.login;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@ -21,6 +19,7 @@ import fr.xephi.authme.security.RandomString;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
public class AsyncronousLogin {
|
||||
|
||||
@ -64,7 +63,8 @@ public class AsyncronousLogin {
|
||||
player.sendMessage(s.replace("THE_CAPTCHA", plugin.cap.get(name)).replace("<theCaptcha>", plugin.cap.get(name)));
|
||||
}
|
||||
return true;
|
||||
} else if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
|
||||
} else
|
||||
if (plugin.captcha.containsKey(name) && plugin.captcha.get(name) >= Settings.maxLoginTry) {
|
||||
try {
|
||||
plugin.captcha.remove(name);
|
||||
plugin.cap.remove(name);
|
||||
@ -87,14 +87,14 @@ public class AsyncronousLogin {
|
||||
if (!database.isAuthAvailable(name)) {
|
||||
m.send(player, "user_unknown");
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||
LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel();
|
||||
LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel();
|
||||
String[] msg;
|
||||
if (Settings.emailRegistration) {
|
||||
msg = m.send("reg_email_msg");
|
||||
} else {
|
||||
msg = m.send("reg_msg");
|
||||
}
|
||||
BukkitTask msgT = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, msg, Settings.getWarnMessageInterval));
|
||||
BukkitTask msgT = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, msg, Settings.getWarnMessageInterval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
}
|
||||
return null;
|
||||
|
@ -1,7 +1,5 @@
|
||||
package fr.xephi.authme.process.logout;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -17,6 +15,7 @@ import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
|
||||
@ -37,10 +36,10 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = player.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
try {
|
||||
if (player.isInsideVehicle())
|
||||
|
@ -1,7 +1,5 @@
|
||||
package fr.xephi.authme.process.register;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
@ -14,6 +12,7 @@ import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
|
||||
@ -37,13 +36,13 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
int time = Settings.getRegistrationTimeout * 20;
|
||||
int msgInterval = Settings.getWarnMessageInterval;
|
||||
if (time != 0) {
|
||||
LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel();
|
||||
BukkitTask id = Bukkit.getScheduler().runTaskLater(plugin, new TimeoutTask(plugin, name), time);
|
||||
LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel();
|
||||
BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), time);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
|
||||
LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId().cancel();
|
||||
BukkitTask nwMsg = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval));
|
||||
BukkitTask nwMsg = Bukkit.getScheduler().runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), msgInterval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg);
|
||||
player.saveData();
|
||||
if (!Settings.noConsoleSpam)
|
||||
|
@ -1,7 +1,5 @@
|
||||
package fr.xephi.authme.process.register;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -22,6 +20,7 @@ import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import me.muizers.Notifications.Notification;
|
||||
|
||||
public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
|
||||
@ -67,10 +66,10 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
BukkitTask msgT = sched.runTask(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
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);
|
||||
|
@ -1,7 +1,6 @@
|
||||
package fr.xephi.authme.task;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -33,11 +32,11 @@ public class MessageTask implements Runnable {
|
||||
for (String ms : msg) {
|
||||
player.sendMessage(ms);
|
||||
}
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
BukkitTask late = sched.runTaskLater(plugin, this, interval * 20);
|
||||
BukkitTask late = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, this, interval * 20);
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(late);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package fr.xephi.authme.task;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -34,7 +35,7 @@ public class TimeoutTask implements Runnable {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
for (final Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (player.getName().toLowerCase().equals(name)) {
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||
LimboPlayer inv = LimboCache.getInstance().getLimboPlayer(name);
|
||||
@ -44,14 +45,27 @@ public class TimeoutTask implements Runnable {
|
||||
playerCache.removeCache(player);
|
||||
}
|
||||
}
|
||||
GameMode gm = AuthMePlayerListener.gameMode.get(name);
|
||||
if (gm != null)
|
||||
{
|
||||
player.setGameMode(gm);
|
||||
ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name());
|
||||
final GameMode gm = AuthMePlayerListener.gameMode.get(name);
|
||||
if (gm != null) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setGameMode(gm);
|
||||
}
|
||||
|
||||
});
|
||||
ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name());
|
||||
}
|
||||
player.kickPlayer(m.send("timeout")[0]);
|
||||
break;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline())
|
||||
player.kickPlayer(m.send("timeout")[0]);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ author: Xephi59
|
||||
website: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
||||
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: fr.xephi.authme.AuthMe
|
||||
version: 5.0-SNAPSHOT
|
||||
version: maven-version
|
||||
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag, Essentials, EssentialsSpawn]
|
||||
commands:
|
||||
register:
|
||||
|
Loading…
Reference in New Issue
Block a user