Improve code of EntityProperty commands, fix it so /entprop without args resets X and Z rotation (Thanks lavajoe), fix it so /entprop and spawning angles match

This commit is contained in:
UnknownShadow200 2017-04-21 14:31:44 +10:00
parent ee72418ab4
commit c11d92f71a
35 changed files with 107 additions and 118 deletions

View File

@ -45,7 +45,7 @@ namespace MCGalaxy.Blocks.Physics {
case 5:
case 6:
if (closest.Pos.BlockY - y != 0) {
index = lvl.PosToInt(x, (ushort)(y + Math.Sign(closest.Pos.BlockY - y)), z);
index = lvl.PosToInt(x, (ushort)(y + Math.Sign(closest.Pos.BlockY - y)), z);
if (MoveFish(lvl, C.b, index, target)) return;
}
dirsVisited++;
@ -55,7 +55,7 @@ namespace MCGalaxy.Blocks.Physics {
case 8:
case 9:
if (closest.Pos.BlockZ - z != 0) {
index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z)));
index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z)));
if (MoveFish(lvl, C.b, index, target)) return;
}
dirsVisited++;
@ -80,7 +80,7 @@ namespace MCGalaxy.Blocks.Physics {
case 2:
case 3:
if (closest.Pos.BlockX - x != 0) {
index = lvl.PosToInt((ushort)(x - Math.Sign(closest.Pos.BlockX - x)), y, z);
index = lvl.PosToInt((ushort)(x - Math.Sign(closest.Pos.BlockX - x)), y, z);
if (MoveFish(lvl, C.b, index, target)) return;
}
dirsVisited++;
@ -90,7 +90,7 @@ namespace MCGalaxy.Blocks.Physics {
case 5:
case 6:
if (closest.Pos.BlockY - y != 0) {
index = lvl.PosToInt(x, (ushort)(y - Math.Sign(closest.Pos.BlockY - y)), z);
index = lvl.PosToInt(x, (ushort)(y - Math.Sign(closest.Pos.BlockY - y)), z);
if (MoveFish(lvl, C.b, index, target)) return;
}
dirsVisited++;
@ -100,7 +100,7 @@ namespace MCGalaxy.Blocks.Physics {
case 8:
case 9:
if (closest.Pos.BlockZ - z != 0) {
index = lvl.PosToInt(x, y, (ushort)(z - Math.Sign(closest.Pos.BlockZ - z)));
index = lvl.PosToInt(x, y, (ushort)(z - Math.Sign(closest.Pos.BlockZ - z)));
if (MoveFish(lvl, C.b, index, target)) return;
}
dirsVisited++;

View File

@ -45,7 +45,7 @@ namespace MCGalaxy.Blocks.Physics {
index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign((closest.Pos.BlockZ - z))));
if (index != C.b && MoveZombie(lvl, ref C, index)) return;
} else {
index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z)));
index = lvl.PosToInt(x, y, (ushort)(z + Math.Sign(closest.Pos.BlockZ - z)));
if (index != C.b && MoveZombie(lvl, ref C, index)) return;
index = lvl.PosToInt((ushort)(x + Math.Sign(closest.Pos.BlockX - x)), y, z);

View File

@ -166,7 +166,7 @@ namespace MCGalaxy {
DoMove();
}
// TODO: check if external code modified pos/rot
// TODO: check if external code modified pos/rot
byte[] packet = Entities.GetPositionPacket(this);
lastPos = Pos; lastRot = Rot;
if (packet == null) return;

View File

