Add mute awareness message feature for t3
Tested by t3hero
This commit is contained in:
parent
7f6796cff9
commit
0d7e404da8
@ -6,4 +6,4 @@ public class ClientMessage
|
|||||||
public String LastAdminTo;
|
public String LastAdminTo;
|
||||||
public long LastToTime;
|
public long LastToTime;
|
||||||
public int SpamCounter;
|
public int SpamCounter;
|
||||||
}
|
}
|
@ -1,5 +1,17 @@
|
|||||||
package mineplex.core.message;
|
package mineplex.core.message;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import mineplex.core.MiniClientPlugin;
|
import mineplex.core.MiniClientPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.chat.Chat;
|
import mineplex.core.chat.Chat;
|
||||||
@ -33,18 +45,6 @@ import mineplex.core.punish.Punishment;
|
|||||||
import mineplex.core.punish.PunishmentSentence;
|
import mineplex.core.punish.PunishmentSentence;
|
||||||
import mineplex.serverdata.commands.AnnouncementCommand;
|
import mineplex.serverdata.commands.AnnouncementCommand;
|
||||||
import mineplex.serverdata.commands.ServerCommandManager;
|
import mineplex.serverdata.commands.ServerCommandManager;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class MessageManager extends MiniClientPlugin<ClientMessage>
|
public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||||
{
|
{
|
||||||
@ -263,6 +263,10 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
|
|
||||||
// Send
|
// Send
|
||||||
UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
|
UtilPlayer.message(to, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
|
||||||
|
if (_punish.GetClient(to.getName()).IsMuted() && _preferences.get(to).isActive(Preference.INFORM_MUTED))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(from, F.main(getName(), F.elem(to.getName()) + " is currently muted and cannot reply to you!"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoMessageAdmin(Player from, Player to, String message)
|
public void DoMessageAdmin(Player from, Player to, String message)
|
||||||
@ -345,7 +349,8 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
"Mmm...Steak!",
|
"Mmm...Steak!",
|
||||||
"Poop! Poop everywhere!",
|
"Poop! Poop everywhere!",
|
||||||
"I'm so forgetful. Like I was going to say somethin...wait what were we talking about?",
|
"I'm so forgetful. Like I was going to say somethin...wait what were we talking about?",
|
||||||
"Mmm...Steak!"
|
"Mmm...Steak!",
|
||||||
|
"#BlameAlex"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +364,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
if (_randomMessage.isEmpty())
|
if (_randomMessage.isEmpty())
|
||||||
return "meow";
|
return "meow";
|
||||||
|
|
||||||
return _randomMessage.get(UtilMath.r(_randomMessage.size()));
|
return UtilMath.randomElement(_randomMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Help(Player caller)
|
public void Help(Player caller)
|
||||||
@ -392,7 +397,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
// Message the sender
|
// Message the sender
|
||||||
RedisMessageCallback message = new RedisMessageCallback(globalMessage, true, to.getName(),
|
RedisMessageCallback message = new RedisMessageCallback(globalMessage, true, to.getName(),
|
||||||
|
|
||||||
C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple + globalMessage.getMessage());
|
C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple + globalMessage.getMessage(), false);
|
||||||
|
|
||||||
// Inform Admins
|
// Inform Admins
|
||||||
for (Player staff : UtilServer.getPlayers())
|
for (Player staff : UtilServer.getPlayers())
|
||||||
@ -416,8 +421,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
|
|
||||||
if (canMessage != null)
|
if (canMessage != null)
|
||||||
{
|
{
|
||||||
|
RedisMessageCallback message = new RedisMessageCallback(globalMessage, false, null, canMessage, false);
|
||||||
RedisMessageCallback message = new RedisMessageCallback(globalMessage, false, null, canMessage);
|
|
||||||
|
|
||||||
message.publish();
|
message.publish();
|
||||||
|
|
||||||
@ -431,9 +435,11 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
UtilPlayer.message(to, message);
|
UtilPlayer.message(to, message);
|
||||||
|
|
||||||
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
|
to.playSound(to.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
|
||||||
|
|
||||||
|
boolean informMuted = _punish.GetClient(to.getName()).IsMuted() && _preferences.get(to).isActive(Preference.INFORM_MUTED);
|
||||||
|
|
||||||
// Message the sender
|
// Message the sender
|
||||||
RedisMessageCallback redisMessage = new RedisMessageCallback(globalMessage, false, to.getName(), message);
|
RedisMessageCallback redisMessage = new RedisMessageCallback(globalMessage, false, to.getName(), message, informMuted);
|
||||||
|
|
||||||
redisMessage.publish();
|
redisMessage.publish();
|
||||||
}
|
}
|
||||||
@ -453,6 +459,11 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
target.sendMessage(message.getMessage());
|
target.sendMessage(message.getMessage());
|
||||||
|
|
||||||
|
if (message.informMuted())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(target, F.main(getName(), F.elem(message.getLastReplied()) + " is currently muted and cannot reply to you!"));
|
||||||
|
}
|
||||||
|
|
||||||
target.playSound(target.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
|
target.playSound(target.getLocation(), Sound.NOTE_PIANO, 2f, 2f);
|
||||||
|
|
||||||
@ -647,6 +658,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
|||||||
|
|
||||||
public PreferencesManager getPreferences()
|
public PreferencesManager getPreferences()
|
||||||
{
|
{
|
||||||
return this._preferences;
|
return _preferences;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -70,4 +70,4 @@ public class RedisMessage extends ServerCommand
|
|||||||
{
|
{
|
||||||
// Utilitizes a callback functionality to seperate dependencies
|
// Utilitizes a callback functionality to seperate dependencies
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,16 +12,17 @@ public class RedisMessageCallback extends ServerCommand
|
|||||||
private String _message;
|
private String _message;
|
||||||
private String _setLastMessage;
|
private String _setLastMessage;
|
||||||
private String _target;
|
private String _target;
|
||||||
private boolean _staffMessage;
|
private boolean _staffMessage, _informMuted;
|
||||||
private UUID _uuid;
|
private UUID _uuid;
|
||||||
|
|
||||||
public RedisMessageCallback(RedisMessage globalMessage, boolean staffMessage, String receivedPlayer, String message)
|
public RedisMessageCallback(RedisMessage globalMessage, boolean staffMessage, String receivedPlayer, String message, boolean informMuted)
|
||||||
{
|
{
|
||||||
_target = globalMessage.getSender();
|
_target = globalMessage.getSender();
|
||||||
_message = message;
|
_message = message;
|
||||||
_setLastMessage = receivedPlayer;
|
_setLastMessage = receivedPlayer;
|
||||||
_uuid = globalMessage.getUUID();
|
_uuid = globalMessage.getUUID();
|
||||||
_staffMessage = staffMessage;
|
_staffMessage = staffMessage;
|
||||||
|
_informMuted = informMuted;
|
||||||
|
|
||||||
if (globalMessage.getSendingServer() != null)
|
if (globalMessage.getSendingServer() != null)
|
||||||
{
|
{
|
||||||
@ -33,6 +34,11 @@ public class RedisMessageCallback extends ServerCommand
|
|||||||
{
|
{
|
||||||
return _staffMessage;
|
return _staffMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean informMuted()
|
||||||
|
{
|
||||||
|
return _informMuted;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLastReplied()
|
public String getLastReplied()
|
||||||
{
|
{
|
||||||
@ -59,4 +65,4 @@ public class RedisMessageCallback extends ServerCommand
|
|||||||
{
|
{
|
||||||
// Utilitizes a callback functionality to seperate dependencies
|
// Utilitizes a callback functionality to seperate dependencies
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,7 +48,9 @@ public enum Preference
|
|||||||
|
|
||||||
PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI"),
|
PARTY_DISPLAY_INVENTORY_UI(true, PreferenceCategory.SOCIAL, Material.CHEST, "Display Parties GUI"),
|
||||||
|
|
||||||
RANDOM_MESSAGES(true, PreferenceCategory.USER, Material.COMMAND, "Send random messages", "Got nothing to say? We got you covered!")
|
RANDOM_MESSAGES(true, PreferenceCategory.USER, Material.COMMAND, "Send Random Messages", "Got nothing to say? We got you covered!"),
|
||||||
|
|
||||||
|
INFORM_MUTED(false, PreferenceCategory.USER, Material.BARRIER, "Inform When Muted", "Inform people who message you if you are muted!")
|
||||||
;
|
;
|
||||||
|
|
||||||
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();
|
private static final Map<Integer, Preference> PREFERENCE_MAP = Maps.newHashMap();
|
||||||
@ -118,6 +120,4 @@ public enum Preference
|
|||||||
{
|
{
|
||||||
return PREFERENCE_MAP.get(id);
|
return PREFERENCE_MAP.get(id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user