mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
tabs to spaces
This commit is contained in:
parent
11c5007898
commit
8b044cc140
@ -133,7 +133,7 @@ namespace MCGalaxy {
|
|||||||
PlayerBot[] bots = Bots.Items;
|
PlayerBot[] bots = Bots.Items;
|
||||||
|
|
||||||
foreach (PlayerBot bot in bots) {
|
foreach (PlayerBot bot in bots) {
|
||||||
if (bot.name.CaselessEq(name)) return bot;
|
if (bot.name.CaselessEq(name)) return bot;
|
||||||
if (bot.name.CaselessContains(name)) {
|
if (bot.name.CaselessContains(name)) {
|
||||||
match = bot; matches++;
|
match = bot; matches++;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ namespace MCGalaxy {
|
|||||||
File.WriteAllText("text/badwords.txt", sb.ToString());
|
File.WriteAllText("text/badwords.txt", sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] lines = File.ReadAllLines("text/badwords.txt");
|
string[] lines = File.ReadAllLines("text/badwords.txt");
|
||||||
// Run the badwords through the reducer to ensure things like Ls become Is and everything is lowercase
|
// Run the badwords through the reducer to ensure things like Ls become Is and everything is lowercase
|
||||||
filters = new List<string>();
|
filters = new List<string>();
|
||||||
foreach (string line in lines) {
|
foreach (string line in lines) {
|
||||||
|
@ -32,7 +32,7 @@ namespace MCGalaxy.Commands {
|
|||||||
string[] args = message.SplitSpaces(2);
|
string[] args = message.SplitSpaces(2);
|
||||||
|
|
||||||
if (!(message == "" || args[0].CaselessEq("all"))) {
|
if (!(message == "" || args[0].CaselessEq("all"))) {
|
||||||
lvl = LevelInfo.FindMatches(p, args[0]);
|
lvl = LevelInfo.FindMatches(p, args[0]);
|
||||||
if (lvl == null) return;
|
if (lvl == null) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, "Hence, you cannot change the color of that bot.");
|
Player.Message(p, "Hence, you cannot change the color of that bot.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string color = args.Length > 2 ? Colors.Parse(args[2]) : "&1";
|
string color = args.Length > 2 ? Colors.Parse(args[2]) : "&1";
|
||||||
if (color == "") { Player.Message(p, "There is no color \"" + args[2] + "\"."); return; }
|
if (color == "") { Player.Message(p, "There is no color \"" + args[2] + "\"."); return; }
|
||||||
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Scolor was set to "
|
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Scolor was set to "
|
||||||
|
@ -79,8 +79,8 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, SubCommand> subCommands = new Dictionary<string, SubCommand>() {
|
Dictionary<string, SubCommand> subCommands = new Dictionary<string, SubCommand>() {
|
||||||
{ "blockprops", new SubCommand(HandleBlockProps, blockPropskHelp) },
|
{ "blockprops", new SubCommand(HandleBlockProps, blockPropsHelp) },
|
||||||
{ "blockproperties", new SubCommand(HandleBlockProps, blockPropskHelp) },
|
{ "blockproperties", new SubCommand(HandleBlockProps, blockPropsHelp) },
|
||||||
{ "env", new SubCommand(HandleEnv, envHelp) },
|
{ "env", new SubCommand(HandleEnv, envHelp) },
|
||||||
{ "go", new SubCommand(HandleGoto, gotoHelp) },
|
{ "go", new SubCommand(HandleGoto, gotoHelp) },
|
||||||
{ "kick", new SubCommand(HandleKick, kickHelp) },
|
{ "kick", new SubCommand(HandleKick, kickHelp) },
|
||||||
@ -136,7 +136,7 @@ namespace MCGalaxy.Commands {
|
|||||||
|
|
||||||
#region Help messages
|
#region Help messages
|
||||||
|
|
||||||
static string[] blockPropskHelp = new string[] {
|
static string[] blockPropsHelp = new string[] {
|
||||||
"%T/os blockprops [id] [action] <args> %H- Manages properties for custom blocks on your map.",
|
"%T/os blockprops [id] [action] <args> %H- Manages properties for custom blocks on your map.",
|
||||||
"%H See %T/help blockprops %Hfor a list of actions",
|
"%H See %T/help blockprops %Hfor a list of actions",
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,6 @@ using System.Collections.Generic;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using MCGalaxy.DB;
|
using MCGalaxy.DB;
|
||||||
using MCGalaxy.SQL;
|
using MCGalaxy.SQL;
|
||||||
using MCGalaxy.Util;
|
|
||||||
|
|
||||||
namespace MCGalaxy.Commands {
|
namespace MCGalaxy.Commands {
|
||||||
public sealed class CmdAbout : Command {
|
public sealed class CmdAbout : Command {
|
||||||
@ -31,9 +30,9 @@ namespace MCGalaxy.Commands {
|
|||||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||||
public CmdAbout() { }
|
public CmdAbout() { }
|
||||||
public override CommandAlias[] Aliases {
|
public override CommandAlias[] Aliases {
|
||||||
get { return new [] { new CommandAlias("binfo"), new CommandAlias("bi"), new CommandAlias("whodid") }; }
|
get { return new [] { new CommandAlias("binfo"), new CommandAlias("bi"), new CommandAlias("whodid") }; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
|
if (Player.IsSuper(p)) { MessageInGameOnly(p); return; }
|
||||||
Player.Message(p, "Break/build a block to display information.");
|
Player.Message(p, "Break/build a block to display information.");
|
||||||
|
@ -30,8 +30,8 @@ namespace MCGalaxy.Commands {
|
|||||||
if (!File.Exists("text/faq.txt")) {
|
if (!File.Exists("text/faq.txt")) {
|
||||||
File.WriteAllText("text/faq.txt", "Example: What does this server run on? This server runs on &bMCGalaxy");
|
File.WriteAllText("text/faq.txt", "Example: What does this server run on? This server runs on &bMCGalaxy");
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] faq = File.ReadAllLines("text/faq.txt");
|
string[] faq = File.ReadAllLines("text/faq.txt");
|
||||||
Player.Message(p, "&cFAQ&f:");
|
Player.Message(p, "&cFAQ&f:");
|
||||||
foreach (string line in faq)
|
foreach (string line in faq)
|
||||||
Player.Message(p, "&f" + line);
|
Player.Message(p, "&f" + line);
|
||||||
|
@ -31,8 +31,8 @@ namespace MCGalaxy.Commands {
|
|||||||
if (!File.Exists(newsFile)) {
|
if (!File.Exists(newsFile)) {
|
||||||
File.WriteAllText(newsFile, "News have not been created. Put News in '" + newsFile + "'."); return;
|
File.WriteAllText(newsFile, "News have not been created. Put News in '" + newsFile + "'."); return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] lines = File.ReadAllLines(newsFile);
|
string[] lines = File.ReadAllLines(newsFile);
|
||||||
Player.MessageLines(p, lines);
|
Player.MessageLines(p, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace MCGalaxy.Commands {
|
|||||||
if (!File.Exists("text/oprules.txt")) {
|
if (!File.Exists("text/oprules.txt")) {
|
||||||
File.WriteAllText("text/oprules.txt", "No oprules entered yet!");
|
File.WriteAllText("text/oprules.txt", "No oprules entered yet!");
|
||||||
}
|
}
|
||||||
string[] oprules = File.ReadAllLines("text/oprules.txt");
|
string[] oprules = File.ReadAllLines("text/oprules.txt");
|
||||||
|
|
||||||
Player who = p;
|
Player who = p;
|
||||||
if (message != "") {
|
if (message != "") {
|
||||||
|
@ -25,7 +25,7 @@ namespace MCGalaxy.Commands {
|
|||||||
public CmdUpdate() { }
|
public CmdUpdate() { }
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (!message.CaselessEq("force")) {
|
if (!message.CaselessEq("force")) {
|
||||||
Updater.UpdateCheck(false, p);
|
Updater.UpdateCheck(false, p);
|
||||||
} else {
|
} else {
|
||||||
Updater.PerformUpdate();
|
Updater.PerformUpdate();
|
||||||
|
@ -111,7 +111,7 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, "Dates must be in the format: yyyy-mm-dd hh:mm:ss");
|
Player.Message(p, "Dates must be in the format: yyyy-mm-dd hh:mm:ss");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime date;
|
DateTime date;
|
||||||
if (!DateTime.TryParseExact(args[2], dateFormat, null, 0, out date)) {
|
if (!DateTime.TryParseExact(args[2], dateFormat, null, 0, out date)) {
|
||||||
Player.Message(p, "Invalid date. (must be in format: yyyy-mm-dd hh:mm:ss");
|
Player.Message(p, "Invalid date. (must be in format: yyyy-mm-dd hh:mm:ss");
|
||||||
@ -169,7 +169,7 @@ namespace MCGalaxy.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateDB(string name, string value, string column) {
|
static void UpdateDB(string name, string value, string column) {
|
||||||
Database.Backend.UpdateRows("Players", column + " = @1", "WHERE Name = @0", name, value.UnicodeToCp437());
|
Database.Backend.UpdateRows("Players", column + " = @1", "WHERE Name = @0", name, value.UnicodeToCp437());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MessageDataChanged(Player p, string name, string type, string value) {
|
static void MessageDataChanged(Player p, string name, string type, string value) {
|
||||||
|
@ -61,7 +61,7 @@ namespace MCGalaxy.Commands.Building {
|
|||||||
handler(p, old, P.X, P.Y, P.Z);
|
handler(p, old, P.X, P.Y, P.Z);
|
||||||
} else {
|
} else {
|
||||||
Player.Message(p, "Cannot mark, no selection or cuboid in progress, " +
|
Player.Message(p, "Cannot mark, no selection or cuboid in progress, " +
|
||||||
"nor could the existing block at the coordinates be activated."); return;
|
"nor could the existing block at the coordinates be activated."); return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,8 @@ namespace MCGalaxy.Commands {
|
|||||||
Player.Message(p, "&cIncorrect syntax. Abuse detected.");
|
Player.Message(p, "&cIncorrect syntax. Abuse detected.");
|
||||||
Thread.Sleep(3000);
|
Thread.Sleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const string msg = "Your IP has been backtraced + reported to FBI Cyber Crimes Unit.";
|
const string msg = "Your IP has been backtraced + reported to FBI Cyber Crimes Unit.";
|
||||||
p.Leave("kicked (" + msg + ")", msg, false);
|
p.Leave("kicked (" + msg + ")", msg, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,12 +168,12 @@ namespace MCGalaxy.DB {
|
|||||||
Vec3U16 fileDims;
|
Vec3U16 fileDims;
|
||||||
|
|
||||||
if (!File.Exists(FilePath)) {
|
if (!File.Exists(FilePath)) {
|
||||||
using (Stream s = OpenWrite()) {
|
using (Stream s = OpenWrite()) {
|
||||||
fileDims = Dims;
|
fileDims = Dims;
|
||||||
BlockDBFile.WriteHeader(s, fileDims);
|
BlockDBFile.WriteHeader(s, fileDims);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
using (Stream s = OpenRead()) {
|
using (Stream s = OpenRead()) {
|
||||||
BlockDBFile.ReadHeader(s, out fileDims);
|
BlockDBFile.ReadHeader(s, out fileDims);
|
||||||
}
|
}
|
||||||
if (fileDims.X < Dims.X || fileDims.Y < Dims.Y || fileDims.Z < Dims.Z) {
|
if (fileDims.X < Dims.X || fileDims.Y < Dims.Y || fileDims.Z < Dims.Z) {
|
||||||
|
@ -22,7 +22,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace MCGalaxy.SQL {
|
namespace MCGalaxy.SQL {
|
||||||
|
|
||||||
/// <summary> Simple abstraction for a database management system. </summary>
|
/// <summary> Simple abstraction for a database management system. </summary>
|
||||||
public abstract class IDatabaseBackend {
|
public abstract class IDatabaseBackend {
|
||||||
|
|
||||||
/// <summary> Describes the arguments for a database connection
|
/// <summary> Describes the arguments for a database connection
|
||||||
|
@ -20,8 +20,8 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace MCGalaxy.Undo {
|
namespace MCGalaxy.Undo {
|
||||||
|
|
||||||
public sealed class UndoDrawOpEntry {
|
public sealed class UndoDrawOpEntry {
|
||||||
public string DrawOpName;
|
public string DrawOpName;
|
||||||
public string LevelName;
|
public string LevelName;
|
||||||
public DateTime Start, End;
|
public DateTime Start, End;
|
||||||
|
@ -70,7 +70,7 @@ namespace MCGalaxy.Generator.Foilage {
|
|||||||
for (int dz = -top; dz <= top; ++dz)
|
for (int dz = -top; dz <= top; ++dz)
|
||||||
for (int dx = -top; dx <= top; ++dx)
|
for (int dx = -top; dx <= top; ++dx)
|
||||||
{
|
{
|
||||||
int dist = (int)(Math.Sqrt(dx * dx + dy * dy + dz * dz));
|
int dist = (int)(Math.Sqrt(dx * dx + dy * dy + dz * dz));
|
||||||
if ((dist < top + 1) && rnd.Next(dist) < 2) {
|
if ((dist < top + 1) && rnd.Next(dist) < 2) {
|
||||||
ushort xx = (ushort)(x + dx), yy = (ushort)(y + dy + height), zz = (ushort)(z + dz);
|
ushort xx = (ushort)(x + dx), yy = (ushort)(y + dy + height), zz = (ushort)(z + dz);
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ namespace MCGalaxy.Generator.Foilage {
|
|||||||
|
|
||||||
/// <summary> Returns true if any green or trunk blocks are in the cube centred at (x, y, z) of extent 'size'. </summary>
|
/// <summary> Returns true if any green or trunk blocks are in the cube centred at (x, y, z) of extent 'size'. </summary>
|
||||||
public static bool TreeCheck(Level lvl, ushort x, ushort y, ushort z, short size) { //return true if tree is near
|
public static bool TreeCheck(Level lvl, ushort x, ushort y, ushort z, short size) { //return true if tree is near
|
||||||
for (short dy = (short)-size; dy <= +size; ++dy)
|
for (int dy = -size; dy <= size; ++dy)
|
||||||
for (short dz = (short)-size; dz <= +size; ++dz)
|
for (int dz = -size; dz <= size; ++dz)
|
||||||
for (short dx = (short)-size; dx <= +size; ++dx)
|
for (int dx = -size; dx <= size; ++dx)
|
||||||
{
|
{
|
||||||
byte tile = lvl.GetTile((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz));
|
byte tile = lvl.GetTile((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz));
|
||||||
if (tile == Block.trunk || tile == Block.green) return true;
|
if (tile == Block.trunk || tile == Block.green) return true;
|
||||||
|
@ -5,7 +5,7 @@ namespace MCGalaxy.Generator {
|
|||||||
|
|
||||||
/// <summary> Interpolation mode for perlin noise. </summary>
|
/// <summary> Interpolation mode for perlin noise. </summary>
|
||||||
public enum NoiseInterpolationMode {
|
public enum NoiseInterpolationMode {
|
||||||
|
|
||||||
/// <summary> Cosine interpolation (fast). </summary>
|
/// <summary> Cosine interpolation (fast). </summary>
|
||||||
Cosine,
|
Cosine,
|
||||||
|
|
||||||
|
@ -142,7 +142,13 @@ namespace MCGalaxy {
|
|||||||
OnListChanged(p, target, false, removed);
|
OnListChanged(p, target, false, removed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary> Called when min or max rank is changed. </summary>
|
||||||
|
public abstract void OnPermissionChanged(Player p, Group grp, string type);
|
||||||
|
|
||||||
|
/// <summary> Called when a whitelist or blacklist is changed. </summary>
|
||||||
|
public abstract void OnListChanged(Player p, string name, bool whitelist, bool removedFromOpposite);
|
||||||
|
|
||||||
bool CheckRank(Player p, LevelPermission perm, string type, bool newPerm) {
|
bool CheckRank(Player p, LevelPermission perm, string type, bool newPerm) {
|
||||||
if (p != null && perm > p.Rank) {
|
if (p != null && perm > p.Rank) {
|
||||||
@ -153,17 +159,6 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Messages all player on the level (and source player) notifying them that the
|
|
||||||
/// min or max rank changed, rechecks access permissions for all players on the level,
|
|
||||||
/// and finally saves the level properties file. </summary>
|
|
||||||
public abstract void OnPermissionChanged(Player p, Group grp, string type);
|
|
||||||
|
|
||||||
/// <summary> Messages all player on the level (and source player) notifying them that the
|
|
||||||
/// target player was whitelisted or blacklisted, rechecks access permissions
|
|
||||||
/// for all players on the level, and finally saves the level properties file. </summary>
|
|
||||||
public abstract void OnListChanged(Player p, string name, bool whitelist, bool removedFromOpposite);
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Returns true if the player is allowed to modify these access permissions,
|
/// <summary> Returns true if the player is allowed to modify these access permissions,
|
||||||
/// and is also allowed to change the access permissions for the target player. </summary>
|
/// and is also allowed to change the access permissions for the target player. </summary>
|
||||||
@ -182,11 +177,10 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
/// <summary> Encapuslates access permissions (visit or build) for a level. </summary>
|
/// <summary> Encapuslates access permissions (visit or build) for a level. </summary>
|
||||||
public sealed class LevelAccessController : AccessController {
|
public sealed class LevelAccessController : AccessController {
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Whether these access permissions apply to
|
/// <summary> Whether these access permissions apply to
|
||||||
/// visit (true) or build (false) permission for the level. </summary>
|
/// visit (true) or build (false) permission for the level. </summary>
|
||||||
public readonly bool IsVisit;
|
public readonly bool IsVisit;
|
||||||
readonly Level lvl;
|
readonly Level lvl;
|
||||||
|
|
||||||
public LevelAccessController(Level lvl, bool isVisit) {
|
public LevelAccessController(Level lvl, bool isVisit) {
|
||||||
@ -229,9 +223,9 @@ namespace MCGalaxy {
|
|||||||
protected override string MaxCmd { get { return IsVisit ? "pervisitmax" : "perbuildmax"; } }
|
protected override string MaxCmd { get { return IsVisit ? "pervisitmax" : "perbuildmax"; } }
|
||||||
|
|
||||||
|
|
||||||
/// <summary> Messages all player on the level (and source player) notifying them that the
|
/// <summary> Messages all player on the level (and source player) notifying them that the
|
||||||
/// min or max rank changed, rechecks access permissions for all players on the level,
|
/// min or max rank changed, rechecks access permissions for all players on the level,
|
||||||
/// and finally saves the level properties file. </summary>
|
/// and finally saves the level properties file. </summary>
|
||||||
public override void OnPermissionChanged(Player p, Group grp, string type) {
|
public override void OnPermissionChanged(Player p, Group grp, string type) {
|
||||||
Update();
|
Update();
|
||||||
Server.s.Log(type + " rank changed to " + grp.trueName + " on " + lvl.name + ".");
|
Server.s.Log(type + " rank changed to " + grp.trueName + " on " + lvl.name + ".");
|
||||||
@ -240,8 +234,8 @@ namespace MCGalaxy {
|
|||||||
Player.Message(p, "{0} rank changed to {1} %Son {2}%S.", type, grp.ColoredName, lvl.ColoredName);
|
Player.Message(p, "{0} rank changed to {1} %Son {2}%S.", type, grp.ColoredName, lvl.ColoredName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Messages all player on the level (and source player) notifying them that the
|
/// <summary> Messages all player on the level (and source player) notifying them that the
|
||||||
/// target player was whitelisted or blacklisted, rechecks access permissions
|
/// target player was whitelisted or blacklisted, rechecks access permissions
|
||||||
/// for all players on the level, and finally saves the level properties file. </summary>
|
/// for all players on the level, and finally saves the level properties file. </summary>
|
||||||
public override void OnListChanged(Player p, string name, bool whitelist, bool removedFromOpposite) {
|
public override void OnListChanged(Player p, string name, bool whitelist, bool removedFromOpposite) {
|
||||||
string type = IsVisit ? "visit" : "build";
|
string type = IsVisit ? "visit" : "build";
|
||||||
|
@ -24,9 +24,9 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
|
|
||||||
//WARNING! DO NOT CHANGE THE WAY THE LEVEL IS SAVED/LOADED!
|
//WARNING! DO NOT CHANGE THE WAY THE LEVEL IS SAVED/LOADED!
|
||||||
//You MUST make it able to save and load as a new version other wise you will make old levels incompatible!
|
//You MUST make it able to save and load as a new version other wise you will make old levels incompatible!
|
||||||
public sealed class LvlExporter : IMapExporter {
|
public sealed class LvlExporter : IMapExporter {
|
||||||
|
|
||||||
public override string Extension { get { return ".lvl"; } }
|
public override string Extension { get { return ".lvl"; } }
|
||||||
|
|
||||||
const int bufferSize = 64 * 1024;
|
const int bufferSize = 64 * 1024;
|
||||||
public override void Write(Stream dst, Level lvl) {
|
public override void Write(Stream dst, Level lvl) {
|
||||||
|
@ -20,14 +20,14 @@ using System.IO;
|
|||||||
using fNbt;
|
using fNbt;
|
||||||
|
|
||||||
namespace MCGalaxy.Levels.IO {
|
namespace MCGalaxy.Levels.IO {
|
||||||
public sealed class CwImporter : IMapImporter {
|
public sealed class CwImporter : IMapImporter {
|
||||||
|
|
||||||
public override string Extension { get { return ".cw"; } }
|
public override string Extension { get { return ".cw"; } }
|
||||||
|
|
||||||
public override Vec3U16 ReadDimensions(Stream src) {
|
public override Vec3U16 ReadDimensions(Stream src) {
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Level Read(Stream src, string name, bool metadata) {
|
public override Level Read(Stream src, string name, bool metadata) {
|
||||||
NbtFile file = new NbtFile();
|
NbtFile file = new NbtFile();
|
||||||
file.LoadFromStream(src);
|
file.LoadFromStream(src);
|
||||||
@ -75,7 +75,7 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
if (cpe.Contains("BlockDefinitions"))
|
if (cpe.Contains("BlockDefinitions"))
|
||||||
ParseBlockDefinitions(cpe, lvl);
|
ParseBlockDefinitions(cpe, lvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ParseEnvMapAppearance(NbtCompound cpe, Level lvl) {
|
static void ParseEnvMapAppearance(NbtCompound cpe, Level lvl) {
|
||||||
NbtCompound comp = (NbtCompound)cpe["EnvMapAppearance"];
|
NbtCompound comp = (NbtCompound)cpe["EnvMapAppearance"];
|
||||||
|
@ -23,9 +23,9 @@ namespace MCGalaxy.Levels.IO {
|
|||||||
|
|
||||||
//WARNING! DO NOT CHANGE THE WAY THE LEVEL IS SAVED/LOADED!
|
//WARNING! DO NOT CHANGE THE WAY THE LEVEL IS SAVED/LOADED!
|
||||||
//You MUST make it able to save and load as a new version other wise you will make old levels incompatible!
|
//You MUST make it able to save and load as a new version other wise you will make old levels incompatible!
|
||||||
public sealed class LvlImporter : IMapImporter {
|
public sealed class LvlImporter : IMapImporter {
|
||||||
|
|
||||||
public override string Extension { get { return ".lvl"; } }
|
public override string Extension { get { return ".lvl"; } }
|
||||||
|
|
||||||
public override Vec3U16 ReadDimensions(Stream src) {
|
public override Vec3U16 ReadDimensions(Stream src) {
|
||||||
using (Stream gs = new GZipStream(src, CompressionMode.Decompress, true)) {
|
using (Stream gs = new GZipStream(src, CompressionMode.Decompress, true)) {
|
||||||
|
@ -15,17 +15,17 @@
|
|||||||
or implied. See the Licenses for the specific language governing
|
or implied. See the Licenses for the specific language governing
|
||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace MCGalaxy {
|
namespace MCGalaxy {
|
||||||
|
|
||||||
public sealed class ClassiCubeBeat : IBeat {
|
public sealed class ClassiCubeBeat : IBeat {
|
||||||
|
|
||||||
string url = "http://www.classicube.net/heartbeat.jsp";
|
string url = "http://www.classicube.net/heartbeat.jsp";
|
||||||
public string URL { get { return url; } }
|
public string URL { get { return url; } }
|
||||||
|
|
||||||
public bool Persistance { get { return true; } }
|
public bool Persistance { get { return true; } }
|
||||||
|
@ -51,7 +51,7 @@ namespace MCGalaxy {
|
|||||||
byte old = level.GetTile(x, y, z), oldExt = 0;
|
byte old = level.GetTile(x, y, z), oldExt = 0;
|
||||||
if (old == Block.Invalid) return;
|
if (old == Block.Invalid) return;
|
||||||
if (old == Block.custom_block) oldExt = level.GetExtTile(x, y, z);
|
if (old == Block.custom_block) oldExt = level.GetExtTile(x, y, z);
|
||||||
|
|
||||||
if (jailed || !agreed || !canBuild) { RevertBlock(x, y, z); return; }
|
if (jailed || !agreed || !canBuild) { RevertBlock(x, y, z); return; }
|
||||||
if (level.IsMuseum && Blockchange == null) return;
|
if (level.IsMuseum && Blockchange == null) return;
|
||||||
|
|
||||||
@ -126,12 +126,12 @@ namespace MCGalaxy {
|
|||||||
if (doDelete) {
|
if (doDelete) {
|
||||||
if (DeleteBlock(old, x, y, z, block, extBlock)) {
|
if (DeleteBlock(old, x, y, z, block, extBlock)) {
|
||||||
level.BlockDB.Cache.Add(this, x, y, z, flags,
|
level.BlockDB.Cache.Add(this, x, y, z, flags,
|
||||||
old, oldExt, 0, 0);
|
old, oldExt, 0, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (PlaceBlock(old, x, y, z, block, extBlock)) {
|
if (PlaceBlock(old, x, y, z, block, extBlock)) {
|
||||||
level.BlockDB.Cache.Add(this, x, y, z, flags,
|
level.BlockDB.Cache.Add(this, x, y, z, flags,
|
||||||
old, oldExt, heldBlock, heldExt);
|
old, oldExt, heldBlock, heldExt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -770,7 +770,7 @@ namespace MCGalaxy {
|
|||||||
cmdArgs = cmd.ToLower(); cmd = "mode";
|
cmdArgs = cmd.ToLower(); cmd = "mode";
|
||||||
command = Command.all.Find("mode");
|
command = Command.all.Find("mode");
|
||||||
} else {
|
} else {
|
||||||
Server.s.CommandUsed(name + " tried to use unknown command: /" + cmd + " " + cmdArgs);
|
Server.s.CommandUsed(name + " tried to use unknown command: /" + cmd + " " + cmdArgs);
|
||||||
SendMessage("Unknown command \"" + cmd + "\"."); return null;
|
SendMessage("Unknown command \"" + cmd + "\"."); return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,12 @@ using MCGalaxy.Games;
|
|||||||
using MCGalaxy.SQL;
|
using MCGalaxy.SQL;
|
||||||
|
|
||||||
namespace MCGalaxy {
|
namespace MCGalaxy {
|
||||||
public class ChatMessage {
|
public class ChatMessage {
|
||||||
public string text { get; set; }
|
public string text { get; set; }
|
||||||
public string time { get; set; }
|
public string time { get; set; }
|
||||||
public string username { get; set; }
|
public string username { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed partial class Player : IDisposable {
|
public sealed partial class Player : IDisposable {
|
||||||
|
|
||||||
public byte GetActualHeldBlock(out byte extBlock) {
|
public byte GetActualHeldBlock(out byte extBlock) {
|
||||||
|
@ -143,7 +143,7 @@ namespace MCGalaxy {
|
|||||||
|
|
||||||
if (File.Exists("text/messages.txt")) {
|
if (File.Exists("text/messages.txt")) {
|
||||||
string[] lines = File.ReadAllLines("text/messages.txt");
|
string[] lines = File.ReadAllLines("text/messages.txt");
|
||||||
messages = new List<string>(lines);
|
messages = new List<string>(lines);
|
||||||
} else {
|
} else {
|
||||||
using (File.Create("text/messages.txt")) {}
|
using (File.Create("text/messages.txt")) {}
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ namespace MCGalaxy {
|
|||||||
/// <returns> true if main level was changed, false if not
|
/// <returns> true if main level was changed, false if not
|
||||||
/// (same map as current main, or given map doesn't exist).</returns>
|
/// (same map as current main, or given map doesn't exist).</returns>
|
||||||
public static bool SetMainLevel(string mapName) {
|
public static bool SetMainLevel(string mapName) {
|
||||||
if (mapName.CaselessEq(level)) return false;
|
if (mapName.CaselessEq(level)) return false;
|
||||||
Level oldMain = mainLevel;
|
Level oldMain = mainLevel;
|
||||||
|
|
||||||
Level lvl = LevelInfo.FindExact(mapName);
|
Level lvl = LevelInfo.FindExact(mapName);
|
||||||
|
@ -20,9 +20,9 @@ using System.Collections;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace MCGalaxy {
|
namespace MCGalaxy {
|
||||||
|
|
||||||
/// <summary> Finds partial matches of a 'name' against the names of the items an enumerable. </summary>
|
/// <summary> Finds partial matches of a 'name' against the names of the items an enumerable. </summary>
|
||||||
/// <remarks> returns number of matches found, and the matching item if only 1 match is found. </remarks>
|
/// <remarks> returns number of matches found, and the matching item if only 1 match is found. </remarks>
|
||||||
public static class Matcher {
|
public static class Matcher {
|
||||||
|
|
||||||
const StringComparison comp = StringComparison.OrdinalIgnoreCase;
|
const StringComparison comp = StringComparison.OrdinalIgnoreCase;
|
||||||
|
@ -26,13 +26,13 @@ namespace System.Runtime.CompilerServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace System {
|
namespace System {
|
||||||
public delegate TReturn Func<TReturn>();
|
public delegate TReturn Func<TReturn>();
|
||||||
public delegate TReturn Func<T1, TReturn>(T1 arg1);
|
public delegate TReturn Func<T1, TReturn>(T1 arg1);
|
||||||
public delegate TReturn Func<T1, T2, TReturn>(T1 arg1, T2 arg2);
|
public delegate TReturn Func<T1, T2, TReturn>(T1 arg1, T2 arg2);
|
||||||
public delegate TReturn Func<T1, T2, T3, TReturn>(T1 arg1, T2 arg2, T3 arg3);
|
public delegate TReturn Func<T1, T2, T3, TReturn>(T1 arg1, T2 arg2, T3 arg3);
|
||||||
|
|
||||||
public delegate void Action();
|
public delegate void Action();
|
||||||
public delegate void Action<T1, T2>(T1 arg1, T2 arg2);
|
public delegate void Action<T1, T2>(T1 arg1, T2 arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MCGalaxy.Util {
|
namespace MCGalaxy.Util {
|
||||||
@ -74,9 +74,9 @@ namespace MCGalaxy.Util {
|
|||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
if (writeMode) {
|
if (writeMode) {
|
||||||
locker.ReleaseWriterLock();
|
locker.ReleaseWriterLock();
|
||||||
} else {
|
} else {
|
||||||
locker.ReleaseReaderLock();
|
locker.ReleaseReaderLock();
|
||||||
}
|
}
|
||||||
locker = null;
|
locker = null;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ using System.Collections.Generic;
|
|||||||
namespace MCGalaxy.Util {
|
namespace MCGalaxy.Util {
|
||||||
public sealed class ThreadSafeCache {
|
public sealed class ThreadSafeCache {
|
||||||
public static ThreadSafeCache DBCache = new ThreadSafeCache(key => new object());
|
public static ThreadSafeCache DBCache = new ThreadSafeCache(key => new object());
|
||||||
|
|
||||||
readonly object locker = new object();
|
readonly object locker = new object();
|
||||||
readonly Dictionary<string, object> items = new Dictionary<string, object>();
|
readonly Dictionary<string, object> items = new Dictionary<string, object>();
|
||||||
readonly Dictionary<string, DateTime> access = new Dictionary<string, DateTime>();
|
readonly Dictionary<string, DateTime> access = new Dictionary<string, DateTime>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user