Use better code
This commit is contained in:
parent
608e7a99bc
commit
75c8a8ced4
32 changed files with 77 additions and 105 deletions
|
|
@ -48,14 +48,12 @@ namespace TShockAPI.Handlers.NetModules
|
|||
/// <returns></returns>
|
||||
public static bool HasPermission(CreativePowerTypes powerType, TSPlayer player)
|
||||
{
|
||||
if (!PowerToPermissionMap.ContainsKey(powerType))
|
||||
if (!PowerToPermissionMap.TryGetValue(powerType, out string permission))
|
||||
{
|
||||
TShock.Log.ConsoleDebug(GetString("CreativePowerHandler received permission check request for unknown creative power"));
|
||||
return false;
|
||||
}
|
||||
|
||||
string permission = PowerToPermissionMap[powerType];
|
||||
|
||||
//prevent being told about the spawnrate permission on join until relogic fixes
|
||||
if (!player.HasReceivedNPCPermissionError && powerType == CreativePowerTypes.SetSpawnRate)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue