Alts Can No Longer Be Promoted

This commit is contained in:
Driftay 2020-05-25 14:16:49 -04:00
parent 6f293dce17
commit 7f927189ea
6 changed files with 83 additions and 69 deletions

View File

@ -57,6 +57,10 @@ public class CmdAdmin extends FCommand {
return; return;
} }
if(fyou.isAlt()){
return;
}
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction // only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
if (fyou.getFaction() != targetFaction) { if (fyou.getFaction() != targetFaction) {
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER); FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);

View File

@ -55,6 +55,10 @@ public class CmdColeader extends FCommand {
return; return;
} }
if(you.isAlt()){
return;
}
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) { if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
context.msg(TL.COMMAND_COLEADER_NOTADMIN); context.msg(TL.COMMAND_COLEADER_NOTADMIN);
return; return;

View File

@ -42,7 +42,6 @@ public class CmdList extends FCommand {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!context.payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) if (!context.payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
return; return;
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions(); ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
factionList.remove(Factions.getInstance().getWilderness()); factionList.remove(Factions.getInstance().getWilderness());
@ -100,6 +99,7 @@ public class CmdList extends FCommand {
String header = FactionsPlugin.getInstance().getConfig().getString("list.header", defaults[0]); String header = FactionsPlugin.getInstance().getConfig().getString("list.header", defaults[0]);
assert header != null;
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount)); header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
lines.add(FactionsPlugin.getInstance().txt.parse(header)); lines.add(FactionsPlugin.getInstance().txt.parse(header));
@ -111,7 +111,6 @@ public class CmdList extends FCommand {
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, context.fPlayer, FactionsPlugin.getInstance().getConfig().getString("list.entry", defaults[2])))); lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, context.fPlayer, FactionsPlugin.getInstance().getConfig().getString("list.entry", defaults[2]))));
} }
context.sendMessage(lines); context.sendMessage(lines);
});
} }
@Override @Override

View File

@ -50,6 +50,10 @@ public class CmdMod extends FCommand {
return; return;
} }
if(you.isAlt()){
return;
}
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) { if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
context.msg(TL.COMMAND_MOD_NOTADMIN); context.msg(TL.COMMAND_MOD_NOTADMIN);
return; return;

View File

@ -74,6 +74,10 @@ public class FPromoteCommand extends FCommand {
} }
} }
if(target.isAlt()){
return;
}
// Don't allow people to demote people who already have the lowest rank. // Don't allow people to demote people who already have the lowest rank.
if (current.value == 0 && relative <= 0) { if (current.value == 0 && relative <= 0) {
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName()); context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());

View File

@ -80,9 +80,9 @@ public class CmdWild extends FCommand implements WaitedTask {
public void teleportPlayer(Player p, FLocation loc) { public void teleportPlayer(Player p, FLocation loc) {
Location finalLoc; Location finalLoc;
if (FactionsPlugin.getInstance().getConfig().getBoolean("Wild.Arrival.SpawnAbove")) { if (FactionsPlugin.getInstance().getConfig().getBoolean("Wild.Arrival.SpawnAbove")) {
finalLoc = new Location(p.getWorld(), loc.getX(), p.getWorld().getHighestBlockYAt(Math.round(loc.getX()), Math.round(loc.getZ())) + FactionsPlugin.getInstance().getConfig().getInt("Wild.Arrival.SpawnAboveBlocks", 1), loc.getZ()); finalLoc = new Location(loc.getWorld(), loc.getX(), loc.getWorld().getHighestBlockYAt(Math.round(loc.getX()), Math.round(loc.getZ())) + FactionsPlugin.getInstance().getConfig().getInt("Wild.Arrival.SpawnAboveBlocks", 1), loc.getZ());
} else { } else {
finalLoc = new Location(p.getWorld(), loc.getX(), p.getWorld().getHighestBlockYAt(Math.round(loc.getX()), Math.round(loc.getZ())), loc.getZ()); finalLoc = new Location(loc.getWorld(), loc.getX(), loc.getWorld().getHighestBlockYAt(Math.round(loc.getX()), Math.round(loc.getZ())), loc.getZ());
} }
p.teleport(finalLoc, PlayerTeleportEvent.TeleportCause.PLUGIN); p.teleport(finalLoc, PlayerTeleportEvent.TeleportCause.PLUGIN);
setTeleporting(p); setTeleporting(p);
@ -115,5 +115,4 @@ public class CmdWild extends FCommand implements WaitedTask {
player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString()); player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString());
teleportRange.remove(player); teleportRange.remove(player);
} }
} }