Fixed Alts NullPointer

Setup base for Members Upgrade
This commit is contained in:
Driftay 2019-05-19 19:01:59 -04:00
parent 06e7eaf572
commit 3c5d8ee050
4 changed files with 14 additions and 1 deletions

@ -75,14 +75,23 @@ public class CmdJoin extends FCommand {
}
return;
}
int limit = 0;
int altLimit = Conf.factionAltMemberLimit;
limit = Conf.factionMemberLimit;
if (limit > 0 && faction.getFPlayers().size() >= limit && !faction.altInvited(fme)) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), limit, fplayer.describeTo(fme, false));
return;
}
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(fme)) {
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), altLimit, fplayer.describeTo(fme, false));
return;
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) {
return;

@ -21,6 +21,9 @@ public class CmdStealth extends FCommand {
}
public void perform() {
Faction faction = fme.getFaction();
if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) {
fme.setStealth(!fme.isStealthEnabled());

@ -483,11 +483,11 @@ public class FactionsBlockListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true);
return;
}
FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (!fme.hasFaction()) {
return;
}

@ -63,6 +63,7 @@ public enum TL {
/**
* Messsges for /f help
*/
ALT_PLACE_DENY("&c[!] &7You are a alt you may not place blocks!"),
COMMAND_HELP_NEXTCREATE("<i>Learn how to create a faction on the next page."),
COMMAND_HELP_INVITATIONS("command.help.invitations", "<i>You might want to close it and use invitations:"),
COMMAND_HELP_HOME("<i>And don't forget to set your home:"),