Added Configurable Option to Broadcast Disband and Create Messages For Factions

**More Coming Soon**
This commit is contained in:
Driftay
2019-02-09 13:33:02 -05:00
parent ce98d68518
commit 3559a9f090
7 changed files with 50 additions and 23 deletions

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;