Add perm check for EoL + Sundial ForceTime check

If the player does not have permission to summon bosses, they should not be able to kill Prismatic Lacewing, which summons the Empress of Light. 
Using the Enchanted Sundial while ForceTime is set to day or night (via config) will conflict with TShock's continued attempts to set it back to day or night, this makes the world appear very glitchy.
This commit is contained in:
stacey 2021-07-04 21:33:48 -04:00 committed by GitHub
parent c5421460ae
commit 65bbd80ca6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2809,10 +2809,17 @@ namespace TShockAPI
{
args.Player.SendErrorMessage("You do not have permission to hurt Town NPCs.");
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
TShock.Log.ConsoleDebug("GetDataHandlers / HandleNpcStrike rejected npc strike {0}", args.Player.Name);
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected npc strike {args.Player.Name}");
return true;
}
if (Main.npc[id].netID == NPCID.EmpressButterfly && !args.Player.HasPermission(Permissions.summonboss))
{
args.Player.SendErrorMessage("You do not have permission to summon the Empress of Light.");
args.Player.SendData(PacketTypes.NpcUpdate, "", id);
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleNpcStrike rejected EoL summon from {args.Player.Name}");
return true;
}
return false;
}
@ -3201,11 +3208,20 @@ namespace TShockAPI
return true;
}
if (type == 3 && !args.Player.HasPermission(Permissions.usesundial))
if (type == 3)
{
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpecial rejected enchanted sundial permission {0}", args.Player.Name);
args.Player.SendErrorMessage("You do not have permission to use the Enchanted Sundial.");
return true;
if (!args.Player.HasPermission(Permissions.usesundial))
{
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission {args.Player.Name}");
args.Player.SendErrorMessage("You do not have permission to use the Enchanted Sundial.");
return true;
}
else if (TShock.Config.Settings.ForceTime != "normal")
{
TShock.Log.ConsoleDebug($"GetDataHandlers / HandleSpecial rejected enchanted sundial permission (ForceTime) { args.Player.Name}");
args.Player.SendErrorMessage($"You must set ForceTime to normal via config to use the Enchanted Sundial.");
return true;
}
}
return false;