Open EricKilla opened 10 years ago
The HandleDeath method is still there in Player.cs, and there is an event for Player Death (OnPlayerDeath), and for the Player.Joined event, we have OnPlayerConnect. 1 step ahead bro ;p
A comment on the HandleDeath issue. It was found when custom commands that were using HandleDeath were messing up.
The error was resolved by changing the occurrence of Block.rock in the p.HandleDeath portion of the command to ((ushort)Block.rock). I assume this has something to do with changing things to ushorts recently, though the non-explicit 'Block.rock' still works fine in existing commands (e.g. /kill, /gun, etc.) as far as I can tell.
The error message was something along the lines of 'cannot find HandleDeath(byte,system.message,boolean)' before it was fixed by explicitly casting Block.rock as a ushort.
We have already changed them in existing commands, custom commands are easy to convert, change byte to ushort in the needed areas
Breaking API changes should be avoid when possible, in this case, it can be avoided.
Add a method of HandleDeath that accepts a byte instead of a ushort that simply runs the ushort HandleDeath method via casting, then mark the method as deprecated
Ex:
[Obsolete("Blocks are no longer bytes, use the ushort overload instead.")]
public void HandleDeath(byte b, string customMessage = "", bool explode = false) {
HandleDeath((ushort)b, customMessage, explode);
}
public void HandleDeath(ushort b, string customMessage = "", bool explode = false) {
.......
}
Agreed. The server is more extendable when you have more events.
For example, Dzienny has a "Player.Joined" event, and we don't. It allows for custom commands to trigger when a player has joined the server.
Also a death event handler should be added.
Also the HandleDeath method is gone (if it existed to begin with).