more fCraft command aliases

This commit is contained in:
UnknownShadow200 2017-02-01 09:00:55 +11:00
parent 6346c0ce83
commit 865fa8f424
12 changed files with 37 additions and 28 deletions

View File

@ -112,7 +112,7 @@ namespace MCGalaxy.Commands {
bool CheckZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) { bool CheckZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) {
Vec3S32 P = marks[0]; Vec3S32 P = marks[0];
string zoneMsg = p.level.FindZoneOwners((ushort)P.X, (ushort)P.Y, (ushort)P.Z); string zoneMsg = p.level.FindZoneOwners(p, (ushort)P.X, (ushort)P.Y, (ushort)P.Z);
Player.Message(p, zoneMsg); Player.Message(p, zoneMsg);
return true; return true;
} }

View File

@ -27,7 +27,10 @@ namespace MCGalaxy.Commands.World {
public override string type { get { return CommandTypes.World; } } public override string type { get { return CommandTypes.World; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("wcopy"), new CommandAlias("worldcopy") }; }
}
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (message == "") { Help(p); return; } if (message == "") { Help(p); return; }
string[] args = message.ToLower().Split(' '); string[] args = message.ToLower().Split(' ');

View File

@ -26,7 +26,10 @@ namespace MCGalaxy.Commands.World {
public override string type { get { return CommandTypes.World; } } public override string type { get { return CommandTypes.World; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("wdelete"), new CommandAlias("worlddelete"), new CommandAlias("wremove") }; }
}
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (message == "" || message.Split(' ').Length > 1) { Help(p); return; } if (message == "" || message.Split(' ').Length > 1) { Help(p); return; }
if (!Formatter.ValidName(p, message, "level")) return; if (!Formatter.ValidName(p, message, "level")) return;

View File

