Merge pull request #217 from AuthMe-Team/master

more from team repo
This commit is contained in:
Alexandre Vanhecke 2015-10-05 15:04:29 +02:00
commit 81de64da6d
62 changed files with 3043 additions and 3596 deletions

View File

@ -1,33 +0,0 @@
# ForcedActions AuthMeReloaded configuration file
forcedActions:
# example1:
# at: firstlogin
# executedBy: console
# commands:
# - 'msg %p Welcome!'
# - pex user set group Player
# example2:
# at: connection
# executedBy: console
# commands:
# - 'msg %p You need to register yourself to play this server!'
#
# Avariable events:
# connection
# firstconnection
# login
# firstlogin
# wrongpassword
# disconnection
# logout
# serverstop
# serverstart
# pluginreload
# mysqlerror
# antiboton
# antibotoff
#

View File

@ -1,113 +0,0 @@
# Advanced AuthMeReloaded configuration file
sessionLogin:
# Do you want to enable session? When enabled
# the ip of a player will be bound to the nickname
# of the player on login. As long as neither of those
# two change players don't have to login on a reconnect
enabled: false
# After how many minutes a session should timeout?
# 0 for unlimitted sessions, use 0 at your own risk!
# consider that session will end only after timeout, and
# if player's ip is changed but the timeout treshould isent
# ended, player will kick out of sever for invalidSession!
timeout: 10
# Do we need to timeout the session if the player is offline
# And try to login with an another IP Address?
sessionExpireOnIpChange: true
security:
# Online players aren't kicked out for "Logged in from another location!", this option should always be set to true!
forceSingleSession: true
# Should we display all other accounts from a player when he joins?
# permission: /authme.admin.accounts
displayOtherAccounts: true
# Should the purge command can be performed only from the console?
purgeOnlyFromConsole: true
# Minimum value for the purge ingame command (if enabled), prevent the destruction of the entire database.
minIngamePurgeDays: 30
captcha:
# Do players need to write a captcha code if they use too many times a wrong password
useCaptcha: false
# Max allowed tries before request a captcha
maxLoginTry: 5
# Captcha length
captchaLength: 5
# Restricted users will be kicked if their IP aren't the same specified below.
# Usage: - username;ip
RestrictedUsers:
- playername;127.0.0.1
# User listed below will bypass every login/registration system. CASE SENSITIVE!!!
# Use this at your own risk!!! USE ONLY WITH ONLINE MODE SERVERS!!!
# This option can add compatibility with BuildCraft and some other mods.
UnrestrictedName: []
passwordEncryption:
# possible values: MD5, SHA1, SHA256, WHIRLPOOL, XAUTH, MD5VB, PHPBB,
# PLAINTEXT ( unhashed password),
# MYBB, IPB3, PHPFUSION, SMF, XENFORO, SALTED2MD5, JOOMLA, BCRYPT, WBB3, SHA512,
# DOUBLEMD5, PBKDF2, WORDPRESS, ROYALAUTH, CUSTOM(for developpers only)
passwordHash: SHA256
# salt length for the SALTED2MD5 MD5(MD5(password)+salt)
doubleMD5SaltLength: 8
# If password checking return false , do we need to check with all
# other password algorithm to check an old password ?
# AuthMe will update the password to the new passwordHash !
supportOldPasswordHash: false
SQLProblem:
# Stop the server if we can't contact the sql database
# Take care with this, if you set that to false,
# AuthMe automatically disable and the server is not protected!
stopServer: true
ReloadCommand:
# /reload support
useReloadCommandSupport: true
console:
# Remove spam console
noConsoleSpam: false
# Replace passwords in the console when player type a command like /login
removePassword: true
externalBoard:
# MySQL column for the salt , needed for some forum/cms support
mySQLColumnSalt: ''
# MySQL column for the group, needed for some forum/cms support
mySQLColumnGroup: ''
# -1 mean disabled. If u want that only
# activated player can login in your server
# u can put in this options the group number
# of unactivated user, needed for some forum/cms support
nonActivedUserGroup: -1
# Other MySQL columns where we need to put the Username (case sensitive)
mySQLOtherUsernameColumns: []
# How much Log to Round needed in BCrypt(do not change it if you do not know what's your doing)
bCryptLog2Round: 10
# phpBB prefix defined during phpbb installation process
phpbbTablePrefix: 'phpbb_'
# phpBB activated group id , 2 is default registered group defined by phpbb
phpbbActivatedGroupId: 2
# WordPress prefix defined during WordPress installation process
wordpressTablePrefix: 'wp_'
hooks:
# Do we need to hook with multiverse for spawn checking?
multiverse: true
# Do we need to hook with ChestShop for prevent buy or selling ?
chestshop: true
# Do we need to hook with BungeeCord for get the real Player ip ?
bungeecord: false
# Do we need to disable Essentials SocialSpy on join ?
disableSocialSpy: true
# Do we need to cache custom Attributes ?
customAttributes: false
# Spawn Priority, Values : authme, essentials, multiverse, default
spawnPriority: authme,essentials,multiverse,default
# AuthMe will NEVER teleport players !
noTeleport: false

View File

@ -1,68 +0,0 @@
# Database AuthMeReloaded configuration file
# What type of database do you want to use? Avariable options: sqlite, mysql, redis
backend: sqlite
# Do you like to cache all the queries? (Performance Boost)
caching: true
# Database Name
databaseName: authme
# Table of the database
tableName: authme
# MySql Database connection settings
# Avariable only if the AuthMeReloaded-Mysql module is installed!
mysql:
port: '3306'
host: 127.0.0.1
username: authme
password: '12345'
# Redis Database connection settings
# Avariable only if the AuthMeReloaded-Redis module is installed!
redis:
# Get Redis from http://redis.io/
host: 127.0.0.1
port: 6379
# If your Redis server uses AUTH, set here the password.
password: ""
# Database column names
columnNames:
idColumn: id
nameColumn: username
realNameColumn: realname
passwordColumn: password
ipColumn: ip
emailColumn: email
loginStatusColumn: loginstatus
lastLoginColumn: lastlogin
lastlLocationXColumn: x
lastLocationYColumn: y
lastLocationZColumn: z
lastLocationWorldColumn: world
backup:
# Enable or disable Automatic Backup of the SQLite database, destination path: "/AuthMe/backups/%date%/%timestamp%.sql"
ActivateBackup: false
# Interval time (in minutes), set to 0 to disable periodic backup
Interval: 300
# Do you want to perform a Backup when the server starts?
OnServerStart: false
# Do you want to perform a Backup when the server stops?
OnServerStop: true
purge:
# Does AuthMe need to purge automatically old unused accounts?
useAutoPurge: false
# Number of Days required to mark an account as Unused
daysBeforeRemovePlayer: 60
# What to remove
remove:
playerInventoryFile: true
essentialsFiles: true
permissions: true
limitedCreativesInventories: true
antiXRayFiles: true
# World where players.dat are stored (necessary to remove inventory files)
defaultWorld: 'world'

View File

@ -1,40 +0,0 @@
emailSystem:
# Do you want to replace the Password registration with an Email registration method?
enableEmailRegistration: false
# Do you want to enable the double check of the email address during a player registration?
# When it's true, registration require that kind of command:
# /register <email> <confirmEmail>
doubleEmailCheck: true
# Like maxRegPerIp but with emails
maxRegPerEmail: 1
# Do you want to recall players to add an email to their accounts?
recallPlayers: true
# Delay in minute for the recall scheduler
delayRecall: 5
passwordRecovery:
# Recovery password length
RecoveryPasswordLength: 8
# Recovery Email subject
mailSubject: 'Your new AuthMe Password'
# Recovery Email text
mailText: 'Dear <playername>, <br /><br /> This is your new AuthMe password for the server <br /><br /> <servername> : <br /><br /> <generatedpass><br /><br />Do not forget to change password after login! <br /> /changepassword <generatedpass> newPassword'
smtpOptions:
# SMTP server host
mailSMTP: smtp.gmail.com
# SMTP server port
mailPort: 465
# Email account that sends the mails
mailAccount: ''
# Email account's password
mailPassword: ''
# Custom SenderName, that replace the mailAccount name in the emails
mailSenderName: ''
emailSecurity:
# Blacklisted domains for emails
emailBlacklist:
- 10minutemail.com
# Do you like a Whitelist instead of a Blacklist?
blacklistAsWhitelist: false

View File

@ -1,100 +0,0 @@
# █████╗ ██╗ ██╗████████╗██╗ ██╗ ███╗ ███╗███████╗ ██████╗ ███████╗██╗ ██████╗ ██████╗ ███████╗██████╗
# ██╔══██╗██║ ██║╚══██╔══╝██║ ██║ ████╗ ████║██╔════╝ ██╔══██╗██╔════╝██║ ██╔═══██╗██╔══██╗██╔════╝██╔══██╗
# ███████║██║ ██║ ██║ ███████║ ██╔████╔██║█████╗ ██████╔╝█████╗ ██║ ██║ ██║██║ ██║█████╗ ██║ ██║
# ██╔══██║██║ ██║ ██║ ██╔══██║ ██║╚██╔╝██║██╔══╝ ██╔══██╗██╔══╝ ██║ ██║ ██║██║ ██║██╔══╝ ██║ ██║
# ██║ ██║╚██████╔╝ ██║ ██║ ██║ ██║ ╚═╝ ██║███████╗ ██║ ██║███████╗███████╗╚██████╔╝██████╔╝███████╗██████╔╝
# ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝
# Welcome to the AuthMeReloaded main configuration file!
# Available languages: en, de, br, cz, pl, fr, ru, hu, sk, es, zhtw, fi, zhcn, lt, it, ko, pt
language: en
registration:
# Do you want to enable the registration on the server?
enabled: true
# Do you want to force players to register before playing?
force: true
# Maximum Registration per IP
maxRegPerIp: 1
# Maximum allowed username length
maxUsernameLength: 30
# Minimum required username length
minUsernameLength: 4
# Regex syntax allowed in player's username
allowedNicknameCharacters: '[a-zA-Z0-9_]*'
# Do you want to kick players after a successful registration?
# Do not use this option with the loginAfterRegister feature below!
kickAfterRegistration: false
# Do you want to force the player to login after a successful registration?
loginAfterRegister: false
login:
# How many players per IP can join the server concurrently?
maxInstanceForIP: 1
# Should not registered players be kicked immediately?
kickNonRegistered: false
# Should the players be kicked immediately on wrong password?
kickOnWrongPassword: false
# Send every X seconds a message to a player to remind him that he has to login/register
messageInterval: 5
# How many second a player can login or register before being kicked? Set this to 0 to disable.
timeout: 30
# Teleport the player to the world's Spawn after login
teleportToSpawnAfterLogin: true
# Teleport provisionally not logged player to world's Spawn.
# After the login, if teleportToSpawnAfterLogin is set to false the player will be teleported to his last location.
teleportToSpawnBeforeLogin: true
# ForceSurvivalMode to player when join?
forceSurvivalMode: false
# Do we need to force the survival mode ONLY after /login process?
forceSurvivalOnlyAfterLogin: false
# Reset every time the player's inventory?
resetInventory: false
# If player join with CreativeMode and ForceSurvivalMode: true inventory will be wiped.
resetInventoryIfCreative: false
# Should we protect the player inventory before logging in?
protectInventoryBeforeLogIn: true
password:
# minimum Length of password
minPasswordLength: 5
# Regex sintax for allowed Chars in passwords.
allowedPasswordCharacters: '[\x21-\x7E]*'
# Enable double check of password when you register or change password.
# When it's true, registration require that kind of command:
# /register <password> <confirmPassword>
doublePasswordCheck: true
# Deny unsafe passwords for being used, put them on lowercase!
unsafePasswords:
- '123456'
- '12345'
- 'qwerty'
- 'password'
protection:
# Enable some server protection systems (country based login, antibot)
enableProtection: false
# Countries allowed to join the server and register, see http://dev.bukkit.org/bukkit-plugins/authme-reloaded/pages/countries-codes/ for countries' codes
countries:
- US
- GB
# Countries blacklisted automatically (It works also with enableProtection set to false)
countriesBlacklist:
- A1
antiBot:
# Do you like to enable the automatic antibot system?
enableAntiBot: false
# Do you want to show AntiBot messages to every player or only to person with the "authme.antibotmessages" permission node?
broadcastMessages: true
# Max number of player allowed to join in 5 secs before the AntiBot activates
antiBotSensibility: 5
# Duration in minutes of the antibot protection
antiBotDuration: 10
# These features are only available on the VeryGames Server Provider
veryGames:
enableIpCheck: false

View File

