mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 06:43:25 -04:00
Remove /killphysics and just make it /physics kill.
This commit is contained in:
parent
84e18c1e70
commit
15c40893ac
@ -1,54 +0,0 @@
|
||||
/*
|
||||
______________________________________________________
|
||||
Can be included and resold as part of a larger work (sublicensable)
|
||||
Commercial use allowed under the following conditions :
|
||||
Command May only be used by MCGalaxy users.This only gives permission to MCGalaxy and users, This may not be posted on any other site and or forums without the permission of the maker [xTYx728]
|
||||
Can modify source-code but cannot distribute modifications (derivative works)
|
||||
Support provided as follows :
|
||||
For this command any, issues you may contact the maker for help.
|
||||
Attribution to software creator must be made as specified:
|
||||
Any edits MUST be reported back to the MCGalaxy forums and credit MUST be given to the respected maker
|
||||
Software trademarks are included in the license
|
||||
Software patents are included in the license
|
||||
Additional terms:
|
||||
This command is not to be posted on ANY other site and (or) forums. Any edits credit MUST be given to the respected owner.
|
||||
_______________________________________________________________________________________________________
|
||||
|
||||
for full licences please go to http://www.binpress.com/license/view/l/2043171cc2d4e3237680e59d87e4dae6
|
||||
_______________________________________________________________________________________________________
|
||||
Idea by tommyz_. made by xTYx728
|
||||
*/
|
||||
using System.Threading;
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdKillPhysics : Command
|
||||
{
|
||||
public override string name { get { return "killphysics"; } }
|
||||
public override string shortcut { get { return "kp"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override bool museumUsable { get { return true; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override void Use(Player p, string message)
|
||||
{
|
||||
if (message == "")
|
||||
{
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
foreach (Level l in loaded)
|
||||
{
|
||||
if (l.physics > 0)
|
||||
{
|
||||
Command.all.Find("physics").Use(null, l.name + " 0");
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
}
|
||||
Player.Message(p, "All physics killed");
|
||||
}
|
||||
}
|
||||
|
||||
public override void Help(Player p)
|
||||
{
|
||||
Player.Message(p, "/killphysics - kills all physics on every level.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -15,27 +15,20 @@
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
namespace MCGalaxy.Commands
|
||||
{
|
||||
public sealed class CmdPhysics : Command
|
||||
{
|
||||
namespace MCGalaxy.Commands {
|
||||
public sealed class CmdPhysics : Command {
|
||||
public override string name { get { return "physics"; } }
|
||||
public override string shortcut { get { return ""; } }
|
||||
public override string type { get { return CommandTypes.World; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public CmdPhysics() { }
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("killphysics", "kill") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") {
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
foreach (Level l in loaded) {
|
||||
if (l.physics > 0)
|
||||
Player.Message(p, "&5" + l.name + " %Shas physics at &b" + l.physics +
|
||||
"%S. &cChecks: " + l.lastCheck + "; Updates: " + l.lastUpdate);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (message == "") { ShowPhysics(p); return; }
|
||||
if (message.CaselessEq("kill")) { KillPhysics(p); return; }
|
||||
|
||||
string[] args = message.Split(' ');
|
||||
Level level = p != null ? p.level : Server.mainLevel;
|
||||
@ -51,25 +44,47 @@ namespace MCGalaxy.Commands
|
||||
level = LevelInfo.FindOrShowMatches(p, args[0]);
|
||||
if (level == null) return;
|
||||
}
|
||||
|
||||
level.setPhysics(state);
|
||||
if (state == 0) level.ClearPhysics();
|
||||
string stateDesc = states[state];
|
||||
level.ChatLevel("Physics are now " + stateDesc + "%S on &b" + level.name + "%S.");
|
||||
|
||||
stateDesc = stateDesc.Substring( 2 );
|
||||
string logInfo = "Physics are now " + stateDesc + " on " + level.name + ".";
|
||||
Server.s.Log(logInfo);
|
||||
level.changed = true;
|
||||
SetPhysics(level, state);
|
||||
}
|
||||
|
||||
internal static string[] states = { "&cOFF", "&aNormal", "&aAdvanced", "&aHardcore", "&aInstant", "&4Doors-only" };
|
||||
|
||||
void ShowPhysics(Player p) {
|
||||
Level[] loaded = LevelInfo.Loaded.Items;
|
||||
foreach (Level lvl in loaded) {
|
||||
if (lvl.physics == 0) continue;
|
||||
Player.Message(p, "&5" + lvl.name + " %Shas physics at &b" + lvl.physics +
|
||||
"%S. &cChecks: " + lvl.lastCheck + "; Updates: " + lvl.lastUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
void KillPhysics(Player p) {
|
||||
Level[] levels = LevelInfo.Loaded.Items;
|
||||
foreach (Level lvl in levels) {
|
||||
if (lvl.physics == 0) continue;
|
||||
SetPhysics(lvl, 0);
|
||||
}
|
||||
Player.Message(p, "Physics killed on all levels.");
|
||||
}
|
||||
|
||||
static void SetPhysics(Level lvl, int state) {
|
||||
lvl.setPhysics(state);
|
||||
if (state == 0) lvl.ClearPhysics();
|
||||
string stateDesc = states[state];
|
||||
lvl.ChatLevel("Physics are now " + stateDesc + "%S on &b" + lvl.name + "%S.");
|
||||
|
||||
stateDesc = stateDesc.Substring( 2 );
|
||||
string logInfo = "Physics are now " + stateDesc + " on " + lvl.name + ".";
|
||||
Server.s.Log(logInfo);
|
||||
lvl.changed = true;
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/physics [map] [0/1/2/3/4/5]");
|
||||
Player.Message(p, "%HSets the physics state for the given map.");
|
||||
Player.Message(p, "%H If no map name is given, uses the current map.");
|
||||
Player.Message(p, "%H 0 = off, 1 = on, 2 = advanced, 3 = hardcore, 4 = instant, 5 = doors only");
|
||||
Player.Message(p, "%H 0 = off, 1 = on, 2 = advanced, 3 = hardcore, 4 = instant, 5 = doors only");
|
||||
Player.Message(p, "%T/physics kill %H- Sets physics to 0 on all loaded levels.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdJoker.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdKick.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdKickban.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdKillPhysics.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdLimit.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdLocation.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdLowlag.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user