@ -26,7 +26,9 @@ namespace MCGalaxy.Commands.World {
public override CommandPerm[] ExtraPerms { public override CommandPerm[] ExtraPerms {
get { return new[] { new CommandPerm(LevelPermission.Admin, "+ can change the main level") }; } get { return new[] { new CommandPerm(LevelPermission.Admin, "+ can change the main level") }; }
} }
public CmdMain() { } public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("wmain", "worldmain") }; }
}
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
if (message == "") { if (message == "") {

View File

@ -24,7 +24,8 @@ namespace MCGalaxy.Commands {
public override bool museumUsable { get { return false; } } public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } } public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public override CommandAlias[] Aliases { public override CommandAlias[] Aliases {
get { return new [] { new CommandAlias("rejoin"), new CommandAlias("rd") }; } get { return new [] { new CommandAlias("rejoin"), new CommandAlias("rd"),
new CommandAlias("wflush"), new CommandAlias("worldflush") }; }
} }
public override CommandPerm[] ExtraPerms { public override CommandPerm[] ExtraPerms {
get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can reload for all players") }; } get { return new[] { new CommandPerm(LevelPermission.Operator, "+ can reload for all players") }; }

View File

@ -25,7 +25,9 @@ namespace MCGalaxy.Commands.World {
public override string type { get { return CommandTypes.World; } } public override string type { get { return CommandTypes.World; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public CmdRenameLvl() { } public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("wrename"), new CommandAlias("worldrename") }; }
}
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
string[] args = message.Split(' '); string[] args = message.Split(' ');

View File

@ -26,7 +26,9 @@ namespace MCGalaxy.Commands.World {
public override string type { get { return CommandTypes.World; } } public override string type { get { return CommandTypes.World; } }
public override bool museumUsable { get { return true; } } public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } } public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public CmdResizeLvl() { } public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("wresize"), new CommandAlias("worldresoze") }; }
}
public override void Use(Player p, string message) { public override void Use(Player p, string message) {
string[] args = message.Split(' '); string[] args = message.Split(' ');

View File

@ -27,7 +27,7 @@ namespace MCGalaxy.Commands {
public override bool museumUsable { get { return false; } } public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public override CommandAlias[] Aliases { public override CommandAlias[] Aliases {
get { return new[] { new CommandAlias("mapsave"), new CommandAlias("wsave") }; } get { return new[] { new CommandAlias("mapsave"), new CommandAlias("wsave"), new CommandAlias("worldsave") }; }
} }
public CmdSave() { } public CmdSave() { }

View File

@ -49,7 +49,7 @@ namespace MCGalaxy {
if (File.Exists(path)) return File.ReadAllText(path); if (File.Exists(path)) return File.ReadAllText(path);
// Unix is case sensitive (older files used correct casing of name) // Unix is case sensitive (older files used correct casing of name)
path = "text/login/" + p.name + ".txt"; path = "text/login/" + p.name + ".txt";
return File.Exists(path) ? File.ReadAllText(path) : "joined"; return File.Exists(path) ? File.ReadAllText(path) : "connected";
} }
public static string GetLogoutMessage(Player p) { public static string GetLogoutMessage(Player p) {

View File

@ -20,8 +20,6 @@
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
using System; using System;
using System.Collections.Generic;
using MCGalaxy.Drawing.Brushes;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foilage {
@ -34,7 +32,7 @@ namespace MCGalaxy.Generator.Foilage {
} }
public override void Output(ushort x, ushort y, ushort z, TreeOutput output) { public override void Output(ushort x, ushort y, ushort z, TreeOutput output) {
for (ushort dy = 0; dy <= height; dy++) { for (int dy = 0; dy <= height; dy++) {
ushort yy = (ushort)(y + dy); ushort yy = (ushort)(y + dy);
if (dy < height) output(x, yy, z, Block.trunk); if (dy < height) output(x, yy, z, Block.trunk);
@ -56,7 +54,7 @@ namespace MCGalaxy.Generator.Foilage {
} }
public override void Output(ushort x, ushort y, ushort z, TreeOutput output) { public override void Output(ushort x, ushort y, ushort z, TreeOutput output) {
for (ushort dy = 0; dy <= height; dy++) for (int dy = 0; dy <= height; dy++)
if (dy < height) output(x, (ushort)(y + dy), z, Block.trunk); if (dy < height) output(x, (ushort)(y + dy), z, Block.trunk);
for (int dz = -2; dz <= 2; dz++) for (int dz = -2; dz <= 2; dz++)

View File

@ -25,8 +25,6 @@ Ideas, concepts, and code were used from the following two sources:
*/ */
using System; using System;
using System.Collections.Generic;
using MCGalaxy.Drawing.Brushes;
namespace MCGalaxy.Generator.Foilage { namespace MCGalaxy.Generator.Foilage {
public sealed class CactusTree : Tree { public sealed class CactusTree : Tree {
@ -46,10 +44,10 @@ namespace MCGalaxy.Generator.Foilage {
int inX = value == 1 ? -1 : 0; int inX = value == 1 ? -1 : 0;
int inZ = value == 2 ? -1 : 0; int inZ = value == 2 ? -1 : 0;
for (ushort dy = height; dy <= rnd.Next(height + 2, height + 5); dy++) { for (int dy = height; dy <= rnd.Next(height + 2, height + 5); dy++) {
output((ushort)(x + inX), (ushort)(y + dy), (ushort)(z + inZ), Block.green); output((ushort)(x + inX), (ushort)(y + dy), (ushort)(z + inZ), Block.green);
} }
for (ushort dy = height; dy <= rnd.Next(height + 2, height + 5); dy++) { for (int dy = height; dy <= rnd.Next(height + 2, height + 5); dy++) {
output((ushort)(x - inX), (ushort)(y + dy), (ushort)(z - inZ), Block.green); output((ushort)(x - inX), (ushort)(y + dy), (ushort)(z - inZ), Block.green);
} }
} }
@ -68,11 +66,11 @@ namespace MCGalaxy.Generator.Foilage {
for (ushort dy = 0; dy < top + height - 1; dy++) for (ushort dy = 0; dy < top + height - 1; dy++)
output(x, (ushort)(y + dy), z, Block.trunk); output(x, (ushort)(y + dy), z, Block.trunk);
for (short dy = (short)-top; dy <= top; ++dy) for (int dy = -top; dy <= top; ++dy)
for (short dz = (short)-top; dz <= top; ++dz) for (int dz = -top; dz <= top; ++dz)
for (short dx = (short)-top; dx <= top; ++dx) for (int dx = -top; dx <= top; ++dx)
{ {
short dist = (short)(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);
@ -93,7 +91,7 @@ namespace MCGalaxy.Generator.Foilage {
} }
public override void Output(ushort x, ushort y, ushort z, TreeOutput output) { public override void Output(ushort x, ushort y, ushort z, TreeOutput output) {
for (ushort dy = 0; dy <= height; dy++) for (int dy = 0; dy <= height; dy++)
output(x, (ushort)(y + dy), z, Block.trunk); output(x, (ushort)(y + dy), z, Block.trunk);
for (int dy = top; dy <= height + 1; dy++) { for (int dy = top; dy <= height + 1; dy++) {
@ -125,7 +123,7 @@ namespace MCGalaxy.Generator.Foilage {
} }
public override void Output(ushort x, ushort y, ushort z, TreeOutput output) { public override void Output(ushort x, ushort y, ushort z, TreeOutput output) {
for (ushort dy = 0; dy <= height; dy++) for (int dy = 0; dy <= height; dy++)
output(x, (ushort)(y + dy), z, Block.trunk); output(x, (ushort)(y + dy), z, Block.trunk);
for (int dy = top; dy <= height + 1; dy++) { for (int dy = top; dy <= height + 1; dy++) {

View File

@ -182,7 +182,7 @@ namespace MCGalaxy {
if (zoneAllow) return true; if (zoneAllow) return true;
if (p.ZoneSpam > DateTime.UtcNow) return false; if (p.ZoneSpam > DateTime.UtcNow) return false;
Player.Message(p, FindZoneOwners(x, y, z)); Player.Message(p, FindZoneOwners(p, x, y, z));
p.ZoneSpam = DateTime.UtcNow.AddSeconds(2); p.ZoneSpam = DateTime.UtcNow.AddSeconds(2);
return false; return false;
} }
@ -210,7 +210,7 @@ namespace MCGalaxy {
return zoneAllow; return zoneAllow;
} }
internal string FindZoneOwners(ushort x, ushort y, ushort z) { internal string FindZoneOwners(Player p, ushort x, ushort y, ushort z) {
string owners = ""; string owners = "";
for (int i = 0; i < ZoneList.Count; i++) { for (int i = 0; i < ZoneList.Count; i++) {
Zone zn = ZoneList[i]; Zone zn = ZoneList[i];
@ -218,14 +218,14 @@ namespace MCGalaxy {
continue; continue;
if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) { if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) {
owners += ", " + zn.Owner.Substring(3); owners += ", " + Group.GetColoredName(zn.Owner.Substring(3));
} else { } else {
owners += ", " + zn.Owner; owners += ", " + PlayerInfo.GetColoredName(p, zn.Owner);
} }
} }
if (owners == "") return "No zones affect this block"; if (owners == "") return "No zones affect this block";
return "This zone belongs to &b" + owners.Remove(0, 2) + "."; return "This zone belongs to " + owners.Remove(0, 2) + ".";
} }
bool CheckRank(Player p) { bool CheckRank(Player p) {