Added Configurable Option to Broadcast Disband and Create Messages For Factions
**More Coming Soon**
This commit is contained in:
parent
ce98d68518
commit
3559a9f090
@ -90,11 +90,11 @@ public class CmdCreate extends FCommand {
|
||||
// That way we don't have to mess up deleting more stuff.
|
||||
// And prevent the user from being returned to NORMAL after deleting his old faction.
|
||||
fme.setRole(Role.LEADER);
|
||||
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("faction-creation-broadcast", true)) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
|
||||
}
|
||||
}
|
||||
|
||||
msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate());
|
||||
|
||||
if (Conf.logFactionCreate) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.SavageFactions;
|
||||
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
|
||||
@ -76,7 +78,6 @@ public class CmdDisband extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// check for tnt before disbanding.
|
||||
|
||||
if (!disbandMap.containsKey(me.getUniqueId().toString()) && faction.getTnt() > 0) {
|
||||
@ -88,14 +89,25 @@ public class CmdDisband extends FCommand {
|
||||
disbandMap.remove(me.getUniqueId().toString());
|
||||
}
|
||||
}, 200L);
|
||||
} else {
|
||||
//Check if the faction we asked confirmation for is the one being disbanded.
|
||||
if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) {
|
||||
} else if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) {
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower);
|
||||
if (follower.getFaction() == faction) {
|
||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||
} else {
|
||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
||||
}
|
||||
}
|
||||
faction.disband(me, PlayerDisbandReason.COMMAND);
|
||||
} else {
|
||||
faction.disband(me, PlayerDisbandReason.COMMAND);
|
||||
me.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_DISBAND_DESCRIPTION;
|
||||
|
@ -99,7 +99,7 @@ public class CmdTnt extends FCommand {
|
||||
return;
|
||||
}
|
||||
if (fme.getFaction().getTnt() < amount) {
|
||||
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH.toString());
|
||||
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH);
|
||||
return;
|
||||
}
|
||||
int fullStacks = amount / 64;
|
||||
|
@ -39,7 +39,7 @@ public class FTeamWrapper {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) {
|
||||
if (!SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false) || SavageFactions.plugin.getConfig().getBoolean("See-Invisible-Faction-Members")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ public class FTeamWrapper {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false)) {
|
||||
if (!SavageFactions.plugin.getConfig().getBoolean("scoreboard.default-prefixes", false) || SavageFactions.plugin.getConfig().getBoolean("See-Invisible-Faction-Members")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -168,8 +168,13 @@ public class FTeamWrapper {
|
||||
FPlayer fplayer = fboard.getFPlayer();
|
||||
Team team = teams.get(fboard);
|
||||
boolean focused = false;
|
||||
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("See-Invisible-Faction-Members", false)) {
|
||||
team.setCanSeeFriendlyInvisibles(true);
|
||||
}
|
||||
|
||||
if ((SavageFactions.plugin.getConfig().getBoolean("ffocus.Enabled")) && (fplayer.getFaction() != null) && (fplayer.getFaction().getFocused() != null)) {
|
||||
for (FPlayer fp : this.faction.getFPlayersWhereOnline(true)) {
|
||||
for (FPlayer fp : faction.getFPlayersWhereOnline(true)) {
|
||||
if (fplayer.getFaction().getFocused().equalsIgnoreCase(fp.getName())) {
|
||||
team.setPrefix(ChatColor.translateAlternateColorCodes('&', SavageFactions.plugin.getConfig().getString("ffocus.Prefix", "&7»&b")));
|
||||
focused = true;
|
||||
@ -181,9 +186,9 @@ public class FTeamWrapper {
|
||||
|
||||
prefix = PlaceholderAPI.setPlaceholders(fplayer.getPlayer(), prefix);
|
||||
prefix = PlaceholderAPI.setBracketPlaceholders(fplayer.getPlayer(), prefix);
|
||||
prefix = prefix.replace("{relationcolor}", this.faction.getRelationTo(fplayer).getColor().toString());
|
||||
prefix = prefix.replace("{relationcolor}", faction.getRelationTo(fplayer).getColor().toString());
|
||||
prefix = prefix.replace("{faction}",
|
||||
this.faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), this.faction.getTag().length())));
|
||||
faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), faction.getTag().length())));
|
||||
if ((team.getPrefix() == null) || (!team.getPrefix().equals(prefix))) {
|
||||
team.setPrefix(prefix);
|
||||
}
|
||||
|
@ -260,15 +260,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
Bukkit.getServer().getPluginManager().callEvent(new FPlayerLeaveEvent(fplayer, this, FPlayerLeaveEvent.PlayerLeaveReason.DISBAND));
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
String who = disbanderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fdisbander.describeTo(fplayer);
|
||||
if (fplayer.getFaction() == this) {
|
||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, who);
|
||||
} else {
|
||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, who, this.getTag(fplayer));
|
||||
}
|
||||
}
|
||||
if (Conf.logFactionDisband) {
|
||||
//TODO: Format this correctly and translate.
|
||||
SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") was disbanded by " + (disbanderIsConsole ? "console command" : fdisbander.getName()) + ".");
|
||||
|
@ -276,6 +276,7 @@ public enum TL {
|
||||
COMMAND_DISBAND_BROADCAST_YOURS("&c&l[!]&7 &c%1$s&7 disbanded your &cfaction."),
|
||||
COMMAND_DISBAND_BROADCAST_NOTYOURS("&c&l[!]&7 &c%1$s<i> &7disbanded the faction &c%2$s."),
|
||||
COMMAND_DISBAND_HOLDINGS("&c&l[!]&7 &7You have been given the disbanded &cfaction's bank&7, totaling &c%1$s."),
|
||||
COMMAND_DISBAND_PLAYER("&c&l[!] &7You have disbanded your &cfaction"),
|
||||
COMMAND_DISBAND_CONFIRM("&c&l[!]&7 Your Faction has&c {tnt} &7tnt left in the bank, it will be &clost&7 if the faction is &cdisbanded&7. Type&c /f disband &7again within &c10&7 seconds to&c disband&7."),
|
||||
COMMAND_DISBAND_DESCRIPTION("Disband a faction"),
|
||||
|
||||
|
@ -691,6 +691,22 @@ fwarp-gui:
|
||||
name: ' '
|
||||
lore:
|
||||
-
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Creation/Disband Broadcast | #
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
faction-creation-broadcast: true
|
||||
faction-disband-broadcast: true
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Invisibility | #
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
See-Invisible-Faction-Members: false
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Rules | #
|
||||
@ -749,6 +765,7 @@ ffocus:
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Vault | #
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
fvault:
|
||||
Enabled: true
|
||||
No-Hoppers-near-vault: true
|
||||
@ -766,6 +783,7 @@ fvault:
|
||||
# +------------------------------------------------------+ #
|
||||
# | Faction Chest | #
|
||||
# +------------------------------------------------------+ #
|
||||
############################################################
|
||||
fchest:
|
||||
Enabled: true
|
||||
Inventory-Title: '&2&lFaction Chest'
|
||||
|
Loading…
Reference in New Issue
Block a user