From 8c1cf3c15ed337c56911f2ac5a09059c747d9651 Mon Sep 17 00:00:00 2001
From: Pia Mancini
Date: Thu, 20 Apr 2017 11:45:15 -0400
Subject: [PATCH 01/10] Add backers and sponsors from Open Collective
Now your open collective backers and sponsors can to appear directly on your README.
see how it'll look [here](https://github.com/apex/apex#backers)
[More info](https://github.com/opencollective/opencollective/wiki/Github-banner)
Also add badges on top
---
README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/README.md b/README.md
index b379295e..da702579 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,9 @@
+[](#backers)
+[](#sponsors)
+
TShock is a server modification for Terraria, written in C#, and based upon the [Terraria Server API](https://github.com/NyxStudios/TerrariaAPI-Server). It uses JSON for configuration management, and offers several features not present in the Terraria Server normally.
## :star: Quick Start
@@ -38,3 +41,73 @@ Please see the contributing file before sending pull requests.
* [Development Builds](https://travis.tshock.co/)
* [Plugins](https://tshock.co/xf/index.php?resources/)
* [Very, very old versions of TShock](https://github.com/TShock/TShock/downloads)
+
+## Backers
+
+Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/tshock#backer)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Sponsors
+
+Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/tshock#sponsor)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 40e3a9d5b872ea005e72e6f25bdee351226030b3 Mon Sep 17 00:00:00 2001
From: Ryozuki
Date: Thu, 22 Jun 2017 21:05:14 +0200
Subject: [PATCH 02/10] fix comment typo
---
TShockAPI/DB/WarpsManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs
index d48ba40e..6ed72f4e 100644
--- a/TShockAPI/DB/WarpsManager.cs
+++ b/TShockAPI/DB/WarpsManager.cs
@@ -61,7 +61,7 @@ namespace TShockAPI.DB
/// The X position.
/// The Y position.
/// The name.
- /// Whether the opration succeeded.
+ /// Whether the operation succeeded.
public bool Add(int x, int y, string name)
{
try
From 6b3f18b1da7142ad23fe7fe27c93a13d6677e349 Mon Sep 17 00:00:00 2001
From: ProfessorXZ
Date: Wed, 5 Jul 2017 15:09:31 +0200
Subject: [PATCH 03/10] Validate tile placement on PlaceObject, update
CHANGELOG.md. Fixes #1418
---
CHANGELOG.md | 6 ++++++
TShockAPI/GetDataHandlers.cs | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa42a2aa..267c8ece 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,7 +3,13 @@
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
## Upcoming Changes
+* API: Added hooks for item, projectile and tile bans (@deadsurgeon42)
+* API: New WorldGrassSpread hook which shold allow corruption/crimson/hallow creep config options to work (@DeathCradle)
+* Fixed saving when one player is one the server and another one joins (@MarioE)
+* Fixed /spawnmob not spawning negative IDs (@MarioE)
+* Validated tile placement on PlaceObject; clients can no longer place frames, paintings etc with dirt blocks (@bartico6, @ProfessorXZ)
+## TShock 4.3.24
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)
* Updated Terraria Server API to 1.3.5.3 (@WhiteXZ, @hakusaro)
* Updated TShock core components to 1.3.5.3 (@hakusaro)
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index 2a7ddd00..77e37c03 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -2350,6 +2350,15 @@ namespace TShockAPI
return true;
}
+ // This is neccessary to check in order to prevent special tiles such as
+ // queen bee larva, paintings etc that use this packet from being placed
+ // without selecting the right item.
+ if (type != args.TPlayer.inventory[args.TPlayer.selectedItem].createTile)
+ {
+ args.Player.SendTileSquare(x, y, 4);
+ return true;
+ }
+
TileObjectData tileData = TileObjectData.GetTileData(type, style, 0);
if (tileData == null)
return true;
From 79f66f554febef5efa2167a13eec544a79f43413 Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Tue, 11 Jul 2017 10:37:17 +0300
Subject: [PATCH 04/10] Turn the player hooks into a tristate
---
TShockAPI/DB/ItemManager.cs | 5 +-
TShockAPI/DB/ProjectileManager.cs | 5 +-
TShockAPI/DB/TileManager.cs | 5 +-
TShockAPI/Hooks/PlayerHooks.cs | 89 +++++++++++++++++++++++++------
TShockAPI/TSPlayer.cs | 6 ++-
5 files changed, 85 insertions(+), 25 deletions(-)
diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs
index 0ff89b40..54ae8ee5 100644
--- a/TShockAPI/DB/ItemManager.cs
+++ b/TShockAPI/DB/ItemManager.cs
@@ -201,8 +201,9 @@ namespace TShockAPI.DB
if (ply.HasPermission(Permissions.usebanneditem))
return true;
- if (PlayerHooks.OnPlayerItembanPermission(ply, this))
- return true;
+ PermissionResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this);
+ if (hookResult != PermissionResult.Inconclusive)
+ return hookResult == PermissionResult.Granted;
var cur = ply.Group;
var traversed = new List();
diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs
index 79bf9a37..234d3cca 100644
--- a/TShockAPI/DB/ProjectileManager.cs
+++ b/TShockAPI/DB/ProjectileManager.cs
@@ -206,8 +206,9 @@ namespace TShockAPI.DB
if (ply.HasPermission(Permissions.canusebannedprojectiles))
return true;
- if (PlayerHooks.OnPlayerProjbanPermission(ply, this))
- return true;
+ PermissionResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this);
+ if (hookResult != PermissionResult.Inconclusive)
+ return hookResult == PermissionResult.Granted;
var cur = ply.Group;
var traversed = new List();
diff --git a/TShockAPI/DB/TileManager.cs b/TShockAPI/DB/TileManager.cs
index 90a235f8..83b079ab 100644
--- a/TShockAPI/DB/TileManager.cs
+++ b/TShockAPI/DB/TileManager.cs
@@ -206,8 +206,9 @@ namespace TShockAPI.DB
if (ply.HasPermission(Permissions.canusebannedtiles))
return true;
- if (PlayerHooks.OnPlayerTilebanPermission(ply, this))
- return true;
+ PermissionResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this);
+ if (hookResult != PermissionResult.Inconclusive)
+ return hookResult == PermissionResult.Granted;
var cur = ply.Group;
var traversed = new List();
diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs
index 062a78b8..7f2e8601 100644
--- a/TShockAPI/Hooks/PlayerHooks.cs
+++ b/TShockAPI/Hooks/PlayerHooks.cs
@@ -155,6 +155,11 @@ namespace TShockAPI.Hooks
///
public string Permission { get; set; }
+ ///
+ /// of the hook.
+ ///
+ public PermissionResult Result { get; set; }
+
///
/// Initializes a new instance of the PlayerPermissionEventArgs class.
///
@@ -164,6 +169,7 @@ namespace TShockAPI.Hooks
{
Player = player;
Permission = permission;
+ Result = PermissionResult.Inconclusive;
}
}
@@ -182,15 +188,21 @@ namespace TShockAPI.Hooks
///
public ItemBan BannedItem { get; set; }
+ ///
+ /// of the hook.
+ ///
+ public PermissionResult Result { get; set; }
+
///
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
///
/// The player who fired the event.
- /// The permission being checked.
+ /// The banned item being checked.
public PlayerItembanPermissionEventArgs(TSPlayer player, ItemBan bannedItem)
{
Player = player;
BannedItem = bannedItem;
+ Result = PermissionResult.Inconclusive;
}
}
@@ -209,6 +221,11 @@ namespace TShockAPI.Hooks
///
public ProjectileBan BannedProjectile { get; set; }
+ ///
+ /// of the hook.
+ ///
+ public PermissionResult Result { get; set; }
+
///
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
///
@@ -218,6 +235,7 @@ namespace TShockAPI.Hooks
{
Player = player;
BannedProjectile = checkedProjectile;
+ Result = PermissionResult.Inconclusive;
}
}
@@ -236,6 +254,11 @@ namespace TShockAPI.Hooks
///
public TileBan BannedTile { get; set; }
+ ///
+ /// of the hook.
+ ///
+ public PermissionResult Result { get; set; }
+
///
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
///
@@ -245,6 +268,7 @@ namespace TShockAPI.Hooks
{
Player = player;
BannedTile = checkedTile;
+ Result = PermissionResult.Inconclusive;
}
}
@@ -439,60 +463,91 @@ namespace TShockAPI.Hooks
/// Fires the event.
///
/// The player firing the event.
- /// True if the event has been handled.
- public static bool OnPlayerPermission(TSPlayer player, string permission)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionResult OnPlayerPermission(TSPlayer player, string permission)
{
if (PlayerPermission == null)
- return false;
+ return PermissionResult.Inconclusive;
var args = new PlayerPermissionEventArgs(player, permission);
PlayerPermission(args);
- return args.Handled;
+
+ if (args.Handled)
+ return args.Result;
+ else
+ return PermissionResult.Inconclusive;
}
///
/// Fires the event.
///
/// The player firing the event.
- /// True if the event has been handled.
- public static bool OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
{
if (PlayerItembanPermission == null)
- return false;
+ return PermissionResult.Inconclusive;
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
PlayerItembanPermission(args);
- return args.Handled;
+
+ if (args.Handled)
+ return args.Result;
+ else
+ return PermissionResult.Inconclusive;
}
///
/// Fires the event.
///
/// The player firing the event.
- /// True if the event has been handled.
- public static bool OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
{
if (PlayerProjbanPermission == null)
- return false;
+ return PermissionResult.Inconclusive;
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
PlayerProjbanPermission(args);
- return args.Handled;
+
+ if (args.Handled)
+ return args.Result;
+ else
+ return PermissionResult.Inconclusive;
}
///
/// Fires the event.
///
/// The player firing the event.
- /// True if the event has been handled.
- public static bool OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
{
if (PlayerTilebanPermission == null)
- return false;
+ return PermissionResult.Inconclusive;
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
PlayerTilebanPermission(args);
- return args.Handled;
+
+ if (args.Handled)
+ return args.Result;
+ else
+ return PermissionResult.Inconclusive;
}
+
}
+
+ ///
+ /// Defines the possible outcomes of handlers.
+ ///
+ public enum PermissionResult
+ {
+ /// Hook doesn't return a result on the permission check.
+ Inconclusive,
+ /// Permission is explicitly denied by a hook.
+ Denied,
+ /// Permission is explicitly granted by a hook.
+ Granted
+ }
+
}
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 8d0819bf..930c587b 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1265,8 +1265,10 @@ namespace TShockAPI
/// True if the player has that permission.
public bool HasPermission(string permission)
{
- if (PlayerHooks.OnPlayerPermission(this, permission))
- return true;
+ PermissionResult hookResult = PlayerHooks.OnPlayerPermission(this, permission);
+
+ if (hookResult != PermissionResult.Inconclusive)
+ return hookResult == PermissionResult.Granted;
if (tempGroup != null)
return tempGroup.HasPermission(permission);
From 3764527d3d390091c4e12f14481cad54b2b0a63d Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Tue, 11 Jul 2017 16:29:48 +0300
Subject: [PATCH 05/10] don't inherit handled event args for them
---
TShockAPI/Hooks/PlayerHooks.cs | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)
diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs
index 7f2e8601..6e3db3d5 100644
--- a/TShockAPI/Hooks/PlayerHooks.cs
+++ b/TShockAPI/Hooks/PlayerHooks.cs
@@ -143,7 +143,7 @@ namespace TShockAPI.Hooks
///
/// EventArgs used for the event.
///
- public class PlayerPermissionEventArgs : HandledEventArgs
+ public class PlayerPermissionEventArgs
{
///
/// The player who fired the event.
@@ -176,7 +176,7 @@ namespace TShockAPI.Hooks
///
/// EventArgs used for the event.
///
- public class PlayerItembanPermissionEventArgs : HandledEventArgs
+ public class PlayerItembanPermissionEventArgs
{
///
/// The player who fired the event.
@@ -209,7 +209,7 @@ namespace TShockAPI.Hooks
///
/// EventArgs used for the event.
///
- public class PlayerProjbanPermissionEventArgs : HandledEventArgs
+ public class PlayerProjbanPermissionEventArgs
{
///
/// The player who fired the event.
@@ -242,7 +242,7 @@ namespace TShockAPI.Hooks
///
/// EventArgs used for the event.
///
- public class PlayerTilebanPermissionEventArgs : HandledEventArgs
+ public class PlayerTilebanPermissionEventArgs
{
///
/// The player who fired the event.
@@ -472,10 +472,7 @@ namespace TShockAPI.Hooks
var args = new PlayerPermissionEventArgs(player, permission);
PlayerPermission(args);
- if (args.Handled)
- return args.Result;
- else
- return PermissionResult.Inconclusive;
+ return args.Result;
}
///
@@ -491,10 +488,7 @@ namespace TShockAPI.Hooks
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
PlayerItembanPermission(args);
- if (args.Handled)
- return args.Result;
- else
- return PermissionResult.Inconclusive;
+ return args.Result;
}
///
@@ -510,10 +504,7 @@ namespace TShockAPI.Hooks
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
PlayerProjbanPermission(args);
- if (args.Handled)
- return args.Result;
- else
- return PermissionResult.Inconclusive;
+ return args.Result;
}
///
@@ -529,10 +520,7 @@ namespace TShockAPI.Hooks
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
PlayerTilebanPermission(args);
- if (args.Handled)
- return args.Result;
- else
- return PermissionResult.Inconclusive;
+ return args.Result;
}
}
From 685d9964f0be1e36ace592e655f69cf416abaf66 Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Wed, 12 Jul 2017 08:47:27 +0300
Subject: [PATCH 06/10] Change enum names for clarity
---
TShockAPI/DB/ItemManager.cs | 6 ++--
TShockAPI/DB/ProjectileManager.cs | 6 ++--
TShockAPI/DB/TileManager.cs | 6 ++--
TShockAPI/Hooks/PlayerHooks.cs | 52 +++++++++++++++----------------
TShockAPI/TSPlayer.cs | 6 ++--
5 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs
index 54ae8ee5..c3d92840 100644
--- a/TShockAPI/DB/ItemManager.cs
+++ b/TShockAPI/DB/ItemManager.cs
@@ -201,9 +201,9 @@ namespace TShockAPI.DB
if (ply.HasPermission(Permissions.usebanneditem))
return true;
- PermissionResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this);
- if (hookResult != PermissionResult.Inconclusive)
- return hookResult == PermissionResult.Granted;
+ PermissionHookResult hookResult = PlayerHooks.OnPlayerItembanPermission(ply, this);
+ if (hookResult != PermissionHookResult.Unhandled)
+ return hookResult == PermissionHookResult.Granted;
var cur = ply.Group;
var traversed = new List();
diff --git a/TShockAPI/DB/ProjectileManager.cs b/TShockAPI/DB/ProjectileManager.cs
index 234d3cca..4214fce6 100644
--- a/TShockAPI/DB/ProjectileManager.cs
+++ b/TShockAPI/DB/ProjectileManager.cs
@@ -206,9 +206,9 @@ namespace TShockAPI.DB
if (ply.HasPermission(Permissions.canusebannedprojectiles))
return true;
- PermissionResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this);
- if (hookResult != PermissionResult.Inconclusive)
- return hookResult == PermissionResult.Granted;
+ PermissionHookResult hookResult = PlayerHooks.OnPlayerProjbanPermission(ply, this);
+ if (hookResult != PermissionHookResult.Unhandled)
+ return hookResult == PermissionHookResult.Granted;
var cur = ply.Group;
var traversed = new List();
diff --git a/TShockAPI/DB/TileManager.cs b/TShockAPI/DB/TileManager.cs
index 83b079ab..c291b21a 100644
--- a/TShockAPI/DB/TileManager.cs
+++ b/TShockAPI/DB/TileManager.cs
@@ -206,9 +206,9 @@ namespace TShockAPI.DB
if (ply.HasPermission(Permissions.canusebannedtiles))
return true;
- PermissionResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this);
- if (hookResult != PermissionResult.Inconclusive)
- return hookResult == PermissionResult.Granted;
+ PermissionHookResult hookResult = PlayerHooks.OnPlayerTilebanPermission(ply, this);
+ if (hookResult != PermissionHookResult.Unhandled)
+ return hookResult == PermissionHookResult.Granted;
var cur = ply.Group;
var traversed = new List();
diff --git a/TShockAPI/Hooks/PlayerHooks.cs b/TShockAPI/Hooks/PlayerHooks.cs
index 6e3db3d5..91f9612c 100644
--- a/TShockAPI/Hooks/PlayerHooks.cs
+++ b/TShockAPI/Hooks/PlayerHooks.cs
@@ -156,9 +156,9 @@ namespace TShockAPI.Hooks
public string Permission { get; set; }
///
- /// of the hook.
+ /// of the hook.
///
- public PermissionResult Result { get; set; }
+ public PermissionHookResult Result { get; set; }
///
/// Initializes a new instance of the PlayerPermissionEventArgs class.
@@ -169,7 +169,7 @@ namespace TShockAPI.Hooks
{
Player = player;
Permission = permission;
- Result = PermissionResult.Inconclusive;
+ Result = PermissionHookResult.Unhandled;
}
}
@@ -189,9 +189,9 @@ namespace TShockAPI.Hooks
public ItemBan BannedItem { get; set; }
///
- /// of the hook.
+ /// of the hook.
///
- public PermissionResult Result { get; set; }
+ public PermissionHookResult Result { get; set; }
///
/// Initializes a new instance of the PlayerItembanPermissionEventArgs class.
@@ -202,7 +202,7 @@ namespace TShockAPI.Hooks
{
Player = player;
BannedItem = bannedItem;
- Result = PermissionResult.Inconclusive;
+ Result = PermissionHookResult.Unhandled;
}
}
@@ -222,9 +222,9 @@ namespace TShockAPI.Hooks
public ProjectileBan BannedProjectile { get; set; }
///
- /// of the hook.
+ /// of the hook.
///
- public PermissionResult Result { get; set; }
+ public PermissionHookResult Result { get; set; }
///
/// Initializes a new instance of the PlayerProjbanPermissionEventArgs class.
@@ -235,7 +235,7 @@ namespace TShockAPI.Hooks
{
Player = player;
BannedProjectile = checkedProjectile;
- Result = PermissionResult.Inconclusive;
+ Result = PermissionHookResult.Unhandled;
}
}
@@ -255,9 +255,9 @@ namespace TShockAPI.Hooks
public TileBan BannedTile { get; set; }
///
- /// of the hook.
+ /// of the hook.
///
- public PermissionResult Result { get; set; }
+ public PermissionHookResult Result { get; set; }
///
/// Initializes a new instance of the PlayerTilebanPermissionEventArgs class.
@@ -268,7 +268,7 @@ namespace TShockAPI.Hooks
{
Player = player;
BannedTile = checkedTile;
- Result = PermissionResult.Inconclusive;
+ Result = PermissionHookResult.Unhandled;
}
}
@@ -463,11 +463,11 @@ namespace TShockAPI.Hooks
/// Fires the event.
///
/// The player firing the event.
- /// Event result if the event has been handled, otherwise .
- public static PermissionResult OnPlayerPermission(TSPlayer player, string permission)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionHookResult OnPlayerPermission(TSPlayer player, string permission)
{
if (PlayerPermission == null)
- return PermissionResult.Inconclusive;
+ return PermissionHookResult.Unhandled;
var args = new PlayerPermissionEventArgs(player, permission);
PlayerPermission(args);
@@ -479,11 +479,11 @@ namespace TShockAPI.Hooks
/// Fires the event.
///
/// The player firing the event.
- /// Event result if the event has been handled, otherwise .
- public static PermissionResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionHookResult OnPlayerItembanPermission(TSPlayer player, ItemBan bannedItem)
{
if (PlayerItembanPermission == null)
- return PermissionResult.Inconclusive;
+ return PermissionHookResult.Unhandled;
var args = new PlayerItembanPermissionEventArgs(player, bannedItem);
PlayerItembanPermission(args);
@@ -495,11 +495,11 @@ namespace TShockAPI.Hooks
/// Fires the event.
///
/// The player firing the event.
- /// Event result if the event has been handled, otherwise .
- public static PermissionResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionHookResult OnPlayerProjbanPermission(TSPlayer player, ProjectileBan bannedProj)
{
if (PlayerProjbanPermission == null)
- return PermissionResult.Inconclusive;
+ return PermissionHookResult.Unhandled;
var args = new PlayerProjbanPermissionEventArgs(player, bannedProj);
PlayerProjbanPermission(args);
@@ -511,11 +511,11 @@ namespace TShockAPI.Hooks
/// Fires the event.
///
/// The player firing the event.
- /// Event result if the event has been handled, otherwise .
- public static PermissionResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
+ /// Event result if the event has been handled, otherwise .
+ public static PermissionHookResult OnPlayerTilebanPermission(TSPlayer player, TileBan bannedTile)
{
if (PlayerTilebanPermission == null)
- return PermissionResult.Inconclusive;
+ return PermissionHookResult.Unhandled;
var args = new PlayerTilebanPermissionEventArgs(player, bannedTile);
PlayerTilebanPermission(args);
@@ -528,10 +528,10 @@ namespace TShockAPI.Hooks
///
/// Defines the possible outcomes of handlers.
///
- public enum PermissionResult
+ public enum PermissionHookResult
{
/// Hook doesn't return a result on the permission check.
- Inconclusive,
+ Unhandled,
/// Permission is explicitly denied by a hook.
Denied,
/// Permission is explicitly granted by a hook.
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 930c587b..8f7b831e 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1265,10 +1265,10 @@ namespace TShockAPI
/// True if the player has that permission.
public bool HasPermission(string permission)
{
- PermissionResult hookResult = PlayerHooks.OnPlayerPermission(this, permission);
+ PermissionHookResult hookResult = PlayerHooks.OnPlayerPermission(this, permission);
- if (hookResult != PermissionResult.Inconclusive)
- return hookResult == PermissionResult.Granted;
+ if (hookResult != PermissionHookResult.Unhandled)
+ return hookResult == PermissionHookResult.Granted;
if (tempGroup != null)
return tempGroup.HasPermission(permission);
From 7f68053d3a8bee0a555d89353510f07bab7ce230 Mon Sep 17 00:00:00 2001
From: Ruby Rose
Date: Tue, 11 Jul 2017 16:33:59 +0300
Subject: [PATCH 07/10] Update CHANGELOG.md
---
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa42a2aa..f0d0f29c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
## Upcoming Changes
+* API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42)
* Updated OpenTerraria API to 1.3.5.3 (@DeathCradle)
* Updated Terraria Server API to 1.3.5.3 (@WhiteXZ, @hakusaro)
* Updated TShock core components to 1.3.5.3 (@hakusaro)
From 156ce5284518b8b4dceda0eb0a973930a1625b29 Mon Sep 17 00:00:00 2001
From: Lucas Nicodemus
Date: Thu, 20 Jul 2017 18:10:16 -0600
Subject: [PATCH 08/10] Closes #1478
This addresses code feedback in the previously deleted pull request
---
CHANGELOG.md | 1 +
TShockAPI/StatTracker.cs | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 91b371a2..d7ab5308 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Fixed saving when one player is one the server and another one joins (@MarioE)
* Fixed /spawnmob not spawning negative IDs (@MarioE)
* Validated tile placement on PlaceObject; clients can no longer place frames, paintings etc with dirt blocks (@bartico6, @ProfessorXZ)
+* Updated to new stat tracking system with more data so we can actually make informed software decisions (Jordan Coulam)
## TShock 4.3.24
* API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42)
diff --git a/TShockAPI/StatTracker.cs b/TShockAPI/StatTracker.cs
index d1c01c1c..47e5d2cc 100644
--- a/TShockAPI/StatTracker.cs
+++ b/TShockAPI/StatTracker.cs
@@ -160,10 +160,10 @@ namespace TShockAPI
{
if (plugins != null)
{
- return plugins;//Return early
+ return plugins; //Return early
}
- plugins = new PluginItem[ServerApi.Plugins.Count];//Initialize with enough room to store the ammount of plugins loaded.
+ plugins = new PluginItem[ServerApi.Plugins.Count]; //Initialize with enough room to store the ammount of plugins loaded.
for (var i = 0; i < ServerApi.Plugins.Count; i++)
{
var pluginItem = new PluginItem();
@@ -181,10 +181,10 @@ namespace TShockAPI
{
if (totalMem != 0)
{
- return totalMem;//Return early
+ return totalMem; //Return early
}
- if (isMono)//Set totalMem so it can be returned later
+ if (isMono) //Set totalMem so it can be returned later
{
var pc = new PerformanceCounter("Mono Memory", "Total Physical Memory");
totalMem = (pc.RawValue / 1024 / 1024 / 1024);
From 7768511e6e7a778acbbde7e8c7d02aba2e1e45d6 Mon Sep 17 00:00:00 2001
From: Lucas Nicodemus
Date: Sun, 23 Jul 2017 22:05:55 -0600
Subject: [PATCH 09/10] Update travis ci badge
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2d024912..2ad38b13 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-
+
From 031ef517e3875e7be8edae0ae53b95052daff4a2 Mon Sep 17 00:00:00 2001
From: quake1337
Date: Fri, 4 Aug 2017 12:52:07 +0200
Subject: [PATCH 10/10] Change field visibility
---
TShockAPI/Sockets/LinuxTcpSocket.cs | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/TShockAPI/Sockets/LinuxTcpSocket.cs b/TShockAPI/Sockets/LinuxTcpSocket.cs
index 98df1674..86381237 100644
--- a/TShockAPI/Sockets/LinuxTcpSocket.cs
+++ b/TShockAPI/Sockets/LinuxTcpSocket.cs
@@ -12,23 +12,23 @@ namespace TShockAPI.Sockets
{
public class LinuxTcpSocket : ISocket
{
- private byte[] _packetBuffer = new byte[1024];
+ public byte[] _packetBuffer = new byte[1024];
- private int _packetBufferLength;
+ public int _packetBufferLength;
- private List