mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
less reliant on core ranks existing
This commit is contained in:
parent
21c0ffb722
commit
abe20df16a
@ -88,9 +88,7 @@ namespace MCGalaxy.Commands
|
||||
|
||||
internal static string FormatBlockName(string block, int i) {
|
||||
Block.Blocks perms = Block.BlockList[Block.Byte(block)];
|
||||
Group grp = Group.findPerm(perms.lowestRank);
|
||||
string col = grp == null ? "&f" : grp.color;
|
||||
return col + block;
|
||||
return Group.GetColor(perms.lowestRank) + block;
|
||||
}
|
||||
|
||||
static void OutputBlockData(Player p, string block) {
|
||||
|
@ -182,8 +182,7 @@ namespace MCGalaxy.Commands {
|
||||
|
||||
internal static string GetColor(Command cmd) {
|
||||
LevelPermission perm = GrpCommands.MinPerm(cmd);
|
||||
Group grp = Group.findPerm(perm);
|
||||
return grp == null ? "&f" : grp.color;
|
||||
return Group.GetColor(perm);
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
|
@ -54,13 +54,11 @@ namespace MCGalaxy.Commands {
|
||||
bool loadOnGoto;
|
||||
RetrieveProps(map, out visitP, out buildP, out loadOnGoto);
|
||||
|
||||
LevelPermission perm = visitP;
|
||||
if (perm < buildP) perm = buildP;
|
||||
Group grp = Group.findPerm(perm);
|
||||
LevelPermission maxPerm = visitP;
|
||||
if (maxPerm < buildP) maxPerm = buildP;
|
||||
|
||||
string color = grp == null ? "&f" : grp.color;
|
||||
string visit = loadOnGoto && (p == null || p.Rank >= visitP) ? "" : " &c[no]";
|
||||
return color + map + visit;
|
||||
return Group.GetColor(maxPerm) + map + visit;
|
||||
}
|
||||
|
||||
static bool IsLoaded(Level[] loaded, string level) {
|
||||
|
@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
string name = Group.findPerm(LevelPermission.Operator).ColoredName;
|
||||
string name = Group.GetColoredName(LevelPermission.Operator);
|
||||
Player.Message(p, "%T/ascend");
|
||||
Player.Message(p, "%HTeleports you to the first free space above you.");
|
||||
Player.Message(p, "%H Does not work on maps which have -hax in their motd. " +
|
||||
|
@ -56,7 +56,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
string name = Group.findPerm(LevelPermission.Operator).ColoredName;
|
||||
string name = Group.GetColoredName(LevelPermission.Operator);
|
||||
Player.Message(p, "%T/descend");
|
||||
Player.Message(p, "%HTeleports you to the first free space below you.");
|
||||
Player.Message(p, "%H Does not work on maps which have -hax in their motd. " +
|
||||
|
@ -93,7 +93,7 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
|
||||
public override void Help(Player p) {
|
||||
string name = Group.findPerm(LevelPermission.Operator).ColoredName;
|
||||
string name = Group.GetColoredName(LevelPermission.Operator);
|
||||
Player.Message(p, "%T/fly");
|
||||
Player.Message(p, "%HThe old method of flight before custom clients.");
|
||||
Player.Message(p, "%HMay not work at all depending on your connection.");
|
||||
|
41
MCGalaxy/Database/BlockDB/BlockDBCache.cs
Normal file
41
MCGalaxy/Database/BlockDB/BlockDBCache.cs
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2015 MCGalaxy
|
||||
|
||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||
not use this file except in compliance with the Licenses. You may
|
||||
obtain a copy of the Licenses at
|
||||
|
||||
http://www.opensource.org/licenses/ecl2.php
|
||||
http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the Licenses are distributed on an "AS IS"
|
||||
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
or implied. See the Licenses for the specific language governing
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Data;
|
||||
using MCGalaxy.SQL;
|
||||
|
||||
namespace MCGalaxy.DB {
|
||||
|
||||
/// <summary> Optimised in-memory BlockDB cache. </summary>
|
||||
public sealed class BlockDBCache {
|
||||
|
||||
public BlockDBCacheNode Head, Tail;
|
||||
|
||||
int nextSize = 10000;
|
||||
}
|
||||
|
||||
// TODO: track start time so we can use int16 instead of int32 time delta
|
||||
public sealed class BlockDBCacheNode {
|
||||
|
||||
public BlockDBCacheNode Prev, Next;
|
||||
|
||||
public int Count;
|
||||
|
||||
public BlockDBEntry[] Entries;
|
||||
}
|
||||
}
|
@ -147,8 +147,7 @@ namespace MCGalaxy.Eco {
|
||||
if (p == null || p.Rank >= PurchaseRank) {
|
||||
Player.Message(p, "&6{0} %S- &a{1} %S{2}", Name, Price, Server.moneys);
|
||||
} else {
|
||||
Group grp = Group.findPerm(PurchaseRank);
|
||||
string grpName = grp == null ? ((int)PurchaseRank).ToString() : grp.ColoredName;
|
||||
string grpName = Group.GetColoredName(PurchaseRank);
|
||||
Player.Message(p, "&6{0} %S({3}%S+) - &a{1} %S{2}", Name, Price, Server.moneys, grpName);
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,9 @@ namespace MCGalaxy {
|
||||
|
||||
public string ColoredName {
|
||||
get {
|
||||
LevelPermission perm = permissionvisit;
|
||||
if (perm < permissionbuild) perm = permissionbuild;
|
||||
|
||||
Group grp = Group.findPerm(perm);
|
||||
string col = grp == null ? "&f" : grp.color;
|
||||
return col + name;
|
||||
LevelPermission maxPerm = permissionvisit;
|
||||
if (maxPerm < permissionbuild) maxPerm = permissionbuild;
|
||||
return Group.GetColoredName(maxPerm) + name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,13 @@ namespace MCGalaxy {
|
||||
public static string GetColoredName(LevelPermission perm) {
|
||||
Group grp = findPerm(perm);
|
||||
if (grp != null) return grp.ColoredName;
|
||||
return "&f" + ((int)perm);
|
||||
return Colors.white + ((int)perm);
|
||||
}
|
||||
|
||||
public static string GetColor(LevelPermission perm) {
|
||||
Group grp = findPerm(perm);
|
||||
if (grp != null) return grp.color;
|
||||
return Colors.white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user