diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 1ef2f4f8b..7377c7d19 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3462,15 +3462,23 @@ private static bool HandleSpecial(GetDataHandlerArgs args) if (OnNPCSpecial(args.Player, args.Data, id, type)) return true; - if (type == 1 && TShock.Config.Settings.DisableDungeonGuardian) + if (type == 1) { - TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandleSpecial rejected type 1 for {0}", args.Player.Name)); - args.Player.SendMessage(GetString("The Dungeon Guardian returned you to your spawn point."), Color.Purple); - args.Player.Spawn(PlayerSpawnContext.RecallFromItem); - return true; - } + if (!args.Player.HasPermission(Permissions.summonboss)) + { + args.Player.SendErrorMessage(GetString("You do not have permission to summon the Skeletron.")); + TShock.Log.ConsoleDebug(GetString($"GetDataHandlers / HandleNpcStrike rejected Skeletron summon from {args.Player.Name}")); + return true; + } - if (type == 3) + return false; + } + else if (type == 2) + { + // Plays SoundID.Item1 + return false; + } + else if (type == 3) { if (!args.Player.HasPermission(Permissions.usesundial)) { @@ -3490,6 +3498,42 @@ private static bool HandleSpecial(GetDataHandlerArgs args) return true; } } + else if (type == 4) + { + // Big Mimic Spawn Smoke + return false; + } + else if (type == 5) + { + // Register Kill for Torch God in Bestiary + return false; + } + else if (type == 6) + { + if (!args.Player.HasPermission(Permissions.usemoondial)) + { + TShock.Log.ConsoleDebug(GetString($"GetDataHandlers / HandleSpecial rejected enchanted moondial permission {args.Player.Name}")); + args.Player.SendErrorMessage(GetString("You do not have permission to use the Enchanted Moondial.")); + return true; + } + else if (TShock.Config.Settings.ForceTime != "normal") + { + TShock.Log.ConsoleDebug(GetString($"GetDataHandlers / HandleSpecial rejected enchanted moondial permission (ForceTime) {args.Player.Name}")); + if (!args.Player.HasPermission(Permissions.cfgreload)) + { + args.Player.SendErrorMessage(GetString("You cannot use the Enchanted Moondial because time is stopped.")); + } + else + args.Player.SendErrorMessage(GetString("You must set ForceTime to normal via config to use the Enchanted Moondial.")); + return true; + } + } + else if (!args.Player.HasPermission($"tshock.specialeffects.{type}")) + { + args.Player.SendErrorMessage(GetString("You do not have permission to use this effect.")); + TShock.Log.ConsoleError(GetString("Unrecognized special effect (Packet 51). Please report this to the TShock developers.")); + return true; + } return false; } diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index d7ec7166d..6aea9859b 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -331,6 +331,9 @@ public static class Permissions [Description("Player can use the Enchanted Sundial item.")] public static readonly string usesundial = "tshock.world.time.usesundial"; + [Description("Player can use the Enchanted Moondial item.")] + public static readonly string usemoondial = "tshock.world.time.usemoondial"; + [Description("User can grow plants.")] public static readonly string grow = "tshock.world.grow"; diff --git a/docs/changelog.md b/docs/changelog.md index 27e037d61..489afccec 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -92,6 +92,10 @@ Use past tense when adding new entries; sign your name off when you add or chang * Fixed typo in `/gbuff`. (@sgkoishi, #2955) * Rewrote the `.dockerignore` file into a denylist. (@timschumi) * Added CI for Docker images. (@timschumi) +* Added a new permission, `tshock.world.time.usemoondial`, for regulating use of Enchanted Moondial. (@Arthri) +* Added a set of new permissions, `tshock.specialeffects.{type}`, for regulating use of new special effects(Packet 51) which are not yet recognized by TShock. (@Arthri) +* Added check for `tshock.npc.summonboss` permission for Skeletron summoning. (@Arthri) +* Fixed `DisableDungeonGuardian` disabling Skeletron summon instead. The config option is useless as of writing. (@Arthri) ## TShock 5.2 * An additional option `pvpwithnoteam` is added at `PvPMode` to enable PVP with no team. (@CelestialAnarchy, #2617, @ATFGK)