Fix /os env weather being case sensitive.

This commit is contained in:
UnknownShadow200 2016-04-05 22:42:50 +10:00
parent 4b96f51fb7
commit 4645049cf6
3 changed files with 94 additions and 43 deletions

34
Blocks/Block.CoreProps.cs Normal file
View File

@ -0,0 +1,34 @@
/*
Copyright 2015 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using MCGalaxy.Blocks;
namespace MCGalaxy {
public sealed partial class Block {
public static BlockProps[] Properties = new BlockProps[256];
static void SetDefaultProperties() {
for (int i = 0; i < 256; i++) {
Properties[i] = new BlockProps((byte)i);
// Fallback for unrecognised physics blocks
if (i >= Block.CpeCount)
Properties[i].ConvertId = Block.orange;
}
}
}
}

View File

@ -1,39 +1,56 @@
/* /*
Copyright 2015 MCGalaxy Copyright 2015 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.
*/ */
using System; using System;
namespace MCGalaxy.Blocks { namespace MCGalaxy.Blocks {
public struct BlockProps { public struct BlockProps {
/// <summary> Standard block id sent to clients in map and block update packets. </summary> /// <summary> Standard block id sent to clients in map and block update packets. </summary>
public byte ConvertId; public byte ConvertId;
/// <summary> Block id converted to when the map is saved to a .lvl file. </summary> /// <summary> Block id converted to when the map is saved to a .lvl file. </summary>
public byte SaveConvertId; public byte SaveConvertId;
/// <summary> Block name used for in commands. </summary> /// <summary> Block name used for in commands. </summary>
public string Name; public string Name;
public BlockProps(byte type) { /// <summary> Whether this block is considered a tdoor. </summary>
ConvertId = type; public bool IsTDoor;
SaveConvertId = type; /// <summary> Whether this block is considered a message block. </summary>
Name = "unknown"; public bool IsMessageBlock;
} /// <summary> Whether this block is considered a portal. </summary>
} public bool IsPortal;
}
/// <summary> Whether walkinhg through this block causes the death of that player. </summary>
public bool CausesDeath;
/// <summary> Whether light passes through this block. </summary>
public bool LightPasses;
/// <summary> Whether this block is an OP block (cannot be replaced by physics changes). </summary>
public bool OPBlock;
public BlockProps(byte type) {
this = default(BlockProps);
ConvertId = type;
SaveConvertId = type;
Name = "unknown";
}
}
}

View File

@ -103,11 +103,11 @@ namespace MCGalaxy.Commands
string col = value == "" ? "normal" : value; string col = value == "" ? "normal" : value;
Command.all.Find("env").Use(p, "l " + type.ToLower() + " " + col); Command.all.Find("env").Use(p, "l " + type.ToLower() + " " + col);
} else if (type == "WEATHER") { } else if (type == "WEATHER") {
if (value == "SUN" || value == "NORMAL") { if (value.CaselessEq("SUN") || value.CaselessEq("NORMAL")) {
Command.all.Find("env").Use(p, "weather 0"); Command.all.Find("env").Use(p, "weather 0");
} else if (value == "RAIN") { } else if (value.CaselessEq("RAIN")) {
Command.all.Find("env").Use(p, "weather 1"); Command.all.Find("env").Use(p, "weather 1");
} else if (value == "SNOW") { } else if (value.CaselessEq("SNOW")) {
Command.all.Find("env").Use(p, "weather 2"); Command.all.Find("env").Use(p, "weather 2");
} else { } else {
Player.SendMessage(p, "/os env weather [sun/rain/snow/normal] -- Changes the weather of your map."); Player.SendMessage(p, "/os env weather [sun/rain/snow/normal] -- Changes the weather of your map.");
@ -116,7 +116,7 @@ namespace MCGalaxy.Commands
Player.SendMessage(p, "/os env [fog/cloud/sky/shadow/sun] [hex color code] -- Changes env colors of your map"); Player.SendMessage(p, "/os env [fog/cloud/sky/shadow/sun] [hex color code] -- Changes env colors of your map");
Player.SendMessage(p, "/os env level -- Sets the water height of your map"); Player.SendMessage(p, "/os env level -- Sets the water height of your map");
Player.SendMessage(p, "/os env cloudheight -- Sets the cloud height of your map"); Player.SendMessage(p, "/os env cloudheight -- Sets the cloud height of your map");
Player.SendMessage(p, "/os env maxcfog -- Sets the max fog distance in your map"); Player.SendMessage(p, "/os env maxfog -- Sets the max fog distance in your map");
Player.SendMessage(p, "/os env horizon -- Sets what block the \"ocean\" shows outside your map"); Player.SendMessage(p, "/os env horizon -- Sets what block the \"ocean\" shows outside your map");
Player.SendMessage(p, "/os env border -- Sets what block replaces the \"bedrock\" below sea level in your map"); Player.SendMessage(p, "/os env border -- Sets what block replaces the \"bedrock\" below sea level in your map");
Player.SendMessage(p, "/os env weather [sun/rain/snow/normal] -- Changes the weather of your map."); Player.SendMessage(p, "/os env weather [sun/rain/snow/normal] -- Changes the weather of your map.");