mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
Changes to AdminChat.
This commit is contained in:
parent
11347c2327
commit
63b80d0d69
@ -1,10 +1,8 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,24 +13,23 @@ public class Command_o extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if(senderIsConsole && args.length == 0)
|
||||
if (args.length == 0)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Only in-game players can toggle AdminChat.");
|
||||
return true;
|
||||
}
|
||||
if (senderIsConsole)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Only in-game players can toggle AdminChat.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length == 0)
|
||||
{
|
||||
TFM_UserInfo userinfo = TFM_UserInfo.getPlayerData(sender_p);
|
||||
userinfo.setAdminChat(!userinfo.inAdminChat());
|
||||
TFM_Util.playerMsg(sender, "Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off")+".");
|
||||
TFM_Util.playerMsg(sender, "Toggled Admin Chat " + (userinfo.inAdminChat() ? "on" : "off") + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// very complicated magic stuff
|
||||
TFM_Util.AdminChatMessage(sender, StringUtils.join(args, " "), senderIsConsole);
|
||||
TFM_Util.adminChatMessage(sender, StringUtils.join(args, " "), senderIsConsole);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -359,16 +359,15 @@ public class TFM_PlayerListener implements Listener
|
||||
}
|
||||
|
||||
// check for adminchat
|
||||
if(playerdata.inAdminChat())
|
||||
if (playerdata.inAdminChat())
|
||||
{
|
||||
TFM_Util.AdminChatMessage(p, message, false);
|
||||
TFM_Util.adminChatMessage(p, message, false);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// finally, set message
|
||||
event.setMessage(message);
|
||||
}
|
||||
|
||||
// finally, set message
|
||||
event.setMessage(message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -998,17 +998,16 @@ public class TFM_Util
|
||||
fos.getChannel().transferFrom(rbc, 0, 1 << 24);
|
||||
fos.close();
|
||||
}
|
||||
public static void AdminChatMessage(CommandSender sender, String message, boolean senderIsConsole)
|
||||
|
||||
public static void adminChatMessage(CommandSender sender, String message, boolean senderIsConsole)
|
||||
{
|
||||
// complicated magic
|
||||
String name = sender.getName()+
|
||||
(senderIsConsole ? ChatColor.DARK_PURPLE+" (Console)" :
|
||||
(TFM_SuperadminList.isSeniorAdmin(sender) ? ChatColor.LIGHT_PURPLE+ " (SrA)" : ChatColor.GOLD+" (SA)"));
|
||||
|
||||
String name = sender.getName() + (senderIsConsole ? ChatColor.DARK_PURPLE + " (Console)" : (TFM_SuperadminList.isSeniorAdmin(sender) ? ChatColor.LIGHT_PURPLE + " (SrA)" : ChatColor.GOLD + " (SA)"));
|
||||
|
||||
TFM_Log.info("[ADMIN] " + name + ": " + message);
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if(TFM_SuperadminList.isUserSuperadmin(p))
|
||||
if (TFM_SuperadminList.isUserSuperadmin(p))
|
||||
{
|
||||
p.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + name + ChatColor.WHITE + ": " + ChatColor.AQUA + message);
|
||||
}
|
||||
|
@ -120,8 +120,9 @@ commands:
|
||||
description: Superadmin command - Attempt to detect "invisible griefers" and "nukers".
|
||||
usage: /<command> <on | off> [range] [blockrate]
|
||||
o:
|
||||
description: Superadmin command - Talk privately with other admins
|
||||
description: Superadmin command - AdminChat - Talk privately with other admins. Using <command> itself will toggle AdminChat on and off for all messages.
|
||||
usage: /<command> [message]
|
||||
aliases: [adminchat]
|
||||
onlinemode:
|
||||
description: Console command - Switch server online-mode on and off.
|
||||
usage: /<command> <on | off>
|
||||
|
Loading…
Reference in New Issue
Block a user