Commit graph

1103 commits

Author SHA1 Message Date
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
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
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
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
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
97f48d6d41 Renamed TSPlayer.CheckIgnores() -> TSPlayer.IsBeingDisabled()
Since all of the flags it was checking have been demystified, this
is pretty self explanatory now.
2017-12-20 17:42:59 -07:00
Lucas Nicodemus
8e5ee7d286 Renamed IgnoreActionsForClearingTrashCan to conform w/ changes
This just changes IgnoreActionsForClearingTrashCan to meet the
same naming scheme for the rest of the old ignore checks. For
consistency. Consistency is nice.
2017-12-20 17:33:18 -07:00
Lucas Nicodemus
4e186e7375 Replace TSPlayer.IgnoreActionsForDisabledArmor -> boolean
TSPlayer.IgnoreActionsForBannedArmor was useless because it only
stored the last armor/dye a player had. Replaced with a boolean.
2017-12-20 17:29:10 -07:00
Lucas Nicodemus
7efcfd055f Replace TSPlayer.IgnoreActionsForCheating w/ boolean
This replaces IgnoreActionsForCheating in TSPlayer with a new
IsDisabledForStackDetection field that tracks the same basic data.

The previous way we did this was storing a string as the "reason"
why a player was disabled for cheating, but it only stored the last
hacked item stack that caused the check to fail. Since we already
have OnSecondUpdate which notifies on _all_ items, we don't need
to store this info in such a useless way anyway. They'll find out
in one second what they need to remove in a more alarmist way.
2017-12-20 17:19:14 -07:00
Lucas Nicodemus
1ef28dfe0d Replace TSPlayer.IgnoreActionsForInventory => IsDisabledForSSC.
This is the first commit in a series to rewrite CheckIgnores()
into whatever its replacement becomes.

IgnoreActionsForInventory was probably used by the SSC system prior
to when we had in-game support for SSC (ergo, when we just checked
to make sure you had removed all items before joining and worked
our way up in inventory data to track it). I could be wrong about
this though.

Now, IsDisabledForSSC tracks only if a player is shut down due to
SSC, rather than a reason that gets broadcast.
2017-12-20 17:01:55 -07:00
Lucas Nicodemus
0260530848 Change Bouncer initialization to a more permanent home 2017-12-16 01:09:40 -07:00
Lucas Nicodemus
1bee289daf Move TShock.CheckIgnores(TSPlayer) -> TSPlayer.CheckIgnores()
Note: This method really sucks and needs to be rebuilt anyway.
2017-12-16 01:03:05 -07:00
Lucas Nicodemus
3f22c52698 Move StartInvasion() out of the TShock main class 2017-12-14 07:56:41 -07:00
Lucas Nicodemus
2f4b1a5bfc Merge branch 'general-devel' into fragments 2017-12-14 07:06:31 -07:00
Lucas Nicodemus
9d6de89a0b
Merge branch 'general-devel' into better-readme 2017-12-14 00:38:36 -07:00
Lucas Nicodemus
b6bc57745f Alnitak is a star in the constellation Orion, part of Orion's Belt 2017-12-13 23:08:43 -07:00
Lucas Nicodemus
ffdcd34c91 Fix issue where setup system could re-enable itself
The current initial setup system would re-enable if setup.lock
was removed even if an account was in the database. This is
because when we switched to "owner" being the primary target
of the setup system, we failed to anticipate that an account with
superadmin would never exist in the database in an ideal
condition.
2017-12-13 22:45:41 -07:00
Lucas Nicodemus
8451ef9fb7 Switch the "auth system" to "initial system" everywhere.
This is better verbiage. If you think about it, you never really
want the "authentication system" to shut off. Doesn't that mean
that the server doesn't authenticate people anymore?
2017-12-13 22:38:44 -07:00
Lucas Nicodemus
9b8aaceb12 Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-10 23:45:03 -07:00
Lucas Nicodemus
ba851d3570 Remove TShock.CheckProjectilePermission
Add TSPlayer.HasProjectilePermission() and its inverse:
	TSPlayer.LacksProjectilePermission()
2017-12-10 23:38:03 -07:00
Patrikk
740ad4d6c3 Add missing "if handled - return" code. 2017-12-10 20:14:54 +01:00
Lucas Nicodemus
031398591a Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-09 08:44:49 -07:00
Edgar Luque
07da3d5f58 missed some more declarations 2017-12-08 01:48:08 +01:00
Edgar Luque
6589531868 Renamed TShockAPI.DB 'User' to 'UserAccount' 2017-12-08 01:38:15 +01:00
Lucas Nicodemus
4e3cd00848 Merge branch 'general-devel' into fragments 2017-12-06 21:14:45 -07:00
Lucas Nicodemus
e782a07564 Move SendTileSquare handling for Bouncer into Bouncer 2017-12-05 02:32:33 -07:00
Lucas Nicodemus
fc233bd3f1 Move ComputeMaxStyles to Utils 2017-12-04 21:57:59 -07:00
Lucas Nicodemus
e85d79e23d Move Distance to Utils.Distance 2017-12-04 21:53:46 -07:00
Lucas Nicodemus
17982bd766 Move SetConsoleTitle to utils 2017-12-04 21:49:56 -07:00
Lucas Nicodemus
7c47fbb3f2 Move FixChestStacks() to utils 2017-12-04 21:45:25 -07:00
Lucas Nicodemus
39733a116d Fix issue where temp bans were stored incorrectly
Bans were being stored as seconds, should be a DateTime in s format
with seconds added on to existing time.
2017-12-02 20:59:30 -07:00
Lucas Nicodemus
7160e758b2 Unbreak comment OnPlayerPreLoginOnPlayerPreLogin 2017-12-02 20:44:17 -07:00
Lucas Nicodemus
718525904a Add remaining backbone for banning accounts (sort of)
Frontend still doesn't work properly. In particular:

1. Need a way to list bans by account name.
2. Need a way to unban by account name.
3. Really need a way to change the IP on a ban lol.

Ban system still needs to be be rebuilt fully, but at least this
doesn't necessarily character ban someone if you were going for an IP
ban.

Fixes #1412
2017-12-02 20:41:14 -07:00
Lucas Nicodemus
204f4c3f4f Add succinct GPL disclaimer. Fixes #1430. 2017-12-02 18:09:24 -07:00
quake1337
e6ec63a90e Add @ijwu's changes + add /proc/meminfo trick for linux 2017-09-20 09:27:28 +02:00
quake1337
68437f0a22 Add "less than 2gb ram" warning 2017-08-14 14:39:22 +02:00
MarioE
241d4c566f Fix incorrect slot calculation, and update submodule. 2017-06-23 14:44:17 -04:00
MarioE
331eeb8cec Fix SaveManager saving when 1 player is on the server and another joins
The real fix would be to fix ServerLeave to not fire incorrectly when a player joins, but this will do for now.
2017-06-19 01:15:45 -04:00