Merge remote-tracking branch 'origin/1.6.x' into 1.6.x

This commit is contained in:
ProSavage 2018-08-04 18:45:56 -05:00
commit 799fef1f39
26 changed files with 187 additions and 158 deletions

View File

@ -39,18 +39,16 @@ public class CmdBan extends FCommand {
return; return;
} }
// Can the player ban for this faction? // Adds bypass to admins and clean permission check
// Check for ALLOW access as well before we check for role. if (!fme.isAdminBypassing()) {
if (access != Access.ALLOW) { Access access = myFaction.getAccess(fme, PermissableAction.BAN);
if (!Permission.BAN.has(sender, true) || !assertMinRole(Role.MODERATOR)) { if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
return; fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban");
}
} else {
if (!Permission.BAN.has(sender, true)) {
return; return;
} }
} }
// Good on permission checks. Now lets just ban the player. // Good on permission checks. Now lets just ban the player.
FPlayer target = argAsFPlayer(0); FPlayer target = argAsFPlayer(0);
if (target == null) { if (target == null) {

View File

@ -37,8 +37,12 @@ public class CmdChat extends FCommand {
if (modeString != null) { if (modeString != null) {
modeString = modeString.toLowerCase(); modeString = modeString.toLowerCase();
if (modeString.startsWith("m")) { // Only allow Mods and higher rank to switch to this channel.
if (modeString.startsWith("m") && fme.getRole().isAtLeast(Role.MODERATOR)) {
modeTarget = ChatMode.MOD; modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("m") && !fme.getRole().isAtLeast(Role.MODERATOR)) {
msg(TL.COMMAND_CHAT_MOD_ONLY);
return;
} else if (modeString.startsWith("p")) { } else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC; modeTarget = ChatMode.PUBLIC;
} else if (modeString.startsWith("a")) { } else if (modeString.startsWith("a")) {

View File

@ -30,11 +30,14 @@ public class CmdChest extends FCommand {
fme.sendMessage("This command is disabled!"); fme.sendMessage("This command is disabled!");
return; return;
} }
Access access = fme.getFaction().getAccess(fme, PermissableAction.CHEST); // This permission check is way too explicit but it's clean
if (access.equals(Access.DENY)) { if (!fme.isAdminBypassing()) {
fme.msg(TL.GENERIC_NOPERMISSION, "chest"); Access access = myFaction.getAccess(fme, PermissableAction.CHEST);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
return;
}
} }
//debug Bukkit.broadcastMessage(fme.getFaction().getUpgrade("Chest") + "");
me.openInventory(fme.getFaction().getChest()); me.openInventory(fme.getFaction().getChest());

View File

@ -37,14 +37,15 @@ public class CmdClaim extends FCommand {
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
if (!fme.isAdminBypassing()) { if (!fme.isAdminBypassing()) {
Access access = forFaction.getAccess(fme, PermissableAction.TERRITORY); Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
if (access == Access.DENY) { if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_NOPERMISSION, "change faction territory!"); fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory");
return; return;
} }
} }
if (radius < 1) { if (radius < 1) {
msg(TL.COMMAND_CLAIM_INVALIDRADIUS); msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
return; return;

View File

@ -31,6 +31,13 @@ public class CmdDeinvite extends FCommand {
@Override @Override
public void perform() { public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0); FPlayer you = this.argAsBestFPlayerMatch(0);
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}
}
if (you == null) { if (you == null) {
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD); FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
for (String id : myFaction.getInvites()) { for (String id : myFaction.getInvites()) {

View File

@ -44,16 +44,13 @@ public class CmdDisband extends FCommand {
boolean isMyFaction = fme != null && faction == myFaction; boolean isMyFaction = fme != null && faction == myFaction;
if (isMyFaction) { if (!fme.isAdminBypassing()) {
if (!assertMinRole(Role.ADMIN)) { Access access = myFaction.getAccess(fme, PermissableAction.DISBAND);
return; if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
} fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband faction");
} else {
if (!Permission.DISBAND_ANY.has(sender, true)) {
return; return;
} }
} }
if (!faction.isNormal()) { if (!faction.isNormal()) {
msg(TL.COMMAND_DISBAND_IMMUTABLE.toString()); msg(TL.COMMAND_DISBAND_IMMUTABLE.toString());
return; return;

View File

@ -30,15 +30,15 @@ public class CmdFWarp extends FCommand {
@Override @Override
public void perform() { public void perform() {
//TODO: check if in combat. //TODO: check if in combat.
if (!fme.isAdminBypassing()) {
// Check for access first. Access access = myFaction.getAccess(fme, PermissableAction.WARP);
Access access = myFaction.getAccess(fme, PermissableAction.WARP); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps");
if (access == Access.DENY) { return;
fme.msg(TL.GENERIC_NOPERMISSION, "warp"); }
return;
} }
if (args.size() == 0) { if (args.size() == 0) {
WarpGUI warpGUI = new WarpGUI(fme); WarpGUI warpGUI = new WarpGUI(fme);
warpGUI.build(); warpGUI.build();

View File

@ -54,10 +54,15 @@ public class CmdFly extends FCommand {
continue; continue;
} }
} }
if (FPlayers.getInstance().getByPlayer(player).isVanished()) { if (FPlayers.getInstance().getByPlayer(player).isVanished()) {
// Actually, vanished players (such as admins) should not display particles to prevent others from knowing their vanished assistance for moderation.
// But we can keep it as a config.
if (P.p.getConfig().getBoolean("ffly.Particles.Enable-While-Vanished")) {
return;
}
continue; continue;
} }
if (P.p.useNonPacketParticles) { if (P.p.useNonPacketParticles) {
// 1.9+ based servers will use the built in particleAPI instead of packet based. // 1.9+ based servers will use the built in particleAPI instead of packet based.
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working. // any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.

View File

@ -47,6 +47,14 @@ public class CmdHome extends FCommand {
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED); fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
return; return;
} }
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
}
if (!myFaction.hasHome()) { if (!myFaction.hasHome()) {
fme.msg(TL.COMMAND_HOME_NOHOME.toString() + (fme.getRole().value < Role.MODERATOR.value ? TL.GENERIC_ASKYOURLEADER.toString() : TL.GENERIC_YOUSHOULD.toString())); fme.msg(TL.COMMAND_HOME_NOHOME.toString() + (fme.getRole().value < Role.MODERATOR.value ? TL.GENERIC_ASKYOURLEADER.toString() : TL.GENERIC_YOUSHOULD.toString()));

View File

@ -48,36 +48,40 @@ public class CmdInvite extends FCommand {
return; return;
} }
Access access = myFaction.getAccess(fme, PermissableAction.INVITE); if (!fme.isAdminBypassing()) {
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) { Access access = myFaction.getAccess(fme, PermissableAction.INVITE);
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "invite"); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
return; fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
return;
}
} }
if (myFaction.isInvited(target)) {
fme.msg(TL.COMMAND_INVITE_ALREADYINVITED, target.getName());
return;
}
if (myFaction.isBanned(target)) { if (myFaction.isBanned(target)) {
fme.msg(TL.COMMAND_INVITE_BANNED, target.getName()); fme.msg(TL.COMMAND_INVITE_BANNED, target.getName());
return; return;
} }
myFaction.invite(target); myFaction.invite(target);
if (!target.isOnline()) { // Send the invitation to the target player when online, otherwise just ignore
return; if (target.isOnline()) {
// Tooltips, colors, and commands only apply to the string immediately before it.
FancyMessage message = new FancyMessage(fme.describeTo(target, true))
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
.color(ChatColor.YELLOW)
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(myFaction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
message.send(target.getPlayer());
} }
// Tooltips, colors, and commands only apply to the string immediately before it.
FancyMessage message = new FancyMessage(fme.describeTo(target, true))
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
.color(ChatColor.YELLOW)
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
.then(myFaction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
message.send(target.getPlayer());
//you.msg("%s<i> invited you to %s", fme.describeTo(you, true), myFaction.describeTo(you));
myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), target.describeTo(myFaction)); myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), target.describeTo(myFaction));
} }

View File

@ -73,40 +73,31 @@ public class CmdKick extends FCommand {
return; return;
} }
// players with admin-level "disband" permission can bypass these requirements // This permission check has been cleaned to be more understandable and logical
if (!Permission.KICK_ANY.has(sender)) { // Unless is admin,
// - Check for the kick permission.
// - Make sure the player is in the faction.
// - Make sure the kicked player has lower rank than the kicker.
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.KICK); Access access = myFaction.getAccess(fme, PermissableAction.KICK);
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) { if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick"); fme.msg(TL.GENERIC_NOPERMISSION, "kick");
return; return;
} }
if (toKickFaction != myFaction) { if (toKickFaction != myFaction) {
msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme)); msg(TL.COMMAND_KICK_NOTMEMBER, toKick.describeTo(fme, true), myFaction.describeTo(fme));
return; return;
} }
if (toKick.getRole().value >= fme.getRole().value) {
// Check for Access before we check for Role.
if (access != Access.ALLOW && toKick.getRole().value >= fme.getRole().value) {
msg(TL.COMMAND_KICK_INSUFFICIENTRANK); msg(TL.COMMAND_KICK_INSUFFICIENTRANK);
return; return;
} }
if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) { if (!Conf.canLeaveWithNegativePower && toKick.getPower() < 0) {
msg(TL.COMMAND_KICK_NEGATIVEPOWER); msg(TL.COMMAND_KICK_NEGATIVEPOWER);
return; return;
} }
} }
Access access = myFaction.getAccess(fme, PermissableAction.KICK);
// This statement allows us to check if they've specifically denied it, or default to
// the old setting of allowing moderators to kick
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) {
fme.msg(TL.GENERIC_NOPERMISSION, "kick");
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 economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) { if (!canAffordCommand(Conf.econCostKick, TL.COMMAND_KICK_TOKICK.toString())) {
return; return;

View File

@ -38,11 +38,15 @@ public class CmdSetFWarp extends FCommand {
Access access = myFaction.getAccess(fme, PermissableAction.SETWARP); Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
// This statement allows us to check if they've specifically denied it, or default to // This statement allows us to check if they've specifically denied it, or default to
// the old setting of allowing moderators to set warps. // the old setting of allowing moderators to set warps.
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) { if (!fme.isAdminBypassing()) {
fme.msg(TL.GENERIC_NOPERMISSION, "set warp"); Access access = myFaction.getAccess(fme, PermissableAction.SETWARP);
return; if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps");
return;
}
} }
int maxWarps = P.p.getConfig().getInt("max-warps", 5); int maxWarps = P.p.getConfig().getInt("max-warps", 5);
if (maxWarps <= myFaction.getWarps().size()) { if (maxWarps <= myFaction.getWarps().size()) {
fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps); fme.msg(TL.COMMAND_SETFWARP_LIMIT, maxWarps);

View File

@ -40,22 +40,11 @@ public class CmdSethome extends FCommand {
return; return;
} }
Access access = faction.getAccess(fme, PermissableAction.SETHOME); if (!fme.isAdminBypassing()) {
if (access == Access.DENY) { Access access = myFaction.getAccess(fme, PermissableAction.SETHOME);
fme.msg(TL.GENERIC_NOPERMISSION, "sethome"); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN && !Permission.SETHOME_ANY.has(sender, true)) {
return; fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home");
} return;
// If player does not have allow run extra permission checks
if (access != Access.ALLOW) {
if (faction == myFaction) {
if (!assertMinRole(Role.MODERATOR)) {
return;
}
} else {
if (!Permission.SETHOME_ANY.has(sender, true)) {
return;
}
} }
} }

View File

@ -21,20 +21,15 @@ public class CmdStealth extends FCommand {
} }
public void perform() { public void perform() {
//Grabs Faction if (myFaction != null && !myFaction.isWilderness() && !myFaction.isSafeZone() && !myFaction.isWarZone() && myFaction.isNormal()) {
Faction faction = fme.getFaction();
if (faction != null && !faction.getId().equalsIgnoreCase("0") && !faction.getId().equalsIgnoreCase("none") && !faction.getId().equalsIgnoreCase("safezone") && !faction.getId().equalsIgnoreCase("warzone")) {
//Grabs Boolean From FPlayer
fme.setStealth(!fme.isStealthEnabled()); fme.setStealth(!fme.isStealthEnabled());
//Sends Enable/Disable Message // Sends Enable/Disable Message
fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE); fme.msg(fme.isStealthEnabled() ? TL.COMMAND_STEALTH_ENABLE : TL.COMMAND_STEALTH_DISABLE);
} else { } else {
//Send "Needed Faction" Message fme.msg(TL.COMMAND_STEALTH_MUSTBEMEMBER);
fme.sendMessage(ChatColor.RED + "You must be in a faction to use this command");
} }
} }
@Override @Override
public TL getUsageTranslation() { public TL getUsageTranslation() {
return TL.COMMAND_STEALTH_DESCRIPTION; return TL.COMMAND_STEALTH_DESCRIPTION;

View File

@ -36,13 +36,14 @@ public class CmdTnt extends FCommand {
return; return;
} }
Access access = fme.getFaction().getAccess(fme, PermissableAction.TNTBANK); if (!fme.isAdminBypassing()) {
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { Access access = myFaction.getAccess(fme, PermissableAction.TNTBANK);
fme.msg(TL.GENERIC_NOPERMISSION, "tntbank"); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
return; fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt bank");
return;
}
} }
if (args.size() == 2) { if (args.size() == 2) {
if (args.get(0).equalsIgnoreCase("add") || args.get(0).equalsIgnoreCase("a")) { if (args.get(0).equalsIgnoreCase("add") || args.get(0).equalsIgnoreCase("a")) {
int testNumber = -1; int testNumber = -1;

View File

@ -34,12 +34,16 @@ public class CmdTntFill extends FCommand {
@Override @Override
public void perform() { public void perform() {
Access access = fme.getFaction().getAccess(fme, PermissableAction.TNTFILL); if (!fme.isAdminBypassing()) {
if (access.equals(Access.DENY)) { Access access = myFaction.getAccess(fme, PermissableAction.TNTFILL);
fme.msg(TL.GENERIC_NOPERMISSION, "tntfill"); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use tnt fill");
return;
}
} }
msg(TL.COMMAND_TNTFILL_HEADER); msg(TL.COMMAND_TNTFILL_HEADER);
int radius = argAsInt(0, 16); int radius = argAsInt(0, 16);
int amount = argAsInt(1, 16); int amount = argAsInt(1, 16);

View File

@ -26,21 +26,10 @@ public class CmdUnban extends FCommand {
@Override @Override
public void perform() { public void perform() {
Access access = myFaction.getAccess(fme, PermissableAction.BAN); if (!fme.isAdminBypassing()) {
if (access == Access.DENY) { Access access = myFaction.getAccess(fme, PermissableAction.BAN);
fme.msg(TL.GENERIC_NOPERMISSION, "ban"); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN && !Permission.BAN.has(sender, true)) {
return; fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans");
}
// Can the player set the home for this faction?
// Check for ALLOW access as well before we check for role.
// TODO: no more duplicate code :(
if (access != Access.ALLOW) {
if (!Permission.BAN.has(sender) && !(assertMinRole(Role.MODERATOR))) {
return;
}
} else {
if (!Permission.BAN.has(sender, true)) {
return; return;
} }
} }

View File

@ -36,15 +36,13 @@ public class CmdUnclaim extends FCommand {
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
if (!fme.isAdminBypassing()) { if (!fme.isAdminBypassing()) {
Access access = forFaction.getAccess(fme, PermissableAction.TERRITORY); Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);
if (access == Access.DENY) { if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_NOPERMISSION, "change faction territory!"); fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage faction territory");
return; return;
} }
} }
if (radius < 1) { if (radius < 1) {
msg(TL.COMMAND_CLAIM_INVALIDRADIUS); msg(TL.COMMAND_CLAIM_INVALIDRADIUS);
return; return;

View File

@ -38,21 +38,37 @@ public class FPromoteCommand extends FCommand {
return; return;
} }
Access access = myFaction.getAccess(fme.getRole(), PermissableAction.PROMOTE);
// Well this is messy.
if (access == null || access == Access.UNDEFINED) {
if (!assertMinRole(Role.MODERATOR)) {
return;
}
} else if (access == Access.DENY) {
msg(TL.COMMAND_NOACCESS);
return;
}
Role current = target.getRole(); Role current = target.getRole();
Role promotion = Role.getRelative(current, +relative); Role promotion = Role.getRelative(current, +relative);
// Now it ain't that messy
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.PROMOTE);
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_NOPERMISSION, "manage ranks");
return;
}
if (target == fme) {
fme.msg(TL.COMMAND_PROMOTE_NOTSELF);
return;
}
// Don't allow people to manage role of their same rank
if (fme.getRole() == current) {
fme.msg(TL.COMMAND_PROMOTE_NOT_SAME);
return;
}
// Don't allow people to promote people to their same or higher rank.
if (fme.getRole().value <= promotion.value) {
fme.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
return;
}
}
if (promotion == null) {
fme.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER);
return;
}
if (promotion == null) { if (promotion == null) {
fme.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER); fme.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER);
return; return;

View File

@ -79,11 +79,12 @@ public class FactionsBlockListener implements Listener {
return; return;
} }
if (event.getBlock().getType() == Material.LEGACY_MOB_SPAWNER) { if (event.getBlock().getType() == Material.LEGACY_MOB_SPAWNER) {
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER); if (!fme.isAdminBypassing()) {
if (access.equals(Access.DENY)) { Access access = myFaction.getAccess(fme, PermissableAction.SPAWNER);
fme.msg(TL.GENERIC_NOPERMISSION, "mine spawners"); if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
event.setCancelled(true); fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
return;
}
} }
} }
} }

View File

@ -63,8 +63,14 @@ public class FactionsChatListener implements Listener {
fplayer.sendMessage("[MCspy]: " + message); fplayer.sendMessage("[MCspy]: " + message);
} }
} }
} else {
// Just in case player gets demoted while in faction chat.
me.msg(TL.COMMAND_CHAT_MOD_ONLY);
event.setCancelled(true);
return;
} }
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("Mod Chat: " + message)); Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("Mod Chat: " + message));
event.setCancelled(true); event.setCancelled(true);

View File

@ -360,10 +360,6 @@ public class FactionsPlayerListener implements Listener {
return false; return false;
} }
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
initPlayer(event.getPlayer()); initPlayer(event.getPlayer());

View File

@ -29,6 +29,7 @@ public enum PermissableAction {
SETHOME("sethome"), SETHOME("sethome"),
TERRITORY("territory"), TERRITORY("territory"),
ACCESS("access"), ACCESS("access"),
HOME("home"),
DISBAND("disband"), DISBAND("disband"),
PROMOTE("promote"), PROMOTE("promote"),
SETWARP("setwarp"), SETWARP("setwarp"),

View File

@ -37,22 +37,29 @@ public class FUpgradesGUI implements Listener {
inventory.setItem(dummySlots.get(i), dummyItem); inventory.setItem(dummySlots.get(i), dummyItem);
} }
ItemStack[] items = buildItems(fme); ItemStack[] items = buildItems(fme);
List<Integer> cropSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots"); List<Integer> cropSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Crops.CropItem.slots");
for (int i = 0; i <= cropSlots.size() - 1; i++) {
inventory.setItem(cropSlots.get(i), items[2]);
}
List<Integer> spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots"); List<Integer> spawnerSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Spawners.SpawnerItem.slots");
for (int i = 0; i <= spawnerSlots.size() - 1; i++) {
inventory.setItem(spawnerSlots.get(i), items[1]);
}
List<Integer> expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots"); List<Integer> expSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.EXP.EXPItem.slots");
for (int i = 0; i <= expSlots.size() - 1; i++) {
inventory.setItem(expSlots.get(i), items[0]);
}
List<Integer> chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots"); List<Integer> chestSlots = P.p.getConfig().getIntegerList("fupgrades.MainMenu.Chest.ChestItem.slots");
for (int i = 0; i <= chestSlots.size() - 1; i++) { if (cropSlots != -1) {
inventory.setItem(chestSlots.get(i), items[3]); for (int i = 0; i <= cropSlots.size() - 1; i++) {
inventory.setItem(cropSlots.get(i), items[2]);
}
}
if (spawnerSlots != -1) {
for (int i = 0; i <= spawnerSlots.size() - 1; i++) {
inventory.setItem(spawnerSlots.get(i), items[1]);
}
}
if (expSlots != -1) {
for (int i = 0; i <= expSlots.size() - 1; i++) {
inventory.setItem(expSlots.get(i), items[0]);
}
}
if (chestSlots != -1) {
for (int i = 0; i <= chestSlots.size() - 1; i++) {
inventory.setItem(chestSlots.get(i), items[3]);
}
} }
fme.getPlayer().openInventory(inventory); fme.getPlayer().openInventory(inventory);
} }

View File

@ -188,6 +188,7 @@ public enum TL {
COMMAND_CHAT_MODE_TRUCE("&c&l[!] &5Truce &7only chat mode."), COMMAND_CHAT_MODE_TRUCE("&c&l[!] &5Truce &7only chat mode."),
COMMAND_CHAT_MODE_FACTION("&c&l[!] &aFaction&7 only chat mode."), COMMAND_CHAT_MODE_FACTION("&c&l[!] &aFaction&7 only chat mode."),
COMMAND_CHAT_MODE_MOD("&c&l[!] &dMod &7only chat mode."), COMMAND_CHAT_MODE_MOD("&c&l[!] &dMod &7only chat mode."),
COMMAND_CHAT_MOD_ONLY("&c&l[!] &7Only Mods can talk through this chat mode."),
COMMAND_CHATSPY_ENABLE("&c&l[!] &7You have &cenabled &7chat spying mode."), COMMAND_CHATSPY_ENABLE("&c&l[!] &7You have &cenabled &7chat spying mode."),
COMMAND_CHATSPY_ENABLELOG(" has ENABLED chat spying mode."), COMMAND_CHATSPY_ENABLELOG(" has ENABLED chat spying mode."),
@ -329,6 +330,7 @@ public enum TL {
COMMAND_INVITE_INVITEDYOU("&chas invited you to join "), COMMAND_INVITE_INVITEDYOU("&chas invited you to join "),
COMMAND_INVITE_INVITED("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction."), COMMAND_INVITE_INVITED("&c&l[!]&7 &c%1$s&7 invited &c%2$s&7 to your faction."),
COMMAND_INVITE_ALREADYMEMBER("&c&l[!]&7 &c%1$s&7 is already a member of&c %2$s"), COMMAND_INVITE_ALREADYMEMBER("&c&l[!]&7 &c%1$s&7 is already a member of&c %2$s"),
COMMAND_INVITE_ALREADYINVITED("&c&l[!]&7 &c%1$s&7 has already been invited"),
COMMAND_INVITE_DESCRIPTION("Invite a player to your faction"), COMMAND_INVITE_DESCRIPTION("Invite a player to your faction"),
COMMAND_INVITE_BANNED("&c&l[!]&7 &7%1$s &cis banned &7from your Faction. &cNot &7sending an invite."), COMMAND_INVITE_BANNED("&c&l[!]&7 &7%1$s &cis banned &7from your Faction. &cNot &7sending an invite."),
@ -635,6 +637,7 @@ public enum TL {
COMMAND_STEALTH_DESCRIPTION("Enable and Disable Stealth Mode"), COMMAND_STEALTH_DESCRIPTION("Enable and Disable Stealth Mode"),
COMMAND_STEALTH_ENABLE( "&2Stealth &8» &7You will no longer disable nearby players fly."), COMMAND_STEALTH_ENABLE( "&2Stealth &8» &7You will no longer disable nearby players fly."),
COMMAND_STEALTH_DISABLE("&2Stealth &8» &7You will now disable other nearby players fly."), COMMAND_STEALTH_DISABLE("&2Stealth &8» &7You will now disable other nearby players fly."),
COMMAND_STEALTH_MUSTBEMEMBER("&2Stealth &8» &4You must be in a faction to use this command"),
COMMAND_STUCK_TIMEFORMAT("m 'minutes', s 'seconds.'"), COMMAND_STUCK_TIMEFORMAT("m 'minutes', s 'seconds.'"),
COMMAND_STUCK_CANCELLED("<a>Teleport cancelled because you were damaged"), COMMAND_STUCK_CANCELLED("<a>Teleport cancelled because you were damaged"),

View File

@ -65,6 +65,7 @@ enable-faction-flight: true
ffly: ffly:
Particles: Particles:
Enabled: true Enabled: true
Enable-While-Vanished: true
AutoEnable: true #If set to true, fly will automatically enable when walking into your own chunk. AutoEnable: true #If set to true, fly will automatically enable when walking into your own chunk.