Restrict scale for players in /model

This commit is contained in:
UnknownShadow200 2019-10-19 12:40:24 +11:00
parent 3bf2de0d22
commit faa46585ad

View File

@ -43,6 +43,7 @@ namespace MCGalaxy.Commands.CPE {
protected override void SetBotData(Player p, PlayerBot bot, string model) {
bool changedAxisScale;
model = ParseModel(p, bot, model, out changedAxisScale);
if (model == null) return;
Entities.UpdateModel(bot, model);
p.Message("You changed the model of bot " + bot.ColoredName + " %Sto a &c" + model);
@ -52,6 +53,7 @@ namespace MCGalaxy.Commands.CPE {
protected override void SetPlayerData(Player p, Player who, string model) {
bool changedAxisScale;
model = ParseModel(p, who, model, out changedAxisScale);
if (model == null) return;
Entities.UpdateModel(who, model);
if (p != who) {
@ -98,6 +100,14 @@ namespace MCGalaxy.Commands.CPE {
changedAxisScale = true;
return ParseModelScale(dst, entity, model, "Z scale", ref entity.ScaleZ);
}
float max = ModelInfo.MaxScale(entity);
// restrict player model scale, but bots can have unlimited model scale
if (ModelInfo.GetRawScale(model) > max) {
dst.Message("%WScale must be {0} or less for {1} model",
max, ModelInfo.GetRawModel(model));
return null;
}
return model;
}