mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 12:42:22 -04:00
More stuff for /zone set, remove /view to another player
This commit is contained in:
parent
075d8ed5c9
commit
395a4ee50f
@ -132,14 +132,8 @@ namespace MCGalaxy.Commands.CPE {
|
|||||||
Player[] players = PlayerInfo.Online.Items;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in players) {
|
foreach (Player pl in players) {
|
||||||
if (pl.level != lvl) continue;
|
if (pl.level != lvl) continue;
|
||||||
pl.SendCurrentMapAppearance();
|
pl.SendCurrentTextures();
|
||||||
|
pl.OnChangedZone();
|
||||||
if (pl.Supports(CpeExt.EnvColors)) {
|
|
||||||
pl.SendCurrentEnvColors();
|
|
||||||
}
|
|
||||||
if (pl.Supports(CpeExt.EnvWeatherType)) {
|
|
||||||
pl.Send(Packet.EnvWeatherType(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Level.SaveSettings(lvl);
|
Level.SaveSettings(lvl);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ namespace MCGalaxy.Commands.CPE {
|
|||||||
Player[] players = PlayerInfo.Online.Items;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in players) {
|
foreach (Player pl in players) {
|
||||||
string url = zip ? pl.level.Config.TexturePack : pl.level.Config.Terrain;
|
string url = zip ? pl.level.Config.TexturePack : pl.level.Config.Terrain;
|
||||||
if (url.Length == 0) pl.SendCurrentMapAppearance();
|
if (url.Length == 0) pl.SendCurrentTextures();
|
||||||
}
|
}
|
||||||
SrvProperties.Save();
|
SrvProperties.Save();
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ namespace MCGalaxy.Commands.CPE {
|
|||||||
Player[] players = PlayerInfo.Online.Items;
|
Player[] players = PlayerInfo.Online.Items;
|
||||||
foreach (Player pl in players) {
|
foreach (Player pl in players) {
|
||||||
if (pl.level != p.level) continue;
|
if (pl.level != p.level) continue;
|
||||||
pl.SendCurrentMapAppearance();
|
pl.SendCurrentTextures();
|
||||||
}
|
}
|
||||||
Level.SaveSettings(p.level);
|
Level.SaveSettings(p.level);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
if(!int.TryParse(x, out width) || !int.TryParse(y, out height) || !int.TryParse(z, out length)) {
|
if(!int.TryParse(x, out width) || !int.TryParse(y, out height) || !int.TryParse(z, out length)) {
|
||||||
width = 32; height = 32; length = 32;
|
width = 32; height = 32; length = 32;
|
||||||
}
|
}
|
||||||
if (width < 32 || !MapGen.OkayAxis(width)) width = 32;
|
if (width < 32 || !MapGen.OkayAxis(width)) width = 32;
|
||||||
if (height < 32 || !MapGen.OkayAxis(height)) height = 32;
|
if (height < 32 || !MapGen.OkayAxis(height)) height = 32;
|
||||||
if (length < 32 || !MapGen.OkayAxis(length)) length = 32;
|
if (length < 32 || !MapGen.OkayAxis(length)) length = 32;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2011 MCGalaxy
|
Copyright 2011 MCForge
|
||||||
|
|
||||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
the GNU General Public License, Version 3 (the "Licenses"); you may
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
@ -27,6 +27,7 @@ namespace MCGalaxy.Commands.Info {
|
|||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
if (!Directory.Exists("extra/text/"))
|
if (!Directory.Exists("extra/text/"))
|
||||||
Directory.CreateDirectory("extra/text");
|
Directory.CreateDirectory("extra/text");
|
||||||
|
|
||||||
if (message.Length == 0) {
|
if (message.Length == 0) {
|
||||||
string[] files = Directory.GetFiles("extra/text", "*.txt");
|
string[] files = Directory.GetFiles("extra/text", "*.txt");
|
||||||
string all = files.Join(f => Path.GetFileNameWithoutExtension(f));
|
string all = files.Join(f => Path.GetFileNameWithoutExtension(f));
|
||||||
@ -38,17 +39,11 @@ namespace MCGalaxy.Commands.Info {
|
|||||||
Player.Message(p, all);
|
Player.Message(p, all);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Player who = p;
|
message = Path.GetFileName(message);
|
||||||
string[] args = message.SplitSpaces();
|
|
||||||
if (args.Length > 1) {
|
|
||||||
who = PlayerInfo.FindMatches(p, args[1]);
|
|
||||||
if (who == null) return;
|
|
||||||
}
|
|
||||||
args[0] = Path.GetFileName(args[0]);
|
|
||||||
|
|
||||||
if (File.Exists("extra/text/" + args[0] + ".txt")) {
|
if (File.Exists("extra/text/" + message + ".txt")) {
|
||||||
string[] lines = File.ReadAllLines("extra/text/" + args[0] + ".txt");
|
string[] lines = File.ReadAllLines("extra/text/" + message + ".txt");
|
||||||
Player.MessageLines(who, lines);
|
Player.MessageLines(p, lines);
|
||||||
} else {
|
} else {
|
||||||
Player.Message(p, "File specified doesn't exist");
|
Player.Message(p, "File specified doesn't exist");
|
||||||
}
|
}
|
||||||
@ -56,9 +51,8 @@ namespace MCGalaxy.Commands.Info {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "/view [file] [player] - Views [file]'s contents");
|
Player.Message(p, "%T/view %H- Lists all files you can view");
|
||||||
Player.Message(p, "/view by itself will list all files you can view");
|
Player.Message(p, "%T/view [file] %H- Views [file]'s contents");
|
||||||
Player.Message(p, "If [player] is given, that player is shown the file");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -50,12 +50,11 @@ namespace MCGalaxy.Core {
|
|||||||
Player.Message(p, "You cannot use /fly on this map.");
|
Player.Message(p, "You cannot use /fly on this map.");
|
||||||
p.isFlying = false;
|
p.isFlying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.ZoneIn = null;
|
||||||
|
p.OnChangedZone();
|
||||||
|
|
||||||
if (p.Supports(CpeExt.EnvWeatherType))
|
p.SendCurrentTextures();
|
||||||
p.Send(Packet.EnvWeatherType((byte)level.Config.Weather));
|
|
||||||
if (p.Supports(CpeExt.EnvColors))
|
|
||||||
p.SendCurrentEnvColors();
|
|
||||||
p.SendCurrentMapAppearance();
|
|
||||||
p.SendCurrentBlockPermissions();
|
p.SendCurrentBlockPermissions();
|
||||||
|
|
||||||
// TODO: unshow old zones here??
|
// TODO: unshow old zones here??
|
||||||
|
@ -142,6 +142,22 @@ namespace MCGalaxy {
|
|||||||
if (i == 4) return LightColor;
|
if (i == 4) return LightColor;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetEnvProp(EnvProp i) {
|
||||||
|
if (i == EnvProp.SidesBlock) return EdgeBlock;
|
||||||
|
if (i == EnvProp.EdgeBlock) return HorizonBlock;
|
||||||
|
if (i == EnvProp.EdgeLevel) return EdgeLevel;
|
||||||
|
if (i == EnvProp.CloudsLevel) return CloudsHeight;
|
||||||
|
if (i == EnvProp.MaxFog) return MaxFogDistance;
|
||||||
|
if (i == EnvProp.CloudsSpeed) return CloudsSpeed;
|
||||||
|
if (i == EnvProp.WeatherSpeed) return WeatherSpeed;
|
||||||
|
if (i == EnvProp.WeatherFade) return WeatherFade;
|
||||||
|
if (i == EnvProp.ExpFog) return ExpFog ? 1 : 0;
|
||||||
|
if (i == EnvProp.SidesOffset) return SidesOffset;
|
||||||
|
if (i == EnvProp.SkyboxHorSpeed) return SkyboxHorSpeed;
|
||||||
|
if (i == EnvProp.SkyboxVerSpeed) return SkyboxVerSpeed;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class LevelConfig : AreaConfig {
|
public sealed class LevelConfig : AreaConfig {
|
||||||
|
@ -143,7 +143,7 @@ namespace MCGalaxy {
|
|||||||
if (pl.Supports(CpeExt.EnvMapAspect)) {
|
if (pl.Supports(CpeExt.EnvMapAspect)) {
|
||||||
pl.Send(Packet.EnvMapProperty(prop, value));
|
pl.Send(Packet.EnvMapProperty(prop, value));
|
||||||
} else {
|
} else {
|
||||||
pl.SendCurrentMapAppearance();
|
pl.SendCurrentTextures();
|
||||||
}
|
}
|
||||||
if (pl.ZoneIn != null) pl.OnChangedZone();
|
if (pl.ZoneIn != null) pl.OnChangedZone();
|
||||||
}
|
}
|
||||||
|
@ -101,33 +101,18 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string lastUrl = "";
|
string lastUrl = "";
|
||||||
public void SendCurrentMapAppearance() {
|
public void SendCurrentTextures() {
|
||||||
byte side = (byte)level.Config.EdgeBlock;
|
byte side = (byte)level.Config.EdgeBlock;
|
||||||
byte edge = (byte)level.Config.HorizonBlock;
|
byte edge = (byte)level.Config.HorizonBlock;
|
||||||
if (!hasBlockDefs) side = level.RawFallback(side);
|
if (!hasBlockDefs) side = level.RawFallback(side);
|
||||||
if (!hasBlockDefs) edge = level.RawFallback(edge);
|
if (!hasBlockDefs) edge = level.RawFallback(edge);
|
||||||
|
|
||||||
if (Supports(CpeExt.EnvMapAspect)) {
|
string url = GetTextureUrl();
|
||||||
string url = GetTextureUrl();
|
if (Supports(CpeExt.EnvMapAspect)) {
|
||||||
// reset all other textures back to client default.
|
// reset all other textures back to client default.
|
||||||
if (url != lastUrl) Send(Packet.EnvMapUrl("", hasCP437));
|
if (url != lastUrl) Send(Packet.EnvMapUrl("", hasCP437));
|
||||||
Send(Packet.EnvMapUrl(url, hasCP437));
|
Send(Packet.EnvMapUrl(url, hasCP437));
|
||||||
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.SidesBlock, side));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.EdgeBlock, edge));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.EdgeLevel, level.Config.EdgeLevel));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.SidesOffset, level.Config.SidesOffset));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.CloudsLevel, level.Config.CloudsHeight));
|
|
||||||
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.MaxFog, level.Config.MaxFogDistance));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.CloudsSpeed, level.Config.CloudsSpeed));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.WeatherSpeed, level.Config.WeatherSpeed));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.WeatherFade, level.Config.WeatherFade));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.ExpFog, level.Config.ExpFog ? 1 : 0));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.SkyboxHorSpeed, level.Config.SkyboxHorSpeed));
|
|
||||||
Send(Packet.EnvMapProperty(EnvProp.SkyboxVerSpeed, level.Config.SkyboxVerSpeed));
|
|
||||||
} else if (Supports(CpeExt.EnvMapAppearance, 2)) {
|
} else if (Supports(CpeExt.EnvMapAppearance, 2)) {
|
||||||
string url = GetTextureUrl();
|
|
||||||
// reset all other textures back to client default.
|
// reset all other textures back to client default.
|
||||||
if (url != lastUrl) {
|
if (url != lastUrl) {
|
||||||
Send(Packet.MapAppearanceV2("", side, edge, level.Config.EdgeLevel,
|
Send(Packet.MapAppearanceV2("", side, edge, level.Config.EdgeLevel,
|
||||||
@ -137,7 +122,7 @@ namespace MCGalaxy {
|
|||||||
level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
|
level.Config.CloudsHeight, level.Config.MaxFogDistance, hasCP437));
|
||||||
lastUrl = url;
|
lastUrl = url;
|
||||||
} else if (Supports(CpeExt.EnvMapAppearance)) {
|
} else if (Supports(CpeExt.EnvMapAppearance)) {
|
||||||
string url = level.Config.Terrain.Length == 0 ? ServerConfig.DefaultTerrain : level.Config.Terrain;
|
url = level.Config.Terrain.Length == 0 ? ServerConfig.DefaultTerrain : level.Config.Terrain;
|
||||||
Send(Packet.MapAppearance(url, side, edge, level.Config.EdgeLevel, hasCP437));
|
Send(Packet.MapAppearance(url, side, edge, level.Config.EdgeLevel, hasCP437));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,13 +133,7 @@ namespace MCGalaxy {
|
|||||||
url = ServerConfig.DefaultTexture.Length == 0 ? ServerConfig.DefaultTerrain : ServerConfig.DefaultTexture;
|
url = ServerConfig.DefaultTexture.Length == 0 ? ServerConfig.DefaultTerrain : ServerConfig.DefaultTexture;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCurrentEnvColors() {
|
|
||||||
for (int i = 0; i <= 4; i++) {
|
|
||||||
SendEnvColor((byte)i, level.Config.GetColor(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendEnvColor(byte type, string hex) {
|
public void SendEnvColor(byte type, string hex) {
|
||||||
if (String.IsNullOrEmpty(hex)) {
|
if (String.IsNullOrEmpty(hex)) {
|
||||||
Send(Packet.EnvColor(type, -1, -1, -1)); return;
|
Send(Packet.EnvColor(type, -1, -1, -1)); return;
|
||||||
@ -235,6 +214,8 @@ namespace MCGalaxy {
|
|||||||
CloudsLevel = 3, MaxFog = 4, CloudsSpeed = 5,
|
CloudsLevel = 3, MaxFog = 4, CloudsSpeed = 5,
|
||||||
WeatherSpeed = 6, WeatherFade = 7, ExpFog = 8,
|
WeatherSpeed = 6, WeatherFade = 7, ExpFog = 8,
|
||||||
SidesOffset = 9, SkyboxHorSpeed = 10, SkyboxVerSpeed = 11,
|
SidesOffset = 9, SkyboxHorSpeed = 10, SkyboxVerSpeed = 11,
|
||||||
|
|
||||||
|
Max,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum EntityProp : byte {
|
public enum EntityProp : byte {
|
||||||
|
@ -379,6 +379,27 @@ namespace MCGalaxy {
|
|||||||
if (Supports(CpeExt.EnvColors)) SendEnvColor((byte)i, col);
|
if (Supports(CpeExt.EnvColors)) SendEnvColor((byte)i, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (EnvProp i = 0; i < EnvProp.Max; i++) {
|
||||||
|
int value = level.Config.GetEnvProp(i);
|
||||||
|
if (i < EnvProp.EdgeBlock) {
|
||||||
|
if (zone != null && zone.Config.GetEnvProp(i) != -1) {
|
||||||
|
value = zone.Config.GetEnvProp(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (zone != null && zone.Config.GetEnvProp(i) != Block.Invalid) {
|
||||||
|
value = zone.Config.GetEnvProp(i);
|
||||||
|
}
|
||||||
|
if (!hasBlockDefs) value = level.RawFallback((byte)value);
|
||||||
|
}
|
||||||
|
if (Supports(CpeExt.EnvMapAspect)) Send(Packet.EnvMapProperty(i, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Supports(CpeExt.EnvWeatherType)) {
|
||||||
|
int weather = level.Config.Weather;
|
||||||
|
if (zone != null && zone.Config.Weather != -1) weather = zone.Config.Weather;
|
||||||
|
Send(Packet.EnvWeatherType((byte)weather));
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: get rid of this
|
// TODO: get rid of this
|
||||||
Server.s.Log("I MOVED");
|
Server.s.Log("I MOVED");
|
||||||
if (ZoneIn != null) Server.s.Log(ZoneIn.ColoredName);
|
if (ZoneIn != null) Server.s.Log(ZoneIn.ColoredName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user