Commit graph

4232 commits

Author SHA1 Message Date
Lucas Nicodemus
0543e0b18f OnGemLockToggle now uses GetDataHandledEventArgs. 2017-12-23 14:27:01 -07:00
Lucas Nicodemus
551762f10e OnProjectileKill now uses GetDataHandledEventArgs. 2017-12-23 14:25:30 -07:00
Lucas Nicodemus
fd7b9858df OnPlaceChest now uses GetDataHandledEventArgs. 2017-12-23 14:24:12 -07:00
Lucas Nicodemus
e9931e8740 OnPlayerInfo now uses GetDataHandledEventArgs. 2017-12-23 14:22:45 -07:00
Lucas Nicodemus
0efa2fd648 OnPlayerMana now uses GetDataHandledEventArgs. 2017-12-23 14:21:42 -07:00
Lucas Nicodemus
8bb3b88ab0 OnPlaceItemFrame now uses GetDataHandledEventArgs. 2017-12-23 14:19:44 -07:00
Lucas Nicodemus
c6a5de4398 OnPaintTile now uses GetDataHandledEventArgs. 2017-12-23 14:17:51 -07:00
Lucas Nicodemus
dbadcc6db0 OnPlayerHP now uses GetDataHandledEventArgs. 2017-12-23 14:16:52 -07:00
Lucas Nicodemus
d54af26916 OnPlayerSlot now uses GetDataHandledEventArgs. 2017-12-23 14:14:58 -07:00
Lucas Nicodemus
3f9c0ebbfe OnPlayerTeam now uses GetDataHandledEventArgs. 2017-12-23 14:13:51 -07:00
Lucas Nicodemus
62013c7594 OnPvpToggled now uses GetDataHandledEventArgs 2017-12-23 14:12:41 -07:00
Lucas Nicodemus
301125b2d8 OnTileEdit is now a GetDataHandledEventArgs. 2017-12-23 14:11:47 -07:00
Lucas Nicodemus
c2fe96921e Turn off XML comment warnings in REST Permissions 2017-12-23 09:39:59 -07:00
Lucas Nicodemus
4158990bee Turn off XML comment warnings for permissions 2017-12-23 09:38:19 -07:00
Lucas Nicodemus
12b83f6f85 Chop out some unused code. 2017-12-23 09:36:18 -07:00
Lucas Nicodemus
5e7cb92de0 Re-apply some changes 2017-12-22 21:18:47 -07:00
Lucas Nicodemus
5991802dce Revert "Clarify summary of TSPlayer.IsInRange"
This reverts commit c501a128ff.
2017-12-22 21:15:26 -07:00
Lucas Nicodemus
058a68658e Merge branch 'crp' of github.com:Pryaxis/TShock into crp 2017-12-22 21:13:13 -07:00
Lucas Nicodemus
604b386cba Rescue lost work 2017-12-22 21:12:56 -07:00
Lucas Nicodemus
50663f7bb3 Merge branch 'general-devel' of github.com:Pryaxis/TShock into crp 2017-12-22 21:07:44 -07:00
Lucas Nicodemus
c501a128ff Clarify summary of TSPlayer.IsInRange 2017-12-22 21:02:53 -07:00
Chris
fe62b14a13
Merge pull request #1578 from Pryaxis/checkspawn
Move TShock.CheckSpawn to Utils.IsInSpawn
2017-12-23 12:25:54 +10:30
Chris
8a58530fdc
Merge branch 'general-devel' into checkspawn 2017-12-23 12:20:03 +10:30
Chris
6f23833ccf
Merge pull request #1576 from Pryaxis/hackedinventory
Move TShock.HackedInventory to TSPlayer.HasHackedItemStacks, OnGetSection -> Bouncer
2017-12-23 12:19:36 +10:30
Lucas Nicodemus
2d06255095 Merge branch 'hackedinventory' into crp 2017-12-22 10:24:49 -07:00
Lucas Nicodemus
a2e6a06985 Fix local var check accidentally being removed 2017-12-22 10:24:23 -07:00
Lucas Nicodemus
0a156c5204 Merge branch 'hackedinventory' into crp 2017-12-22 10:22:46 -07:00
Lucas Nicodemus
b93bab65d7 Fix automatically disabling all players
In rewriting Disable, I accidentally implemented logic that disabled all
players for having banned armor. This is now fixed.
2017-12-22 10:21:49 -07:00
Lucas Nicodemus
848d3c4778 Merge branch 'hackedinventory' into crp 2017-12-22 10:18:51 -07:00
Lucas Nicodemus
bfbe58e9ed Implement cooldown warnings on build permissions 2017-12-22 10:03:59 -07:00
Lucas Nicodemus
a76144b503 Merge branch 'general-devel' into hackedinventory 2017-12-22 09:43:28 -07:00
Lucas Nicodemus
2d8a02764f Merge branch 'general-devel' into checkspawn 2017-12-22 09:43:11 -07:00
Lucas Nicodemus
8a88fd1642 Merge branch 'general-devel' into crp 2017-12-22 09:42:25 -07:00
Lucas Nicodemus
91b0ed71a5 Remove connections per IP code. Closes #1577 2017-12-22 09:40:25 -07:00
Lucas Nicodemus
e370873fff Warn players if they can't modify the world
This reimplements warnings that CheckTilePermissions previously had. It
defaults to on because every single call currently in TShock expects it
to be on.
2017-12-22 01:30:29 -07:00
Lucas Nicodemus
7b2a4494b5 Move ice tile processing to TSPlayer.
This moves ice tile placement and processing from
TShock.CheckTilePermissions to TSPlayer in the form of the new boolean
'HasModifiedIceSuccessfully.' This is such a stupid thing we have to
track, but we have to track it.

