Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0c198fd
Added Command aliases and CommandType
frc5529 May 16, 2015
9e77c52
Test
frc5529 May 16, 2015
5b411cb
Basic CPE and ClickDistance support
frc5529 May 16, 2015
969f511
Added CPE and ClickDistance to properties
frc5529 May 16, 2015
066eb44
Lots of things!
May 23, 2015
81ef4e5
Forgot a file
May 23, 2015
d873172
Merge pull request #2 from 727021/MCSong-CPE
May 23, 2015
4add768
Lots of things!
Jun 19, 2015
f8657bf
Getting work done
Jun 24, 2015
296f261
CPE is working!
Jun 26, 2015
8d5feb9
Lots of GUI work
Jul 10, 2015
f67e758
HackControl Support + GUI
Jul 11, 2015
517a3d9
Update changelog
Jul 11, 2015
ea8d462
Finished maps tab and fixed some derps
Jul 15, 2015
12fd327
Merge branch 'master' of https://github.com/727021/MCSong.git
Jul 15, 2015
8b86a10
Finished property window
Aug 1, 2015
2555ef1
Fixed a thing
Aug 11, 2015
b31ded8
Updated the updater
Aug 14, 2015
ba13daf
Merge branch 'master' of https://github.com/727021/MCSong.git
Aug 14, 2015
a2bee65
Update README.md
Aug 18, 2015
afba3c0
Update README.md
Aug 18, 2015
eca1b64
Update README.md
Aug 18, 2015
5ef1d9d
GUI Work, MBs now stored in flatfile
Aug 18, 2015
dd23bca
Finished PlayerDB, MessagesDB, and CPE MessageTypes
Aug 19, 2015
b2f0342
Update CmdBind.cs
Aug 20, 2015
c8fc898
Moar
Sep 9, 2015
c0d4b50
Merge branch 'master' of https://github.com/727021/MCSong.git
Sep 9, 2015
58431d1
Added magic
Sep 9, 2015
ff063e0
Change default jump height
Sep 23, 2015
629fe21
Disabled Mojang heartbeat pump
Oct 12, 2015
42c31c1
Disabled Mojang beat (server list is dead)
Oct 13, 2015
1f738bd
Stuff
Dec 9, 2015
4771dff
Everything is broken...
727021 Jul 11, 2018
a365aa6
Update README.md
727021 Jul 14, 2019
a6d60ed
Update .gitignore
727021 Jul 14, 2019
c47db9b
Start work on implementing PostgreSQL support
727021 Jan 29, 2020
d53dc64
Convert database code to SQLite
727021 Feb 3, 2020
fb0b8c1
Update .gitignore
727021 Feb 3, 2020
dd038f2
Work on remote console
727021 Feb 5, 2020
e9d4996
Add omniban list
727021 Feb 5, 2020
f45ee7b
Remove ignored files
727021 Feb 5, 2020
6462789
Add old changes
727021 Jul 17, 2020
41b0ab6
Bump System.Text.Encodings.Web from 4.7.0 to 4.7.2 in /MCSong
dependabot[bot] Apr 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ MCSong/bin/
MCSong/obj/
FROSTEDBUTTS/
*.suo
/.vs/ProjectSettings.json
/.vs
/packages
Binary file added Interop.NATUPNPLib.dll
Binary file not shown.
20 changes: 19 additions & 1 deletion MCSong.sln
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCSong_", "MCSong\MCSong_.csproj", "{12597DB0-7C34-4DE1-88EA-9250FF3372EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Starter", "MCSong\Starter.csproj", "{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Debug|Any CPU.ActiveCfg = Debug|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Debug|Mixed Platforms.Build.0 = Debug|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Debug|x86.ActiveCfg = Debug|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Debug|x86.Build.0 = Debug|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Release|Any CPU.ActiveCfg = Release|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Release|Mixed Platforms.ActiveCfg = Release|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Release|Mixed Platforms.Build.0 = Release|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Release|x86.ActiveCfg = Release|x86
{12597DB0-7C34-4DE1-88EA-9250FF3372EB}.Release|x86.Build.0 = Release|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Debug|Any CPU.ActiveCfg = Debug|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Debug|Mixed Platforms.Build.0 = Debug|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Debug|x86.ActiveCfg = Debug|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Debug|x86.Build.0 = Debug|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Release|Any CPU.ActiveCfg = Release|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Release|Mixed Platforms.ActiveCfg = Release|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Release|Mixed Platforms.Build.0 = Release|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Release|x86.ActiveCfg = Release|x86
{63DCBB31-92CD-4464-A86C-A7E51A5FE9FE}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand Down
122 changes: 119 additions & 3 deletions MCSong/Block.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@ public class Block
public const byte snake = (byte)251;
public const byte snaketail = (byte)252;

// CPE Blocks
public const byte cobbleslab = (byte)50;
public const byte rope = (byte)51;
public const byte sandstone = (byte)52;
public const byte snow = (byte)53;
public const byte cpefire = (byte)54;
public const byte lightpink = (byte)55;
public const byte forestgreen = (byte)56;
public const byte brown = (byte)57;
public const byte deepblue = (byte)58;
public const byte turquoise = (byte)59;
public const byte ice = (byte)60;
public const byte ceramic = (byte)61;
public const byte cpemagma = (byte)62;
public const byte pillar = (byte)63;
public const byte crate = (byte)64;
public const byte stonebrick = (byte)65;

public static List<Blocks> BlockList = new List<Blocks>();
public class Blocks
{
Expand Down Expand Up @@ -462,7 +480,7 @@ public static void SetBlocks()
{
string[] lines = File.ReadAllLines("properties/block.properties");

if (lines.Length == 0) ;
if (lines.Length == 0) { }
else if (lines[0] == "#Version 2")
{
string[] colon = new string[] { " : " };
Expand Down Expand Up @@ -597,6 +615,9 @@ public static bool Walkthrough(byte type)
case mushroom:
case redmushroom:
case shrub:
//CPE
case rope:
case cpefire:
return true;
}
return false;
Expand Down Expand Up @@ -709,7 +730,7 @@ public static bool Placable(byte type)
return false;
}

if (type > 49) { return false; }
if (type > 65) { return false; }
return true;
}

Expand Down Expand Up @@ -849,6 +870,12 @@ public static bool LavaKill(byte type)
case Block.mushroom:
case Block.redmushroom:
case Block.bookcase:
//CPE
case Block.lightpink:
case Block.brown:
case Block.deepblue:
case Block.turquoise:
case Block.crate:
return true;
}
return false;
Expand Down Expand Up @@ -881,6 +908,7 @@ public static bool LightPass(byte type)
case Block.mushroom:
case Block.redmushroom:
case Block.shrub:
case Block.rope:
return true;

default:
Expand Down Expand Up @@ -1049,13 +1077,41 @@ public static bool mb(byte type)
case Block.deathwater:

case flagbase:
//CPE
case Block.cobbleslab:
case Block.rope:
case Block.sandstone:
case Block.snow:
case Block.cpefire:
case Block.lightpink:
case Block.forestgreen:
case Block.brown:
case Block.deepblue:
case Block.turquoise:
case Block.ice:
case Block.ceramic:
case Block.cpemagma:
case Block.pillar:
case Block.crate:
case Block.stonebrick:
return false;

default:
return true;
}
}

public static bool Extended(byte b)
{
return (b >= (byte)50 && b <= (byte)65);
}

public static byte SupportLevel(byte b)
{
if (b >= (byte)50 && b <= (byte)65) return (byte)1;
else return (byte)0;
}

public static string Name(byte type)
{
switch (type)
Expand Down Expand Up @@ -1111,6 +1167,24 @@ public static string Name(byte type)
case 48: return "mossy_cobblestone";
case 49: return "obsidian";

//CPE
case 50: return "cobblestone_slab";
case 51: return "rope";
case 52: return "sandstone";
case 53: return "snow";
case 54: return "cpefire";
case 55: return "lightpink";
case 56: return "forestgreen";
case 57: return "brown";
case 58: return "deepblue";
case 59: return "turquoise";
case 60: return "ice";
case 61: return "ceramic";
case 62: return "cpemagma";
case 63: return "pillar";
case 64: return "crate";
case 65: return "stonebrick";

case 70: return "flagbase";
case 100: return "op_glass";
case 101: return "opsidian"; //TODO Add command or just use bind?
Expand Down Expand Up @@ -1337,6 +1411,24 @@ public static byte Byte(string type)
case "mossy_cobblestone": return 48;
case "obsidian": return 49;

//CPE
case "cobblestone_slab": return 50;
case "rope": return 51;
case "sandstone": return 52;
case "snow": return 53;
case "cpefire": return 54;
case "lightpink": return 55;
case "forestgreen": return 56;
case "brown": return 57;
case "deepblue": return 58;
case "turquoise": return 59;
case "ice": return 60;
case "ceramic": return 61;
case "cpemagma": return 62;
case "pillar": return 63;
case "crate": return 64;
case "stonebrick": return 65;

case "op_glass": return 100;
case "opsidian": return 101; //TODO Add command or just use bind?
case "op_brick": return 102; //TODO
Expand Down Expand Up @@ -1536,6 +1628,30 @@ public static byte Byte(string type)
}
}

public static byte Fallback(byte b)
{
switch (b)
{
case cobbleslab: return staircasestep;
case rope: return mushroom;
case sandstone: return sand;
case snow: return air;
case cpefire: return fire;
case lightpink: return pink;
case forestgreen: return green;
case brown: return dirt;
case deepblue: return blue;
case turquoise: return cyan;
case ice: return glass;
case ceramic: return iron;
case cpemagma: return obsidian;
case pillar: return white;
case crate: return wood;
case stonebrick: return stone;
default: return b;
}
}

public static byte Convert(byte b)
{
switch (b)
Expand Down Expand Up @@ -1705,7 +1821,7 @@ public static byte Convert(byte b)
case fishlavashark: return obsidian;

default:
if (b < 50) return b; else return 22;
if (b <= 65) return b; else return 22;
}
}
public static byte SaveConvert(byte b)
Expand Down
58 changes: 58 additions & 0 deletions MCSong/ChatBuffer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MCSong
{
public class ChatBuffer
{
public ChatBuffer()
{
this.buffer = new List<string>();
this.currentIndex = 0;
}

private List<string> buffer;// [0:"Oldest", 1:"Older", 2:"Newer", 3:"Newest"]
private int currentIndex;

public void addEntry(string s)
{
buffer.Add(s);
currentIndex = buffer.Count - 1;
}

public string up()
{
if (buffer.Count <= 0) { return ""; }
string temp = "";
if (currentIndex >= 0)
{
temp = buffer.ElementAt(currentIndex);
}
if (currentIndex > 0)
{
currentIndex--;
}
return temp;
}

public string down()
{
if (currentIndex < (buffer.Count-1))
{
currentIndex++;
return buffer.ElementAt(currentIndex);
}
return "";
}

public void clear()
{
this.buffer.Clear();
this.currentIndex = 0;
}
}
}
5 changes: 3 additions & 2 deletions MCSong/Commands/CmdAbort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ namespace MCSong
public class CmdAbort : Command
{
public override string name { get { return "abort"; } }
public override string shortcut { get { return "a"; } }
public override string type { get { return "build"; } }
public override string[] aliases { get { return new string[] { "a" }; } }
public override CommandType type { get { return CommandType.Building; } }
public override bool consoleUsable { get { return false; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
public CmdAbort() { }
Expand Down
23 changes: 7 additions & 16 deletions MCSong/Commands/CmdAbout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ namespace MCSong
public class CmdAbout : Command
{
public override string name { get { return "about"; } }
public override string shortcut { get { return "b"; } }
public override string type { get { return "information"; } }
public override string[] aliases { get { return new string[] { "b" }; } }
public override CommandType type { get { return CommandType.Information; } }
public override bool consoleUsable { get { return false; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdAbout() { }
Expand Down Expand Up @@ -53,24 +54,14 @@ public void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type)
message = p.level.foundInfo(x, y, z);
if (message != "") Player.SendMessage(p, "Physics information: &a" + message);

DataTable Blocks = MySQL.fillData("SELECT * FROM `Block" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);

string Username, TimePerformed, BlockUsed;
bool Deleted, foundOne = false;

for (int i = 0; i < Blocks.Rows.Count; i++)
SQLiteHelper.SQLResult blockQuery = SQLiteHelper.ExecuteQuery($@"SELECT username,when,x,y,z,type,deleted FROM Blocks{p.level.name} WHERE x = {x} AND y = {y} AND z = {z};");
for (int i = 0; i < blockQuery.rowsAffected; i++)
{
foundOne = true;
Username = Blocks.Rows[i]["Username"].ToString();
TimePerformed = DateTime.Parse(Blocks.Rows[i]["TimePerformed"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
BlockUsed = Block.Name((byte)Blocks.Rows[i]["Type"]).ToString();
Deleted = (bool)Blocks.Rows[i]["Deleted"];

if (!Deleted)
Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
else
Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
Player.SendMessage(p, (blockQuery[i]["deleted"].ToLower() == "true" ? "&3Created by " : "&4Deleted by ") + $"{Server.FindColor(blockQuery[i]["username"])}{blockQuery[i]["username"]}{Server.DefaultColor}, using &3{Block.Name(byte.Parse(blockQuery[i]["type"]))}");
}

List<Level.BlockPos> inCache = p.level.blockCache.FindAll(bP => bP.x == x && bP.y == y && bP.z == z);
Expand All @@ -93,7 +84,7 @@ public void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type)
if (!foundOne)
Player.SendMessage(p, "This block has not been modified since the map was cleared.");

Blocks.Dispose();
//Blocks.Dispose();

GC.Collect();
GC.WaitForPendingFinalizers();
Expand Down
Loading