mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-29 16:43:30 -04:00
Cleanup /kill.
This commit is contained in:
parent
f1926f8874
commit
02b09db0d5
@ -51,7 +51,7 @@ namespace MCGalaxy.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (Player pl in Player.players) {
|
foreach (Player pl in Player.players) {
|
||||||
if (pl.level != p.level || p == pl || pl.hidden ||pl.referee)
|
if (pl.level != p.level || p == pl || pl.hidden || pl.referee)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string name = null;
|
string name = null;
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2011 MCGalaxy
|
Copyright 2011 MCGalaxy
|
||||||
|
|
||||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
not use this file except in compliance with the Licenses. You may
|
not use this file except in compliance with the Licenses. You may
|
||||||
obtain a copy of the Licenses at
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
http://www.opensource.org/licenses/ecl2.php
|
http://www.opensource.org/licenses/ecl2.php
|
||||||
http://www.gnu.org/licenses/gpl-3.0.html
|
http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the Licenses are distributed on an "AS IS"
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
namespace MCGalaxy.Commands
|
namespace MCGalaxy.Commands
|
||||||
{
|
{
|
||||||
public sealed class CmdKill : Command
|
public sealed class CmdKill : Command
|
||||||
@ -25,84 +25,38 @@ namespace MCGalaxy.Commands
|
|||||||
public override bool museumUsable { get { return true; } }
|
public override bool museumUsable { get { return true; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||||
public CmdKill() { }
|
public CmdKill() { }
|
||||||
|
static char[] trimChars = { ' ' };
|
||||||
|
|
||||||
public override void Use(Player p, string message)
|
public override void Use(Player p, string message) {
|
||||||
{
|
|
||||||
if (message == "") { Help(p); return; }
|
if (message == "") { Help(p); return; }
|
||||||
|
bool explode = false;
|
||||||
|
string deathMessage;
|
||||||
|
string killer = p == null ? "(console)" : p.color + p.DisplayName;
|
||||||
|
string[] args = message.Split(trimChars, 2);
|
||||||
|
|
||||||
Player who; string killMsg; int killMethod = 0;
|
Player who = Player.Find(args[0]);
|
||||||
if (message.IndexOf(' ') == -1)
|
if (args.Length >= 2) {
|
||||||
{
|
if(args[1].ToLower() == "explode") {
|
||||||
who = Player.Find(message);
|
deathMessage = " was exploded by " + killer;
|
||||||
|
explode = true;
|
||||||
|
} else {
|
||||||
|
deathMessage = " " + args[1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deathMessage = " was killed by " + killer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (who == null) {
|
||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
p.HandleDeath(Block.rock, " killed themselves in their confusion");
|
||||||
killMsg = " was killed by " + p.color + p.DisplayName;
|
Player.SendMessage(p, "Could not find player"); return;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
killMsg = " was killed by " + "the Console.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
who = Player.Find(message.Split(' ')[0]);
|
|
||||||
message = message.Substring(message.IndexOf(' ') + 1);
|
|
||||||
|
|
||||||
if (message.IndexOf(' ') == -1)
|
|
||||||
{
|
|
||||||
if (message.ToLower() == "explode")
|
|
||||||
{
|
|
||||||
if (p != null)
|
|
||||||
{
|
|
||||||
killMsg = " was exploded by " + p.color + p.DisplayName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
killMsg = " was exploded by the Console.";
|
|
||||||
}
|
|
||||||
killMethod = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
killMsg = " " + message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (message.Split(' ')[0].ToLower() == "explode")
|
|
||||||
{
|
|
||||||
killMethod = 1;
|
|
||||||
message = message.Substring(message.IndexOf(' ') + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
killMsg = " " + message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who == null)
|
if (p != null && who.group.Permission > p.group.Permission) {
|
||||||
{
|
p.HandleDeath(Block.rock, " was killed by " + who.color + who.DisplayName);
|
||||||
if (p != null)
|
Player.SendMessage(p, "Cannot kill someone of higher rank"); return;
|
||||||
{
|
|
||||||
p.HandleDeath(Block.rock, " killed itself in its confusion");
|
|
||||||
}
|
|
||||||
Player.SendMessage(p, "Could not find player");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
who.HandleDeath(Block.rock, deathMessage, explode);
|
||||||
if (p != null)
|
|
||||||
{
|
|
||||||
if (who.group.Permission > p.group.Permission)
|
|
||||||
{
|
|
||||||
p.HandleDeath(Block.rock, " was killed by " + who.color + who.DisplayName);
|
|
||||||
Player.SendMessage(p, "Cannot kill someone of higher rank");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (killMethod == 1)
|
|
||||||
who.HandleDeath(Block.rock, killMsg, true);
|
|
||||||
else
|
|
||||||
who.HandleDeath(Block.rock, killMsg);
|
|
||||||
}
|
}
|
||||||
public override void Help(Player p)
|
public override void Help(Player p)
|
||||||
{
|
{
|
||||||
|
@ -231,11 +231,5 @@ namespace MCGalaxy
|
|||||||
public void ClearBlockchange() { Blockchange = null; }
|
public void ClearBlockchange() { Blockchange = null; }
|
||||||
public bool HasBlockchange() { return (Blockchange == null); }
|
public bool HasBlockchange() { return (Blockchange == null); }
|
||||||
public object blockchangeObject = null;
|
public object blockchangeObject = null;
|
||||||
|
|
||||||
//lolwut
|
|
||||||
public delegate void BecomeBrony(Player p);
|
|
||||||
public delegate void SonicRainboom(Player p);
|
|
||||||
public static event BecomeBrony OnBecomeBrony;
|
|
||||||
public static event SonicRainboom OnSonicRainboom;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2057,8 +2057,6 @@ return;
|
|||||||
else {
|
else {
|
||||||
SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!");
|
SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!");
|
||||||
}
|
}
|
||||||
if ( OnBecomeBrony != null )
|
|
||||||
OnBecomeBrony(this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( cmd.ToLower() == "rainbowdashlikescoolthings" ) {
|
if ( cmd.ToLower() == "rainbowdashlikescoolthings" ) {
|
||||||
@ -2069,8 +2067,6 @@ return;
|
|||||||
else {
|
else {
|
||||||
SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!");
|
SendMessage("You have used this command 2 times. You cannot use it anymore! Sorry, Brony!");
|
||||||
}
|
}
|
||||||
if ( OnSonicRainboom != null )
|
|
||||||
OnSonicRainboom(this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2408,30 +2404,19 @@ return;
|
|||||||
{
|
{
|
||||||
if (p.Loading && p != from) { return; }
|
if (p.Loading && p != from) { return; }
|
||||||
if (p.level != from.level || (from.hidden && !self)) { return; }
|
if (p.level != from.level || (from.hidden && !self)) { return; }
|
||||||
|
|
||||||
if (p != from)
|
if (p != from)
|
||||||
{
|
{
|
||||||
if (Server.ZombieModeOn && !p.aka)
|
if (Server.ZombieModeOn && !p.aka) {
|
||||||
{
|
if (from.infected) {
|
||||||
if (from.infected)
|
|
||||||
{
|
|
||||||
if (Server.ZombieName != "")
|
if (Server.ZombieName != "")
|
||||||
p.SendSpawn(from.id, c.red + Server.ZombieName + possession, x, y, z, rotx, roty);
|
p.SendSpawn(from.id, c.red + Server.ZombieName + possession, x, y, z, rotx, roty);
|
||||||
else
|
else
|
||||||
p.SendSpawn(from.id, c.red + from.name + possession, x, y, z, rotx, roty);
|
p.SendSpawn(from.id, c.red + from.name + possession, x, y, z, rotx, roty);
|
||||||
return;
|
} else if (!from.referee) {
|
||||||
}
|
|
||||||
else if (from.referee)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p.SendSpawn(from.id, from.color + from.name + possession, x, y, z, rotx, roty);
|
p.SendSpawn(from.id, from.color + from.name + possession, x, y, z, rotx, roty);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
p.SendSpawn(from.id, from.color + from.name + possession, x, y, z, rotx, roty);
|
p.SendSpawn(from.id, from.color + from.name + possession, x, y, z, rotx, roty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user