Added some bypass permissions

This commit is contained in:
Sn0wStorm 2013-11-21 23:06:43 +01:00
parent 9d5b90254a
commit 71a8a66d64
3 changed files with 22 additions and 6 deletions

View File

@ -115,7 +115,7 @@ public class BPlayer {
// Player has drunken too much
public void drinkCap(Player player) {
if (overdrinkKick) {
if (overdrinkKick && !player.hasPermission("brewery.bypass.overdrink")) {
passOut(player);
} else {
quality = getQuality() * 100;
@ -263,7 +263,7 @@ public class BPlayer {
public void login(final Player player) {
if (drunkeness < 10) {
if (offlineDrunk > 60) {
if (enableHome) {
if (enableHome && !player.hasPermission("brewery.bypass.teleport")) {
goHome(player);
}
}
@ -274,8 +274,10 @@ public class BPlayer {
} else if (offlineDrunk - drunkeness >= 30) {
Location randomLoc = Wakeup.getRandom(player.getLocation());
if (randomLoc != null) {
player.teleport(randomLoc);
P.p.msg(player, P.p.languageReader.get("Player_Wake"));
if (!player.hasPermission("brewery.bypass.teleport")) {
player.teleport(randomLoc);
P.p.msg(player, P.p.languageReader.get("Player_Wake"));
}
}
}

View File

@ -270,10 +270,17 @@ public class CommandListener implements CommandExecutor {
bPlayer.setData(drunkeness, quality);
}
p.msg(sender, p.languageReader.get("CMD_Player", playerName, "" + drunkeness, "" + bPlayer.getQuality()));
if (drunkeness > 100) {
bPlayer.drinkCap(p.getServer().getPlayer(playerName));
Player player = p.getServer().getPlayer(playerName);
if (player != null) {
bPlayer.drinkCap(player);
} else {
if (!BPlayer.overdrinkKick) {
bPlayer.setData(100, 0);
}
}
}
p.msg(sender, p.languageReader.get("CMD_Player", playerName, "" + drunkeness, "" + bPlayer.getQuality()));
}

View File

@ -181,6 +181,13 @@ public class PlayerListener implements Listener {
final Player player = event.getPlayer();
BPlayer bplayer = BPlayer.get(player.getName());
if (bplayer != null) {
if (player.hasPermission("brewery.bypass.logindeny")) {
if (bplayer.getDrunkeness() > 100) {
bplayer.setData(100, 0);
}
bplayer.join(player);
return;
}
switch (bplayer.canJoin()) {
case 0:
bplayer.join(player);