@ -1,21 +0,0 @@
_________________________________________________________________________________
> <
> WARNING: Conversions can't be undone! DO ALWAYS A BACKUP BEFORE!!! <
> <
_________________________________________________________________________________
> AuthMe Reloaded converters description file <
_________________________________________________________________________________
Built-in converters (Into the Plugin's core module):
Old File Backend ("file") >>> SQLite ("/authme converter flatfiletosqlite") THIS CONVERTER WILL BE REMOVED FROM THE CORE IN FUTURE VERSIONS!!!
Converters in the Converters module (Into the Converters module avariable at: NEED LINK):
SQlite >>> MySql ("/authme converter sqlitetomysql")
MySql >>> Redis ("/authme converter mysqltoredis")
Rakamak >>> SQlite ("/authme converter rakamaktosqlite [databasefile.rak] [(ip-mode) (ipdatabasefle.rak)]")
CrazyLogin >>> SQlite ("/authme converter crazylogintosqlite [databasefile.db]")
xAuth (Min version 2.6) >>> SQlite ("/authme converter xauthtosqlite") NOTE: xAUTH MUST BE INSTALLED AND CONFIGURED IN THE SERVER, it works with all the xAuth backends!
Discontinued Converters (use an old AuthMe version like 3.4):
RoyalAuth >>> SQlite
vAuth >>> SQlite

View File

@ -3,6 +3,8 @@
<hr> <hr>
#####Development tools: #####Development tools:
- DEVELOPMENT TEAM REPO (<strong>please send PRs here!</strong>): <a href="https://github.com/AuthMe-Team/AuthMeReloaded">Github Development Page</a>
- Developers ChatRoom: [![Join the chat at https://gitter.im/Xephi/AuthMeReloaded](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Xephi/AuthMeReloaded?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - Developers ChatRoom: [![Join the chat at https://gitter.im/Xephi/AuthMeReloaded](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Xephi/AuthMeReloaded?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
- Build status: [![Build Status](https://travis-ci.org/Xephi/AuthMeReloaded.svg?branch=master)](https://travis-ci.org/Xephi/AuthMeReloaded) [![Dependency Status](https://www.versioneye.com/user/projects/55bab9e8653762002000190a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55bab9e8653762002000190a) - Build status: [![Build Status](https://travis-ci.org/Xephi/AuthMeReloaded.svg?branch=master)](https://travis-ci.org/Xephi/AuthMeReloaded) [![Dependency Status](https://www.versioneye.com/user/projects/55bab9e8653762002000190a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55bab9e8653762002000190a)
@ -41,6 +43,8 @@ McStats: http://mcstats.org/plugin/AuthMe
#####Running Requirements: #####Running Requirements:
>- Java 1.7 (should work also with Java 1.8) >- Java 1.7 (should work also with Java 1.8)
>- Spigot or CraftBukkit (1.7.10 or 1.8.X) >- Spigot or CraftBukkit (1.7.10 or 1.8.X)
>- Vault
>- Protocollib
<hr> <hr>
###Plugin Description: ###Plugin Description:
@ -130,6 +134,6 @@ GameHosting.it is leader in Italy as Game Server Provider. With its own DataCent
[![GameHosting](http://www.gamehosting.it/images/bn3.png)](http://www.gamehosting.it) [![GameHosting](http://www.gamehosting.it/images/bn3.png)](http://www.gamehosting.it)
#####Credits #####Credits
<p>Team members: Xephi(Main Developer, Author), Maxetto(Contributor) and sgdc3(Contributor) <p>Team members: look at the <a href="https://github.com/AuthMe-Team/AuthMeReloaded/blob/master/team.txt">team.txt file</a>
<p>Credit for old version of the plugin to: d4rkwarriors, fabe1337 , Whoami2 and pomo4ka</p> <p>Credit for old version of the plugin to: d4rkwarriors, fabe1337 , Whoami2 and pomo4ka</p>
<p>Thanks also to: AS1LV3RN1NJA, Hoeze and eprimex</p> <p>Thanks also to: AS1LV3RN1NJA, Hoeze and eprimex</p>

194
pom.xml
View File

@ -6,6 +6,7 @@
<groupId>fr.xephi</groupId> <groupId>fr.xephi</groupId>
<artifactId>authme</artifactId> <artifactId>authme</artifactId>
<version>5.1-SNAPSHOT</version> <version>5.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>AuthMeReloaded</name> <name>AuthMeReloaded</name>
<description>Authentication plugin for CraftBukkit/Spigot!</description> <description>Authentication plugin for CraftBukkit/Spigot!</description>
@ -56,7 +57,7 @@
<resource> <resource>
<targetPath>.</targetPath> <targetPath>.</targetPath>
<filtering>true</filtering> <filtering>true</filtering>
<directory>${basedir}/src/main/resources/</directory> <directory>src/main/resources/</directory>
<includes> <includes>
<include>*.yml</include> <include>*.yml</include>
</includes> </includes>
@ -64,7 +65,7 @@
<resource> <resource>
<targetPath>./messages/</targetPath> <targetPath>./messages/</targetPath>
<filtering>false</filtering> <filtering>false</filtering>
<directory>${basedir}/src/main/resources/messages/</directory> <directory>src/main/resources/messages/</directory>
<includes> <includes>
<include>*.yml</include> <include>*.yml</include>
</includes> </includes>
@ -88,9 +89,8 @@
<artifactSet> <artifactSet>
<includes> <includes>
<include>com.zaxxer:HikariCP</include> <include>com.zaxxer:HikariCP</include>
<include>org.slf4j:slf4j-simple</include> <include>org.slf4j:slf4j-jdk14</include>
<include>org.slf4j:slf4j-api</include> <include>org.slf4j:slf4j-api</include>
<include>com.google.code.gson:gson</include>
<include>com.maxmind.geoip:geoip-api</include> <include>com.maxmind.geoip:geoip-api</include>
<include>com.sun.mail:javax.mail</include> <include>com.sun.mail:javax.mail</include>
<include>com.comphenix.attribute:AttributeStorage</include> <include>com.comphenix.attribute:AttributeStorage</include>
@ -121,13 +121,13 @@
<!-- SpigotMC Repo (Bukkit and SpigotAPI) --> <!-- SpigotMC Repo (Bukkit and SpigotAPI) -->
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public</url> <url>http://hub.spigotmc.org/nexus/content/groups/public</url>
</repository> </repository>
<!-- EssentialsX Repo --> <!-- EssentialsX Repo -->
<repository> <repository>
<id>ess-repo</id> <id>ess-repo</id>
<url>https://ci.drtshock.net/plugin/repository/everything</url> <url>http://ci.drtshock.net/plugin/repository/everything</url>
</repository> </repository>
<!-- CombatTagPlus Repo --> <!-- CombatTagPlus Repo -->
@ -160,11 +160,12 @@
<url>http://repo.luricos.de/content/repositories/releases</url> <url>http://repo.luricos.de/content/repositories/releases</url>
</repository> </repository>
<!-- Xephi Repo (ChestShop) --> <!-- Xephi Repo
<repository> <repository>
<id>xephi-repo</id> <id>xephi-repo</id>
<url>http://ci.xephi.fr/plugin/repository/everything/</url> <url>http://ci.xephi.fr/plugin/repository/everything/</url>
</repository> </repository>
-->
<!-- Metrics Snapshots Repo --> <!-- Metrics Snapshots Repo -->
<repository> <repository>
@ -190,12 +191,23 @@
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-jdk14</artifactId>
<version>1.7.12</version> <version>1.7.12</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Log4J Logger (for the filter) -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-beta9</version>
<scope>provided</scope>
<optional>true</optional>
</dependency> </dependency>
<!-- SQLite Connector --> <!-- SQLite Connector -->
@ -204,14 +216,7 @@
<artifactId>sqlite-jdbc</artifactId> <artifactId>sqlite-jdbc</artifactId>
<version>3.8.11.1</version> <version>3.8.11.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> <optional>true</optional>
<!-- Google JSON Library -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency> </dependency>
<!-- Java Email API and Implementation --> <!-- Java Email API and Implementation -->
@ -220,6 +225,7 @@
<artifactId>javax.mail-api</artifactId> <artifactId>javax.mail-api</artifactId>
<version>1.5.4</version> <version>1.5.4</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>com.sun.mail</groupId>
@ -232,6 +238,7 @@
<groupId>javax.activation</groupId> <groupId>javax.activation</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
@ -241,6 +248,7 @@
<artifactId>geoip-api</artifactId> <artifactId>geoip-api</artifactId>
<version>1.2.15</version> <version>1.2.15</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional>
</dependency> </dependency>
<!-- Metrics API --> <!-- Metrics API -->
@ -255,6 +263,7 @@
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
<!-- Spigot-Api, http://www.spigotmc.org/ Based on the Bukkit project, <!-- Spigot-Api, http://www.spigotmc.org/ Based on the Bukkit project,
@ -264,6 +273,21 @@
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>${bukkitVersion}</version> <version>${bukkitVersion}</version>
<scope>provided</scope> <scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
<exclusion>
<artifactId>json-simple</artifactId>
<groupId>com.googlecode.json-simple</groupId>
</exclusion>
<exclusion>
<artifactId>persistence-api</artifactId>
<groupId>javax.persistence</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- Attribute --> <!-- Attribute -->
@ -282,6 +306,25 @@
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency>
<!--ProtocolLib http://dev.bukkit.org/bukkit-plugins/protocollib/ -->
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.4.0</version>
<optional>true</optional>
<exclusions>
<exclusion>
<artifactId>cglib-nodep</artifactId>
<groupId>cglib</groupId>
</exclusion>
<exclusion>
<artifactId>BukkitExecutors</artifactId>
<groupId>com.comphenix.executors</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<!-- Vault, http://dev.bukkit.org/bukkit-plugins/vault/ --> <!-- Vault, http://dev.bukkit.org/bukkit-plugins/vault/ -->
@ -300,6 +343,7 @@
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
<!-- Multi World plugin, http://www.spigotmc.org/resources/multiverse-core.390/ --> <!-- Multi World plugin, http://www.spigotmc.org/resources/multiverse-core.390/ -->
@ -330,7 +374,28 @@
<artifactId>CommandHandler</artifactId> <artifactId>CommandHandler</artifactId>
<groupId>com.pneumaticraft.commandhandler</groupId> <groupId>com.pneumaticraft.commandhandler</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>SerializationConfig</artifactId>
<groupId>me.main__.util</groupId>
</exclusion>
<exclusion>
<artifactId>Logging</artifactId>
<groupId>com.dumptruckman.minecraft</groupId>
</exclusion>
<exclusion>
<artifactId>metrics</artifactId>
<groupId>org.mcstats.bukkit</groupId>
</exclusion>
<exclusion>
<artifactId>buscript</artifactId>
<groupId>com.dumptruckman.minecraft</groupId>
</exclusion>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
<!-- Essentials plugin --> <!-- Essentials plugin -->
@ -345,6 +410,7 @@
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
<!-- Anti PvPLogging plugin, https://github.com/MinelinkNetwork/CombatTagPlus --> <!-- Anti PvPLogging plugin, https://github.com/MinelinkNetwork/CombatTagPlus -->
@ -419,6 +485,7 @@
<groupId>org.mcstats.bukkit</groupId> <groupId>org.mcstats.bukkit</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
<!-- XAuth, another authentication plugin, required by the database converter --> <!-- XAuth, another authentication plugin, required by the database converter -->
@ -456,101 +523,12 @@
<artifactId>AccountsClient</artifactId> <artifactId>AccountsClient</artifactId>
<groupId>com.mojang</groupId> <groupId>com.mojang</groupId>
</exclusion> </exclusion>
</exclusions>
</dependency>
<!-- ChestShop, on our maven repo http://dev.bukkit.org/bukkit-plugins/chestshop/ -->
<dependency>
<groupId>com.acrobot.chestshop</groupId>
<artifactId>chestshop</artifactId>
<version>3.8.12</version>
<scope>provided</scope>
<exclusions>
<exclusion> <exclusion>
<groupId>org.bukkit</groupId> <artifactId>log4j-core</artifactId>
<artifactId>bukkit</artifactId> <groupId>org.apache.logging.log4j</groupId>
</exclusion>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
</exclusion>
<exclusion>
<artifactId>Vault</artifactId>
<groupId>net.milkbowl.vault</groupId>
</exclusion>
<exclusion>
<artifactId>odditem</artifactId>
<groupId>info.somethingodd</groupId>
</exclusion>
<exclusion>
<artifactId>scrollingmenusign</artifactId>
<groupId>me.desht</groupId>
</exclusion>
<exclusion>
<artifactId>truezip</artifactId>
<groupId>de.schlichtherle</groupId>
</exclusion>
<exclusion>
<artifactId>residence</artifactId>
<groupId>net.t00thpick1</groupId>
</exclusion>
<exclusion>
<artifactId>Heroes</artifactId>
<groupId>com.herocraftonline.heroes</groupId>
</exclusion>
<exclusion>
<artifactId>HeroChat</artifactId>
<groupId>com.dthielke.herochat</groupId>
</exclusion>
<exclusion>
<artifactId>worldguard</artifactId>
<groupId>com.sk89q</groupId>
</exclusion>
<exclusion>
<artifactId>worldedit</artifactId>
<groupId>com.sk89q</groupId>
</exclusion>
<exclusion>
<artifactId>lwc</artifactId>
<groupId>com.griefcraft.lwc</groupId>
</exclusion>
<exclusion>
<artifactId>js</artifactId>
<groupId>rhino</groupId>
</exclusion>
<exclusion>
<artifactId>jchronic</artifactId>
<groupId>com.sk89q</groupId>
</exclusion>
<exclusion>
<artifactId>deadbolt</artifactId>
<groupId>com.daemitus.deadbolt</groupId>
</exclusion>
<exclusion>
<artifactId>bukkit-classloader-check</artifactId>
<groupId>com.sk89q.spigot</groupId>
</exclusion>
<exclusion>
<artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId>
</exclusion>
<exclusion>
<artifactId>opencsv</artifactId>
<groupId>net.sf.opencsv</groupId>
</exclusion>
<exclusion>
<artifactId>simplechestlock</artifactId>
<groupId>com.webkonsept.bukkit.simplechestlock</groupId>
</exclusion>
<exclusion>
<artifactId>commandbook</artifactId>
<groupId>com.sk89q</groupId>
</exclusion>
<exclusion>
<artifactId>lockette</artifactId>
<groupId>org.yi.acru.bukkit.lockette</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
<optional>true</optional>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -1,7 +1,7 @@
package fr.xephi.authme; package fr.xephi.authme;
import com.comphenix.protocol.ProtocolLibrary;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import com.maxmind.geoip.LookupService;
import com.onarandombox.MultiverseCore.MultiverseCore; import com.onarandombox.MultiverseCore.MultiverseCore;
import fr.xephi.authme.api.API; import fr.xephi.authme.api.API;
import fr.xephi.authme.api.NewAPI; import fr.xephi.authme.api.NewAPI;
@ -38,7 +38,8 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import org.mcstats.Metrics; import org.mcstats.Metrics;
import java.io.*; import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.Calendar; import java.util.Calendar;
@ -64,8 +65,6 @@ public class AuthMe extends JavaPlugin {
private JsonCache playerBackup; private JsonCache playerBackup;
public OtherAccounts otherAccounts; public OtherAccounts otherAccounts;
public Location essentialsSpawn; public Location essentialsSpawn;
public LookupService lookupService;
public boolean legacyChestShop = false;
public boolean antibotMod = false; public boolean antibotMod = false;
public boolean delayedAntiBot = true; public boolean delayedAntiBot = true;
@ -74,6 +73,7 @@ public class AuthMe extends JavaPlugin {
public Essentials ess; public Essentials ess;
public MultiverseCore multiverse; public MultiverseCore multiverse;
public CombatTagPlus combatTagPlus; public CombatTagPlus combatTagPlus;
public AuthMeInventoryListener inventoryProtector;
// Manager // Manager
private ModuleManager moduleManager; private ModuleManager moduleManager;
@ -108,6 +108,7 @@ public class AuthMe extends JavaPlugin {
// TODO: split the plugin in more modules // TODO: split the plugin in more modules
moduleManager = new ModuleManager(this); moduleManager = new ModuleManager(this);
@SuppressWarnings("unused")
int loaded = moduleManager.loadModules(); int loaded = moduleManager.loadModules();
// TODO: remove vault as hard dependency // TODO: remove vault as hard dependency
@ -120,7 +121,7 @@ public class AuthMe extends JavaPlugin {
// TODO: new configuration style (more files) // TODO: new configuration style (more files)
try { try {
settings = new Settings(this); settings = new Settings(this);
settings.reload(); Settings.reload();
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.writeStackTrace(e); ConsoleLogger.writeStackTrace(e);
ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!"); ConsoleLogger.showError("Can't load the configuration file... Something went wrong, to avoid security issues the server will shutdown!");
@ -190,15 +191,12 @@ public class AuthMe extends JavaPlugin {
// Check Multiverse // Check Multiverse
checkMultiverse(); checkMultiverse();
// Check PerWorldInventories Version
checkPerWorldInventories();
// Check ChestShop
checkChestShop();
// Check Essentials // Check Essentials
checkEssentials(); checkEssentials();
//Check if the protocollib is available. If so we could listen for inventory protection
checkProtocolLib();
// 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!
@ -221,7 +219,7 @@ public class AuthMe extends JavaPlugin {
} }
// Setup the inventory backup // Setup the inventory backup
playerBackup = new JsonCache(this); playerBackup = new JsonCache();
// Set the DataManager // Set the DataManager
dataManager = new DataManager(this); dataManager = new DataManager(this);
@ -240,12 +238,6 @@ public class AuthMe extends JavaPlugin {
Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this)); Bukkit.getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCordMessage(this));
} }
// Legacy chestshop hook
if (legacyChestShop) {
pm.registerEvents(new AuthMeChestShopListener(this), this);
ConsoleLogger.info("Hooked successfully with ChestShop!");
}
// Reload support hook // Reload support hook
if (Settings.reloadSupport) { if (Settings.reloadSupport) {
if (database != null) { if (database != null) {
@ -384,10 +376,10 @@ public class AuthMe extends JavaPlugin {
if (Settings.isCachingEnabled) { if (Settings.isCachingEnabled) {
database = new CacheDataSource(this, database); database = new CacheDataSource(this, database);
} else {
database = new DatabaseCalls(database);
} }
database = new DatabaseCalls(database);
if (Settings.getDataSource == DataSource.DataSourceType.FILE) { if (Settings.getDataSource == DataSource.DataSourceType.FILE) {
Converter converter = new ForceFlatToSqlite(database, this); Converter converter = new ForceFlatToSqlite(database, this);
server.getScheduler().runTaskAsynchronously(this, converter); server.getScheduler().runTaskAsynchronously(this, converter);
@ -423,53 +415,6 @@ public class AuthMe extends JavaPlugin {
} }
} }
// Check the version of the ChestShop plugin
public void checkChestShop() {
if (Settings.legacyChestShop && server.getPluginManager().isPluginEnabled("ChestShop")) {
String rawver = com.Acrobot.ChestShop.ChestShop.getVersion();
double version;
try {
version = Double.valueOf(rawver.split(" ")[0]);
} catch (NumberFormatException nfe) {
try {
version = Double.valueOf(rawver.split("t")[0]);
} catch (NumberFormatException nfee) {
legacyChestShop = false;
return;
}
}
if (version >= 3.813) {
return;
}
if (version < 3.50) {
ConsoleLogger.showError("Please Update your ChestShop version! Bugs may occur!");
return;
}
legacyChestShop = true;
} else {
legacyChestShop = false;
}
}
// Check PerWorldInventories version
public void checkPerWorldInventories() {
if (server.getPluginManager().isPluginEnabled("PerWorldInventories")) {
double version = 0;
String ver = server.getPluginManager().getPlugin("PerWorldInventories").getDescription().getVersion();
try {
version = Double.valueOf(ver.split(" ")[0]);
} catch (NumberFormatException nfe) {
try {
version = Double.valueOf(ver.split("t")[0]);
} catch (NumberFormatException ignore) {
}
}
if (version < 1.57) {
ConsoleLogger.showError("Please Update your PerWorldInventories version! INVENTORY WIPE may occur!");
}
}
}
// Get the Multiverse plugin // Get the Multiverse plugin
public void checkMultiverse() { public void checkMultiverse() {
if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) { if (Settings.multiverse && server.getPluginManager().isPluginEnabled("Multiverse-Core")) {
@ -523,6 +468,19 @@ public class AuthMe extends JavaPlugin {
} }
} }
// Check the presence of the ProtocolLib plugin
public void checkProtocolLib() {
if (Settings.protectInventoryBeforeLogInEnabled) {
if (server.getPluginManager().isPluginEnabled("ProtocolLib")) {
inventoryProtector = new AuthMeInventoryListener(this);
ProtocolLibrary.getProtocolManager().addPacketListener(inventoryProtector);
} else {
ConsoleLogger.showError("WARNING!!! The protectInventory feature requires ProtocolLib! Disabling it...");
Settings.protectInventoryBeforeLogInEnabled = false;
}
}
}
// Check if a player/command sender have a permission // Check if a player/command sender have a permission
public boolean authmePermissible(Player player, String perm) { public boolean authmePermissible(Player player, String perm) {
if (player.hasPermission(perm)) { if (player.hasPermission(perm)) {
@ -554,13 +512,10 @@ public class AuthMe extends JavaPlugin {
} }
if (LimboCache.getInstance().hasLimboPlayer(name)) { if (LimboCache.getInstance().hasLimboPlayer(name)) {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
if (Settings.protectInventoryBeforeLogInEnabled) {
player.getInventory().setArmorContents(limbo.getArmour());
player.getInventory().setContents(limbo.getInventory());
}
if (!Settings.noTeleport) { if (!Settings.noTeleport) {
player.teleport(limbo.getLoc()); player.teleport(limbo.getLoc());
} }
Utils.addNormal(player, limbo.getGroup()); Utils.addNormal(player, limbo.getGroup());
player.setOp(limbo.getOperator()); player.setOp(limbo.getOperator());
limbo.getTimeoutTaskId().cancel(); limbo.getTimeoutTaskId().cancel();
@ -768,5 +723,14 @@ public class AuthMe extends JavaPlugin {
return realIP; return realIP;
} }
@Deprecated
public String getCountryCode(String ip) {
return Utils.getCountryCode(ip);
}
@Deprecated
public String getCountryName(String ip) {
return Utils.getCountryName(ip);
}
} }

View File

@ -160,7 +160,6 @@ public class Utils {
} }
// TODO: remove if not needed // TODO: remove if not needed
@SuppressWarnings("unused")
public static void hasPermOnJoin(Player player) { public static void hasPermOnJoin(Player player) {
if (plugin.permission == null) if (plugin.permission == null)
return; return;
@ -176,20 +175,24 @@ public class Utils {
if (player == null || Utils.isUnrestricted(player)) { if (player == null || Utils.isUnrestricted(player)) {
return true; return true;
} }
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
return true; return true;
} }
if (!plugin.database.isAuthAvailable(name)) {
if (!Settings.isForcedRegistrationEnabled) { if (!Settings.isForcedRegistrationEnabled) {
if (!plugin.database.isAuthAvailable(name)) {
return true; return true;
} }
} }
return false; return false;
} }
public static boolean isUnrestricted(Player player) { public static boolean isUnrestricted(Player player) {
return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName())); return Settings.isAllowRestrictedIp && !Settings.getUnrestrictedName.isEmpty()
&& (Settings.getUnrestrictedName.contains(player.getName()));
} }
private static boolean useGroupSystem() { private static boolean useGroupSystem() {

View File

@ -159,7 +159,7 @@ public class API {
if (isRegistered(name)) { if (isRegistered(name)) {
return false; return false;
} }
PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com"); PlayerAuth auth = new PlayerAuth(name, hash, "198.18.0.1", 0, "your@email.com", playerName);
if (!instance.database.saveAuth(auth)) { if (!instance.database.saveAuth(auth)) {
return false; return false;
} }

View File

@ -6,11 +6,9 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.Utils; import fr.xephi.authme.Utils;
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;
@ -94,16 +92,6 @@ public class NewAPI {
} }
} }
public void setPlayerInventory(Player player, ItemStack[] content,
ItemStack[] armor) {
try {
player.getInventory().setContents(content);
player.getInventory().setArmorContents(armor);
} catch (Exception npe) {
ConsoleLogger.showError("Some error appear while trying to set inventory for " + player.getName());
}
}
/** /**
* *
* @param playerName * @param playerName
@ -145,7 +133,7 @@ public class NewAPI {
if (isRegistered(name)) { if (isRegistered(name)) {
return false; return false;
} }
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com"); PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0, "your@email.com", playerName);
return plugin.database.saveAuth(auth); return plugin.database.saveAuth(auth);
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException ex) {
return false; return false;

View File

@ -1,36 +1,17 @@
package fr.xephi.authme.cache.backup; package fr.xephi.authme.cache.backup;
import org.bukkit.inventory.ItemStack;
public class DataFileCache { public class DataFileCache {
private ItemStack[] inventory;
private ItemStack[] armor;
private String group; private String group;
private boolean operator; private boolean operator;
private boolean flying; private boolean flying;
public DataFileCache(ItemStack[] inventory, ItemStack[] armor) { public DataFileCache(String group, boolean operator, boolean flying) {
this(inventory, armor, "", false, false);
}
public DataFileCache(ItemStack[] inventory, ItemStack[] armor,
String group, boolean operator, boolean flying) {
this.inventory = inventory;
this.armor = armor;
this.group = group; this.group = group;
this.operator = operator; this.operator = operator;
this.flying = flying; this.flying = flying;
} }
public ItemStack[] getInventory() {
return inventory;
}
public ItemStack[] getArmour() {
return armor;
}
public String getGroup() { public String getGroup() {
return group; return group;
} }

View File

@ -3,20 +3,13 @@ package fr.xephi.authme.cache.backup;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.google.gson.*; import com.google.gson.*;
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.settings.Settings; import fr.xephi.authme.settings.Settings;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import java.io.ByteArrayInputStream; import org.bukkit.entity.Player;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@ -24,11 +17,9 @@ import java.lang.reflect.Type;
public class JsonCache { public class JsonCache {
private final Gson gson; private final Gson gson;
private final AuthMe plugin;
private final File cacheDir; private final File cacheDir;
public JsonCache(AuthMe plugin) { public JsonCache() {
this.plugin = plugin;
cacheDir = Settings.CACHE_FOLDER; cacheDir = Settings.CACHE_FOLDER;
if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) { if (!cacheDir.exists() && !cacheDir.isDirectory() && !cacheDir.mkdir()) {
ConsoleLogger.showError("Failed to create cache directory."); ConsoleLogger.showError("Failed to create cache directory.");
@ -99,49 +90,8 @@ public class JsonCache {
jsonObject.addProperty("operator", dataFileCache.getOperator()); jsonObject.addProperty("operator", dataFileCache.getOperator());
jsonObject.addProperty("flying", dataFileCache.isFlying()); jsonObject.addProperty("flying", dataFileCache.isFlying());
JsonArray arr;
ItemStack[] contents;
// inventory
contents = dataFileCache.getInventory();
arr = new JsonArray();
putItems(contents, arr);
jsonObject.add("inventory", arr);
// armour
contents = dataFileCache.getArmour();
arr = new JsonArray();
putItems(contents, arr);
jsonObject.add("armour", arr);
return jsonObject; return jsonObject;
} }
private void putItems(ItemStack[] contents, JsonArray target) {
for (ItemStack item : contents) {
if (item == null) {
item = new ItemStack(Material.AIR);
}
JsonObject val = new JsonObject();
if (item.getType() == Material.SKULL_ITEM) {
SkullMeta meta = (SkullMeta) item.getItemMeta();
if (meta.hasOwner() && (meta.getOwner() == null || meta.getOwner().isEmpty())) {
item.setItemMeta(plugin.getServer().getItemFactory().getItemMeta(Material.SKULL_ITEM));
}
}
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BukkitObjectOutputStream objectOut = new BukkitObjectOutputStream(baos);
objectOut.writeObject(item);
objectOut.close();
val.addProperty("item", Base64Coder.encodeLines(baos.toByteArray()));
} catch (IOException e) {
e.printStackTrace();
continue;
}
target.add(val);
}
}
} }
private static class PlayerDataDeserializer implements JsonDeserializer<DataFileCache> { private static class PlayerDataDeserializer implements JsonDeserializer<DataFileCache> {
@ -166,39 +116,7 @@ public class JsonCache {
flying = e.getAsBoolean(); flying = e.getAsBoolean();
} }
JsonArray arr; return new DataFileCache(group, operator, flying);
ItemStack[] inv = null;
ItemStack[] armour = null;
if (jsonObject.has("inventory")) {
arr = jsonObject.get("inventory").getAsJsonArray();
inv = getItems(arr);
}
if (jsonObject.has("armour")) {
arr = jsonObject.get("armour").getAsJsonArray();
armour = getItems(arr);
}
return new DataFileCache(inv, armour, group, operator, flying);
}
private ItemStack[] getItems(JsonArray arr) {
ItemStack[] contents = new ItemStack[arr.size()];
for (int i = 0; i < arr.size(); i++) {
JsonObject item = arr.get(i).getAsJsonObject();
String encoded = item.get("item").getAsString();
byte[] decoded = Base64Coder.decodeLines(encoded);
try {
ByteArrayInputStream baos = new ByteArrayInputStream(decoded);
BukkitObjectInputStream objectIn = new BukkitObjectInputStream(baos);
contents[i] = (ItemStack) objectIn.readObject();
objectIn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
return contents;
} }
} }

View File

@ -11,7 +11,6 @@ import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -25,15 +24,13 @@ public class LimboCache {
private LimboCache(AuthMe plugin) { private LimboCache(AuthMe plugin) {
this.plugin = plugin; this.plugin = plugin;
this.cache = new ConcurrentHashMap<>(); this.cache = new ConcurrentHashMap<>();
this.playerData = new JsonCache(plugin); this.playerData = new JsonCache();
} }
public void addLimboPlayer(Player player) { public void addLimboPlayer(Player player) {
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
Location loc = player.getLocation(); Location loc = player.getLocation();
GameMode gameMode = player.getGameMode(); GameMode gameMode = player.getGameMode();
ItemStack[] arm;
ItemStack[] inv;
boolean operator = false; boolean operator = false;
String playerGroup = ""; String playerGroup = "";
boolean flying = false; boolean flying = false;
@ -42,12 +39,10 @@ public class LimboCache {
final StoreInventoryEvent event = new StoreInventoryEvent(player, playerData); final StoreInventoryEvent event = new StoreInventoryEvent(player, playerData);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) { if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) {
inv = event.getInventory(); player.getInventory().setContents(event.getInventory());
arm = event.getArmor(); player.getInventory().setArmorContents(event.getArmor());
} else {
inv = null;
arm = null;
} }
DataFileCache cache = playerData.readCache(player); DataFileCache cache = playerData.readCache(player);
if (cache != null) { if (cache != null) {
playerGroup = cache.getGroup(); playerGroup = cache.getGroup();
@ -58,12 +53,10 @@ public class LimboCache {
StoreInventoryEvent event = new StoreInventoryEvent(player); StoreInventoryEvent event = new StoreInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) { if (!event.isCancelled() && event.getInventory() != null && event.getArmor() != null) {
inv = event.getInventory(); player.getInventory().setContents(event.getInventory());
arm = event.getArmor(); player.getInventory().setArmorContents(event.getArmor());
} else {
inv = null;
arm = null;
} }
operator = player.isOp(); operator = player.isOp();
flying = player.isFlying(); flying = player.isFlying();
if (plugin.permission != null) { if (plugin.permission != null) {
@ -93,7 +86,7 @@ public class LimboCache {
if (player.isDead()) { if (player.isDead()) {
loc = plugin.getSpawnLocation(player); loc = plugin.getSpawnLocation(player);
} }
cache.put(name, new LimboPlayer(name, loc, inv, arm, gameMode, operator, playerGroup, flying)); cache.put(name, new LimboPlayer(name, loc, gameMode, operator, playerGroup, flying));
} }
public void addLimboPlayer(Player player, String group) { public void addLimboPlayer(Player player, String group) {

View File

@ -2,14 +2,11 @@ package fr.xephi.authme.cache.limbo;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
public class LimboPlayer { public class LimboPlayer {
private String name; private String name;
private ItemStack[] inventory;
private ItemStack[] armour;
private Location loc = null; private Location loc = null;
private BukkitTask timeoutTaskId = null; private BukkitTask timeoutTaskId = null;
private BukkitTask messageTaskId = null; private BukkitTask messageTaskId = null;
@ -18,19 +15,6 @@ public class LimboPlayer {
private String group = ""; private String group = "";
private boolean flying = false; private boolean flying = false;
public LimboPlayer(String name, Location loc, ItemStack[] inventory,
ItemStack[] armour, GameMode gameMode, boolean operator,
String group, boolean flying) {
this.name = name;
this.loc = loc;
this.inventory = inventory;
this.armour = armour;
this.gameMode = gameMode;
this.operator = operator;
this.group = group;
this.flying = flying;
}
public LimboPlayer(String name, Location loc, GameMode gameMode, public LimboPlayer(String name, Location loc, GameMode gameMode,
boolean operator, String group, boolean flying) { boolean operator, String group, boolean flying) {
this.name = name; this.name = name;
@ -54,22 +38,6 @@ public class LimboPlayer {
return loc; return loc;
} }
public ItemStack[] getArmour() {
return armour;
}
public ItemStack[] getInventory() {
return inventory;
}
public void setArmour(ItemStack[] armour) {
this.armour = armour;
}
public void setInventory(ItemStack[] inventory) {
this.inventory = inventory;
}
public GameMode getGameMode() { public GameMode getGameMode() {
return gameMode; return gameMode;
} }
@ -105,5 +73,4 @@ public class LimboPlayer {
public boolean isFlying() { public boolean isFlying() {
return flying; return flying;
} }
} }

View File

@ -109,7 +109,7 @@ public class AdminCommand implements CommandExecutor {
} }
} else if (args[0].equalsIgnoreCase("reload")) { } else if (args[0].equalsIgnoreCase("reload")) {
try { try {
plugin.getSettings().reload(); Settings.reload();
m.reloadMessages(); m.reloadMessages();
plugin.database.close(); plugin.database.close();
plugin.setupDatabase(); plugin.setupDatabase();
@ -260,7 +260,7 @@ public class AdminCommand implements CommandExecutor {
return; return;
} }
String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name); String hash = PasswordSecurity.getHash(Settings.getPasswordHash, lowpass, name);
PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com"); PlayerAuth auth = new PlayerAuth(name, hash, "192.168.0.1", 0L, "your@email.com", name);
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)
auth.setSalt(PasswordSecurity.userSalt.get(name)); auth.setSalt(PasswordSecurity.userSalt.get(name));
else auth.setSalt(""); else auth.setSalt("");

View File

@ -62,7 +62,7 @@ public class ChangePasswordCommand implements CommandExecutor {
return true; return true;
} }
} }
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, args[0])); plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new ChangePasswordTask(plugin, player, args[0], args[1]));
return true; return true;
} }
} }

View File

@ -173,12 +173,9 @@ public class EmailCommand implements CommandExecutor {
plugin.database.updatePassword(auth); plugin.database.updatePassword(auth);
plugin.mail.main(auth, thePass); plugin.mail.main(auth, thePass);
m.send(player, "email_send"); m.send(player, "email_send");
} catch (NoSuchAlgorithmException ex) { } catch (NoSuchAlgorithmException | NoClassDefFoundError ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m.send(sender, "error"); m.send(sender, "error");
} catch (NoClassDefFoundError ncdfe) {
ConsoleLogger.showError(ncdfe.getMessage());
m.send(sender, "error");
} }
} else { } else {
m.send(player, "reg_email_msg"); m.send(player, "reg_email_msg");

View File

@ -18,7 +18,6 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
@ -34,7 +33,7 @@ public class UnregisterCommand implements CommandExecutor {
public UnregisterCommand(AuthMe plugin) { public UnregisterCommand(AuthMe plugin) {
this.plugin = plugin; this.plugin = plugin;
this.playerCache = new JsonCache(plugin); this.playerCache = new JsonCache();
} }
@Override @Override
@ -79,8 +78,7 @@ public class UnregisterCommand implements CommandExecutor {
player.teleport(tpEvent.getTo()); player.teleport(tpEvent.getTo());
} }
} }
player.getInventory().setContents(new ItemStack[36]);
player.getInventory().setArmorContents(new ItemStack[4]);
player.saveData(); player.saveData();
PlayerCache.getInstance().removePlayer(player.getName().toLowerCase()); PlayerCache.getInstance().removePlayer(player.getName().toLowerCase());
if (!Settings.getRegisteredGroup.isEmpty()) if (!Settings.getRegisteredGroup.isEmpty())

View File

@ -1,20 +1,18 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
/** /**
*
* @author Xephi59 * @author Xephi59
*/ */
public class CrazyLoginConverter implements Converter { public class CrazyLoginConverter implements Converter {
@ -33,22 +31,17 @@ public class CrazyLoginConverter implements Converter {
return this; return this;
} }
private static String fileName;
private static File source;
@Override @Override
public void run() { public void run() {
fileName = Settings.crazyloginFileName; String fileName = Settings.crazyloginFileName;
try { try {
source = new File(AuthMe.getInstance().getDataFolder() + File.separator + fileName); File source = new File(AuthMe.getInstance().getDataFolder() + File.separator + fileName);
if (!source.exists()) { if (!source.exists()) {
sender.sendMessage("Error while trying to import datas, please put " + fileName + " in AuthMe folder!"); sender.sendMessage("Error while trying to import datas, please put " + fileName + " in AuthMe folder!");
return; return;
} }
source.createNewFile();
BufferedReader users = null;
String line; String line;
users = new BufferedReader(new FileReader(source)); BufferedReader users = new BufferedReader(new FileReader(source));
while ((line = users.readLine()) != null) { while ((line = users.readLine()) != null) {
if (line.contains("|")) { if (line.contains("|")) {
String[] args = line.split("\\|"); String[] args = line.split("\\|");
@ -56,14 +49,11 @@ public class CrazyLoginConverter implements Converter {
continue; continue;
if (args[0].equalsIgnoreCase("name")) if (args[0].equalsIgnoreCase("name"))
continue; continue;
String player = args[0].toLowerCase(); String playerName = args[0].toLowerCase();
String psw = args[1]; String psw = args[1];
try { if (psw != null) {
if (player != null && psw != null) { PlayerAuth auth = new PlayerAuth(playerName, psw, "127.0.0.1", System.currentTimeMillis(), playerName);
PlayerAuth auth = new PlayerAuth(player, psw, "127.0.0.1", System.currentTimeMillis(), player); database.saveAuth(auth);
database.saveAuth(auth);
}
} catch (Exception e) {
} }
} }
} }

View File

@ -1,18 +1,12 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import java.io.*;
/** /**
*
* @author Xephi59 * @author Xephi59
*/ */
public class FlatToSql implements Converter { public class FlatToSql implements Converter {
@ -29,8 +23,6 @@ public class FlatToSql implements Converter {
private static String columnEmail; private static String columnEmail;
private static String columnLogged; private static String columnLogged;
private static String columnID; private static String columnID;
private static File source;
private static File output;
public FlatToSql() { public FlatToSql() {
tableName = Settings.getMySQLTablename; tableName = Settings.getMySQLTablename;
@ -50,9 +42,9 @@ public class FlatToSql implements Converter {
@Override @Override
public void run() { public void run() {
try { try {
source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db"); File source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db");
source.createNewFile(); source.createNewFile();
output = new File(AuthMe.getInstance().getDataFolder() + File.separator + "authme.sql"); File output = new File(AuthMe.getInstance().getDataFolder() + File.separator + "authme.sql");
output.createNewFile(); output.createNewFile();
BufferedReader br = new BufferedReader(new FileReader(source)); BufferedReader br = new BufferedReader(new FileReader(source));
BufferedWriter sql = new BufferedWriter(new FileWriter(output)); BufferedWriter sql = new BufferedWriter(new FileWriter(output));

View File

@ -1,44 +1,44 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.*;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.settings.Settings;
public class FlatToSqlite implements Converter { public class FlatToSqlite implements Converter {
public CommandSender sender; public CommandSender sender;
private String tableName;
private String columnName;
private String columnPassword;
private String columnIp;
private String columnLastLogin;
private String lastlocX;
private String lastlocY;
private String lastlocZ;
private String lastlocWorld;
private String columnEmail;
private String database;
private String columnID;
private Connection con;
public FlatToSqlite(CommandSender sender) { public FlatToSqlite(CommandSender sender) {
this.sender = sender; this.sender = sender;
} }
private static String tableName; private static void close(AutoCloseable o) {
private static String columnName; if (o != null) {
private static String columnPassword; try {
private static String columnIp; o.close();
private static String columnLastLogin; } catch (Exception ex) {
private static String lastlocX; ConsoleLogger.showError(ex.getMessage());
private static String lastlocY; }
private static String lastlocZ; }
private static String lastlocWorld; }
private static String columnEmail;
private static File source;
private static String database;
private static String columnID;
private static Connection con;
@Override @Override
public void run() { public void run() {
@ -55,6 +55,12 @@ public class FlatToSqlite implements Converter {
columnEmail = Settings.getMySQLColumnEmail; columnEmail = Settings.getMySQLColumnEmail;
columnID = Settings.getMySQLColumnId; columnID = Settings.getMySQLColumnId;
File source = new File(Settings.PLUGIN_FOLDER, "auths.db");
if (!source.exists()) {
sender.sendMessage("Source file for FlatFile database not found... Aborting");
return;
}
try { try {
connect(); connect();
setup(); setup();
@ -62,14 +68,12 @@ public class FlatToSqlite implements Converter {
sender.sendMessage("Some error appeared while trying to setup and connect to sqlite database... Aborting"); sender.sendMessage("Some error appeared while trying to setup and connect to sqlite database... Aborting");
return; return;
} }
try {
source = new File(AuthMe.getInstance().getDataFolder() + File.separator + "auths.db"); try (BufferedReader reader = new BufferedReader(new FileReader(source))) {
source.createNewFile();
BufferedReader br = new BufferedReader(new FileReader(source));
String line; String line;
int i = 1; int i = 1;
String newline; String newline;
while ((line = br.readLine()) != null) { while ((line = reader.readLine()) != null) {
String[] args = line.split(":"); String[] args = line.split(":");
if (args.length == 4) if (args.length == 4)
newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", 0, 0, 0, 'world', 'your@email.com');"; newline = "INSERT INTO " + tableName + " VALUES (" + i + ", '" + args[0] + "', '" + args[1] + "', '" + args[2] + "', " + args[3] + ", 0, 0, 0, 'world', 'your@email.com');";
@ -84,25 +88,23 @@ public class FlatToSqlite implements Converter {
saveAuth(newline); saveAuth(newline);
i = i + 1; i = i + 1;
} }
br.close(); String resp = "The FlatFile has been converted to " + database + ".db file";
ConsoleLogger.info("The FlatFile has been converted to " + database + ".db file"); ConsoleLogger.info(resp);
close(); sender.sendMessage(resp);
sender.sendMessage("The FlatFile has been converted to " + database + ".db file");
return;
} 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("Can't open the flat database file!");
} finally {
close(con);
} }
return;
} }
private synchronized static void connect() private synchronized void connect() throws ClassNotFoundException, SQLException {
throws ClassNotFoundException, SQLException {
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");
con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db"); con = DriverManager.getConnection("jdbc:sqlite:plugins/AuthMe/" + database + ".db");
} }
private synchronized static void setup() throws SQLException { private synchronized void setup() throws SQLException {
Statement st = null; Statement st = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
@ -145,7 +147,7 @@ public class FlatToSqlite implements Converter {
} }
} }
private static synchronized boolean saveAuth(String s) { private synchronized boolean saveAuth(String s) {
PreparedStatement pst = null; PreparedStatement pst = null;
try { try {
pst = con.prepareStatement(s); pst = con.prepareStatement(s);
@ -158,32 +160,4 @@ public class FlatToSqlite implements Converter {
} }
return true; return true;
} }
private static void close(Statement st) {
if (st != null) {
try {
st.close();
} catch (SQLException ex) {
ConsoleLogger.showError(ex.getMessage());
}
}
}
private static void close(ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException ex) {
ConsoleLogger.showError(ex.getMessage());
}
}
}
public synchronized static void close() {
try {
con.close();
} catch (SQLException ex) {
ConsoleLogger.showError(ex.getMessage());
}
}
} }

View File

@ -5,15 +5,13 @@ import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.SQLite; import fr.xephi.authme.datasource.SQLite;
import fr.xephi.authme.settings.Settings;
public class ForceFlatToSqlite implements Converter { public class ForceFlatToSqlite implements Converter {
private DataSource data; private DataSource data;
private AuthMe plugin;
public ForceFlatToSqlite(DataSource data, AuthMe plugin) { public ForceFlatToSqlite(DataSource data, AuthMe plugin) {
this.data = data; this.data = data;
this.plugin = plugin;
} }
@Override @Override
@ -25,7 +23,7 @@ public class ForceFlatToSqlite implements Converter {
auth.setRealName("Player"); auth.setRealName("Player");
sqlite.saveAuth(auth); sqlite.saveAuth(auth);
} }
plugin.getSettings().setValue("DataSource.backend", "sqlite"); Settings.setValue("DataSource.backend", "sqlite");
ConsoleLogger.info("Database successfully converted to sqlite !"); ConsoleLogger.info("Database successfully converted to sqlite !");
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.showError("An error appeared while trying to convert flatfile to sqlite ..."); ConsoleLogger.showError("An error appeared while trying to convert flatfile to sqlite ...");

View File

@ -1,5 +1,14 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Settings;
import org.bukkit.command.CommandSender;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
@ -8,18 +17,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.security.HashAlgorithm;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.settings.Settings;
/** /**
*
* @author Xephi59 * @author Xephi59
*/ */
public class RakamakConverter implements Converter { public class RakamakConverter implements Converter {
@ -38,27 +36,19 @@ public class RakamakConverter implements Converter {
return this; return this;
} }
private static Boolean useIP;
private static String fileName;
private static String ipFileName;
private static File source;
private static File ipfiles;
@Override @Override
public void run() { public void run() {
HashAlgorithm hash = Settings.getPasswordHash; HashAlgorithm hash = Settings.getPasswordHash;
useIP = Settings.rakamakUseIp; boolean useIP = Settings.rakamakUseIp;
fileName = Settings.rakamakUsers; String fileName = Settings.rakamakUsers;
ipFileName = Settings.rakamakUsersIp; String ipFileName = Settings.rakamakUsersIp;
HashMap<String, String> playerIP = new HashMap<String, String>(); File source = new File(Settings.PLUGIN_FOLDER, fileName);
HashMap<String, String> playerPSW = new HashMap<String, String>(); File ipfiles = new File(Settings.PLUGIN_FOLDER, ipFileName);
HashMap<String, String> playerIP = new HashMap<>();
HashMap<String, String> playerPSW = new HashMap<>();
try { try {
source = new File(AuthMe.getInstance().getDataFolder() + File.separator + fileName); BufferedReader users;
ipfiles = new File(AuthMe.getInstance().getDataFolder() + File.separator + ipFileName); BufferedReader ipFile;
source.createNewFile();
ipfiles.createNewFile();
BufferedReader users = null;
BufferedReader ipFile = null;
ipFile = new BufferedReader(new FileReader(ipfiles)); ipFile = new BufferedReader(new FileReader(ipfiles));
String line; String line;
if (useIP) { if (useIP) {
@ -84,17 +74,17 @@ public class RakamakConverter implements Converter {
} }
users.close(); users.close();
for (Entry<String, String> m : playerPSW.entrySet()) { for (Entry<String, String> m : playerPSW.entrySet()) {
String player = m.getKey(); String playerName = m.getKey();
String psw = playerPSW.get(player); String psw = playerPSW.get(playerName);
String ip; String ip;
if (useIP) { if (useIP) {
ip = playerIP.get(player); ip = playerIP.get(playerName);
} else { } else {
ip = "127.0.0.1"; ip = "127.0.0.1";
} }
PlayerAuth auth = new PlayerAuth(player, psw, ip, System.currentTimeMillis(), player); PlayerAuth auth = new PlayerAuth(playerName, psw, ip, System.currentTimeMillis(), playerName);
if (PasswordSecurity.userSalt.containsKey(player)) if (PasswordSecurity.userSalt.containsKey(playerName))
auth.setSalt(PasswordSecurity.userSalt.get(player)); auth.setSalt(PasswordSecurity.userSalt.get(playerName));
database.saveAuth(auth); database.saveAuth(auth);
} }
ConsoleLogger.info("Rakamak database has been imported correctly"); ConsoleLogger.info("Rakamak database has been imported correctly");

View File

@ -1,13 +1,12 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import java.io.File;
import org.bukkit.OfflinePlayer;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import org.bukkit.OfflinePlayer;
import java.io.File;
public class RoyalAuthConverter implements Converter { public class RoyalAuthConverter implements Converter {
@ -24,16 +23,17 @@ public class RoyalAuthConverter implements Converter {
for (OfflinePlayer o : plugin.getServer().getOfflinePlayers()) { for (OfflinePlayer o : plugin.getServer().getOfflinePlayers()) {
try { try {
String name = o.getName().toLowerCase(); String name = o.getName().toLowerCase();
String separator = File.separator; String sp = File.separator;
File file = new File("." + separator + "plugins" + separator + "RoyalAuth" + separator + "userdata" + separator + name + ".yml"); File file = new File("." + sp + "plugins" + sp + "RoyalAuth" + sp + "userdata" + sp + name + ".yml");
if (data.isAuthAvailable(name)) if (data.isAuthAvailable(name))
continue; continue;
if (!file.exists()) if (!file.exists())
continue; continue;
RoyalAuthYamlReader ra = new RoyalAuthYamlReader(file); RoyalAuthYamlReader ra = new RoyalAuthYamlReader(file);
PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com"); PlayerAuth auth = new PlayerAuth(name, ra.getHash(), "127.0.0.1", ra.getLastLogin(), "your@email.com", o.getName());
data.saveAuth(auth); data.saveAuth(auth);
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.writeStackTrace(e);
ConsoleLogger.showError("Error while trying to import " + o.getName() + " RoyalAuth datas"); ConsoleLogger.showError("Error while trying to import " + o.getName() + " RoyalAuth datas");
} }
} }

View File

@ -1,9 +1,9 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import java.io.File;
import fr.xephi.authme.settings.CustomConfiguration; import fr.xephi.authme.settings.CustomConfiguration;
import java.io.File;
public class RoyalAuthYamlReader extends CustomConfiguration { public class RoyalAuthYamlReader extends CustomConfiguration {
public RoyalAuthYamlReader(File file) { public RoyalAuthYamlReader(File file) {

View File

@ -1,15 +1,14 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import java.util.List;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.datasource.FlatFile; import fr.xephi.authme.datasource.FlatFile;
import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Messages;
import org.bukkit.command.CommandSender;
import java.util.List;
public class SqlToFlat implements Converter { public class SqlToFlat implements Converter {
@ -38,11 +37,9 @@ public class SqlToFlat implements Converter {
} }
} }
sender.sendMessage("Successfully convert from SQL table to file auths.db"); sender.sendMessage("Successfully convert from SQL table to file auths.db");
return;
} catch (Exception ex) { } catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
Messages.getInstance().send(sender, "error"); Messages.getInstance().send(sender, "error");
return;
} }
} }

View File

@ -1,10 +1,9 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import org.bukkit.command.CommandSender;
public class vAuthConverter implements Converter { public class vAuthConverter implements Converter {

View File

@ -1,18 +1,18 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Scanner; import java.util.Scanner;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
public class vAuthFileReader { public class vAuthFileReader {
public AuthMe plugin; public AuthMe plugin;
@ -27,33 +27,31 @@ public class vAuthFileReader {
public void convert() throws IOException { public void convert() throws IOException {
final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml"); final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml");
Scanner scanner = null; Scanner scanner;
try { try {
scanner = new Scanner(file); scanner = new Scanner(file);
while (scanner.hasNextLine()) { while (scanner.hasNextLine()) {
String line = scanner.nextLine(); String line = scanner.nextLine();
String name = line.split(": ")[0]; String name = line.split(": ")[0];
String password = line.split(": ")[1]; String password = line.split(": ")[1];
PlayerAuth auth = null; PlayerAuth auth;
if (isUUIDinstance(password)) { if (isUUIDinstance(password)) {
String pname = null; String pname;
try { try {
pname = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName(); pname = Bukkit.getOfflinePlayer(UUID.fromString(name)).getName();
} catch (Exception e) { } catch (Exception | NoSuchMethodError e) {
pname = getName(UUID.fromString(name));
} catch (NoSuchMethodError e) {
pname = getName(UUID.fromString(name)); pname = getName(UUID.fromString(name));
} }
if (pname == null) if (pname == null)
continue; continue;
auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com"); auth = new PlayerAuth(pname.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", pname);
} else { } else {
auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com"); auth = new PlayerAuth(name.toLowerCase(), password, "127.0.0.1", System.currentTimeMillis(), "your@email.com", name);
} }
if (auth != null) database.saveAuth(auth);
database.saveAuth(auth);
} }
} catch (Exception e) { } catch (Exception e) {
ConsoleLogger.writeStackTrace(e);
} }
} }
@ -70,7 +68,7 @@ public class vAuthFileReader {
if (op.getUniqueId().compareTo(uuid) == 0) if (op.getUniqueId().compareTo(uuid) == 0)
return op.getName(); return op.getName();
} }
} catch (Exception e) { } catch (Exception ignored) {
} }
return null; return null;
} }

View File

@ -1,8 +1,7 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import org.bukkit.command.CommandSender;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import org.bukkit.command.CommandSender;
public class xAuthConverter implements Converter { public class xAuthConverter implements Converter {

View File

@ -1,5 +1,13 @@
package fr.xephi.authme.converter; package fr.xephi.authme.converter;
import de.luricos.bukkit.xAuth.database.DatabaseTables;
import de.luricos.bukkit.xAuth.utils.xAuthLog;
import de.luricos.bukkit.xAuth.xAuth;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
import org.bukkit.command.CommandSender;
import java.io.File; import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -8,15 +16,6 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.command.CommandSender;
import de.luricos.bukkit.xAuth.xAuth;
import de.luricos.bukkit.xAuth.database.DatabaseTables;
import de.luricos.bukkit.xAuth.utils.xAuthLog;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.datasource.DataSource;
public class xAuthToFlat { public class xAuthToFlat {
public AuthMe instance; public AuthMe instance;
@ -48,7 +47,7 @@ public class xAuthToFlat {
String pl = getIdPlayer(id); String pl = getIdPlayer(id);
String psw = getPassword(id); String psw = getPassword(id);
if (psw != null && !psw.isEmpty() && pl != null) { if (psw != null && !psw.isEmpty() && pl != null) {
PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com"); PlayerAuth auth = new PlayerAuth(pl, psw, "192.168.0.1", 0, "your@email.com", pl);
database.saveAuth(auth); database.saveAuth(auth);
} }
} }
@ -82,7 +81,7 @@ public class xAuthToFlat {
} }
public List<Integer> getXAuthPlayers() { public List<Integer> getXAuthPlayers() {
List<Integer> xP = new ArrayList<Integer>(); List<Integer> xP = new ArrayList<>();
Connection conn = xAuth.getPlugin().getDatabaseController().getConnection(); Connection conn = xAuth.getPlugin().getDatabaseController().getConnection();
PreparedStatement ps = null; PreparedStatement ps = null;
ResultSet rs = null; ResultSet rs = null;
@ -95,7 +94,7 @@ public class xAuthToFlat {
} }
} catch (SQLException e) { } catch (SQLException e) {
xAuthLog.severe("Cannot import xAuthPlayers", e); xAuthLog.severe("Cannot import xAuthPlayers", e);
return new ArrayList<Integer>(); return new ArrayList<>();
} finally { } finally {
xAuth.getPlugin().getDatabaseController().close(conn, ps, rs); xAuth.getPlugin().getDatabaseController().close(conn, ps, rs);
} }

View File

@ -6,24 +6,29 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache; import fr.xephi.authme.cache.auth.PlayerCache;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class CacheDataSource implements DataSource { public class CacheDataSource implements DataSource {
private final DataSource source; private final DataSource source;
private final AuthMe plugin; private final ExecutorService exec;
private ConcurrentHashMap<String, PlayerAuth> cache = new ConcurrentHashMap<>(); private final ConcurrentHashMap<String, PlayerAuth> cache = new ConcurrentHashMap<>();
public CacheDataSource(AuthMe pl, DataSource src) { public CacheDataSource(AuthMe pl, DataSource src) {
this.plugin = pl;
this.source = src; this.source = src;
this.exec = Executors.newCachedThreadPool();
/* /*
* We need to load all players in cache ... It will took more time to * We need to load all players in cache ... It will took more time to
* load the server, but it will be much easier to check for an * load the server, but it will be much easier to check for an
* isAuthAvailable ! * isAuthAvailable !
*/ */
pl.getServer().getScheduler().runTaskAsynchronously(pl, new Runnable() { exec.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
for (PlayerAuth auth : source.getAllAuths()) { for (PlayerAuth auth : source.getAllAuths()) {
@ -50,7 +55,7 @@ public class CacheDataSource implements DataSource {
@Override @Override
public synchronized boolean saveAuth(final PlayerAuth auth) { public synchronized boolean saveAuth(final PlayerAuth auth) {
cache.put(auth.getNickname(), auth); cache.put(auth.getNickname(), auth);
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() { exec.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!source.saveAuth(auth)) { if (!source.saveAuth(auth)) {
@ -62,45 +67,95 @@ public class CacheDataSource implements DataSource {
} }
@Override @Override
public synchronized boolean updatePassword(PlayerAuth auth) { public synchronized boolean updatePassword(final PlayerAuth auth) {
if (source.updatePassword(auth)) { if (!cache.containsKey(auth.getNickname())) {
if (cache.containsKey(auth.getNickname())) return false;
cache.get(auth.getNickname()).setHash(auth.getHash());
return true;
} }
return false; final String oldHash = cache.get(auth.getNickname()).getHash();
cache.get(auth.getNickname()).setHash(auth.getHash());
exec.execute(new Runnable() {
@Override
public void run() {
if (!source.updatePassword(auth)) {
if (cache.containsKey(auth.getNickname())) {
cache.get(auth.getNickname()).setHash(oldHash);
}
}
}
});
return true;
} }
@Override @Override
public boolean updateSession(PlayerAuth auth) { public boolean updateSession(final PlayerAuth auth) {
if (source.updateSession(auth)) { if (!cache.containsKey(auth.getNickname())) {
if (cache.containsKey(auth.getNickname())) { return false;
cache.get(auth.getNickname()).setIp(auth.getIp());
cache.get(auth.getNickname()).setLastLogin(auth.getLastLogin());
cache.get(auth.getNickname()).setRealName(auth.getRealName());
}
return true;
} }
return false; PlayerAuth cachedAuth = cache.get(auth.getNickname());
final String oldIp = cachedAuth.getIp();
final long oldLastLogin = cachedAuth.getLastLogin();
final String oldRealName = cachedAuth.getRealName();
cachedAuth.setIp(auth.getIp());
cachedAuth.setLastLogin(auth.getLastLogin());
cachedAuth.setRealName(auth.getRealName());
exec.execute(new Runnable() {
@Override
public void run() {
if (!source.updateSession(auth)) {
if (cache.containsKey(auth.getNickname())) {
PlayerAuth cachedAuth = cache.get(auth.getNickname());
cachedAuth.setIp(oldIp);
cachedAuth.setLastLogin(oldLastLogin);
cachedAuth.setRealName(oldRealName);
}
}
}
});
return true;
} }
@Override @Override
public boolean updateQuitLoc(PlayerAuth auth) { public boolean updateQuitLoc(final PlayerAuth auth) {
if (source.updateQuitLoc(auth)) { if (!cache.containsKey(auth.getNickname())) {
if (cache.containsKey(auth.getNickname())) { return false;
cache.get(auth.getNickname()).setQuitLocX(auth.getQuitLocX());
cache.get(auth.getNickname()).setQuitLocY(auth.getQuitLocY());
cache.get(auth.getNickname()).setQuitLocZ(auth.getQuitLocZ());
cache.get(auth.getNickname()).setWorld(auth.getWorld());
}
return true;
} }
return false; final PlayerAuth cachedAuth = cache.get(auth.getNickname());
final double oldX = cachedAuth.getQuitLocX();
final double oldY = cachedAuth.getQuitLocY();
final double oldZ = cachedAuth.getQuitLocZ();
final String oldWorld = cachedAuth.getWorld();
cachedAuth.setQuitLocX(auth.getQuitLocX());
cachedAuth.setQuitLocY(auth.getQuitLocY());
cachedAuth.setQuitLocZ(auth.getQuitLocZ());
cachedAuth.setWorld(auth.getWorld());
exec.execute(new Runnable() {
@Override
public void run() {
if (!source.updateQuitLoc(auth)) {
if (cache.containsKey(auth.getNickname())) {
PlayerAuth cachedAuth = cache.get(auth.getNickname());
cachedAuth.setQuitLocX(oldX);
cachedAuth.setQuitLocY(oldY);
cachedAuth.setQuitLocZ(oldZ);
cachedAuth.setWorld(oldWorld);
}
}
}
});
return true;
} }
@Override @Override
public int getIps(String ip) { public int getIps(String ip) {
return source.getIps(ip); int count = 0;
for (Map.Entry<String, PlayerAuth> p : cache.entrySet()) {
if (p.getValue().getIp().equals(ip)) {
count++;
}
}
return count;
} }
@Override @Override
@ -130,75 +185,133 @@ public class CacheDataSource implements DataSource {
} }
@Override @Override
public synchronized boolean removeAuth(String user) { public synchronized boolean removeAuth(String username) {
if (source.removeAuth(user)) { final String user = username.toLowerCase();
cache.remove(user); final PlayerAuth auth = cache.get(user);
return true; cache.remove(user);
} exec.execute(new Runnable() {
return false; @Override
public void run() {
if (!source.removeAuth(user)) {
cache.put(user, auth);
}
}
});
return true;
} }
@Override @Override
public synchronized void close() { public synchronized void close() {
exec.shutdown();
source.close(); source.close();
} }
@Override @Override
public void reload() { public void reload() {
cache.clear(); exec.execute(new Runnable() {
source.reload(); @Override
for (Player player : Utils.getOnlinePlayers()) { public void run() {
String user = player.getName().toLowerCase(); cache.clear();
if (PlayerCache.getInstance().isAuthenticated(user)) { source.reload();
PlayerAuth auth = source.getAuth(user); for (Player player : Utils.getOnlinePlayers()) {
cache.put(user, auth); String user = player.getName().toLowerCase();
if (PlayerCache.getInstance().isAuthenticated(user)) {
PlayerAuth auth = source.getAuth(user);
cache.put(user, auth);
}
}
} }
} });
} }
@Override @Override
public synchronized boolean updateEmail(PlayerAuth auth) { public synchronized boolean updateEmail(final PlayerAuth auth) {
if (source.updateEmail(auth)) { if (!cache.containsKey(auth.getNickname())) {
if (cache.containsKey(auth.getNickname())) return false;
cache.get(auth.getNickname()).setEmail(auth.getEmail());
return true;
} }
return false; PlayerAuth cachedAuth = cache.get(auth.getNickname());
final String oldEmail = cachedAuth.getEmail();
cachedAuth.setEmail(auth.getEmail());
exec.execute(new Runnable() {
@Override
public void run() {
if (!source.updateEmail(auth)) {
if (cache.containsKey(auth.getNickname())) {
cache.get(auth.getNickname()).setEmail(oldEmail);
}
}
}
});
return true;
} }
@Override @Override
public synchronized boolean updateSalt(PlayerAuth auth) { public synchronized boolean updateSalt(final PlayerAuth auth) {
if (source.updateSalt(auth)) { if (!cache.containsKey(auth.getNickname())) {
if (cache.containsKey(auth.getNickname())) return false;
cache.get(auth.getNickname()).setSalt(auth.getSalt());
return true;
} }
return false; PlayerAuth cachedAuth = cache.get(auth.getNickname());
final String oldSalt = cachedAuth.getSalt();
cachedAuth.setSalt(auth.getSalt());
exec.execute(new Runnable() {
@Override
public void run() {
if (!source.updateSalt(auth)) {
if (cache.containsKey(auth.getNickname())) {
cache.get(auth.getNickname()).setSalt(oldSalt);
}
}
}
});
return true;
} }
@Override @Override
public synchronized List<String> getAllAuthsByName(PlayerAuth auth) { public synchronized List<String> getAllAuthsByName(PlayerAuth auth) {
return source.getAllAuthsByName(auth); List<String> result = new ArrayList<>();
for (Map.Entry<String, PlayerAuth> stringPlayerAuthEntry : cache.entrySet()) {
PlayerAuth p = stringPlayerAuthEntry.getValue();
if (p.getIp().equals(auth.getIp()))
result.add(p.getNickname());
}
return result;
} }
@Override @Override
public synchronized List<String> getAllAuthsByIp(String ip) { public synchronized List<String> getAllAuthsByIp(String ip) {
return source.getAllAuthsByIp(ip); List<String> result = new ArrayList<>();
for (Map.Entry<String, PlayerAuth> stringPlayerAuthEntry : cache.entrySet()) {
PlayerAuth p = stringPlayerAuthEntry.getValue();
if (p.getIp().equals(ip))
result.add(p.getNickname());
}
return result;
} }
@Override @Override
public synchronized List<String> getAllAuthsByEmail(String email) { public synchronized List<String> getAllAuthsByEmail(String email) {
return source.getAllAuthsByEmail(email); List<String> result = new ArrayList<>();
for (Map.Entry<String, PlayerAuth> stringPlayerAuthEntry : cache.entrySet()) {
PlayerAuth p = stringPlayerAuthEntry.getValue();
if (p.getEmail().equals(email))
result.add(p.getNickname());
}
return result;
} }
@Override @Override
public synchronized void purgeBanned(List<String> banned) { public synchronized void purgeBanned(final List<String> banned) {
source.purgeBanned(banned); exec.execute(new Runnable() {
for (PlayerAuth auth : cache.values()) { @Override
if (banned.contains(auth.getNickname())) { public void run() {
cache.remove(auth.getNickname()); source.purgeBanned(banned);
for (PlayerAuth auth : cache.values()) {
if (banned.contains(auth.getNickname())) {
cache.remove(auth.getNickname());
}
}
} }
} });
} }
@Override @Override
@ -208,45 +321,66 @@ public class CacheDataSource implements DataSource {
@Override @Override
public boolean isLogged(String user) { public boolean isLogged(String user) {
return source.isLogged(user.toLowerCase()); user = user.toLowerCase();
return PlayerCache.getInstance().getCache().containsKey(user);
} }
@Override @Override
public void setLogged(String user) { public void setLogged(final String user) {
source.setLogged(user.toLowerCase()); exec.execute(new Runnable() {
@Override
public void run() {
source.setLogged(user.toLowerCase());
}
});
} }
@Override @Override
public void setUnlogged(String user) { public void setUnlogged(final String user) {
source.setUnlogged(user.toLowerCase()); exec.execute(new Runnable() {
@Override
public void run() {
source.setUnlogged(user.toLowerCase());
}
});
} }
@Override @Override
public void purgeLogged() { public void purgeLogged() {
source.purgeLogged(); exec.execute(new Runnable() {
@Override
public void run() {
source.purgeLogged();
}
});
} }
@Override @Override
public int getAccountsRegistered() { public int getAccountsRegistered() {
return source.getAccountsRegistered(); return cache.size();
} }
@Override @Override
public void updateName(String oldone, String newone) { public void updateName(final String oldone, final String newone) {
if (cache.containsKey(oldone)) { if (cache.containsKey(oldone)) {
cache.put(newone, cache.get(oldone)); cache.put(newone, cache.get(oldone));
cache.remove(oldone); cache.remove(oldone);
} }
source.updateName(oldone, newone); exec.execute(new Runnable() {
@Override
public void run() {
source.updateName(oldone, newone);
}
});
} }
@Override @Override
public List<PlayerAuth> getAllAuths() { public List<PlayerAuth> getAllAuths() {
return source.getAllAuths(); return new ArrayList<>(cache.values());
} }
@Override @Override
public List<PlayerAuth> getLoggedPlayers() { public List<PlayerAuth> getLoggedPlayers() {
return source.getLoggedPlayers(); return new ArrayList<>(PlayerCache.getInstance().getCache().values());
} }
} }

View File

@ -4,7 +4,9 @@ import fr.xephi.authme.cache.auth.PlayerAuth;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.*; import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class DatabaseCalls implements DataSource { public class DatabaseCalls implements DataSource {
@ -214,13 +216,8 @@ public class DatabaseCalls implements DataSource {
@Override @Override
public synchronized void close() { public synchronized void close() {
try { exec.shutdown();
exec.shutdown(); database.close();
exec.awaitTermination(10, TimeUnit.SECONDS);
database.close();
} catch (Exception e) {
e.printStackTrace();
}
} }
@Override @Override

View File

@ -284,7 +284,7 @@ public class FlatFile implements DataSource {
public int purgeDatabase(long until) { public int purgeDatabase(long until) {
BufferedReader br = null; BufferedReader br = null;
BufferedWriter bw = null; BufferedWriter bw = null;
ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> lines = new ArrayList<>();
int cleared = 0; int cleared = 0;
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
@ -330,8 +330,8 @@ public class FlatFile implements DataSource {
public List<String> autoPurgeDatabase(long until) { public List<String> autoPurgeDatabase(long until) {
BufferedReader br = null; BufferedReader br = null;
BufferedWriter bw = null; BufferedWriter bw = null;
ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> lines = new ArrayList<>();
List<String> cleared = new ArrayList<String>(); List<String> cleared = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -379,7 +379,7 @@ public class FlatFile implements DataSource {
} }
BufferedReader br = null; BufferedReader br = null;
BufferedWriter bw = null; BufferedWriter bw = null;
ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> lines = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -512,7 +512,7 @@ public class FlatFile implements DataSource {
@Override @Override
public List<String> getAllAuthsByName(PlayerAuth auth) { public List<String> getAllAuthsByName(PlayerAuth auth) {
BufferedReader br = null; BufferedReader br = null;
List<String> countIp = new ArrayList<String>(); List<String> countIp = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -525,10 +525,10 @@ public class FlatFile implements DataSource {
return countIp; return countIp;
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>(); return new ArrayList<>();
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>(); return new ArrayList<>();
} finally { } finally {
if (br != null) { if (br != null) {
try { try {
@ -542,7 +542,7 @@ public class FlatFile implements DataSource {
@Override @Override
public List<String> getAllAuthsByIp(String ip) { public List<String> getAllAuthsByIp(String ip) {
BufferedReader br = null; BufferedReader br = null;
List<String> countIp = new ArrayList<String>(); List<String> countIp = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -555,10 +555,10 @@ public class FlatFile implements DataSource {
return countIp; return countIp;
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>(); return new ArrayList<>();
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>(); return new ArrayList<>();
} finally { } finally {
if (br != null) { if (br != null) {
try { try {
@ -572,7 +572,7 @@ public class FlatFile implements DataSource {
@Override @Override
public List<String> getAllAuthsByEmail(String email) { public List<String> getAllAuthsByEmail(String email) {
BufferedReader br = null; BufferedReader br = null;
List<String> countEmail = new ArrayList<String>(); List<String> countEmail = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -585,10 +585,10 @@ public class FlatFile implements DataSource {
return countEmail; return countEmail;
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>(); return new ArrayList<>();
} catch (IOException ex) { } catch (IOException ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
return new ArrayList<String>(); return new ArrayList<>();
} finally { } finally {
if (br != null) { if (br != null) {
try { try {
@ -603,7 +603,7 @@ public class FlatFile implements DataSource {
public void purgeBanned(List<String> banned) { public void purgeBanned(List<String> banned) {
BufferedReader br = null; BufferedReader br = null;
BufferedWriter bw = null; BufferedWriter bw = null;
ArrayList<String> lines = new ArrayList<String>(); ArrayList<String> lines = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -613,8 +613,7 @@ public class FlatFile implements DataSource {
if (banned.contains(args[0])) { if (banned.contains(args[0])) {
lines.add(line); lines.add(line);
} }
} catch (NullPointerException npe) { } catch (NullPointerException | ArrayIndexOutOfBoundsException exc) {
} catch (ArrayIndexOutOfBoundsException aioobe) {
} }
} }
bw = new BufferedWriter(new FileWriter(source)); bw = new BufferedWriter(new FileWriter(source));
@ -700,7 +699,7 @@ public class FlatFile implements DataSource {
@Override @Override
public List<PlayerAuth> getAllAuths() { public List<PlayerAuth> getAllAuths() {
BufferedReader br = null; BufferedReader br = null;
List<PlayerAuth> auths = new ArrayList<PlayerAuth>(); List<PlayerAuth> auths = new ArrayList<>();
try { try {
br = new BufferedReader(new FileReader(source)); br = new BufferedReader(new FileReader(source));
String line; String line;
@ -746,6 +745,6 @@ public class FlatFile implements DataSource {
@Override @Override
public List<PlayerAuth> getLoggedPlayers() { public List<PlayerAuth> getLoggedPlayers() {
return new ArrayList<PlayerAuth>(); return new ArrayList<>();
} }
} }

View File

@ -18,12 +18,11 @@ public class ProtectInventoryEvent extends CustomEvent {
private ItemStack[] emptyArmor = null; private ItemStack[] emptyArmor = null;
private Player player; private Player player;
public ProtectInventoryEvent(Player player, ItemStack[] storedinventory, public ProtectInventoryEvent(Player player) {
ItemStack[] storedarmor) {
super(true); super(true);
this.player = player; this.player = player;
this.storedinventory = storedinventory; this.storedinventory = player.getInventory().getContents();
this.storedarmor = storedarmor; this.storedarmor = player.getInventory().getArmorContents();
this.emptyInventory = new ItemStack[36]; this.emptyInventory = new ItemStack[36];
this.emptyArmor = new ItemStack[4]; this.emptyArmor = new ItemStack[4];
} }

View File

@ -1,49 +1,23 @@
package fr.xephi.authme.events; package fr.xephi.authme.events;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
/** /**
* * This event restore the inventory.
* This event restore the inventory from cache
* *
* @author Xephi59 * @author Xephi59
*/ */
public class RestoreInventoryEvent extends CustomEvent { public class RestoreInventoryEvent extends CustomEvent {
private ItemStack[] inventory;
private ItemStack[] armor;
private Player player; private Player player;
public RestoreInventoryEvent(Player player, ItemStack[] inventory, public RestoreInventoryEvent(Player player) {
ItemStack[] armor) {
this.player = player; this.player = player;
this.inventory = inventory;
this.armor = armor;
} }
public RestoreInventoryEvent(Player player, ItemStack[] inventory, public RestoreInventoryEvent(Player player, boolean async) {
ItemStack[] armor, boolean b) { super(async);
super(b);
this.player = player; this.player = player;
this.inventory = inventory;
this.armor = armor;
}
public ItemStack[] getInventory() {
return this.inventory;
}
public void setInventory(ItemStack[] inventory) {
this.inventory = inventory;
}
public ItemStack[] getArmor() {
return this.armor;
}
public void setArmor(ItemStack[] armor) {
this.armor = armor;
} }
public Player getPlayer() { public Player getPlayer() {
@ -53,5 +27,4 @@ public class RestoreInventoryEvent extends CustomEvent {
public void setPlayer(Player player) { public void setPlayer(Player player) {
this.player = player; this.player = player;
} }
} }

View File

@ -1,6 +1,5 @@
package fr.xephi.authme.events; package fr.xephi.authme.events;
import fr.xephi.authme.cache.backup.DataFileCache;
import fr.xephi.authme.cache.backup.JsonCache; import fr.xephi.authme.cache.backup.JsonCache;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -24,14 +23,8 @@ public class StoreInventoryEvent extends CustomEvent {
public StoreInventoryEvent(Player player, JsonCache jsonCache) { public StoreInventoryEvent(Player player, JsonCache jsonCache) {
this.player = player; this.player = player;
DataFileCache cache = jsonCache.readCache(player); this.inventory = player.getInventory().getContents();
if (cache != null) { this.armor = player.getInventory().getArmorContents();
this.inventory = cache.getInventory();
this.armor = cache.getArmour();
} else {
this.inventory = player.getInventory().getContents();
this.armor = player.getInventory().getArmorContents();
}
} }
public ItemStack[] getInventory() { public ItemStack[] getInventory() {
@ -57,5 +50,4 @@ public class StoreInventoryEvent extends CustomEvent {
public void setPlayer(Player player) { public void setPlayer(Player player) {
this.player = player; this.player = player;
} }
} }

View File

@ -1,25 +0,0 @@
package fr.xephi.authme.listener;
import com.Acrobot.ChestShop.Events.PreTransactionEvent;
import com.Acrobot.ChestShop.Events.PreTransactionEvent.TransactionOutcome;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class AuthMeChestShopListener implements Listener {
public AuthMe plugin;
public AuthMeChestShopListener(AuthMe plugin) {
this.plugin = plugin;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPreTransaction(PreTransactionEvent event) {
if (Utils.checkAuth(event.getClient()))
return;
event.setCancelled(TransactionOutcome.OTHER);
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.*; import org.bukkit.event.entity.*;
import org.bukkit.projectiles.ProjectileSource;
public class AuthMeEntityListener implements Listener { public class AuthMeEntityListener implements Listener {
@ -121,13 +122,14 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority = EventPriority.HIGHEST) // TODO: Need to check this, player can't throw snowball but the item is taken.
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onProjectileLaunch(ProjectileLaunchEvent event) { public void onProjectileLaunch(ProjectileLaunchEvent event) {
Projectile projectile = event.getEntity(); Projectile projectile = event.getEntity();
if (projectile == null) if (projectile == null)
return; return;
Entity shooter = (Entity) projectile.getShooter(); ProjectileSource shooter = projectile.getShooter();
if (shooter == null || !(shooter instanceof Player)) { if (shooter == null || !(shooter instanceof Player)) {
return; return;
} }
@ -139,7 +141,7 @@ public class AuthMeEntityListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onShoot(EntityShootBowEvent event) { public void onShoot(EntityShootBowEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (entity == null || !(entity instanceof Player)) { if (entity == null || !(entity instanceof Player)) {

View File

@ -0,0 +1,101 @@
/*
* Copyright (C) 2015 AuthMe-Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.xephi.authme.listener;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.settings.Settings;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Collections;
import java.util.logging.Level;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class AuthMeInventoryListener extends PacketAdapter {
private static final int PLAYER_INVENTORY = 0;
//http://wiki.vg/Inventory#Inventory (0-4 crafting, 5-8 armor, 9-35 main inventory, 36-44 inventory)
//+1 because an index starts with 0
private static final int PLAYER_CRAFTING_SIZE = 5;
private static final int HOTBAR_SIZE = 9;
public AuthMeInventoryListener(AuthMe plugin) {
super(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS);
}
@Override
public void onPacketSending(PacketEvent packetEvent) {
Player player = packetEvent.getPlayer();
PacketContainer packet = packetEvent.getPacket();
byte windowId = packet.getIntegers().read(0).byteValue();
if (windowId == PLAYER_INVENTORY && Settings.protectInventoryBeforeLogInEnabled
&& !PlayerCache.getInstance().isAuthenticated(player.getName())) {
packetEvent.setCancelled(true);
}
}
public void sendInventoryPacket(Player player) {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
PacketContainer inventoryPacket = protocolManager.createPacket(PacketType.Play.Server.WINDOW_ITEMS);
//we are sending our own inventory
inventoryPacket.getIntegers().write(0, PLAYER_INVENTORY);
ItemStack[] playerCrafting = new ItemStack[PLAYER_CRAFTING_SIZE];
ItemStack[] armorContents = player.getInventory().getArmorContents();
ItemStack[] mainInventory = player.getInventory().getContents();
//bukkit saves the armor in reversed order
Collections.reverse(Arrays.asList(armorContents));
//same main inventory. The hotbar is at the beginning but it should be at the end of the array
ItemStack[] hotbar = Arrays.copyOfRange(mainInventory, 0, HOTBAR_SIZE);
ItemStack[] storedInventory = Arrays.copyOfRange(mainInventory, HOTBAR_SIZE, mainInventory.length);
//concat all parts of the inventory together
int inventorySize = playerCrafting.length + armorContents.length + mainInventory.length;
ItemStack[] completeInventory = new ItemStack[inventorySize];
System.arraycopy(playerCrafting, 0, completeInventory, 0, playerCrafting.length);
System.arraycopy(armorContents, 0, completeInventory, playerCrafting.length, armorContents.length);
//storedInventory and hotbar
System.arraycopy(storedInventory, 0, completeInventory
, playerCrafting.length + armorContents.length, storedInventory.length);
System.arraycopy(hotbar, 0, completeInventory
, playerCrafting.length + armorContents.length + storedInventory.length, hotbar.length);
inventoryPacket.getItemArrayModifier().write(0, completeInventory);
try {
protocolManager.sendServerPacket(player, inventoryPacket, false);
} catch (InvocationTargetException invocationExc) {
plugin.getLogger().log(Level.WARNING, "Error during inventory recovery", invocationExc);
}
}
}

View File

@ -9,7 +9,6 @@ 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;
import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -66,9 +65,6 @@ public class AuthMePlayerListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (Utils.checkAuth(event.getPlayer()))
return;
String msg = event.getMessage(); String msg = event.getMessage();
if (msg.equalsIgnoreCase("/worldedit cui")) if (msg.equalsIgnoreCase("/worldedit cui"))
return; return;
@ -81,8 +77,10 @@ public class AuthMePlayerListener implements Listener {
if (Settings.allowCommands.contains(cmd)) if (Settings.allowCommands.contains(cmd))
return; return;
event.setMessage("/notloggedin"); if (!Utils.checkAuth(event.getPlayer())) {
event.setCancelled(true); event.setMessage("/notloggedin");
event.setCancelled(true);
}
} }
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL) @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
@ -208,13 +206,12 @@ public class AuthMePlayerListener implements Listener {
public void onPreLogin(AsyncPlayerPreLoginEvent event) { public void onPreLogin(AsyncPlayerPreLoginEvent event) {
final String name = event.getName().toLowerCase(); final String name = event.getName().toLowerCase();
final Player player = Bukkit.getServer().getPlayer(name); final Player player = Bukkit.getServer().getPlayer(name);
if (player == null) if (player == null)
return; return;
// Check if forceSingleSession is set to true, so kick player that has // Check if forceSingleSession is set to true, so kick player that has
// joined with same nick of online player // joined with same nick of online player
if (plugin.dataManager.isOnline(player, name) && Settings.isForceSingleSessionEnabled) { if (Settings.isForceSingleSessionEnabled && plugin.dataManager.isOnline(player, name)) {
event.setKickMessage(m.send("same_nick")[0]); event.setKickMessage(m.send("same_nick")[0]);
event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
if (LimboCache.getInstance().hasLimboPlayer(name)) if (LimboCache.getInstance().hasLimboPlayer(name))
@ -228,7 +225,6 @@ public class AuthMePlayerListener implements Listener {
LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase()); LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase());
} }
} }
}); });
} }
} }
@ -248,46 +244,34 @@ public class AuthMePlayerListener implements Listener {
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) if (event.getResult() != PlayerLoginEvent.Result.ALLOWED)
return; return;
if (!Settings.countriesBlacklist.isEmpty()) { if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable
&& !plugin.authmePermissible(player, "authme.bypassantibot")) {
String code = Utils.getCountryCode(event.getAddress().getHostAddress()); String code = Utils.getCountryCode(event.getAddress().getHostAddress());
if (((code == null) || (Settings.countriesBlacklist.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { if (((code == null) || Settings.countriesBlacklist.contains(code))) {
event.setKickMessage(m.send("country_banned")[0]); event.setKickMessage(m.send("country_banned")[0]);
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
return; return;
} }
} }
if (Settings.enableProtection && !Settings.countries.isEmpty()) { if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable
&& !plugin.authmePermissible(player, "authme.bypassantibot")) {
String code = Utils.getCountryCode(event.getAddress().getHostAddress()); String code = Utils.getCountryCode(event.getAddress().getHostAddress());
if (((code == null) || (!Settings.countries.contains(code) && !isAuthAvailable)) && !plugin.authmePermissible(player, "authme.bypassantibot")) { if (((code == null) || !Settings.countries.contains(code))) {
event.setKickMessage(m.send("country_banned")[0]); event.setKickMessage(m.send("country_banned")[0]);
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
return; return;
} }
} }
if (Settings.isKickNonRegisteredEnabled && !Settings.antiBotInAction) { // TODO: Add message to the messages file!!!
if (!isAuthAvailable) { if (Settings.isKickNonRegisteredEnabled && !isAuthAvailable) {
event.setKickMessage(m.send("reg_only")[0]); if (Settings.antiBotInAction) {
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
return;
}
}
if (Settings.antiBotInAction) {
if (!isAuthAvailable) {
event.setKickMessage("AntiBot service in action! You actually need to be registered!"); event.setKickMessage("AntiBot service in action! You actually need to be registered!");
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
return; return;
} } else {
} event.setKickMessage(m.send("reg_only")[0]);
if (isAuthAvailable && plugin.database.getType() != DataSource.DataSourceType.FILE) {
PlayerAuth auth = plugin.database.getAuth(name);
if (auth.getRealName() != null && !auth.getRealName().isEmpty() && !auth.getRealName().equalsIgnoreCase("Player") && !auth.getRealName().equals(player.getName())) {
event.setKickMessage(m.send("same_nick")[0]);
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
if (Settings.banUnsafeIp)
plugin.getServer().banIP(player.getAddress().getAddress().getHostAddress());
return; return;
} }
} }
@ -372,7 +356,7 @@ public class AuthMePlayerListener implements Listener {
plugin.management.performQuit(player, false); plugin.management.performQuit(player, false);
if (plugin.database.isAuthAvailable(name) && !PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection) if (!PlayerCache.getInstance().isAuthenticated(name) && Settings.enableProtection)
event.setQuitMessage(null); event.setQuitMessage(null);
} }
@ -430,7 +414,6 @@ public class AuthMePlayerListener implements Listener {
public void run() { public void run() {
player.closeInventory(); player.closeInventory();
} }
}, 1); }, 1);
} }

View File

@ -56,10 +56,6 @@ public class AuthMeServerListener implements Listener {
ConsoleLogger.info("Multiverse-Core has been disabled, unhook!"); ConsoleLogger.info("Multiverse-Core has been disabled, unhook!");
return; return;
} }
if (pluginName.equalsIgnoreCase("ChestShop")) {
plugin.legacyChestShop = false;
ConsoleLogger.info("ChestShop has been disabled, unhook!");
}
if (pluginName.equalsIgnoreCase("CombatTagPlus")) { if (pluginName.equalsIgnoreCase("CombatTagPlus")) {
plugin.combatTagPlus = null; plugin.combatTagPlus = null;
ConsoleLogger.info("CombatTagPlus has been disabled, unhook!"); ConsoleLogger.info("CombatTagPlus has been disabled, unhook!");
@ -68,6 +64,10 @@ public class AuthMeServerListener implements Listener {
plugin.permission = null; plugin.permission = null;
ConsoleLogger.showError("Vault has been disabled, unhook permissions!"); ConsoleLogger.showError("Vault has been disabled, unhook permissions!");
} }
if (pluginName.equalsIgnoreCase("ProtocolLib")) {
plugin.inventoryProtector = null;
ConsoleLogger.showError("ProtocolLib has been disabled, unhook packet inventory protection!");
}
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
@ -77,11 +77,12 @@ public class AuthMeServerListener implements Listener {
plugin.checkEssentials(); plugin.checkEssentials();
if (pluginName.equalsIgnoreCase("Multiverse-Core")) if (pluginName.equalsIgnoreCase("Multiverse-Core"))
plugin.checkMultiverse(); plugin.checkMultiverse();
if (pluginName.equalsIgnoreCase("ChestShop"))
plugin.checkChestShop();
if (pluginName.equalsIgnoreCase("CombatTagPlus")) if (pluginName.equalsIgnoreCase("CombatTagPlus"))
plugin.checkCombatTagPlus(); plugin.checkCombatTagPlus();
if (pluginName.equalsIgnoreCase("Vault")) if (pluginName.equalsIgnoreCase("Vault"))
plugin.checkVault(); plugin.checkVault();
if (pluginName.equalsIgnoreCase("ProtocolLib")) {
plugin.checkProtocolLib();
}
} }
} }

View File

@ -32,9 +32,7 @@ public class EssSpawn extends CustomConfiguration {
return null; return null;
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch"))); Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
return location; return location;
} catch (NullPointerException npe) { } catch (NullPointerException | NumberFormatException npe) {
return null;
} catch (NumberFormatException nfe) {
return null; return null;
} }
} }

View File

@ -6,10 +6,7 @@ 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.JsonCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.FirstSpawnTeleportEvent; import fr.xephi.authme.events.FirstSpawnTeleportEvent;
import fr.xephi.authme.events.ProtectInventoryEvent; import fr.xephi.authme.events.ProtectInventoryEvent;
@ -26,7 +23,6 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
@ -39,13 +35,11 @@ public class AsyncronousJoin {
protected AuthMe plugin; protected AuthMe plugin;
protected String name; protected String name;
private Messages m = Messages.getInstance(); private Messages m = Messages.getInstance();
private JsonCache playerBackup;
public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) { public AsyncronousJoin(Player player, AuthMe plugin, DataSource database) {
this.player = player; this.player = player;
this.plugin = plugin; this.plugin = plugin;
this.database = database; this.database = database;
this.playerBackup = new JsonCache(plugin);
this.name = player.getName().toLowerCase(); this.name = player.getName().toLowerCase();
} }
@ -127,27 +121,14 @@ public class AsyncronousJoin {
} }
placePlayerSafely(player, spawnLoc); placePlayerSafely(player, spawnLoc);
LimboCache.getInstance().updateLimboPlayer(player); LimboCache.getInstance().updateLimboPlayer(player);
DataFileCache dataFile = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour());
playerBackup.createCache(player, dataFile);
// protect inventory // protect inventory
if (Settings.protectInventoryBeforeLogInEnabled) { if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase()); ProtectInventoryEvent ev = new ProtectInventoryEvent(player);
ProtectInventoryEvent ev = new ProtectInventoryEvent(player, limbo.getInventory(), limbo.getArmour());
plugin.getServer().getPluginManager().callEvent(ev); plugin.getServer().getPluginManager().callEvent(ev);
if (ev.isCancelled()) { if (ev.isCancelled()) {
plugin.inventoryProtector.sendInventoryPacket(player);
if (!Settings.noConsoleSpam) if (!Settings.noConsoleSpam)
ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ..."); ConsoleLogger.info("ProtectInventoryEvent has been cancelled for " + player.getName() + " ...");
} else {
final ItemStack[] inv = ev.getEmptyArmor();
final ItemStack[] armor = ev.getEmptyArmor();
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
plugin.api.setPlayerInventory(player, inv, armor);
}
});
} }
} }
} else { } else {

View File

@ -42,7 +42,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
this.name = player.getName().toLowerCase(); this.name = player.getName().toLowerCase();
this.limbo = LimboCache.getInstance().getLimboPlayer(name); this.limbo = LimboCache.getInstance().getLimboPlayer(name);
this.auth = database.getAuth(name); this.auth = database.getAuth(name);
this.playerCache = new JsonCache(plugin); this.playerCache = new JsonCache();
} }
public LimboPlayer getLimbo() { public LimboPlayer getLimbo() {
@ -92,10 +92,10 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
} }
protected void restoreInventory() { protected void restoreInventory() {
RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); RestoreInventoryEvent event = new RestoreInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
plugin.api.setPlayerInventory(player, event.getInventory(), event.getArmor()); plugin.inventoryProtector.sendInventoryPacket(player);
} }
} }
@ -128,7 +128,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
// Inventory - Make it after restore GameMode , cause we need to // Inventory - Make it after restore GameMode , cause we need to
// restore the // restore the
// right inventory in the right gamemode // right inventory in the right gamemode
if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) { if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) {
restoreInventory(); restoreInventory();
} }
if (Settings.forceOnlyAfterLogin) { if (Settings.forceOnlyAfterLogin) {

View File

@ -9,8 +9,6 @@ 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.JsonCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.AuthMeTeleportEvent; import fr.xephi.authme.events.AuthMeTeleportEvent;
@ -25,7 +23,6 @@ public class AsyncronousLogout {
protected DataSource database; protected DataSource database;
protected boolean canLogout = true; protected boolean canLogout = true;
private Messages m = Messages.getInstance(); private Messages m = Messages.getInstance();
private JsonCache playerBackup;
public AsyncronousLogout(Player player, AuthMe plugin, public AsyncronousLogout(Player player, AuthMe plugin,
DataSource database) { DataSource database) {
@ -33,7 +30,6 @@ public class AsyncronousLogout {
this.plugin = plugin; this.plugin = plugin;
this.database = database; this.database = database;
this.name = player.getName().toLowerCase(); this.name = player.getName().toLowerCase();
this.playerBackup = new JsonCache(plugin);
} }
private void preLogout() { private void preLogout() {
@ -79,13 +75,7 @@ public class AsyncronousLogout {
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) {
player.getInventory().clear();
// create cache file for handling lost of inventories on unlogged in
// status
DataFileCache playerData = new DataFileCache(LimboCache.getInstance().getLimboPlayer(name).getInventory(), LimboCache.getInstance().getLimboPlayer(name).getArmour());
playerBackup.createCache(player, playerData);
}
sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin)); sched.scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerLogout(p, plugin));
} }
} }

View File

@ -3,7 +3,6 @@ package fr.xephi.authme.process.quit;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
@ -13,7 +12,6 @@ import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer; import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource; import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.listener.AuthMePlayerListener; import fr.xephi.authme.listener.AuthMePlayerListener;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
@ -23,8 +21,6 @@ public class AsyncronousQuit {
protected DataSource database; protected DataSource database;
protected Player player; protected Player player;
private String name; private String name;
private ItemStack[] armor = null;
private ItemStack[] inv = null;
private boolean isOp = false; private boolean isOp = false;
private boolean isFlying = false; private boolean isFlying = false;
private boolean needToChange = false; private boolean needToChange = false;
@ -60,10 +56,6 @@ public class AsyncronousQuit {
if (LimboCache.getInstance().hasLimboPlayer(name)) { if (LimboCache.getInstance().hasLimboPlayer(name)) {
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name); LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
if (Settings.protectInventoryBeforeLogInEnabled && player.hasPlayedBefore()) {
inv = limbo.getInventory();
armor = limbo.getArmour();
}
if (limbo.getGroup() != null && !limbo.getGroup().equals("")) if (limbo.getGroup() != null && !limbo.getGroup().equals(""))
Utils.addNormal(player, limbo.getGroup()); Utils.addNormal(player, limbo.getGroup());
needToChange = true; needToChange = true;
@ -94,17 +86,8 @@ public class AsyncronousQuit {
PlayerCache.getInstance().removePlayer(name); PlayerCache.getInstance().removePlayer(name);
database.setUnlogged(name); database.setUnlogged(name);
} }
AuthMePlayerListener.gameMode.remove(name); AuthMePlayerListener.gameMode.remove(name);
final Player p = player; Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, player, isOp, isFlying, needToChange));
RestoreInventoryEvent ev = new RestoreInventoryEvent(player, inv, armor, true);
Bukkit.getPluginManager().callEvent(ev);
if (ev.isCancelled()) {
inv = null;
armor = null;
} else {
inv = ev.getInventory();
armor = ev.getArmor();
}
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new ProcessSyncronousPlayerQuit(plugin, p, inv, armor, isOp, isFlying, needToChange));
} }
} }

View File

@ -2,7 +2,6 @@ package fr.xephi.authme.process.quit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
@ -13,26 +12,21 @@ public class ProcessSyncronousPlayerQuit implements Runnable {
protected Player player; protected Player player;
protected boolean isOp; protected boolean isOp;
protected boolean isFlying; protected boolean isFlying;
protected ItemStack[] inv;
protected ItemStack[] armor;
protected boolean needToChange; protected boolean needToChange;
public ProcessSyncronousPlayerQuit(AuthMe plugin, Player player, public ProcessSyncronousPlayerQuit(AuthMe plugin, Player player
ItemStack[] inv, ItemStack[] armor, boolean isOp, boolean isFlying, , boolean isOp, boolean isFlying
boolean needToChange) { , boolean needToChange) {
this.plugin = plugin; this.plugin = plugin;
this.player = player; this.player = player;
this.isOp = isOp; this.isOp = isOp;
this.isFlying = isFlying; this.isFlying = isFlying;
this.armor = armor;
this.inv = inv;
this.needToChange = needToChange; this.needToChange = needToChange;
} }
@Override @Override
public void run() { public void run() {
if (inv != null && armor != null)
plugin.api.setPlayerInventory(player, inv, armor);
if (needToChange) { if (needToChange) {
player.setOp(isOp); player.setOp(isOp);
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) { if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {

View File

@ -67,14 +67,10 @@ public class AsyncronousRegister {
allowRegister = false; allowRegister = false;
} }
else if (!Settings.unsafePasswords.isEmpty()) { else if (!Settings.unsafePasswords.isEmpty() && Settings.unsafePasswords.contains(password.toLowerCase())) {
if (Settings.unsafePasswords.contains(password.toLowerCase())) { m.send(player, "password_error_unsafe");
m.send(player, "password_error_unsafe"); allowRegister = false;
allowRegister = false; } else if (database.isAuthAvailable(name)) {
}
}
else if (database.isAuthAvailable(name)) {
m.send(player, "user_regged"); m.send(player, "user_regged");
allowRegister = false; allowRegister = false;
} }

View File

@ -91,14 +91,15 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
player.teleport(tpEvent.getTo()); player.teleport(tpEvent.getTo());
} }
} }
if (Settings.protectInventoryBeforeLogInEnabled && limbo.getInventory() != null && limbo.getArmour() != null) {
RestoreInventoryEvent event = new RestoreInventoryEvent(player, limbo.getInventory(), limbo.getArmour()); if (Settings.protectInventoryBeforeLogInEnabled && plugin.inventoryProtector != null) {
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getArmor() != null && event.getInventory() != null) { if (!event.isCancelled()) {
player.getInventory().setContents(event.getInventory()); plugin.inventoryProtector.sendInventoryPacket(player);
player.getInventory().setArmorContents(event.getArmor());
} }
} }
limbo.getTimeoutTaskId().cancel(); limbo.getTimeoutTaskId().cancel();
limbo.getMessageTaskId().cancel(); limbo.getMessageTaskId().cancel();
LimboCache.getInstance().deleteLimboPlayer(name); LimboCache.getInstance().deleteLimboPlayer(name);
@ -153,6 +154,5 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
// Register is now finish , we can force all commands // Register is now finish , we can force all commands
forceCommands(); forceCommands();
} }
} }

View File

@ -33,10 +33,10 @@ public class PHPFUSION implements EncryptionMethod {
hash.append(hex); hash.append(hex);
} }
digest = hash.toString(); digest = hash.toString();
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException e) {
} catch (InvalidKeyException e) { //ingore
} catch (NoSuchAlgorithmException e) {
} }
return digest; return digest;
} }

View File

@ -44,7 +44,7 @@ public class XF implements EncryptionMethod {
} }
public String regmatch(String pattern, String line) { public String regmatch(String pattern, String line) {
List<String> allMatches = new ArrayList<String>(); List<String> allMatches = new ArrayList<>();
Matcher m = Pattern.compile(pattern).matcher(line); Matcher m = Pattern.compile(pattern).matcher(line);
while (m.find()) { while (m.find()) {
allMatches.add(m.group(1)); allMatches.add(m.group(1));

View File

@ -70,9 +70,7 @@ public class MacBasedPRF implements PRF {
try { try {
mac = Mac.getInstance(macAlgorithm, provider); mac = Mac.getInstance(macAlgorithm, provider);
hLen = mac.getMacLength(); hLen = mac.getMacLength();
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException | NoSuchProviderException e) {
throw new RuntimeException(e);
} catch (NoSuchProviderException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }

View File

@ -44,8 +44,8 @@ public class OtherAccounts extends CustomConfiguration {
this.getStringList(uuid.toString()).add(player.getName()); this.getStringList(uuid.toString()).add(player.getName());
save(); save();
} }
} catch (NoSuchMethodError e) { } catch (NoSuchMethodError | Exception e) {
} catch (Exception e) { //ingore
} }
} }
@ -58,10 +58,9 @@ public class OtherAccounts extends CustomConfiguration {
this.getStringList(uuid.toString()).remove(player.getName()); this.getStringList(uuid.toString()).remove(player.getName());
save(); save();
} }
} catch (NoSuchMethodError e) { } catch (NoSuchMethodError | Exception e) {
} catch (Exception e) { //ignore
} }
} }
public List<String> getAllPlayersByUUID(UUID uuid) { public List<String> getAllPlayersByUUID(UUID uuid) {

View File

@ -14,10 +14,11 @@ import java.util.List;
public final class Settings extends YamlConfiguration { public final class Settings extends YamlConfiguration {
private AuthMe plugin; private static AuthMe plugin;
private static Settings instance;
// This is not an option! // This is not an option!
public static Boolean antiBotInAction = false; public static boolean antiBotInAction = false;
public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder(); public static final File PLUGIN_FOLDER = AuthMe.getInstance().getDataFolder();
public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules"); public static final File MODULE_FOLDER = new File(PLUGIN_FOLDER, "modules");
@ -59,7 +60,7 @@ public final class Settings extends YamlConfiguration {
protectInventoryBeforeLogInEnabled, isBackupActivated, protectInventoryBeforeLogInEnabled, isBackupActivated,
isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport, isBackupOnStart, isBackupOnStop, isStopEnabled, reloadSupport,
rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts, rakamakUseIp, noConsoleSpam, removePassword, displayOtherAccounts,
useCaptcha, emailRegistration, multiverse, legacyChestShop, bungee, useCaptcha, emailRegistration, multiverse, bungee,
banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange, banUnsafeIp, doubleEmailCheck, sessionExpireOnIpChange,
disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge, disableSocialSpy, forceOnlyAfterLogin, useEssentialsMotd, usePurge,
purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgePlayerDat, purgeEssentialsFile, supportOldPassword,
@ -94,30 +95,30 @@ public final class Settings extends YamlConfiguration {
protected static YamlConfiguration configFile; protected static YamlConfiguration configFile;
public Settings(AuthMe plugin) { public Settings(AuthMe pl) {
instance = this;
plugin = pl;
configFile = (YamlConfiguration) plugin.getConfig(); configFile = (YamlConfiguration) plugin.getConfig();
this.plugin = plugin;
} }
public final void reload() throws Exception { public static void reload() throws Exception {
plugin.getLogger().info("Loading Configuration File..."); plugin.getLogger().info("Loading Configuration File...");
boolean exist = SETTINGS_FILE.exists(); boolean exist = SETTINGS_FILE.exists();
if (!exist) { if (!exist) {
plugin.saveDefaultConfig(); plugin.saveDefaultConfig();
} }
load(SETTINGS_FILE); instance.load(SETTINGS_FILE);
if (exist) { if (exist) {
mergeConfig(); instance.mergeConfig();
} }
loadVariables(); loadVariables();
if (exist) { if (exist) {
saveDefaults(); instance.saveDefaults();
} }
messageFile = new File(PLUGIN_FOLDER, "messages" + File.separator + "messages_" + messagesLanguage + ".yml"); messageFile = new File(PLUGIN_FOLDER, "messages" + File.separator + "messages_" + messagesLanguage + ".yml");
} }
@SuppressWarnings("unchecked")
public static void loadVariables() { public static void loadVariables() {
messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase()); messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase());
isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false); isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false);
@ -183,7 +184,7 @@ public final class Settings extends YamlConfiguration {
backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"); backupWindowsPath = configFile.getString("BackupSystem.MysqlWindowsPath", "C:\\Program Files\\MySQL\\MySQL Server 5.1\\");
isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true); isStopEnabled = configFile.getBoolean("Security.SQLProblem.stopServer", true);
reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true); reloadSupport = configFile.getBoolean("Security.ReloadCommand.useReloadCommandSupport", true);
allowCommands = (List<String>) configFile.getList("settings.restrictions.allowCommands"); allowCommands = configFile.getStringList("settings.restrictions.allowCommands");
if (configFile.contains("allowCommands")) { if (configFile.contains("allowCommands")) {
if (!allowCommands.contains("/login")) if (!allowCommands.contains("/login"))
allowCommands.add("/login"); allowCommands.add("/login");
@ -208,7 +209,7 @@ public final class Settings extends YamlConfiguration {
getmailSMTP = configFile.getString("Email.mailSMTP", "smtp.gmail.com"); getmailSMTP = configFile.getString("Email.mailSMTP", "smtp.gmail.com");
getMailPort = configFile.getInt("Email.mailPort", 465); getMailPort = configFile.getInt("Email.mailPort", 465);
getRecoveryPassLength = configFile.getInt("Email.RecoveryPasswordLength", 8); getRecoveryPassLength = configFile.getInt("Email.RecoveryPasswordLength", 8);
getMySQLOtherUsernameColumn = (List<String>) configFile.getList("ExternalBoardOptions.mySQLOtherUsernameColumns", new ArrayList<String>()); getMySQLOtherUsernameColumn = configFile.getStringList("ExternalBoardOptions.mySQLOtherUsernameColumns");
displayOtherAccounts = configFile.getBoolean("settings.restrictions.displayOtherAccounts", true); displayOtherAccounts = configFile.getBoolean("settings.restrictions.displayOtherAccounts", true);
getMySQLColumnId = configFile.getString("DataSource.mySQLColumnId", "id"); getMySQLColumnId = configFile.getString("DataSource.mySQLColumnId", "id");
getmailSenderName = configFile.getString("Email.mailSenderName", ""); getmailSenderName = configFile.getString("Email.mailSenderName", "");
@ -221,7 +222,6 @@ public final class Settings extends YamlConfiguration {
saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8); saltLength = configFile.getInt("settings.security.doubleMD5SaltLength", 8);
getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1); getmaxRegPerEmail = configFile.getInt("Email.maxRegPerEmail", 1);
multiverse = configFile.getBoolean("Hooks.multiverse", true); multiverse = configFile.getBoolean("Hooks.multiverse", true);
legacyChestShop = configFile.getBoolean("Hooks.legacyChestshop", false);
bungee = configFile.getBoolean("Hooks.bungeecord", false); bungee = configFile.getBoolean("Hooks.bungeecord", false);
getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds"); getForcedWorlds = configFile.getStringList("settings.restrictions.ForceSpawnOnTheseWorlds");
banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false); banUnsafeIp = configFile.getBoolean("settings.restrictions.banUnsafedIP", false);
@ -272,7 +272,7 @@ public final class Settings extends YamlConfiguration {
emailBlacklist = configFile.getStringList("Email.emailBlacklisted"); emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
emailWhitelist = configFile.getStringList("Email.emailWhitelisted"); emailWhitelist = configFile.getStringList("Email.emailWhitelisted");
forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands"); forceRegisterCommands = configFile.getStringList("settings.forceRegisterCommands");
forceRegisterCommandsAsConsole = (List<String>) configFile.getList("settings.forceRegisterCommandsAsConsole", new ArrayList<String>()); forceRegisterCommandsAsConsole = configFile.getStringList("settings.forceRegisterCommandsAsConsole");
customAttributes = configFile.getBoolean("Hooks.customAttributes"); customAttributes = configFile.getBoolean("Hooks.customAttributes");
generateImage = configFile.getBoolean("Email.generateImage", true); generateImage = configFile.getBoolean("Email.generateImage", true);
@ -287,7 +287,8 @@ public final class Settings extends YamlConfiguration {
set("Xenoforo.predefinedSalt", null); set("Xenoforo.predefinedSalt", null);
changes = true; changes = true;
} }
if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") || configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) { if (configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA1") ||
configFile.getString("settings.security.passwordHash", "SHA256").toUpperCase().equals("XFSHA256")) {
set("settings.security.passwordHash", "XENFORO"); set("settings.security.passwordHash", "XENFORO");
changes = true; changes = true;
} }
@ -460,12 +461,13 @@ public final class Settings extends YamlConfiguration {
changes = true; changes = true;
} }
if (contains("Hooks.chestshop")) { if (contains("Hooks.chestshop")) {
if(getBoolean("Hooks.chestshop")) {
set("Hooks.legacyChestshop", true);
}
set("Hooks.chestshop", null); set("Hooks.chestshop", null);
changes = true; changes = true;
} }
if (contains("Hooks.legacyChestshop")) {
set("Hooks.legacyChestshop", null);
changes = true;
}
if (!contains("Email.generateImage")) { if (!contains("Email.generateImage")) {
set("Email.generateImage", true); set("Email.generateImage", true);
changes = true; changes = true;
@ -481,9 +483,9 @@ public final class Settings extends YamlConfiguration {
} }
} }
public void setValue(String key, Object value) { public static void setValue(String key, Object value) {
this.set(key, value); instance.set(key, value);
this.save(); save();
} }
private static HashAlgorithm getPasswordHash() { private static HashAlgorithm getPasswordHash() {
@ -511,11 +513,11 @@ public final class Settings extends YamlConfiguration {
* return false if ip and name doesnt amtch with player that join the * return false if ip and name doesnt amtch with player that join the
* server, so player has a restricted access * server, so player has a restricted access
*/ */
public static Boolean getRestrictedIp(String name, String ip) { public static boolean getRestrictedIp(String name, String ip) {
Iterator<String> iter = getRestrictedIp.iterator(); Iterator<String> iter = getRestrictedIp.iterator();
Boolean trueonce = false; boolean trueonce = false;
Boolean namefound = false; boolean namefound = false;
while (iter.hasNext()) { while (iter.hasNext()) {
String[] args = iter.next().split(";"); String[] args = iter.next().split(";");
String testname = args[0]; String testname = args[0];
@ -527,11 +529,7 @@ public final class Settings extends YamlConfiguration {
} }
} }
} }
if (!namefound) { return !namefound || trueonce;
return true;
} else {
return trueonce;
}
} }
/** /**
@ -539,9 +537,9 @@ public final class Settings extends YamlConfiguration {
* *
* @return True if saved successfully * @return True if saved successfully
*/ */
public final boolean save() { public static boolean save() {
try { try {
save(SETTINGS_FILE); instance.save(SETTINGS_FILE);
return true; return true;
} catch (Exception ex) { } catch (Exception ex) {
return false; return false;

View File

@ -90,9 +90,7 @@ public class Spawn extends CustomConfiguration {
return null; 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"))); 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; return location;
} catch (NullPointerException npe) { } catch (NullPointerException | NumberFormatException npe) {
return null;
} catch (NumberFormatException nfe) {
return null; return null;
} }
} }
@ -103,9 +101,7 @@ public class Spawn extends CustomConfiguration {
return null; return null;
Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch"))); Location location = new Location(Bukkit.getWorld(this.getString("firstspawn.world")), this.getDouble("firstspawn.x"), this.getDouble("firstspawn.y"), this.getDouble("firstspawn.z"), Float.parseFloat(this.getString("firstspawn.yaw")), Float.parseFloat(this.getString("firstspawn.pitch")));
return location; return location;
} catch (NullPointerException npe) { } catch (NullPointerException | NumberFormatException npe) {
return null;
} catch (NumberFormatException nfe) {
return null; return null;
} }
} }

View File

@ -15,12 +15,14 @@ public class ChangePasswordTask implements Runnable {
private final AuthMe plugin; private final AuthMe plugin;
private final Player player; private final Player player;
private String password; private final String oldPassword;
private final String newPassword;
public ChangePasswordTask(AuthMe plugin, Player player, String password) { public ChangePasswordTask(AuthMe plugin, Player player, String oldPassword, String newPassword) {
this.plugin = plugin; this.plugin = plugin;
this.player = player; this.player = player;
this.password = password; this.oldPassword = oldPassword;
this.newPassword = newPassword;
} }
@Override @Override
@ -28,13 +30,15 @@ public class ChangePasswordTask implements Runnable {
Messages m = Messages.getInstance(); Messages m = Messages.getInstance();
try { try {
String name = player.getName().toLowerCase(); String name = player.getName().toLowerCase();
String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, password, name); String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, newPassword, name);
if (PasswordSecurity.comparePasswordWithHash(password, PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) { PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
PlayerAuth auth = PlayerCache.getInstance().getAuth(name); if (PasswordSecurity.comparePasswordWithHash(oldPassword, auth.getHash(), player.getName())) {
auth.setHash(hashnew); auth.setHash(hashnew);
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) {
auth.setSalt(PasswordSecurity.userSalt.get(name)); auth.setSalt(PasswordSecurity.userSalt.get(name));
else auth.setSalt(""); } else {
auth.setSalt("");
}
if (!plugin.database.updatePassword(auth)) { if (!plugin.database.updatePassword(auth)) {
m.send(player, "error"); m.send(player, "error");
return; return;

View File

@ -353,8 +353,6 @@ Email:
Hooks: Hooks:
# Do we need to hook with multiverse for spawn checking? # Do we need to hook with multiverse for spawn checking?
multiverse: true multiverse: true
# Do we need to hook with legacy ChestShop < 3.8.13 for prevent buy or selling ?
legacyChestshop: false
# Do we need to hook with BungeeCord for get the real Player ip ? # Do we need to hook with BungeeCord for get the real Player ip ?
bungeecord: false bungeecord: false
# Do we need to disable Essentials SocialSpy on join ? # Do we need to disable Essentials SocialSpy on join ?

View File

@ -1,47 +1,48 @@
# Translator: uSoc_lifehome (http://lifeho.me) # # Translator: lifehome<m@lifeho.me> #
# Last modif: 1443428389 UTC #
# -------------------------------------------- # # -------------------------------------------- #
unknown_user: '&8[&6用戶系統&8] &f用戶資料並不存在於資料庫中。' unknown_user: '&8[&6用戶系統&8] &f用戶資料並不存在。'
unsafe_spawn: '&8[&6用戶系統&8] &f你的登出位置不安全現在將傳送你到重生點。' unsafe_spawn: '&8[&6用戶系統&8] &f你的登出位置不安全現在將傳送你到重生點。'
not_logged_in: '&8[&6用戶系統&8] &c你還沒有登入 ' not_logged_in: '&8[&6用戶系統&8] &c你還沒有登入 '
reg_voluntarily: '&8[&6用戶系統&8] &f你可以使用這個指令來註冊: 《 /register <密碼> <重覆密碼> 》' reg_voluntarily: '&8[&6用戶系統&8] &f你可以使用這個指令來註冊: 《 /register <密碼> <重覆密碼> 》'
usage_log: '&8[&6用戶系統&8] &c用法: 《 /login <密碼> 》' usage_log: '&8[&6用戶系統&8] &f用法: 《 /login <密碼> 》'
wrong_pwd: '&8[&6用戶系統&8] &c你輸入了錯誤的密碼。' wrong_pwd: '&8[&6用戶系統&8] &c你輸入了錯誤的密碼。'
unregistered: '&8[&6用戶系統&8] &c你已成功取消會員註冊記錄。' unregistered: '&8[&6用戶系統&8] &c你已成功刪除會員註冊記錄。'
reg_disabled: '&8[&6用戶系統&8] &c本伺服器已停止新玩家註冊。' reg_disabled: '&8[&6用戶系統&8] &c本伺服器已停止新玩家註冊。'
valid_session: '&8[&6用戶系統&8] &b嗨 我記得你,歡迎回來~' valid_session: '&8[&6用戶系統&8] &b嗨 歡迎回來'
login: '&8[&6用戶系統&8] &c你成功登入了。' login: '&8[&6用戶系統&8] &c你成功登入了。'
password_error_nick: '&fYou can''t use your name as password' password_error_nick: '&8[&6用戶系統&8] &c這個密碼太不安全了'
password_error_unsafe: '&fYou can''t use unsafe passwords' password_error_unsafe: '&8[&6用戶系統&8] &c這個密碼太不安全了'
vb_nonActiv: '&8[&6用戶系統&8] &f你的帳戶還沒有經過電郵驗證 ' vb_nonActiv: '&8[&6用戶系統&8] &f你的帳戶還沒有經過電郵驗證 '
user_regged: '&8[&6用戶系統&8] &c此用戶名已經註冊過了。' user_regged: '&8[&6用戶系統&8] &c此用戶名已經註冊過了。'
usage_reg: '&8[&6用戶系統&8] &c用法: 《 /register <密碼> <重覆密碼> 》' usage_reg: '&8[&6用戶系統&8] &f用法: 《 /register <密碼> <重覆密碼> 》'
max_reg: '&8[&6用戶系統&8] &f你的IP地址已達到註冊數上限。' max_reg: '&8[&6用戶系統&8] &f你的IP地址已達到註冊數上限。'
no_perm: '&8[&6用戶系統&8] &b你可以到 CraftingHK 玩家百科中查看說明文件。' no_perm: '&8[&6用戶系統&8] &b你可以到 CraftingHK 玩家百科中查看說明文件。'
error: '&8[&6用戶系統&8] &f發生錯誤請與管理員聯絡。' error: '&8[&6用戶系統&8] &f發生錯誤請與管理員聯絡。'
login_msg: '&8[&6用戶系統&8] &c請使用這個指令來登入 《 /login <密碼> 》' login_msg: '&8[&6用戶系統&8] &c請使用這個指令來登入 《 /login <密碼> 》'
reg_msg: '&8[&6用戶系統&8] &c請使用這個指令來註冊: 《 /register <密碼> <重覆密碼> 》' reg_msg: '&8[&6用戶系統&8] &c請使用這個指令來註冊: 《 /register <密碼> <重覆密碼> 》'
reg_email_msg: '&8[&6用戶系統&8] &c請使用這個指令來註冊: 《 /register <電郵> <重覆電郵> 》' reg_email_msg: '&8[&6用戶系統&8] &c請使用這個指令來註冊: 《 /register <電郵> <重覆電郵> 》'
usage_unreg: '&8[&6用戶系統&8] &c用法: 《 /unregister <密碼> 》' usage_unreg: '&8[&6用戶系統&8] &f用法: 《 /unregister <密碼> 》'
pwd_changed: '&8[&6用戶系統&8] &c你成功更換了你的密碼 ' pwd_changed: '&8[&6用戶系統&8] &c你成功更換了你的密碼 '
user_unknown: '&8[&6用戶系統&8] &c此用戶名沒有已登記資料。' user_unknown: '&8[&6用戶系統&8] &c此用戶名沒有已登記資料。'
password_error: '&8[&6用戶系統&8] &f密碼不符合。' password_error: '&8[&6用戶系統&8] &f密碼不符合。'
invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞請等待登入階段結束。' invalid_session: '&8[&6用戶系統&8] &f登入階段資料已損壞請等待登入階段結束。'
reg_only: '&8[&6用戶系統&8] &f限已註冊會員請先到 https://www.example.com/ 註冊。' reg_only: '&8[&6用戶系統&8] &f限已註冊會員請先到 https://crafting.hk/ 註冊。'
logged_in: '&8[&6用戶系統&8] &c你已經登入過了。' logged_in: '&8[&6用戶系統&8] &c你已經登入過了。'
logout: '&8[&6用戶系統&8] &b你成功登出了。' logout: '&8[&6用戶系統&8] &b你成功登出了。'
same_nick: '&8[&6用戶系統&8] &f同名玩家已在遊玩。' same_nick: '&8[&6用戶系統&8] &f同名玩家已在遊玩。'
registered: '&8[&6用戶系統&8] &b你成功註冊了。' registered: '&8[&6用戶系統&8] &b你成功註冊了。'
pass_len: '&8[&6用戶系統&8] &f你的密碼並不符合規定長度。' pass_len: '&8[&6用戶系統&8] &f你的密碼並不符合規定長度。'
reload: '&8[&6用戶系統&8] &b登入系統設定及資料庫重新載入完畢。' reload: '&8[&6用戶系統&8] &b登入系統設定及資料庫重新載入完畢。'
timeout: '&8[&6用戶系統&8] &f登入逾時。' timeout: '&8[&6用戶系統&8] &f登入逾時。'
usage_changepassword: '&8[&6用戶系統&8] &f用法 《 /changepassword <舊密碼> <新密碼> 》' usage_changepassword: '&8[&6用戶系統&8] &f用法 《 /changepassword <舊密碼> <新密碼> 》'
name_len: '&8[&6用戶系統&8] &c你的用戶名不符合規定長度。' name_len: '&8[&6用戶系統&8] &c你的用戶名不符合規定長度。'
regex: '&8[&6用戶系統&8] &c你的用戶名含有不容許之字符。以下為准許之字母 REG_EX' regex: '&8[&6用戶系統&8] &c用戶名稱錯誤! 登入系統只接受以下字符 REG_EX'
add_email: '&8[&6用戶系統&8] &b請為你的帳戶立即添加電郵地址 《 /email add <電郵地址> <重覆電郵地址> 》' add_email: '&8[&6用戶系統&8] &b請為你的帳戶立即添加電郵地址 《 /email add <電郵地址> <重覆電郵地址> 》'
recovery_email: '&8[&6用戶系統&8] &c忘記密碼 請使用這個指令來更新密碼: 《 /email recovery <電郵地址> 》' recovery_email: '&8[&6用戶系統&8] &c忘記密碼 請使用這個指令來更新密碼: 《 /email recovery <電郵地址> 》'
usage_captcha: '&8[&6用戶系統&8] &c用法: 《 /captcha <驗證碼> 》' usage_captcha: '&8[&6用戶系統&8] &f用法: 《 /captcha <驗證碼> 》'
wrong_captcha: '&8[&6用戶系統&8] &c你輸入了錯誤的驗證碼,請使用 《 /captcha <驗證碼> 》 再次輸入。' wrong_captcha: '&8[&6用戶系統&8] &c你輸入的驗證碼無效,請使用 《 /captcha <驗證碼> 》 再次輸入。'
valid_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼無效 ' valid_captcha: '&8[&6用戶系統&8] &c你所輸入的驗證碼無效 '
kick_forvip: '&c因為有VIP玩家登入了伺服器。' kick_forvip: '&c因為有VIP玩家登入了伺服器。'
kick_fullserver: '&c抱歉 因為伺服器滿人了,所以你目前未能登入伺服器。' kick_fullserver: '&c抱歉 因為伺服器滿人了,所以你目前未能登入伺服器。'
usage_email_add: '&8[&6用戶系統&8] &f用法 《 /email add <電郵> <重覆電郵> 》' usage_email_add: '&8[&6用戶系統&8] &f用法 《 /email add <電郵> <重覆電郵> 》'
@ -50,10 +51,10 @@ usage_email_recovery: '&8[&6用戶系統&8] &f用法 《 /email recovery <電
new_email_invalid: '&8[&6用戶系統&8] 你所填寫的新電郵地址並不正確。' new_email_invalid: '&8[&6用戶系統&8] 你所填寫的新電郵地址並不正確。'
old_email_invalid: '&8[&6用戶系統&8] 你所填寫的舊電郵地址並不正確。' old_email_invalid: '&8[&6用戶系統&8] 你所填寫的舊電郵地址並不正確。'
email_invalid: '&8[&6用戶系統&8] 你所填寫的電郵地址並不正確。' email_invalid: '&8[&6用戶系統&8] 你所填寫的電郵地址並不正確。'
email_added: '&8[&6用戶系統&8] 已加入你的電郵地址記錄。' email_added: '&8[&6用戶系統&8] 已新增你的電郵地址。'
email_confirm: '&8[&6用戶系統&8] 請重覆輸入你的電郵地址。' email_confirm: '&8[&6用戶系統&8] 請重覆輸入你的電郵地址。'
email_changed: '&8[&6用戶系統&8] 你的電郵地址記錄已更改。' email_changed: '&8[&6用戶系統&8] 你的電郵地址已更改。'
email_send: '&8[&6用戶系統&8] 忘記密碼信件已寄出,請查收。' email_send: '&8[&6用戶系統&8] 忘記密碼信件已寄出,請查收。'
country_banned: '&8[&6用戶系統&8] 本伺服器已停止對你的國家提供遊戲服務。' country_banned: '&8[&6用戶系統&8] 本伺服器已停止對你的國家提供遊戲服務。'
antibot_auto_enabled: '&8[&6用戶系統&8] 防止機械人程序已因應現時大量不尋常連線而啟用。' antibot_auto_enabled: '&8[&6用戶系統&8] 防止機械人程序已因應現時大量不尋常連線而啟用。'
antibot_auto_disabled: '&8[&6用戶系統&8] 防止機械人程序檢查到不正常連接數已減少,並於 %m 分鐘後停止運作。' antibot_auto_disabled: '&8[&6用戶系統&8] 不正常連接數已減少,防止機械人程序將於 %m 分鐘後停止。'

View File

@ -4,7 +4,7 @@ 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 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 player.
main: fr.xephi.authme.AuthMe main: fr.xephi.authme.AuthMe
version: ${project.version} version: ${project.version}
softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories] softdepend: [Vault, ChestShop, Multiverse-Core, Citizens, CombatTag, Essentials, EssentialsSpawn, PerWorldInventories, ProtocolLib]
commands: commands:
register: register:
description: Register an account description: Register an account

View File

@ -1,9 +1,12 @@
AuthMe-Team: AuthMe-Team:
Active staff: Active staff:
Xephi (Xephi59) - Leader, Main developer Xephi (Xephi59) - Leader, Main developer (temporary inactive)
Gabriele C. (sgdc3) - Ticket Manager, Project Page and Structure Manager, Contributor
DNx5 - Developer DNx5 - Developer
games647 - Developer
Gabriele C. (sgdc3) - Project Manager, Contributor
Staff to contact:
CryLegend - Contributor, AuthMeBridge Developer (Need activation) CryLegend - Contributor, AuthMeBridge Developer (Need activation)
External Contributors: External Contributors: