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