mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
Minor performance optimisations.
This commit is contained in:
parent
ce33c52d48
commit
94e231ce49
@ -96,7 +96,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
Coords.X = x; Coords.Y = y; Coords.Z = z;
|
||||
Coords.Block = brush.NextBlock(this);
|
||||
|
||||
if (Coords.Block != Block.Zero)
|
||||
if (Coords.Block == Block.custom_block)
|
||||
Coords.ExtBlock = brush.NextExtBlock(this);
|
||||
return Coords;
|
||||
}
|
||||
|
@ -244,10 +244,11 @@ namespace MCGalaxy {
|
||||
// therefore raw = 64log2(speed) + 128
|
||||
byte rawSpeed = (byte)(64 * Math.Log(def.Speed, 2) + 128);
|
||||
buffer[index++] = def.BlockID;
|
||||
Encoding.ASCII.GetBytes(def.Name.PadRight(64), 0, 64, buffer, index);
|
||||
index += 64;
|
||||
NetUtils.WriteAscii(def.Name, buffer, index);
|
||||
index += 64;
|
||||
buffer[index++] = def.CollideType;
|
||||
buffer[index++] = rawSpeed;
|
||||
|
||||
buffer[index++] = def.TopTex;
|
||||
if (uniqueSideTexs) {
|
||||
buffer[index++] = def.LeftTex;
|
||||
|
@ -178,12 +178,12 @@ namespace MCGalaxy {
|
||||
if (p.Rank < LevelPermission.Admin) {
|
||||
bool foundDel = FindZones(p, x, y, z, ref inZone, ref AllowBuild, ref Owners);
|
||||
if (!AllowBuild) {
|
||||
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
|
||||
if (p.ZoneSpam <= DateTime.UtcNow) {
|
||||
if (Owners != "")
|
||||
Player.Message(p, "This zone belongs to &b" + Owners.Remove(0, 2) + ".");
|
||||
else
|
||||
Player.Message(p, "This zone belongs to no one.");
|
||||
p.ZoneSpam = DateTime.UtcNow;
|
||||
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -222,17 +222,17 @@ namespace MCGalaxy {
|
||||
|
||||
bool CheckRank(Player p, bool AllowBuild, bool inZone) {
|
||||
if (p.Rank < permissionbuild && (!inZone || !AllowBuild)) {
|
||||
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
|
||||
if (p.ZoneSpam <= DateTime.UtcNow) {
|
||||
Player.Message(p, "Must be at least " + PermissionToName(permissionbuild) + " to build here");
|
||||
p.ZoneSpam = DateTime.UtcNow;
|
||||
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p.Rank > perbuildmax && (!inZone || !AllowBuild) && !p.group.CanExecute("perbuildmax")) {
|
||||
if (p.ZoneSpam.AddSeconds(2) <= DateTime.UtcNow) {
|
||||
if (p.ZoneSpam <= DateTime.UtcNow) {
|
||||
Player.Message(p, "Your rank must be " + perbuildmax + " or lower to build here!");
|
||||
p.ZoneSpam = DateTime.UtcNow;
|
||||
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user