diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 578a8653..e4c8527e 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -3492,15 +3492,23 @@ namespace TShockAPI 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)) { @@ -3520,6 +3528,42 @@ namespace TShockAPI 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 99ac5d7d..4dd84c67 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -331,6 +331,9 @@ namespace TShockAPI [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 537361eb..49a579ed 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -117,6 +117,11 @@ Use past tense when adding new entries; sign your name off when you add or chang * Added a property `TSPlayer.Hostile`, which gets pvp player mode. (@AgaSpace) * Fixed bug where when the `UseSqlLogs` config property is true, an empty log file would still get created. (@ZakFahey) * Fixed typo in `/gbuff`. (@sgkoishi, #2955) + +Rewrote the 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) * Added a constructor for `TShockAPI.PlayerData` that accepts the `includingStarterInventory` parameter, which is responsible for loading the TShock inventory. * Declared the constructor `TShockAPI.PlayerData` accepting the argument `TShockAPI.TSPlayer` obsolete. * Updated the `PlayerData.StoreSlot` method: Added an overload that takes `TShockAPI.NetItem`.