Fix claiming check bug caused by Sevenja's Pull Request

This commit is contained in:
ProSavage 2018-07-25 15:09:55 -05:00
parent 8bde15d864
commit cb6f0a8104
6 changed files with 10 additions and 7 deletions

View File

@ -47,7 +47,6 @@ public class CmdMod extends FCommand {
boolean permAny = Permission.MOD_ANY.has(sender, false); boolean permAny = Permission.MOD_ANY.has(sender, false);
Faction targetFaction = you.getFaction(); Faction targetFaction = you.getFaction();
if (targetFaction != myFaction && !permAny) { if (targetFaction != myFaction && !permAny) {
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true)); msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
return; return;

View File

@ -520,7 +520,7 @@ public class FactionsPlayerListener implements Listener {
FScoreboard.remove(me); FScoreboard.remove(me);
} }
public String parseAllPlaceholders(String string, Faction faction) { public String parseAllPlaceholders(String string, Faction faction, Player player) {
string = string.replace("{Faction}", faction.getTag()) string = string.replace("{Faction}", faction.getTag())
.replace("{online}", faction.getOnlinePlayers().size() + "") .replace("{online}", faction.getOnlinePlayers().size() + "")
.replace("{offline}", faction.getFPlayers().size() - faction.getOnlinePlayers().size() + "") .replace("{offline}", faction.getFPlayers().size() - faction.getOnlinePlayers().size() + "")
@ -677,9 +677,9 @@ public class FactionsPlayerListener implements Listener {
if (P.p.getConfig().getBoolean("Title.Show-Title")) { if (P.p.getConfig().getBoolean("Title.Show-Title")) {
String title = P.p.getConfig().getString("Title.Format.Title"); String title = P.p.getConfig().getString("Title.Format.Title");
title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
title = parseAllPlaceholders(title, factionTo); title = parseAllPlaceholders(title, factionTo, player);
String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
subTitle = parseAllPlaceholders(subTitle, factionTo); subTitle = parseAllPlaceholders(subTitle, factionTo, player);
if (!P.p.mc17) { if (!P.p.mc17) {
if (!P.p.mc18) { if (!P.p.mc18) {
me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle), P.p.getConfig().getInt("Title.Options.FadeInTime"), me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle), P.p.getConfig().getInt("Title.Options.FadeInTime"),

View File

@ -141,7 +141,6 @@ public abstract class MCommand<T extends MPlugin> {
// TODO: There should be a boolean for silence // TODO: There should be a boolean for silence
public boolean validCall(CommandSender sender, List<String> args) { public boolean validCall(CommandSender sender, List<String> args) {
return validSenderType(sender, true) && validSenderPermissions(sender, true) && validArgs(args, sender); return validSenderType(sender, true) && validSenderPermissions(sender, true) && validArgs(args, sender);
} }
public boolean isEnabled() { public boolean isEnabled() {

View File

@ -171,7 +171,7 @@ public abstract class MPlugin extends JavaPlugin {
conf.save(lang); conf.save(lang);
} catch (IOException e) { } catch (IOException e) {
getLogger().log(Level.WARNING, "Factions: Failed to save lang.yml."); getLogger().log(Level.WARNING, "Factions: Failed to save lang.yml.");
getLogger().log(Level.WARNING, "Factions: Report this stack trace to drtshock."); getLogger().log(Level.WARNING, "Factions: Report this stack trace to prosavage.");
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -734,7 +734,7 @@ public abstract class MemoryFPlayer implements FPlayer {
return true; return true;
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) { } else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
return true; return true;
} else if (forFaction.getAccess(this,PermissableAction.TERRITORY) == Access.ALLOW) { } else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW) {
return true; return true;
} else if (myFaction != forFaction) { } else if (myFaction != forFaction) {
error = P.p.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this)); error = P.p.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
@ -1111,14 +1111,18 @@ public abstract class MemoryFPlayer implements FPlayer {
// notifyFailure is false if called by auto-claim; no need to notify on every failure for it // notifyFailure is false if called by auto-claim; no need to notify on every failure for it
// return value is false on failure, true on success // return value is false on failure, true on success
Faction currentFaction = Board.getInstance().getFactionAt(flocation); Faction currentFaction = Board.getInstance().getFactionAt(flocation);
int ownedLand = forFaction.getLandRounded(); int ownedLand = forFaction.getLandRounded();
if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) { if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) {
return false; return false;
} }
// if economy is enabled and they're not on the bypass list, make sure they can pay // if economy is enabled and they're not on the bypass list, make sure they can pay
boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone(); boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone();
double cost = 0.0; double cost = 0.0;

View File

@ -779,6 +779,7 @@ public enum TL {
CLAIM_CLICK_TO_CLAIM("Click to try to claim &2(%1$d, %2$d)"), CLAIM_CLICK_TO_CLAIM("Click to try to claim &2(%1$d, %2$d)"),
CLAIM_MAP_OUTSIDEBORDER("&cThis claim is outside the worldborder!"), CLAIM_MAP_OUTSIDEBORDER("&cThis claim is outside the worldborder!"),
CLAIM_YOUAREHERE("You are here"), CLAIM_YOUAREHERE("You are here"),
CLAIM_NO_TERRITORY_PERM("You do not have permission from your faction leader to do this!"),
/** /**
* More generic, or less easily categorisable translations, which may apply to more than one class * More generic, or less easily categorisable translations, which may apply to more than one class