@ -37,7 +37,7 @@ namespace MCGalaxy {
// Replace any whole word containing a bad word inside it (including partial word matches)
static string FilterWords(string text) {
string[] words = text.SplitSpaces();
string[] words = text.SplitSpaces();
string[] reduced = Reduce(text).SplitSpaces();
// Loop through each reduced word, looking for a bad word

View File

@ -37,44 +37,39 @@ namespace MCGalaxy.Commands.CPE {
UseBotOrPlayer(p, message, "rotation");
}
protected override void SetBotData(Player p, PlayerBot bot, string[] args) {
EntityProp prop = EntityProp.RotX;
int angle = 0;
if (!ParseArgs(p, args, 2, ref prop, ref angle)) return;
Entities.UpdateEntityProp(bot, prop, angle);
protected override void SetBotData(Player p, PlayerBot bot, string args) {
if (!ParseArgs(p, args, bot)) return;
BotsFile.UpdateBot(bot);
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
EntityProp prop = EntityProp.RotX;
int angle = 0;
if (!ParseArgs(p, args, 1, ref prop, ref angle)) return;
Entities.UpdateEntityProp(who, prop, angle);
protected override void SetPlayerData(Player p, Player who, string args) {
if (!ParseArgs(p, args, who)) return;
Server.rotations.AddOrReplace(who.name, who.Rot.RotX + " " + who.Rot.RotZ);
Server.rotations.Save();
}
static bool ParseArgs(Player p, string[] args, int i, ref EntityProp prop, ref int angle) {
string[] bits;
if (args.Length <= i) {
Player.Message(p, "You need to provide an axis name and angle."); return false;
static bool ParseArgs(Player p, string args, Entity entity) {
if (args == "") {
Entities.UpdateEntityProp(entity, EntityProp.RotX, 0);
Entities.UpdateEntityProp(entity, EntityProp.RotZ, 0);
return true;
}
bits = args[i].SplitSpaces();
string[] bits = args.SplitSpaces();
if (bits.Length != 2) {
Player.Message(p, "You need to provide an axis name and angle."); return false;
}
int angle = 0;
if (!CommandParser.GetInt(p, bits[1], "Angle", ref angle, -360, 360)) return false;
if (bits[0].CaselessEq("x")) {
prop = EntityProp.RotX;
Entities.UpdateEntityProp(entity, EntityProp.RotX, angle);
} else if (bits[0].CaselessEq("z")) {
prop = EntityProp.RotZ;
Entities.UpdateEntityProp(entity, EntityProp.RotZ, angle);
} else {
Player.Message(p, "Axis name must be X or Z."); return false;
}
return CommandParser.GetInt(p, bits[1], "Angle", ref angle, -360, 360);
return true;
}
public override void Help(Player p) {

View File

@ -40,16 +40,16 @@ namespace MCGalaxy.Commands.CPE {
UseBotOrPlayer(p, message, "model");
}
protected override void SetBotData(Player p, PlayerBot bot, string[] args) {
string model = GetModel(p, args, 2);
protected override void SetBotData(Player p, PlayerBot bot, string model) {
model = GetModel(model);
Entities.UpdateModel(bot, model);
Player.Message(p, "You changed the model of bot " + bot.ColoredName + " %Sto a &c" + model);
BotsFile.UpdateBot(bot);
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
string model = GetModel(p, args, 1);
protected override void SetPlayerData(Player p, Player who, string model) {
model = GetModel(model);
Entities.UpdateModel(who, model);
if (p != who) {
@ -66,8 +66,8 @@ namespace MCGalaxy.Commands.CPE {
Server.models.Save();
}
static string GetModel(Player p, string[] args, int i) {
string model = args.Length > i ? args[i] : "humanoid";
static string GetModel(string model) {
if (model == "") model = "humanoid";
model = model.ToLower();
model = model.Replace(':', '|'); // since many assume : is for scale instead of |.
return model;

View File

@ -36,9 +36,8 @@ namespace MCGalaxy.Commands.CPE {
UseBotOrPlayer(p, message, "skin");
}
protected override void SetBotData(Player p, PlayerBot bot, string[] args) {
string skin = GetSkin(p, args, 2, bot.name);
if (skin == null) return;
protected override void SetBotData(Player p, PlayerBot bot, string skin) {
skin = GetSkin(skin, bot.name);
bot.SkinName = skin;
Player.Message(p, "You changed the skin of bot " + bot.ColoredName + " %Sto &c" + skin);
@ -47,9 +46,8 @@ namespace MCGalaxy.Commands.CPE {
BotsFile.UpdateBot(bot);
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
string skin = GetSkin(p, args, 1, who.truename);
if (skin == null) return;
protected override void SetPlayerData(Player p, Player who, string skin) {
skin = GetSkin(skin, who.truename);
who.SkinName = skin;
Entities.GlobalDespawn(who, true);
Entities.GlobalSpawn(who, true);
@ -68,8 +66,8 @@ namespace MCGalaxy.Commands.CPE {
Server.skins.Save();
}
static string GetSkin(Player p, string[] args, int i, string defSkin) {
string skin = args.Length > i ? args[i] : defSkin;
static string GetSkin(string skin, string defSkin) {
if (skin == "") skin = defSkin;
if (skin[0] == '+')
skin = "http://skins.minecraft.net/MinecraftSkins/" + skin.Substring(1) + ".png";
return skin;

View File

@ -482,7 +482,7 @@ namespace MCGalaxy.Commands.CPE {
}
return block;
}
static byte GetFreeId(bool global, Level lvl) {
// Start from opposite ends to avoid overlap.
@ -541,7 +541,7 @@ namespace MCGalaxy.Commands.CPE {
}
static bool CheckBlockId(Player p, string arg, out int blockId) {
blockId = 0;
blockId = 0;
return CommandParser.GetInt(p, arg, "Block ID", ref blockId, 0, 254);
}

View File

@ -32,14 +32,14 @@ namespace MCGalaxy.Commands {
}
public override void Use(Player p, string message) { UseBotOrPlayer(p, message, "color"); }
protected override void SetBotData(Player p, PlayerBot bot, string[] args) {
protected override void SetBotData(Player p, PlayerBot bot, string colName) {
if (p != null && !bot.level.BuildAccess.CheckDetailed(p)) {
Player.Message(p, "Hence, you cannot change the color of that bot.");
return;
}
string color = args.Length > 2 ? Colors.Parse(args[2]) : "&1";
if (color == "") { Player.Message(p, "There is no color \"" + args[2] + "\"."); return; }
string color = colName == "" ? "&1" : Colors.Parse(colName);
if (color == "") { Player.Message(p, "There is no color \"" + colName + "\"."); return; }
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Scolor was set to "
+ color + Colors.Name(color));
bot.color = color;
@ -49,14 +49,14 @@ namespace MCGalaxy.Commands {
BotsFile.UpdateBot(bot);
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
protected override void SetPlayerData(Player p, Player who, string colName) {
string color = "";
if (args.Length == 1) {
if (colName == "") {
Chat.MessageGlobal(who, who.ColoredName + " %Shad their color removed.", false);
who.color = who.group.color;
} else {
color = Colors.Parse(args[1]);
if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; }
color = Colors.Parse(colName);
if (color == "") { Player.Message(p, "There is no color \"" + colName + "\"."); return; }
else if (color == who.color) { Player.Message(p, who.DisplayName + " %Salready has that color."); return; }
Chat.MessageGlobal(who, who.ColoredName + " %Shad their color changed to " + color + Colors.Name(color) + "%S.", false);

View File

@ -32,16 +32,16 @@ namespace MCGalaxy.Commands {
UsePlayer(p, message, "login message");
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
if (args.Length == 1) {
protected override void SetPlayerData(Player p, Player who, string loginMsg) {
if (loginMsg == "") {
string path = PlayerDB.LoginPath(who.name);
if (File.Exists(path)) File.Delete(path);
Player.Message(p, "The login message of {0} %Shas been removed.",
who.ColoredName);
} else {
PlayerDB.SetLoginMessage(who.name, args[1]);
PlayerDB.SetLoginMessage(who.name, loginMsg);
Player.Message(p, "The login message of {0} %Shas been changed to: {1}",
who.ColoredName, args[1]);
who.ColoredName, loginMsg);
}
}

View File

@ -32,16 +32,16 @@ namespace MCGalaxy.Commands {
UsePlayer(p, message, "logout message");
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
if (args.Length == 1) {
protected override void SetPlayerData(Player p, Player who, string logoutMsg) {
if (logoutMsg == "") {
string path = PlayerDB.LogoutPath(who.name);
if (File.Exists(path)) File.Delete(path);
Player.Message(p, "The logout message of {0} %Shas been removed.",
who.ColoredName);
} else {
PlayerDB.SetLogoutMessage(who.name, args[1]);
PlayerDB.SetLogoutMessage(who.name, logoutMsg);
Player.Message(p, "The logout message of {0} %Shas been changed to: {1}",
who.ColoredName, args[1]);
who.ColoredName, logoutMsg);
}
}

View File

@ -38,17 +38,16 @@ namespace MCGalaxy.Commands {
UseBotOrPlayer(p, message, "nick");
}
protected override void SetBotData(Player p, PlayerBot bot, string[] args) {
string newName = args.Length > 2 ? args[2] : "";
if (newName == "") {
protected override void SetBotData(Player p, PlayerBot bot, string nick) {
if (nick == "") {
bot.DisplayName = bot.name;
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + " %Sreverted to their original name.");
} else {
string nameTag = newName.CaselessEq("empty") ? "" : newName;
if (newName.Length > 62) { Player.Message(p, "Name must be 62 or fewer letters."); return; }
string nameTag = nick.CaselessEq("empty") ? "" : nick;
if (nick.Length > 62) { Player.Message(p, "Name must be 62 or fewer letters."); return; }
Player.Message(p, "You changed the name of bot " + bot.ColoredName + " %Sto &c" + nameTag);
bot.DisplayName = Colors.EscapeColors(newName);
bot.DisplayName = Colors.EscapeColors(nick);
}
bot.GlobalDespawn();
@ -56,16 +55,15 @@ namespace MCGalaxy.Commands {
BotsFile.UpdateBot(bot);
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
string newName = args.Length > 1 ? args[1] : "";
if (newName == "") {
protected override void SetPlayerData(Player p, Player who, string nick) {
if (nick == "") {
Chat.MessageGlobal(who, who.FullName + " %Sreverted their nick to their original name.", false);
who.DisplayName = who.truename;
} else {
if (newName.Length >= 30) { Player.Message(p, "Nick must be under 30 letters."); return; }
if (nick.Length >= 30) { Player.Message(p, "Nick must be under 30 letters."); return; }
Chat.MessageGlobal(who, who.FullName + " %Shad their nick changed to " + who.color + newName + "%S.", false);
who.DisplayName = newName;
Chat.MessageGlobal(who, who.FullName + " %Shad their nick changed to " + who.color + nick + "%S.", false);
who.DisplayName = nick;
}
PlayerDB.Save(who);

View File

@ -30,13 +30,13 @@ namespace MCGalaxy.Commands {
}
public override void Use(Player p, string message) { UsePlayer(p, message, "title color"); }
protected override void SetPlayerData(Player p, Player who, string[] args) {
protected override void SetPlayerData(Player p, Player who, string colName) {
string color = "";
if (args.Length == 1) {
if (colName == "") {
Chat.MessageGlobal(who, who.ColoredName + " %Shad their title color removed.", false);
} else {
color = Colors.Parse(args[1]);
if (color == "") { Player.Message(p, "There is no color \"" + args[1] + "\"."); return; }
color = Colors.Parse(colName);
if (color == "") { Player.Message(p, "There is no color \"" + colName + "\"."); return; }
else if (color == who.titlecolor) { Player.Message(p, who.DisplayName + " %Salready has that title color."); return; }
Chat.MessageGlobal(who, who.ColoredName + " %Shad their title color changed to " + color + Colors.Name(color) + "%S.", false);

View File

@ -34,8 +34,7 @@ namespace MCGalaxy.Commands {
UsePlayer(p, message, "title");
}
protected override void SetPlayerData(Player p, Player who, string[] args) {
string title = args.Length > 1 ? args[1] : "";
protected override void SetPlayerData(Player p, Player who, string title) {
if (title.Length >= 20) { Player.Message(p, "Title must be under 20 letters."); return; }
if (title == "") {

View File

@ -28,7 +28,7 @@ namespace MCGalaxy.Commands {
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override void Use(Player p, string message) {
string[] args = message.SplitSpaces();
string[] args = message.SplitSpaces();
if (args.Length > 2) { Help(p); return; }
string plName = "", modifier = args[args.Length - 1];
int ignored;

View File

@ -41,7 +41,7 @@ namespace MCGalaxy.Commands {
Player.Message(p, "Hence, you cannot change the " + type + " of that bot.");
return;
}
SetBotData(p, bot, args);
SetBotData(p, bot, args.Length > 2 ? args[2] : "");
} else {
if (p != who && !CheckExtraPerm(p, 1)) {
MessageNeedExtra(p, 1); return;
@ -50,7 +50,7 @@ namespace MCGalaxy.Commands {
if (p != null && who.Rank > p.Rank) {
MessageTooHighRank(p, "change the " + type + " of", true); return;
}
SetPlayerData(p, who, args);
SetPlayerData(p, who, args.Length > 1 ? args[1] : "");
}
}
@ -66,7 +66,7 @@ namespace MCGalaxy.Commands {
MessageTooHighRank(p, "change the " + type + " of", true); return;
}
if (p != who && !CheckExtraPerm(p)) { MessageNeedExtra(p, 1); return; }
SetPlayerData(p, who, args);
SetPlayerData(p, who, args.Length > 1 ? args[1] : "");
}
bool CheckOwn(Player p, string[] args, string type) {
@ -77,8 +77,8 @@ namespace MCGalaxy.Commands {
return true;
}
protected virtual void SetBotData(Player p, PlayerBot bot, string[] args) { }
protected virtual void SetBotData(Player p, PlayerBot bot, string args) { }
protected virtual void SetPlayerData(Player p, Player who, string[] args) { }
protected virtual void SetPlayerData(Player p, Player who, string args) { }
}
}

View File

@ -42,7 +42,7 @@ namespace MCGalaxy.Commands {
if (cmd == "bs") {
if (!CommandParser.GetInt(p, args[1], "Blocks per interval", ref value, 0)) return;
BlockQueue.blockupdates = value;
Player.Message(p, "Blocks per interval is now {0}.", BlockQueue.blockupdates);
} else if (cmd == "ts") {

View File

@ -42,9 +42,9 @@ namespace MCGalaxy.Commands {
string target = PlayerInfo.GetColoredName(p, name);
if (notes.Count == 0) {
Player.Message(p, "{0} %Shas no notes.", target); return;
Player.Message(p, "{0} %Shas no notes.", target); return;
} else {
Player.Message(p, " Notes for {0}:", target);
Player.Message(p, " Notes for {0}:", target);
}
foreach (string line in notes) {

View File

@ -38,7 +38,7 @@ namespace MCGalaxy.Commands.Moderation {
// Check tempbans first
if (Server.tempBans.Remove(name)) {
Server.tempBans.Save();
Chat.MessageGlobal("{0} had their temporary ban lifted by {1}.", name, srcFull);
Server.s.Log("UNBANNED: " + name + " by " + src);
Server.IRC.Say(name + " was unbanned by " + src + ".");

View File

@ -21,9 +21,9 @@ using System.IO;
using System.Net;
namespace MCGalaxy.Commands.Moderation {
/// <summary> Provides common helper methods for moderation commands. </summary>
public static class ModActionCmd {
/// <summary> Provides common helper methods for moderation commands. </summary>
public static class ModActionCmd {
/// <summary> Expands @[rule number] to the actual rule with that number. </summary>
public static string ExpandReason(Player p, string reason) {

View File

@ -143,7 +143,7 @@ namespace MCGalaxy.Commands.World {
extAbove = lvl.GetExtTile((ushort)x, (ushort)(y + 1), (ushort)z);
if (lvl.LightPasses(above, extAbove)) {
if (p.level.DoBlockchange(p, (ushort)x, (ushort)y, (ushort)z, Block.grass) == 2) {
if (p.level.DoBlockchange(p, (ushort)x, (ushort)y, (ushort)z, Block.grass) == 2) {
buffer.Add(index, Block.grass, 0);
totalFixed++;
}

View File

@ -36,8 +36,8 @@ namespace MCGalaxy.Commands {
if (lvl == null) return;
}
} else {
if (!CommandParser.GetInt(p, parts[0], "Pause time", ref seconds, 0)) return;
if (!CommandParser.GetInt(p, parts[0], "Pause time", ref seconds, 0)) return;
lvl = Matcher.FindLevels(p, parts[1]);
if (lvl == null) return;
}

View File

@ -50,7 +50,7 @@ namespace MCGalaxy.Commands.Building {
Player.Message(p, "Value must be {0} or below for {1} trees.", tree.MaxSize, parts[0]); return;
}
dArgs.size = size;
dArgs.size = size;
dArgs.brushMsg = parts.Length >= 3 ? parts[2] : ""; // type value brush
} else {
dArgs.brushMsg = parts.Length >= 2 ? parts[1] : ""; // type brush

View File

@ -64,7 +64,7 @@ namespace MCGalaxy.Commands {
static void ShowRequestMessage(Player p, Player target) {
if (!Chat.NotIgnoring(p, target)) return;
Player.Message(target, p.ColoredName + " %Swould like to teleport to you.");
Player.Message(target, "Type &2/tpaccept %Sor &4/tpdeny%S.");
Player.Message(target, "This request will timeout after &b90 %Sseconds.");

View File

@ -36,8 +36,8 @@ namespace MCGalaxy.Drawing {
public sealed class RgbPaletteMatcher : IPaletteMatcher {
PaletteEntry[] front, back;
public void SetPalette(PaletteEntry[] front, PaletteEntry[] back) {
PaletteEntry[] front, back;
public void SetPalette(PaletteEntry[] front, PaletteEntry[] back) {
this.front = front; this.back = back;
}

View File

@ -202,12 +202,10 @@ namespace MCGalaxy {
Level lvl = entity.Level;
Orientation rot = entity.Rot;
if (prop == EntityProp.RotX)
rot.RotX = Orientation.DegreesToPacked(value);
if (prop == EntityProp.RotY)
rot.RotY = Orientation.DegreesToPacked(value);
if (prop == EntityProp.RotZ)
rot.RotZ = Orientation.DegreesToPacked(value);
byte angle = Orientation.DegreesToPacked(value);
if (prop == EntityProp.RotX) rot.RotX = angle;
if (prop == EntityProp.RotY) rot.RotY = angle;
if (prop == EntityProp.RotZ) rot.RotZ = angle;
entity.Rot = rot;
if (prop == EntityProp.RotY) entity.SetYawPitch(rot.RotY, rot.HeadX);
@ -217,7 +215,8 @@ namespace MCGalaxy {
if (!pl.CanSeeEntity(entity)) continue;
byte id = (pl == entity) ? Entities.SelfID : entity.EntityID;
pl.Send(Packet.EntityProperty(id, prop, value));
pl.Send(Packet.EntityProperty(id, prop,
Orientation.PackedToDegrees(angle)));
}
}

View File

@ -45,7 +45,7 @@ namespace MCGalaxy.Levels.IO {
}
public static void LoadEnv(Level level) {
string path = "levels/level properties/" + level.MapName + ".env";
string path = "levels/level properties/" + level.MapName + ".env";
PropertiesFile.Read(path, ref level, EnvLineProcessor);
}

View File

@ -43,7 +43,7 @@ namespace MCGalaxy {
}
static void MakeDefineBlockStart(BlockDefinition def, byte[] buffer, ref int i,
bool uniqueSideTexs, bool hasCP437) {
bool uniqueSideTexs, bool hasCP437) {
// speed = 2^((raw - 128) / 64);
// therefore raw = 64log2(speed) + 128
byte rawSpeed = (byte)(64 * Math.Log(def.Speed, 2) + 128);

View File

@ -38,7 +38,7 @@ namespace MCGalaxy {
buffer[130] = Block.canPlace(p, Block.blackrock) ? (byte)100 : (byte)0;
return buffer;
}
public static byte[] LevelFinalise(ushort width, ushort height, ushort length) {
byte[] buffer = new byte[7];
buffer[0] = Opcode.LevelFinalise;
@ -49,7 +49,7 @@ namespace MCGalaxy {
}
public static byte[] AddEntity(byte id, string name, Position pos,
Orientation rot, bool hasCP437) {
Orientation rot, bool hasCP437) {
byte[] buffer = new byte[74];
buffer[0] = Opcode.AddEntity;
buffer[1] = id;

View File

@ -106,7 +106,7 @@ namespace MCGalaxy {
}
static void AddGroup(ref Group grp) {
Group.AddAndLoadGroup(
Group.AddAndLoadGroup(
new Group(grp.Permission, grp.maxBlocks, grp.maxUndo, grp.trueName,
grp.color[0], grp.MOTD, grp.fileName, grp.OverseerMaps, grp.prefix));
grp = null;

View File

@ -51,9 +51,9 @@ namespace MCGalaxy {
PlayerActions.ChangeMap(p, lvl);
if (p.level.name.CaselessEq(wp.lvlname)) {
p.SendPos(Entities.SelfID,
new Position(wp.x, wp.y, wp.z),
new Orientation(wp.rotx, wp.roty));
p.SendPos(Entities.SelfID,
new Position(wp.x, wp.y, wp.z),
new Orientation(wp.rotx, wp.roty));
Player.Message(p, "Sent you to waypoint/warp");
} else {
Player.Message(p, "Unable to send you to the warp as the map it is on is not loaded.");

View File

@ -208,7 +208,7 @@ namespace MCGalaxy {
// Backwards compatibility with old config, where some permissions were global
if (perms.viewPerm != -1)
CommandExtraPerms.Find("review", 1).MinRank = (LevelPermission)perms.viewPerm;
CommandExtraPerms.Find("review", 1).MinRank = (LevelPermission)perms.viewPerm;
if (perms.nextPerm != -1)
CommandExtraPerms.Find("review", 2).MinRank = (LevelPermission)perms.nextPerm;
if (perms.clearPerm != -1)

View File

@ -58,7 +58,7 @@ namespace MCGalaxy {
Player.Message(p, "%TExtra permissions:");
foreach (CommandExtraPerms extra in extraPerms) {
Player.Message(p, "{0}) {1}%S{2}", extra.Number,
Group.GetColoredName(extra.MinRank), extra.Description);
Group.GetColoredName(extra.MinRank), extra.Description);
}
}

View File

@ -23,8 +23,8 @@ namespace MCGalaxy {
/// <summary> Outputs a large range of values across a number of 'pages'. (Pagination) </summary>
public static class MultiPageOutput {
/// <summary> Outputs a large range of values across a number of 'pages'. (Pagination) </summary>
/// <param name="lines">true if each item is printed on a separate line, false if combined. </param>
/// <summary> Outputs a large range of values across a number of 'pages'. (Pagination) </summary>
/// <param name="lines">true if each item is printed on a separate line, false if combined. </param>
public static void Output<T>(Player p, IList<T> items, Func<T, string> formatter,
string cmd, string type, string modifier, bool lines) {
int page = 0, total = items.Count;

View File

@ -23,7 +23,7 @@ using System.IO;
namespace MCGalaxy {
public static class Utils {
/// <summary> The absolute path on disc of the folder MCGalaxy.exe is currently running from. </summary>
/// <summary> The absolute path on disc of the folder MCGalaxy.exe is currently running from. </summary>
public static string FolderPath { get { return AppDomain.CurrentDomain.BaseDirectory; } }
public static bool IsValidHex(string hex) {