From faa46585ad074fdc14d127353a9a9d9300094573 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 19 Oct 2019 12:40:24 +1100 Subject: [PATCH] Restrict scale for players in /model --- MCGalaxy/Commands/CPE/CmdModel.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MCGalaxy/Commands/CPE/CmdModel.cs b/MCGalaxy/Commands/CPE/CmdModel.cs index 2902d3858..8a1ec767f 100644 --- a/MCGalaxy/Commands/CPE/CmdModel.cs +++ b/MCGalaxy/Commands/CPE/CmdModel.cs @@ -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; }