forked from ClassiCube/MCGalaxy-Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeamChat.cs
33 lines (28 loc) · 903 Bytes
/
TeamChat.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using MCGalaxy;
using MCGalaxy.Events;
using MCGalaxy.Events.PlayerEvents;
namespace PluginTeamChat
{
public class TeamChat : Plugin
{
public override string creator { get { return "Not UnknownShadow200"; } }
public override string MCGalaxy_Version { get { return "1.9.1.4"; } }
public override string name { get { return "TeamChatPlugin"; } }
public override void Load(bool startup) {
OnPlayerChatEvent.Register(DoTeamChat, Priority.Low);
}
public override void Unload(bool shutdown) {
OnPlayerChatEvent.Unregister(DoTeamChat);
}
void DoTeamChat(Player p, string message) {
if (p.cancelchat || message.Length <= 1 || message[0] != '=') return;
if (p.Game.Team == null) {
p.Message("You are not on a team, so cannot send a team message.");
} else {
p.Game.Team.Message(p, message.Substring(1));
}
p.cancelchat = true;
}
}
}