Remove unused code

This commit is contained in:
UnknownShadow200 2017-06-24 13:17:20 +10:00
parent 288c6e67dd
commit a74b0681fb
10 changed files with 9 additions and 88 deletions

View File

@ -47,7 +47,7 @@ namespace MCGalaxy.Commands.Info {
Player.Message(p, "Retrieving block change records..");
bool foundAny = false;
ListFromDatabase(p, ref foundAny, names, x, y, z);
ListFromDatabase(p, ref foundAny, x, y, z);
using (IDisposable rLock = p.level.BlockDB.Locker.AccquireRead(30 * 1000)) {
if (rLock != null) {
p.level.BlockDB.FindChangesAt(x, y, z,
@ -70,8 +70,7 @@ namespace MCGalaxy.Commands.Info {
return true;
}
static void ListFromDatabase(Player p, ref bool foundAny, Dictionary<int, string> names,
ushort x, ushort y, ushort z) {
static void ListFromDatabase(Player p, ref bool foundAny, ushort x, ushort y, ushort z) {
if (!Database.TableExists("Block" + p.level.name)) return;
using (DataTable Blocks = Database.Backend.GetRows("Block" + p.level.name, "*",
"WHERE X=@0 AND Y=@1 AND Z=@2", x, y, z)) {
@ -116,8 +115,6 @@ namespace MCGalaxy.Commands.Info {
BlockDBChange.Output(p, name, entry);
}
static ushort U16(object x) { return ushort.Parse(x.ToString()); }
public override void Help(Player p) {
Player.Message(p, "%T/about");
Player.Message(p, "%HOutputs the change/edit history for a block.");

View File

@ -154,10 +154,6 @@ namespace MCGalaxy.Commands.Info {
data.Likes, data.Dislikes);
}
static string JoinNames(List<string> items, Player p) {
return items.Join(name => PlayerInfo.GetColoredName(p, name));
}
static string GetRealmMapOwner(string lvlName) {
bool plus = Server.ClassicubeAccountPlus;
// Early out when accounts have + and map doesn't.

View File

@ -96,16 +96,6 @@ namespace MCGalaxy.Commands.Info {
return value == "today" || value == "yesterday" || value == "thismonth" || value == "lastmonth" || value == "all";
}
static void DoQuery(Player p, string group, string start, string end, string name, string cmd, string msg) {
DataTable table = Database.Backend.GetRows(
"Opstats", "COUNT(ID)" ,"WHERE Time >= @0 AND Time < @1 AND " +
"Name LIKE @2 AND Cmd LIKE @3 AND Cmdmsg " + msg, start, end, name, cmd);
// don't use colour codes in cli or gui
Player.Message(p, (p == null ? "" : "&a") + group + (p == null ? "" : "&5") + table.Rows[0]["COUNT(id)"]);
table.Dispose();
}
static int Query(string start, string end, string name, string cmd, string msg = "!=''") {
using (DataTable table = Database.Backend.GetRows(
"Opstats", "COUNT(ID)" ,"WHERE Time >= @0 AND Time < @1 AND " +

View File

@ -114,8 +114,6 @@ namespace MCGalaxy.Commands.Info {
}
}
static Section MakeSection(string title) { return MakeSection(Group.standard, title); }
static Section MakeSection(Group group, string title) {
Section sec;
sec.group = group;

View File

@ -145,7 +145,7 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, "Block {0} is {1}: {2}",
BlockName(scope, lvl, block),
type, getter(props) ? "&aYes" : "&cNo");
OnPropsChanged(scope, lvl, block, false);
OnPropsChanged(scope, lvl, block);
}
static void SetEnum(Player p, BlockProps[] scope, ExtBlock block, string msg) {
@ -156,7 +156,7 @@ namespace MCGalaxy.Commands.World {
scope[block.Index].AnimalAI = ai;
Player.Message(p, "Animal AI for {0} set to: {1}",
BlockName(scope, lvl, block), ai);
OnPropsChanged(scope, lvl, block, true);
OnPropsChanged(scope, lvl, block);
}
static void SetDeathMessage(Player p, BlockProps[] scope, ExtBlock block, string msg) {
@ -170,11 +170,11 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, "Death message for {0} set to: {1}",
BlockName(scope, lvl, block), msg);
}
OnPropsChanged(scope, lvl, block, false);
OnPropsChanged(scope, lvl, block);
}
static void OnPropsChanged(BlockProps[] scope, Level level, ExtBlock block, bool physics) {
static void OnPropsChanged(BlockProps[] scope, Level level, ExtBlock block) {
scope[block.Index].Changed = true;
if (scope == Block.Props) {

View File

@ -61,8 +61,6 @@ namespace MCGalaxy.Commands.World {
Player.Message(p, "Converted map!");
}
enum FileType { Mcf, Fcm, Dat, Cw };
public override void Help(Player p) {
Player.Message(p, "%T/import [name]");
Player.Message(p, "%HImports a map file with that name.");

View File

@ -126,15 +126,6 @@ namespace MCGalaxy.Commands.World {
GetBool(lvl.Buildable), GetBool(lvl.Deletable));
}
internal static void SetBool(Player p, Level lvl, ref bool target, string name, bool negate = false) {
target = !target;
bool display = negate ? !target : target;
lvl.ChatLevel(name + GetBool(display));
if (p == null || p.level != lvl)
Player.Message(p, name + GetBool(display, p == null));
}
static string GetBool(bool value, bool console = false) {
return console ? (value ? "ON" : "OFF") : (value ? "&aON" : "&cOFF");
}

View File

@ -51,11 +51,11 @@ namespace MCGalaxy.Drawing.Ops {
pos = p1;
foreach (char c in Text) {
DrawLetter(Player, Level, c, brush, output);
DrawLetter(Player, c, brush, output);
}
}
void DrawLetter(Player p, Level lvl, char c, Brush brush, DrawOpOutput output) {
void DrawLetter(Player p, char c, Brush brush, DrawOpOutput output) {
if ((int)c >= 256 || letters[(int)c] == null) {
Player.Message(p, "\"" + c + "\" is not currently supported, replacing with space.");
pos.X = (ushort)(pos.X + dirX * 4 * Scale);

View File

@ -99,7 +99,7 @@ namespace MCGalaxy.Drawing {
public byte BestMatch(byte R, byte G, byte B, out bool backLayer) {
backLayer = false;
return BestMatch(R, G, B, out backLayer);
return BestMatch(R, G, B);
}

View File

@ -85,55 +85,6 @@ namespace MCGalaxy.Network {
bot.connection.Listener.OnPrivateNotice -= Listener_OnPrivateNotice;
}
#region In-game event handlers
void Player_PlayerAction(Player p, PlayerAction action,
string message, bool stealth) {
if (!bot.Enabled) return;
string msg = null;
if (action == PlayerAction.AFK && !p.hidden)
msg = p.ColoredName + " %Sis AFK " + message;
else if (action == PlayerAction.UnAFK && !p.hidden)
msg = p.ColoredName + " %Sis no longer AFK";
else if (action == PlayerAction.Joker)
msg = p.ColoredName + " %Sis now a &aJ&bo&ck&5e&9r%S";
else if (action == PlayerAction.Unjoker)
msg = p.ColoredName + " %Sis no longer a &aJ&bo&ck&5e&9r%S";
else if (action == PlayerAction.Me)
msg = "*" + p.DisplayName + " " + message;
else if (action == PlayerAction.Review)
msg = p.ColoredName + " %Sis requesting a review.";
else if (action == PlayerAction.JoinWorld && Server.ircShowWorldChanges && !p.hidden)
msg = p.ColoredName + " %Swent to &8" + message;
if (msg != null) bot.Say(msg, stealth);
}
void Player_PlayerDisconnect(Player p, string reason) {
if (!bot.Enabled || p.hidden) return;
if (!Server.guestLeaveNotify && p.Rank <= LevelPermission.Guest) return;
bot.Say(p.DisplayName + " %Sleft the game (" + reason + "%S)", false);
}
void Player_PlayerConnect(Player p) {
if (!bot.Enabled || p.hidden) return;
if (!Server.guestJoinNotify && p.Rank <= LevelPermission.Guest) return;
bot.Say(p.DisplayName + " %Sjoined the game", false);
}
void Player_PlayerChat(Player p, string message) {
if (!bot.Enabled) return;
if (message.Trim(trimChars) == "") return;
string name = Server.ircPlayerTitles ? p.FullName : p.group.prefix + p.ColoredName;
bot.Say(name + "%S: " + message, p.opchat);
}
#endregion
void Listener_OnAction(UserInfo user, string channel, string description) {
Player.GlobalIRCMessage(String.Format("%I(IRC) * {0} {1}", user.Nick, description));