Reload command should use CmdReveal's resending map, not the load/unload/goto hackery. (Thanks Jjp137)

This commit is contained in:
UnknownShadow200 2016-01-30 08:05:54 +11:00
parent 32e500d63f
commit 3133384af9
4 changed files with 14 additions and 22 deletions

View File

@ -50,7 +50,7 @@ namespace MCGalaxy.Commands {
foreach (Player who in Player.players.ToArray()) {
if (who.level == lvl)
ReloadMap(p, who);
ReloadMap(p, who, true);
}
} else {
Player who = Player.Find(parts[0]);
@ -59,13 +59,13 @@ namespace MCGalaxy.Commands {
} else if (who.group.Permission > p.group.Permission && p != who) {
Player.SendMessage(p, "Cannot reload the map of someone higher than you."); return;
}
ReloadMap(p, who);
ReloadMap(p, who, true);
}
GC.Collect();
GC.WaitForPendingFinalizers();
}
void ReloadMap(Player p, Player who) {
internal static void ReloadMap(Player p, Player who, bool showMessage) {
who.Loading = true;
foreach (Player pl in Player.players.ToArray()) if (who.level == pl.level && who != pl) who.SendDespawn(pl.id);
foreach (PlayerBot b in PlayerBot.playerbots.ToArray()) if (who.level == b.level) who.SendDespawn(b.id);
@ -89,6 +89,7 @@ namespace MCGalaxy.Commands {
who.Loading = false;
if (!showMessage) return;
if (p != null && !p.hidden) { who.SendMessage("&bMap reloaded by " + p.name); }
if (p != null && p.hidden) { who.SendMessage("&bMap reloaded"); }
Player.SendMessage(p, "&4Finished reloading for " + who.name);

View File

@ -258,10 +258,10 @@ namespace MCGalaxy.Commands {
p.level.LightColor = preset.Sun;
if (CaselessEquals( value, "normal")) {
Command.all.Find("env").Use(p, "l weather 0");
Command.all.Find("env").Use(p, "l water normal");
Command.all.Find("env").Use(p, "l bedrock normal");
Command.all.Find("env").Use(p, "l level normal");
Command.all.Find("env").Use(p, "weather 0");
Command.all.Find("env").Use(p, "water normal");
Command.all.Find("env").Use(p, "bedrock normal");
Command.all.Find("env").Use(p, "level normal");
}
return true;
} else {

View File

@ -15,7 +15,9 @@
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System.Collections.Generic;
using System.IO;
namespace MCGalaxy.Commands {
public sealed class CmdReload : Command {
@ -42,21 +44,13 @@ namespace MCGalaxy.Commands {
foreach (Player pl in Player.players) {
if (pl.level.name.ToLower() != name.ToLower()) continue;
if (p != null)
p.ignorePermission = true;
Command.all.Find("unload").Use(p, name);
Command.all.Find("load").Use(p, name);
Command.all.Find("goto").Use(pl, name);
CmdReveal.ReloadMap(p, pl, false);
}
Player.GlobalMessage("&cThe map, " + name + " has been reloaded!");
Server.IRC.Say("The map, " + name + " has been reloaded.");
string src = p == null ? "the console" : p.name;
Server.s.Log("The map " + name + " was reloaded by " + src);
if (p != null )
p.ignorePermission = false;
return;
}
public override void Help(Player p) {

View File

@ -2306,12 +2306,9 @@ return;
}
else if (self)
{
if (!p.ignorePermission)
{
p.pos = new ushort[3] { x, y, z }; p.rot = new byte[2] { rotx, roty };
p.oldpos = p.pos; p.basepos = p.pos; p.oldrot = p.rot;
p.SendSpawn(0xFF, from.color + from.name + possession, x, y, z, rotx, roty);
}
p.pos = new ushort[3] { x, y, z }; p.rot = new byte[2] { rotx, roty };
p.oldpos = p.pos; p.basepos = p.pos; p.oldrot = p.rot;
p.SendSpawn(0xFF, from.color + from.name + possession, x, y, z, rotx, roty);
}
});
}