mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Allow non-plugin delegate handlers to cancel player events.
This commit is contained in:
parent
9c34a134c1
commit
cac87fa7e6
@ -22,12 +22,12 @@ namespace MCGalaxy {
|
|||||||
/// <summary> This is the player object </summary>
|
/// <summary> This is the player object </summary>
|
||||||
public sealed partial class Player {
|
public sealed partial class Player {
|
||||||
|
|
||||||
internal bool cancelcommand = false;
|
public bool cancelcommand = false;
|
||||||
internal bool cancelchat = false;
|
public bool cancelchat = false;
|
||||||
internal bool cancelmove = false;
|
public bool cancelmove = false;
|
||||||
internal bool cancelBlock = false;
|
public bool cancelBlock = false;
|
||||||
internal bool cancelmysql = false;
|
public bool cancelmysql = false;
|
||||||
internal bool cancelmessage = false;
|
public bool cancelmessage = false;
|
||||||
internal bool HasBlockchange { get { return Blockchange != null; } }
|
internal bool HasBlockchange { get { return Blockchange != null; } }
|
||||||
|
|
||||||
//Should people be able to cancel this event?
|
//Should people be able to cancel this event?
|
||||||
|
@ -210,15 +210,12 @@ namespace MCGalaxy {
|
|||||||
public void SendMessage(byte id, string message, bool colorParse = true) {
|
public void SendMessage(byte id, string message, bool colorParse = true) {
|
||||||
message = ConvertMessage(message, colorParse);
|
message = ConvertMessage(message, colorParse);
|
||||||
int totalTries = 0;
|
int totalTries = 0;
|
||||||
if ( MessageRecieve != null )
|
if (MessageRecieve != null)
|
||||||
MessageRecieve(this, message);
|
MessageRecieve(this, message);
|
||||||
if ( OnMessageRecieve != null )
|
if (OnMessageRecieve != null)
|
||||||
OnMessageRecieve(this, message);
|
OnMessageRecieve(this, message);
|
||||||
OnMessageRecieveEvent.Call(this, message);
|
OnMessageRecieveEvent.Call(this, message);
|
||||||
if ( cancelmessage ) {
|
if (cancelmessage) { cancelmessage = false; return; }
|
||||||
cancelmessage = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
retryTag: try {
|
retryTag: try {
|
||||||
foreach (string raw in LineWrapper.Wordwrap(message)) {
|
foreach (string raw in LineWrapper.Wordwrap(message)) {
|
||||||
|
@ -528,9 +528,7 @@ return;
|
|||||||
if (PlayerChat != null) PlayerChat(this, text);
|
if (PlayerChat != null) PlayerChat(this, text);
|
||||||
OnPlayerChatEvent.Call(this, text);
|
OnPlayerChatEvent.Call(this, text);
|
||||||
|
|
||||||
if (cancelchat) {
|
if (cancelchat) { cancelchat = false; return; }
|
||||||
cancelchat = false; return;
|
|
||||||
}
|
|
||||||
if (Server.worldChat) {
|
if (Server.worldChat) {
|
||||||
SendChatFrom(this, text);
|
SendChatFrom(this, text);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user