Fix gb/lb remove not showing message, update help of /fly and fix it to actually work oops

This commit is contained in:
UnknownShadow200 2017-07-17 10:49:17 +10:00
parent 8befec23a8
commit dddebe4ecf
4 changed files with 25 additions and 22 deletions

View File

@ -194,6 +194,9 @@ namespace MCGalaxy.Commands.CPE {
RemoveBlockProps(global, block, p);
BlockDefinition.Remove(def, defs, p == null ? null : p.level);
string scope = global ? "global" : "level";
Player.Message(p, "Removed " + scope + " custom block " + def.Name + "(" + def.BlockID + ")");
BlockDefinition globalDef = BlockDefinition.GlobalDefs[block.RawID];
if (!global && globalDef != null)
BlockDefinition.Add(globalDef, defs, p.level);

View File

@ -84,9 +84,9 @@ namespace MCGalaxy.Commands.Fun {
Player p = state.player;
if (state.player.aiming) { DoAim(state); return; }
foreach (Vec3U16 cP in state.lastGlass) {
if (!p.level.IsValidPos(cP)) continue;
p.RevertBlock(cP.X, cP.Y, cP.Z);
foreach (Vec3U16 pos in state.lastGlass) {
if (!p.level.IsValidPos(pos)) continue;
p.RevertBlock(pos.X, pos.Y, pos.Z);
}
task.Repeating = false;
}
@ -106,19 +106,19 @@ namespace MCGalaxy.Commands.Fun {
// Revert all glass blocks now not in the ray from the player's direction
for (int i = 0; i < state.lastGlass.Count; i++) {
Vec3U16 cP = state.lastGlass[i];
if (state.glassCoords.Contains(cP)) continue;
Vec3U16 pos = state.lastGlass[i];
if (state.glassCoords.Contains(pos)) continue;
if (p.level.IsValidPos(cP))
p.RevertBlock(cP.X, cP.Y, cP.Z);
if (p.level.IsValidPos(pos))
p.RevertBlock(pos.X, pos.Y, pos.Z);
state.lastGlass.RemoveAt(i); i--;
}
// Place the new glass blocks that are in the ray from the player's direction
foreach (Vec3U16 cP in state.glassCoords) {
if (state.lastGlass.Contains(cP)) continue;
state.lastGlass.Add(cP);
p.SendBlockchange(cP.X, cP.Y, cP.Z, (ExtBlock)Block.Glass);
foreach (Vec3U16 pos in state.glassCoords) {
if (state.lastGlass.Contains(pos)) continue;
state.lastGlass.Add(pos);
p.SendBlockchange(pos.X, pos.Y, pos.Z, (ExtBlock)Block.Glass);
}
state.glassCoords.Clear();
}

View File

@ -30,7 +30,7 @@ namespace MCGalaxy.Commands.Misc {
public override void Use(Player p, string message) {
if (!Hacks.CanUseHacks(p, p.level)) {
Player.Message(p, "You cannot use /fly on this map.");
Player.Message(p, "You cannot use %T/fly %Son this map.");
p.isFlying = false; return;
}
@ -57,8 +57,8 @@ namespace MCGalaxy.Commands.Misc {
Player p = state.player;
if (state.player.isFlying) { DoFly(state); return; }
foreach (Vec3U16 cP in state.lastGlass) {
p.SendBlockchange(cP.X, cP.Y, cP.Z, ExtBlock.Air);
foreach (Vec3U16 pos in state.lastGlass) {
p.SendBlockchange(pos.X, pos.Y, pos.Z, ExtBlock.Air);
}
Player.Message(p, "Stopped flying");
task.Repeating = false;
@ -78,7 +78,7 @@ namespace MCGalaxy.Commands.Misc {
{
Vec3U16 pos;
pos.X = (ushort)xx; pos.Y = (ushort)yy; pos.Z = (ushort)zz;
if (!p.level.IsAirAt(pos.X, pos.Y, pos.Z)) state.glassCoords.Add(pos);
if (p.level.IsAirAt(pos.X, pos.Y, pos.Z)) state.glassCoords.Add(pos);
}
foreach (Vec3U16 P in state.glassCoords) {
@ -102,10 +102,10 @@ namespace MCGalaxy.Commands.Misc {
public override void Help(Player p) {
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.");
Player.Message(p, "%H Does not work on maps which have -hax in their motd. " +
"(unless you are {0}%H+ and the motd also has +ophax)", name);
Player.Message(p, "%HCreates a grass platform underneath you that moves with you.");
Player.Message(p, "%H May not work if you have high latency.");
Player.Message(p, "%H Cannot be used on maps which have -hax in their motd. " +
"(unless you are {0}%H+ and the motd has +ophax)", name);
}
}
}

View File

@ -69,9 +69,9 @@ namespace MCGalaxy {
WriteI16((short)pos.Y, arr, offset + 2);
WriteI16((short)pos.Z, arr, offset + 4);
} else {
WriteI32((int)pos.X, arr, offset + 0);
WriteI32((int)pos.Y, arr, offset + 4);
WriteI32((int)pos.Z, arr, offset + 8);
WriteI32(pos.X, arr, offset + 0);
WriteI32(pos.Y, arr, offset + 4);
WriteI32(pos.Z, arr, offset + 8);
}
return extPos ? 12 : 6;
}