Added /f chat mod

This commit is contained in:
_ProSavage_ 2018-03-04 20:57:27 -06:00 committed by Trent Hensler
parent f65fe27c53
commit fe464ba750
5 changed files with 29 additions and 5 deletions

View File

@ -74,6 +74,7 @@ public class Conf {
public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s";
public static String allianceChatFormat = ChatColor.LIGHT_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String modChatFormat = ChatColor.RED + "%s:" + ChatColor.WHITE + " %s";
public static boolean broadcastDescriptionChanges = false;
public static boolean broadcastTagChanges = false;

View File

@ -36,7 +36,9 @@ public class CmdChat extends FCommand {
if (modeString != null) {
modeString = modeString.toLowerCase();
if (modeString.startsWith("p")) {
if (modeString.startsWith("m")) {
modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC;
} else if (modeString.startsWith("a")) {
modeTarget = ChatMode.ALLIANCE;
@ -52,7 +54,9 @@ public class CmdChat extends FCommand {
fme.setChatMode(modeTarget);
if (fme.getChatMode() == ChatMode.PUBLIC) {
if (fme.getChatMode() == ChatMode.MOD) {
msg(TL.COMMAND_CHAT_MODE_MOD);
} else if (fme.getChatMode() == ChatMode.PUBLIC) {
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
} else if (fme.getChatMode() == ChatMode.ALLIANCE) {
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.listeners;
import com.massivecraft.factions.*;
import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -14,7 +15,6 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.util.UnknownFormatConversionException;
import java.util.logging.Level;
public class FactionsChatListener implements Listener {
public P p;
@ -30,9 +30,25 @@ public class FactionsChatListener implements Listener {
String msg = event.getMessage();
FPlayer me = FPlayers.getInstance().getByPlayer(talkingPlayer);
ChatMode chat = me.getChatMode();
//Is it a MOD chat
if (chat == ChatMode.MOD) {
Faction myFaction = me.getFaction();
// Is it a faction chat message?
if (chat == ChatMode.FACTION) {
String message = String.format(Conf.modChatFormat, ChatColor.stripColor(me.getNameAndTag()), msg);
//Send to all mods
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
if (myFaction == fplayer.getFaction() && fplayer.getRole().isAtLeast(Role.MODERATOR)) {
fplayer.sendMessage(message);
} else if (fplayer.isSpyingChat() && me != fplayer) {
fplayer.sendMessage("[MCspy]: " + message);
}
}
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("Mod Chat: " + message));
event.setCancelled(true);
} else if (chat == ChatMode.FACTION) {
Faction myFaction = me.getFaction();
String message = String.format(Conf.factionChatFormat, me.describeTo(myFaction), msg);

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.struct;
import com.massivecraft.factions.zcore.util.TL;
public enum ChatMode {
MOD(4,TL.CHAT_MOD),
FACTION(3, TL.CHAT_FACTION),
ALLIANCE(2, TL.CHAT_ALLIANCE),
TRUCE(1, TL.CHAT_TRUCE),

View File

@ -106,6 +106,7 @@ public enum TL {
COMMAND_CHAT_MODE_ALLIANCE("<i>Alliance only chat mode."),
COMMAND_CHAT_MODE_TRUCE("<i>Truce only chat mode."),
COMMAND_CHAT_MODE_FACTION("<i>Faction only chat mode."),
COMMAND_CHAT_MODE_MOD("<i>Mod only chat mode."),
COMMAND_CHATSPY_ENABLE("<i>You have enabled chat spying mode."),
COMMAND_CHATSPY_ENABLELOG(" has ENABLED chat spying mode."),
@ -674,6 +675,7 @@ public enum TL {
/**
* Chat modes
*/
CHAT_MOD("mod chat"),
CHAT_FACTION("faction chat"),
CHAT_ALLIANCE("alliance chat"),
CHAT_TRUCE("truce chat"),