mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-19 04:07:10 -04:00
BlockDB on reload build commands and think I fixed colors once and for all
This commit is contained in:
parent
6ec0c41239
commit
b32a63fc5e
28
Color.cs
28
Color.cs
@ -110,7 +110,7 @@ namespace MCGalaxy
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
static readonly Dictionary<string, string> MinecraftToIRCColors = new Dictionary<string, string> {
|
||||
public static readonly Dictionary<string, string> MinecraftToIRCColors = new Dictionary<string, string> {
|
||||
{ white, "\u000300" },
|
||||
{ black, "\u000301" },
|
||||
{ navy, "\u000302" },
|
||||
@ -188,5 +188,31 @@ namespace MCGalaxy
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
/// <summary> Replaces Minecraft color codes with equivalent IRC color codes, in the given StringBuilder.
|
||||
/// Opposite of IrcToMinecraftColors method. </summary>
|
||||
/// <param name="sb"> StringBuilder objects, the contents of which will be processed. </param>
|
||||
/// <exception cref="ArgumentNullException"> sb is null. </exception>
|
||||
public static void MinecraftToIrcColors(StringBuilder sb)
|
||||
{
|
||||
if (sb == null) throw new ArgumentNullException("sb");
|
||||
foreach (var codePair in MinecraftToIRCColors)
|
||||
{
|
||||
sb.Replace(codePair.Key, codePair.Value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Replaces Minecraft color codes with equivalent IRC color codes, in the given string.
|
||||
/// Opposite of IrcToMinecraftColors method. </summary>
|
||||
/// <param name="input"> String to process. </param>
|
||||
/// <returns> A processed string. </returns>
|
||||
/// <exception cref="ArgumentNullException"> input is null. </exception>
|
||||
public static string MinecraftToIrcColors(string input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
StringBuilder sb = new StringBuilder(input);
|
||||
MinecraftToIrcColors(sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -456,7 +456,7 @@ namespace MCGalaxy.Commands
|
||||
p.SendMessage("You tried to cuboid over 10000 blocks, reloading map for faster cuboid.");
|
||||
buffer.ForEach(delegate(Pos pos)
|
||||
{
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, type);
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, type, p);
|
||||
});
|
||||
foreach(Player pl in Player.players)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ namespace MCGalaxy.Commands
|
||||
p.SendMessage("You tried to cuboid over 10000 blocks, reloading map for faster fill.");
|
||||
foreach (Pos pos in buffer)
|
||||
{
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, cpos.type);
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, cpos.type, p);
|
||||
}
|
||||
foreach (Player pl in Player.players)
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ namespace MCGalaxy.Commands
|
||||
p.SendMessage("You tried to replace over 10000 blocks, reloading map for faster replace.");
|
||||
foreach (Pos pos in buffer)
|
||||
{
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, cpos.newType);
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, cpos.newType, p);
|
||||
}
|
||||
foreach (Player pl in Player.players)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ namespace MCGalaxy.Commands
|
||||
p.SendMessage("You tried to replace over 10000 blocks, reloading map for faster replace.");
|
||||
foreach (Pos Pos in stored)
|
||||
{
|
||||
p.level.SetTile(Pos.x, Pos.y, Pos.z, newType);
|
||||
p.level.SetTile(Pos.x, Pos.y, Pos.z, newType, p);
|
||||
}
|
||||
foreach (Player pl in Player.players)
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ namespace MCGalaxy.Commands
|
||||
p.SendMessage("You tried to replace over 10000 blocks, reloading map for faster replace.");
|
||||
foreach (Pos pos in buffer)
|
||||
{
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, cpos.newType);
|
||||
p.level.SetTile(pos.x, pos.y, pos.z, cpos.newType, p);
|
||||
}
|
||||
foreach (Player pl in Player.players)
|
||||
{
|
||||
|
26
ForgeBot.cs
26
ForgeBot.cs
@ -91,14 +91,20 @@ namespace MCGalaxy {
|
||||
message = ".";
|
||||
|
||||
if (color) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
sb.Replace("%" + i, ColorSignal + c.MCtoIRC("&" + i));
|
||||
sb.Replace("&" + i, ColorSignal + c.MCtoIRC("&" + i));
|
||||
}
|
||||
for (char ch = 'a'; ch <= 'f'; ch++) {
|
||||
sb.Replace("%" + ch, ColorSignal + c.MCtoIRC("&" + ch));
|
||||
sb.Replace("&" + ch, ColorSignal + c.MCtoIRC("&" + ch));
|
||||
}
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
sb.Replace("%" + i, ColorSignal + c.MCtoIRC("&" + i));
|
||||
//sb.Replace("&" + i, ColorSignal + c.MCtoIRC("&" + i));
|
||||
}
|
||||
for (char ch = 'a'; ch <= 'f'; ch++)
|
||||
{
|
||||
sb.Replace("%" + ch, ColorSignal2 + c.MCtoIRC("&" + ch));
|
||||
//sb.Replace("&" + ch, ColorSignal2 + c.MCtoIRC("&" + ch));
|
||||
}
|
||||
foreach (var codePair in c.MinecraftToIRCColors)
|
||||
{
|
||||
message.Replace(codePair.Key, codePair.Value);
|
||||
}
|
||||
}
|
||||
sb.Replace("%r", ResetSignal);
|
||||
|
||||
@ -207,6 +213,10 @@ namespace MCGalaxy {
|
||||
Server.IRC.Say("Unknown command!");
|
||||
}
|
||||
}
|
||||
for (byte i = 10; i < 16; i++)
|
||||
message = message.Replace(ColorSignal + i, c.IRCtoMC(i).Replace('&', '%'));
|
||||
for (byte i = 0; i < 10; i++)
|
||||
message = message.Replace(ColorSignal + i, c.IRCtoMC(i).Replace('&', '%'));
|
||||
message = c.IrcToMinecraftColors(message);
|
||||
|
||||
if(String.IsNullOrEmpty(message.Trim()))
|
||||
|
@ -457,12 +457,24 @@ namespace MCGalaxy
|
||||
blocks[b] = type;
|
||||
//blockchanges[x + width * z + width * height * y] = pName;
|
||||
}
|
||||
public void SetTile(ushort x, ushort y, ushort z, byte type)
|
||||
public void SetTile(ushort x, ushort y, ushort z, byte type, Player p = null)
|
||||
{
|
||||
if (blocks == null) return;
|
||||
if (!InBound(x, y, z)) return;
|
||||
blocks[PosToInt(x, y, z)] = type;
|
||||
//blockchanges[x + width * z + width * height * y] = pName;
|
||||
if (p != null)
|
||||
{
|
||||
Level.BlockPos bP;
|
||||
bP.name = p.name;
|
||||
bP.TimePerformed = DateTime.Now;
|
||||
bP.x = x; bP.y = y; bP.z = z;
|
||||
bP.type = type;
|
||||
if (bP.type == 0)
|
||||
bP.deleted = true;
|
||||
else
|
||||
bP.deleted = false;
|
||||
blockCache.Add(bP);
|
||||
}
|
||||
}
|
||||
|
||||
public bool InBound(ushort x, ushort y, ushort z)
|
||||
|
@ -2749,12 +2749,13 @@ return;
|
||||
sb.Replace("%r", "&f");
|
||||
for ( int i = 0; i < 10; i++ ) {
|
||||
sb.Replace("%" + i, "&" + i);
|
||||
sb.Replace("&" + i + " &", " &");
|
||||
//sb.Replace("&" + i + " &", " &");
|
||||
}
|
||||
for ( char ch = 'a'; ch <= 'f'; ch++ ) {
|
||||
sb.Replace("%" + ch, "&" + ch);
|
||||
sb.Replace("&" + ch + " &", " &");
|
||||
//sb.Replace("&" + ch + " &", " &");
|
||||
}
|
||||
message = c.MinecraftToIrcColors(message);
|
||||
// Begin fix to replace all invalid color codes typed in console or chat with "."
|
||||
for ( char ch = (char)0; ch <= (char)47; ch++ ) // Characters that cause clients to disconnect
|
||||
sb.Replace("&" + ch, String.Empty);
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
1.5.0.8
|
||||
1.5.1.0
|
@ -37,7 +37,7 @@ using System.Runtime.InteropServices;
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("24d9085c-78ba-4f53-b69c-f2b52153683f")]
|
||||
|
||||
[assembly: AssemblyVersion("1.5.0.8")]
|
||||
[assembly: AssemblyVersion("1.5.1.0")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user