Previously, we duplicated all of the check permission code and inserted
special ice code paths. This duplicated a ton of code for little gain.
The result of moving everything is that the control flow is easier to
follow.

In Terraria ice tiles are placed and melt on a timer so it's necessary
to track them being placed and removed to permit tile events that would
otherwise be blocked due to region checks and stuff. They're usually
fairly harmless blocks, and without this code, ice wouldn't work
properly. It's not ideal for this to be in TShock at all.
2017-12-22 01:16:18 -07:00
Lucas Nicodemus
195a23a7e5 Migrate most of CheckTilePermission to TSPlayer
TShock.CheckTilePermission(ply, x, y, paint) has been replaced with
TSPlayer.HasPaintPermission and TSPlayer.HasBuildPermission
respectively. These two methods dramatically simplify the logic required
to process build permissions.

Still todo after this commit:

1. Implement warnings for when a player fails a permission check on
build. This is probably going to be accomplished by a default argument
to the HasBuildPermission signature.

2. Create a variant that checks for ice tile permission and use like
HasPaintPermission() so as to remove the other
TShock.CheckTilePermission method.

Annoyingly, all of the existing methods that start with Check seem to
"check" if they player _doesn't_ have permission (true = no permission),
which makes nearly every call negative.
2017-12-22 00:31:02 -07:00
Lucas Nicodemus
fbfb509cc9 Merge branch 'checkspawn' into crp 2017-12-22 00:29:39 -07:00
Lucas Nicodemus
f93ffbc2e7 Implement named args in item stack hack check
This addresses feedback from @QuiCM and @ijwu, who pointed out that C#
allows you to specify the arguments that go into a call during
invocation, which dramatically improves readability.
2017-12-21 23:00:09 -07:00
Lucas Nicodemus
09121368e4 Move TShock.CheckRangePermission to TSPlayer
TShock.CheckRangePermission is now TSPlayer.IsInRange, but the most
important thing is that this method returns the opposite of what the
original did, so all of the calls that would go to it are now inverted.
2017-12-21 20:32:07 -07:00
Lucas Nicodemus
64241a44c7 Move TShock.CheckSpawn to Utils.IsInSpawn
Continuing in the quest to clean things out of the TShock main class,
this moves CheckSpawn out and renames it for clarity.
2017-12-21 19:54:14 -07:00
Lucas Nicodemus
6a7bc4540e Merge branch 'hackedinventory' of github.com:Pryaxis/TShock into hackedinventory 2017-12-21 18:52:16 -07:00
Lucas Nicodemus
ef1486b78c Move OnGetSection to Bouncer
Bonus: Introduces a new GetDataHandledEventArgs for use in events that
have players, data, and need to be handled.

I was originally going to modify GetDataHandlerArgs, but that comes from
the EventArgs class of args that isn't handled, and changing that to
extend HandledEventArgs would imply we care or check to see if those are
handled and we don't so we're stuck with this implementation for a
teenie tiny bit.
2017-12-21 18:49:29 -07:00
Lucas Nicodemus
390649aa56 Move OnGetSection to Bouncer
Bonus: Introduces a new GetDataHandledEventArgs for use in events that
have players, data, and need to be handled.

I was originally going to modify GetDataHandlerArgs, but that comes from
the EventArgs class of args that isn't handled, and changing that to
extend HandledEventArgs would imply we care or check to see if those are
handled and we don't so we're stuck with this implementation for a
teenie tiny bit.
2017-12-21 18:46:24 -07:00
Lucas Nicodemus
f9a1819e26 Update grammar on stack cheat messages. 2017-12-21 17:16:57 -07:00
Lucas Nicodemus
8a43c701a3 Merge remote-tracking branch 'origin/general-devel' into hackedinventory 2017-12-21 16:59:12 -07:00
Ivan
d4cb07379b
Merge pull request #1573 from Pryaxis/checkignores
Rebuilt TSPlayer.CheckIgnores() as TSPlayer.IsBeingDisabled(). Fixes #1561.
2017-12-22 00:57:54 +01:00
Lucas Nicodemus
b316ba8200 Move inventory stack hack detection to TSPlayer
Only called in one method, the stack hack detection can move to
TSPlayer as it only ever operates on one player.

In a future commit, this will replace the stack hack detection
OnSecondUpdate() and also set the disabled flag if a player has
a hacked stack when called.
2017-12-21 16:50:20 -07:00
Lucas Nicodemus
7730faf94f Change diction to refer to "saved data" on Disable 2017-12-21 08:22:51 -07:00
Lucas Nicodemus
ea630e5aa2 Rephrase SSC login message to avoid grammar choice 2017-12-20 21:32:56 -07:00