Add VIP Slots method

This commit is contained in:
Xephi 2013-04-03 03:21:33 +02:00
parent 6485acca53
commit 468aaa18a3
18 changed files with 77 additions and 12 deletions

View File

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

View File

@ -21,6 +21,7 @@ import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@ -255,7 +256,6 @@ public class AuthMe extends JavaPlugin {
if (permissionProvider != null)
permission = permissionProvider.getProvider();
else {
ConsoleLogger.showError("Vault and Permissions plugins is needed for enable AuthMe Reloaded!");
this.getServer().getPluginManager().disablePlugin(this);
}
@ -498,4 +498,18 @@ public class AuthMe extends JavaPlugin {
return m;
}
public Player generateKickPlayer(Player[] players) {
Player player = null;
int i;
for (i = 0 ; i <= players.length ; i++) {
Random rdm = new Random();
int a = rdm.nextInt(players.length);
if (!players[a].hasPermission("authme.vip")) {
player = players[a];
break;
}
}
return player;
}
}

View File

@ -566,7 +566,7 @@ public class AuthMePlayerListener implements Listener {
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerLogin(PlayerLoginEvent event) {
final Player player = event.getPlayer();
@ -652,6 +652,26 @@ public class AuthMePlayerListener implements Listener {
return;
}
}
if (event.getResult() != Result.KICK_FULL) return;
if (player.isBanned()) return;
if (!player.hasPermission("authme.vip")) {
event.disallow(Result.KICK_FULL, m._("kick_fullserver"));
return;
}
if (plugin.getServer().getOnlinePlayers().length > plugin.getServer().getMaxPlayers()) {
event.allow();
return;
} else {
final Player pl = plugin.generateKickPlayer(plugin.getServer().getOnlinePlayers());
if (pl != null) {
pl.kickPlayer(m._("kick_forvip"));
event.allow();
return;
} else {
ConsoleLogger.info("The player " + player.getName() + " wants to join, but the server is full");
event.disallow(Result.KICK_FULL, m._("kick_fullserver"));
}
}
}

View File

@ -73,6 +73,8 @@ public class Messages extends CustomConfiguration {
this.set("usage_captcha", "&cUsage: /captcha <theCaptcha>");
this.set("wrong_captcha", "&cWrong Captcha, please use : /captcha THE_CAPTCHA");
this.set("valid_captcha", "&cYour captcha is valid !");
this.set("kick_forvip", "&cA VIP Player join the full server!");
this.set("kick_fullserver", "&cThe server is actually full, Sorry!");
}
private void loadFile() {

View File

@ -35,4 +35,6 @@ bad_database_email: '[AuthMe] This /email command only available with MySQL and
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -37,4 +37,6 @@ bad_database_email: '[AuthMe] This /email command only available with MySQL and
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,4 +38,6 @@ bad_database_email: '[AuthMe] This /email command only available with MySQL and
recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,5 +38,6 @@ recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -39,3 +39,5 @@ recovery_email: '&c¿Olvidaste tu contraseña? Por favor usa /email recovery <tu
usage_captcha: '&cUso: /captcha <elCaptcha>'
wrong_captcha: '&cCaptcha incorrecto, please use : /captcha EL_CAPTCHA'
valid_captcha: '&c¡ Captcha ingresado correctamente !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,5 +38,5 @@ recovery_email: '&cUnohtuiko salasana?'
usage_captcha: '&cKäyttö: /captcha <theCaptcha>'
wrong_captcha: '&cVäärä varmistus, käytä : /captcha THE_CAPTCHA'
valid_captcha: '&cSinun varmistus epäonnistui.!'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -37,4 +37,6 @@ bad_database_email: '[AuthMe] La commande /email est disponible uniquement pour
recovery_email: '&cOublie de MotDePasse? Utilisez /email recovery <yourEmail>'
usage_captcha: '&cTrop de Mauvais MotDePasse, utilisez: /captcha <leCaptcha>'
wrong_captcha: '&cCaptcha Incorrect, entrez de nouveau : /captcha THE_CAPTCHA'
valid_captcha: '&cLe Captcha est valide, Merci!'
valid_captcha: '&cLe Captcha est valide, Merci!'
kick_forvip: '&cUn joueur VIP a rejoint le serveur plein!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,3 +38,5 @@ recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,3 +38,5 @@ recovery_email: '&cForgot your password? Please use /email recovery <yourEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -40,3 +40,8 @@ add_email: '&eДобавь свой email: &d/email add АДРЕСОЧТЫ П
bad_database_email: '&c[AuthMe] Команда &d/email&c доступна только при работе с MySQL
или SQLite'
recovery_email: '&cЗабыл пароль? Используй команду &d/email recovery <АДРЕСОЧТЫ>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -41,4 +41,6 @@ bad_database_email: '[AuthMe] Tento príkaz je dostupny iba pri MySQL SQLite'
recovery_email: '&cZabudol si heslo? Pouzi príkaz /email recovery <tvojEmail>'
usage_captcha: '&cUsage: /captcha <theCaptcha>'
wrong_captcha: '&cWrong Captcha, please use : /captcha THE_CAPTCHA'
valid_captcha: '&cYour captcha is valid !'
valid_captcha: '&cYour captcha is valid !'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,3 +38,5 @@ recovery_email: '&c忘了你的密码请输入“/email recovery <你的
usage_captcha: '&c正确用法/captcha <验证码>'
wrong_captcha: '&c错误的验证码请输入“/captcha <验证码>”'
valid_captcha: '&c你的验证码是有效的'
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -38,3 +38,5 @@ recovery_email: '&c忘記密碼 請使用這個的指令來更新密碼
usage_captcha: '&c用法 《 /captcha <驗證碼> 》'
wrong_captcha: '&c你輸入了錯誤的驗證碼請使用 《 /captcha <驗證碼> 》 再次輸入 。'
valid_captcha: '&c你的驗證碼是無效的 '
kick_forvip: '&cA VIP Player join the full server!'
kick_fullserver: '&cThe server is actually full, Sorry!'

View File

@ -3,7 +3,7 @@ author: darkwarriros,Xephi
website: http://www.multiplayer-italia.com/
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
main: uk.org.whoami.authme.AuthMe
version: 2.7.13
version: 2.7.13b2
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag]
commands:
register:
@ -131,4 +131,7 @@ permissions:
default: op
authme.admin.spawn:
description: Teleport to AuthMe spawn point
default: op
authme.vip:
description: Allow vip slot when the server is full
default: op