Refactor for new configuration
This commit is contained in:
parent
a03647ce38
commit
9423febd0a
26 changed files with 351 additions and 433 deletions
|
|
@ -2305,13 +2305,13 @@ namespace TShockAPI
|
|||
NetMessage.SendData((int)PacketTypes.PlayerInfo, -1, args.Player.Index, NetworkText.FromLiteral(args.Player.Name), args.Player.Index);
|
||||
return true;
|
||||
}
|
||||
if (TShock.Config.MediumcoreOnly && difficulty < 1)
|
||||
if (TShock.Config.Settings.MediumcoreOnly && difficulty < 1)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerInfo rejected mediumcore required");
|
||||
args.Player.Kick("You need to join with a mediumcore player or higher.", true, true);
|
||||
return true;
|
||||
}
|
||||
if (TShock.Config.HardcoreOnly && difficulty < 2)
|
||||
if (TShock.Config.Settings.HardcoreOnly && difficulty < 2)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerInfo rejected hardcore required");
|
||||
args.Player.Kick("You need to join with a hardcore player.", true, true);
|
||||
|
|
@ -2359,7 +2359,7 @@ namespace TShockAPI
|
|||
{
|
||||
args.Player.PlayerData.StoreSlot(slot, type, prefix, stack);
|
||||
}
|
||||
else if (Main.ServerSideCharacter && TShock.Config.DisableLoginBeforeJoin && !bypassTrashCanCheck &&
|
||||
else if (Main.ServerSideCharacter && TShock.Config.Settings.DisableLoginBeforeJoin && !bypassTrashCanCheck &&
|
||||
args.Player.HasSentInventory && !args.Player.HasPermission(Permissions.bypassssc))
|
||||
{
|
||||
// The player might have moved an item to their trash can before they performed a single login attempt yet.
|
||||
|
|
@ -2383,7 +2383,7 @@ namespace TShockAPI
|
|||
args.Player.PlayerData = new PlayerData(args.Player);
|
||||
args.Player.PlayerData.CopyCharacter(args.Player);
|
||||
|
||||
if (account != null && !TShock.Config.DisableUUIDLogin)
|
||||
if (account != null && !TShock.Config.Settings.DisableUUIDLogin)
|
||||
{
|
||||
if (account.UUID == args.Player.UUID)
|
||||
{
|
||||
|
|
@ -2424,13 +2424,13 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (account != null && !TShock.Config.DisableLoginBeforeJoin)
|
||||
else if (account != null && !TShock.Config.Settings.DisableLoginBeforeJoin)
|
||||
{
|
||||
args.Player.RequiresPassword = true;
|
||||
NetMessage.SendData((int)PacketTypes.PasswordRequired, args.Player.Index);
|
||||
return true;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))
|
||||
else if (!string.IsNullOrEmpty(TShock.Config.Settings.ServerPassword))
|
||||
{
|
||||
args.Player.RequiresPassword = true;
|
||||
NetMessage.SendData((int)PacketTypes.PasswordRequired, args.Player.Index);
|
||||
|
|
@ -2448,11 +2448,11 @@ namespace TShockAPI
|
|||
if (OnGetSection(args.Player, args.Data, args.Data.ReadInt32(), args.Data.ReadInt32()))
|
||||
return true;
|
||||
|
||||
if (TShock.Utils.GetActivePlayerCount() + 1 > TShock.Config.MaxSlots &&
|
||||
if (TShock.Utils.GetActivePlayerCount() + 1 > TShock.Config.Settings.MaxSlots &&
|
||||
!args.Player.HasPermission(Permissions.reservedslot))
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleGetSection rejected reserve slot");
|
||||
args.Player.Kick(TShock.Config.ServerFullReason, true, true);
|
||||
args.Player.Kick(TShock.Config.Settings.ServerFullReason, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2557,7 +2557,7 @@ namespace TShockAPI
|
|||
if (OnPlayerHP(args.Player, args.Data, plr, cur, max) || cur <= 0 || max <= 0 || args.Player.IgnoreSSCPackets)
|
||||
return true;
|
||||
|
||||
if (max > TShock.Config.MaxHP && !args.Player.HasPermission(Permissions.ignorehp))
|
||||
if (max > TShock.Config.Settings.MaxHP && !args.Player.HasPermission(Permissions.ignorehp))
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerHp rejected over max hp {0}", args.Player.Name);
|
||||
args.Player.Disable("Maximum HP beyond limit", DisableFlags.WriteToLogAndConsole);
|
||||
|
|
@ -2771,7 +2771,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (TShock.ProjectileBans.ProjectileIsBanned(type, args.Player) && !TShock.Config.IgnoreProjKill)
|
||||
if (TShock.ProjectileBans.ProjectileIsBanned(type, args.Player) && !TShock.Config.Settings.IgnoreProjKill)
|
||||
{
|
||||
// According to 2012 deathmax, this is a workaround to fix skeletron prime issues
|
||||
// https://github.com/Pryaxis/TShock/commit/a5aa9231239926f361b7246651e32144bbf28dda
|
||||
|
|
@ -2808,7 +2808,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
string pvpMode = TShock.Config.PvPMode.ToLowerInvariant();
|
||||
string pvpMode = TShock.Config.Settings.PvPMode.ToLowerInvariant();
|
||||
if (pvpMode == "disabled" || pvpMode == "always" || (DateTime.UtcNow - args.Player.LastPvPTeamChange).TotalSeconds < 5)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleTogglePvp rejected fastswitch {0}", args.Player.Name);
|
||||
|
|
@ -2869,7 +2869,7 @@ namespace TShockAPI
|
|||
|
||||
args.Player.ActiveChest = id;
|
||||
|
||||
if (!args.Player.HasBuildPermission(x, y) && TShock.Config.RegionProtectChests)
|
||||
if (!args.Player.HasBuildPermission(x, y) && TShock.Config.Settings.RegionProtectChests)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleChestActive rejected build permission and region check {0}", args.Player.Name);
|
||||
args.Player.SendData(PacketTypes.ChestOpen, "", -1);
|
||||
|
|
@ -2923,7 +2923,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
|
||||
var account = TShock.UserAccounts.GetUserAccountByName(args.Player.Name);
|
||||
if (account != null && !TShock.Config.DisableLoginBeforeJoin)
|
||||
if (account != null && !TShock.Config.Settings.DisableLoginBeforeJoin)
|
||||
{
|
||||
if (account.VerifyPassword(password))
|
||||
{
|
||||
|
|
@ -2970,9 +2970,9 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))
|
||||
if (!string.IsNullOrEmpty(TShock.Config.Settings.ServerPassword))
|
||||
{
|
||||
if (TShock.Config.ServerPassword == password)
|
||||
if (TShock.Config.Settings.ServerPassword == password)
|
||||
{
|
||||
args.Player.RequiresPassword = false;
|
||||
if (args.Player.State == 1)
|
||||
|
|
@ -3005,9 +3005,9 @@ namespace TShockAPI
|
|||
if (OnPlayerMana(args.Player, args.Data, plr, cur, max) || cur < 0 || max < 0 || args.Player.IgnoreSSCPackets)
|
||||
return true;
|
||||
|
||||
if (max > TShock.Config.MaxMP && !args.Player.HasPermission(Permissions.ignoremp))
|
||||
if (max > TShock.Config.Settings.MaxMP && !args.Player.HasPermission(Permissions.ignoremp))
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerMana rejected max mana {0} {1}/{2}", args.Player.Name, max, TShock.Config.MaxMP);
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandlePlayerMana rejected max mana {0} {1}/{2}", args.Player.Name, max, TShock.Config.Settings.MaxMP);
|
||||
args.Player.Disable("Maximum MP beyond limit", DisableFlags.WriteToLogAndConsole);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3092,7 +3092,7 @@ namespace TShockAPI
|
|||
{
|
||||
var buff = args.Data.ReadUInt16();
|
||||
|
||||
if (buff == 10 && TShock.Config.DisableInvisPvP && args.TPlayer.hostile)
|
||||
if (buff == 10 && TShock.Config.Settings.DisableInvisPvP && args.TPlayer.hostile)
|
||||
buff = 0;
|
||||
|
||||
if (Netplay.Clients[args.TPlayer.whoAmI].State < 2 && (buff == 156 || buff == 47 || buff == 149))
|
||||
|
|
@ -3125,7 +3125,7 @@ namespace TShockAPI
|
|||
if (OnNPCSpecial(args.Player, args.Data, id, type))
|
||||
return true;
|
||||
|
||||
if (type == 1 && TShock.Config.DisableDungeonGuardian)
|
||||
if (type == 1 && TShock.Config.Settings.DisableDungeonGuardian)
|
||||
{
|
||||
TShock.Log.ConsoleDebug("GetDataHandlers / HandleSpecial rejected type 1 for {0}", args.Player.Name);
|
||||
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point.", Color.Purple);
|
||||
|
|
@ -3275,7 +3275,7 @@ namespace TShockAPI
|
|||
thing = String.Format("summoned the {0}", npc.FullName);
|
||||
break;
|
||||
}
|
||||
if (TShock.Config.AnonymousBossInvasions)
|
||||
if (TShock.Config.Settings.AnonymousBossInvasions)
|
||||
TShock.Utils.SendLogs(string.Format("{0} {1}!", args.Player.Name, thing), Color.PaleVioletRed, args.Player);
|
||||
else
|
||||
TShock.Utils.Broadcast(String.Format("{0} {1}!", args.Player.Name, thing), 175, 75, 255);
|
||||
|
|
@ -3712,7 +3712,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (TShock.Config.AnonymousBossInvasions)
|
||||
if (TShock.Config.Settings.AnonymousBossInvasions)
|
||||
TShock.Utils.SendLogs(string.Format("{0} started the Old One's Army event!", args.Player.Name), Color.PaleVioletRed, args.Player);
|
||||
else
|
||||
TShock.Utils.Broadcast(string.Format("{0} started the Old One's Army event!", args.Player.Name), 175, 75, 255);
|
||||
|
|
@ -3754,14 +3754,14 @@ namespace TShockAPI
|
|||
return true;
|
||||
|
||||
args.Player.Dead = true;
|
||||
args.Player.RespawnTimer = TShock.Config.RespawnSeconds;
|
||||
args.Player.RespawnTimer = TShock.Config.Settings.RespawnSeconds;
|
||||
|
||||
foreach (NPC npc in Main.npc)
|
||||
{
|
||||
if (npc.active && (npc.boss || npc.type == 13 || npc.type == 14 || npc.type == 15) &&
|
||||
Math.Abs(args.TPlayer.Center.X - npc.Center.X) + Math.Abs(args.TPlayer.Center.Y - npc.Center.Y) < 4000f)
|
||||
{
|
||||
args.Player.RespawnTimer = TShock.Config.RespawnBossSeconds;
|
||||
args.Player.RespawnTimer = TShock.Config.Settings.RespawnBossSeconds;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3770,10 +3770,10 @@ namespace TShockAPI
|
|||
if (args.TPlayer.difficulty == 1 || args.TPlayer.difficulty == 2) // Player is not softcore
|
||||
{
|
||||
bool mediumcore = args.TPlayer.difficulty == 1;
|
||||
bool shouldBan = mediumcore ? TShock.Config.BanOnMediumcoreDeath : TShock.Config.BanOnHardcoreDeath;
|
||||
bool shouldKick = mediumcore ? TShock.Config.KickOnMediumcoreDeath : TShock.Config.KickOnHardcoreDeath;
|
||||
string banReason = mediumcore ? TShock.Config.MediumcoreBanReason : TShock.Config.HardcoreBanReason;
|
||||
string kickReason = mediumcore ? TShock.Config.MediumcoreKickReason : TShock.Config.HardcoreKickReason;
|
||||
bool shouldBan = mediumcore ? TShock.Config.Settings.BanOnMediumcoreDeath : TShock.Config.Settings.BanOnHardcoreDeath;
|
||||
bool shouldKick = mediumcore ? TShock.Config.Settings.KickOnMediumcoreDeath : TShock.Config.Settings.KickOnHardcoreDeath;
|
||||
string banReason = mediumcore ? TShock.Config.Settings.MediumcoreBanReason : TShock.Config.Settings.HardcoreBanReason;
|
||||
string kickReason = mediumcore ? TShock.Config.Settings.MediumcoreKickReason : TShock.Config.Settings.HardcoreKickReason;
|
||||
|
||||
if (shouldBan)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue