Commit graph

479 commits

Author SHA1 Message Date
stacey
d61ebb4111
Update TSPlayer.cs 2021-07-16 12:20:13 -04:00
stacey
1e9804a13d
Separate current player count and max server slots 2021-07-15 16:12:36 -04:00
stacey
b8b86a42fd
Add space after comma so names look less clustered 2021-07-15 15:51:14 -04:00
stacey
b88d1f562f
Add player count support for MOTD 2021-07-15 15:48:27 -04:00
Lucas Nicodemus
da163b80ac Allow operators to disable build permission notices
This commit allows server operators to disable build permission failure
notices. This is because some servers wish to have a "silent" operation
mode where the server doesn't send out these messages to users. This
makes sense, e.g., when the server is a "museum" and isn't intended to
be changed.
2021-06-12 23:53:17 -07:00
Lucas Nicodemus
fd97c2268a Send success messages as Color.LightGreen
Basically Color.Green looks ugly and Color.LightGreen looks less ugly. I
could see changing the default to something like pure green, but I think
this might cause people to be like "yo why is this so bright."

Now arguably this should be configurable but I'm not going to
revolutionize the world by abandoning far more important work to allow
more artful messages. I just think that Color.Green is ugly enough that
I can't tolerate it.
2021-06-12 13:22:56 -07:00
Lucas Nicodemus
e73ce17130 Add fallback for finding players using tsi & tsn
This commit adds a fallback to address problems with FindByNameOrID
potentially returning ambiguous results. Now, in response to a multiple
match error, a player can specify tsi:[number] or tsn:[exact name] to
match a user ID or name exactly. This behaves analogous to the old
behavior of the search method.
2021-05-25 19:25:30 -07:00
Lucas Nicodemus
09fe254f17 Change TSPlayer.FindByNameOrID to keep searching
Currently, the TSPlayer FindbyNameOrID method aborts if it finds an
"exact match" based on this criteria:

1. If the player ID is on the server, it must be the thing we're looking
   for. Therefore, return that.

2. If the case sensitive "exact match" is on the server that isn't an
   ID, that must be what we're looking for. Therefore, return that.

3. Just yolo and downcase everything and return any number of matching
   players next.

This commit changes the behavior because some players have been joining
servers with ambiguous names, like `1`. In the current system, this
player is difficult to query because they're an "ID" and therefore an
exact match will be returned even if a player name exists that matches
the criteria.

This also alleviates the issue of a case exact match falling down the
same trap. It's ambiguous enough in all of these situations that an
admin should just be using a player ID instead.`
2021-05-25 18:39:56 -07:00
Lucas Nicodemus
68ae73ffef Warn players if bypass SSC permission is enabled
If a player has the tshock.ignore.ssc permission, odds are that they may
want to know that their data isn't being saved or not. This change
allows users to be notified if they have SSC data stored in the DB but
they aren't having it loaded due to the aforementioned permission.

This permission causes great confusion, but we can't really change it
because we would break existing setups. This is an easy change that
gives people a reason why they suddenly "have no items."

This new option can be turned off in the config file for SSC if it's not
desired.

This change also modifies some of the log messages so that it's clear
why the SSC save didn't occur for a given player.
2021-05-21 01:16:04 -07:00
stacey
e0c9f45038
Add %specifier% to SendFileTextAsMessage 2021-05-14 12:58:16 -04:00
Chris
01fc41968d Refactor wallow command & update changelog 2021-04-19 22:04:41 +09:30
Luke
71e2ae1b31 Corrected UUID InsertBan in TSPlayer
Pointed out thanks to this discussion: https://github.com/Pryaxis/TShock/discussions/2268#discussioncomment-598331
2021-04-12 17:35:46 +10:00
Chris
e23509de75 Removed stoned and frozen from disable 2021-03-23 11:35:26 +10:30
Chris
9423febd0a Refactor for new configuration 2020-12-03 17:43:10 +10:30
Chris
3e6cdb3c71 Remove ban immunity at the command level.
Ban immunity will be managed when a ban is validated
2020-11-29 14:26:25 +10:30
Chris
cde4cc5f04 Ban rewrite and various other adjustments 2020-11-26 17:20:19 +10:30
Chris
56de9f6684 Ban rewrite 2020-11-15 11:05:04 +10:30
Chris
39e13f74d6 Remove TShock.Itembans in favour of TShock.ItemBans 2020-11-13 19:22:10 +10:30
Chris
f513ec24ad Add extra accessory slots to TSPlayer.Accessories 2020-11-13 17:44:54 +10:30
Chris
7122e5fb9a Update TSPlayer to allow sending tile rectangles 2020-11-13 17:44:27 +10:30
Rustly
01bae0475d apply the rest of fixes for snake flute, prevent players from seeing the npc perm error on join 2020-06-15 13:32:42 -05:00
Chris
d46f534533 Standardize permission rejection messages 2020-06-02 10:18:40 +09:30
Chris
badba523e7
Merge branch 'general-devel' into projectilestruct-addition 2020-06-01 19:12:38 +09:30
Chris
9fb27543b9 Some refactoring from feedback 2020-06-01 18:35:58 +09:30
Chris
36089d96bb Fix doors for real this time.
Should also fix tile entities (such as item frames, pylons) and other tile objects.
Further, fixes a longstanding issue with SendTileSquare that resulted in half squares being sent instead of full squares, causing visual bugs and desyncs most noticeable with doors
2020-06-01 15:12:45 +09:30
Patrikkk
9934a3935d ProjectileStruct - Adding extra data
Can we store the type of the recent projectile as well? This could be used in my upcoming PR regarding the golf packet where I check for recently created projectiles, and their types. Having only the index is not useful in this scenario, because the projectile can already be killed, so cannot access the Main.projectile array to get the projectile type.

Can this be public instead of internal? Developers could make good use of it, instead of having to implement their own version of RecentProjectiles in their plugins.
2020-05-30 11:22:50 +02:00
Chris
d4a0f47e45 WIP - splitting STS into new class and processing methods 2020-05-29 14:05:43 +09:30
Chris
6e4b6e1f5e Fix paint permission check 2020-05-29 13:58:44 +09:30
Zack
9209ac0b73
Apply suggestions from code review
Co-authored-by: Lucas Nicodemus <shank@shanked.me>
2020-05-24 04:19:00 -04:00
Olink
965361c406 Add a projectile tracker, so that we can allow fluid bombs. 2020-05-24 03:48:08 -04:00
Lucas Nicodemus
dbc4bd4747
Add verbose debug log for rangechecks 2020-05-22 22:16:41 -07:00
Chris
5d2945ab1f Change SendMessage & SendMessageFromPlayer to use FromLiteral not FromFormattable. Solves #1856 2020-05-23 13:05:22 +09:30
Chris
83eb707761 Update SendMessage and SendMessageFromPlayer to use inbuilt Terraria chat messaging 2020-05-22 13:27:03 +09:30
Axeel
56a9e27365
Fix player respawn again (#1830)
* fix respawn time unit, add spawn bouncer, add respawn time config warning

Co-authored-by: Lucas Nicodemus <shank@shanked.me>
2020-05-21 13:37:31 +08:00
鱼鱼
946d54b69e fix player spawn stuff 2020-05-20 21:27:49 +08:00
Patrikkk
2d5166cfa4 Updating SpawnPlayer and PlayerUpdate packet
Fixing the HasHackedItemStacks method by adding missing Void Vault check.
2020-05-18 00:04:49 +02:00
Lucas Nicodemus
b5f95d5918
Fragments: Separate out item bans (#1595)
* Remove commented out warning disable

* Add initial ItemBans segregation infrastructure

* Add shell for initial OnSecondUpdate stuff

* Add comments yo

* Remove duplicated logic

* Split out more item ban code

This part of the fragments work is primarily aimed at reducing the
complexity of OnSecondUpdate in TShock and moving that check out into
the ItemBans subsytem.

Of major note in this is the removal of "check", which was a string
variable that tracked state and replacement of many of the item ban
activities with sane private methods that are at least somewhat
sensible. Obviously there's a lot to be desired in this system and I'm
really going for a run here by trying to continue a branch from so long
ago that I barely even remember the whole point of existence.

Still to do: GetDataHandlers related item ban code needs to be moved
into its own hook in the ItemBan system. Finally, there is a downside to
some of this: we're basically iterating over players again and again if
we keep this pattern up, which is kinda lame for complexity purposes.

* alt j: comment changes

* Move item ban check out of main playerupdate check

Separates out item ban logic from the rest of GetDataHandlers so that
item bans is more isolated in terms of what fragments is asking for.

* alt-j: convert indentation to tabs

* alt-j: fix botching source code

* Move item ban related chest checks out of gdh

* Remove chest item change detection from item bans

It doesn't do anything. If a user removes an item from a chest, it
bypasses this check. If a user adds an item to a chest, the server seems
to persist the change anyway, even if the event is handled. That's a bug
for sure, but fundamentally, it's not the item ban system's fault.

* Revert "Remove chest item change detection from item bans"

This reverts commit 758541ac5c4d4096df2db05ba2a398968113e1e4.

* Fix logic issues related to item ban handling

Re-implements chest item handling and correctly handles events and
returns after setting handled event state.

* Remove TSPlayer.HasProjectilePermission

In infinite wisdom, it turns out this is not a good method for TSPlayer
to have. It just checks the states of things as per what the item ban
system says is banned and then creates implicit relationships to the
projectile ban system.

Doing this effectively knocks down another external reference to the
item ban system outside of the context of the implementation for the
system itself and its related hooks.

This commit also adds context around what the heck is going on with some
of our more interesting checks as per discussions in Telegram with @Ijwu
and @QuiCM.

* Update changelog

* Remove useless ref to Projectile.SetDefaults

* Change item ban to ban based on ID not strings

I think I was so confused as to why we were passing strings everywhere
that I just felt inclined to continue the trend in previous commits.
2020-05-16 16:27:34 -07:00
Lucas Nicodemus
70dd72443d Update copyright to 2019 again
Fixes #1658, most likely.
2019-03-29 17:16:37 -07:00
Egor
1eae5ae671 Remove TSPlayer.InitSpawn 2018-04-27 08:41:57 +03:00
Egor
ec44ae6ff6 Don't send PlayerTeam packet twice in SetTeam 2018-04-26 22:29:41 +03:00
Lucas Nicodemus
569b350cea Update to Pryaxis, 2018 part 2
If there's one thing I learned in this exercise, it's that letting
people add random python scripts to the repo like gpltext.py that
promise to be easier than find and replace is a bad idea.
2018-01-01 02:20:56 -07:00
Lucas Nicodemus
8d934ef08f Update to 2018 2018-01-01 02:17:21 -07:00
Lucas Nicodemus
cb2ed84038 Revert "Add TSPlayer.ActivePlayers"
This reverts commit 17cfdc3a16.
2017-12-31 01:25:05 -07:00
Lucas Nicodemus
17cfdc3a16 Add TSPlayer.ActivePlayers 2017-12-31 01:13:03 -07:00
Lucas Nicodemus
3ac52091ea Move SendFileToUser to TSP.SendFileTextAsMessage.
This is not a great method, but it's actually the only method in TShock
that interpolates the %map% and %players% variables and it used in at
least three places in the codebase. Since it's already so specialized,
it's not worth changing it to take an actual File object, in my humble
opinion.

This also clarifies what the method does and what makes it special, as
opposed to being fairly generic.
2017-12-29 08:40:44 -07:00
Lucas Nicodemus
48393d60c7 Move SendMultipleMatchError to TSPlayer.
This is a great method for a player to have and not for the Utils class
to have.
2017-12-29 08:15:04 -07:00
Lucas Nicodemus
152c67f27c Move Utils.Ban -> TSPlayer.Ban.
Arguably, this is one of the more controversial methods that's being
kept. Because it kicks and bans a target player, it's more useful than
removing it and requiring people to interface with the TShock Ban
Manager directly (not a good move for the future). Whether or not this
method sucks is up for debate, but right now I think it's totally fine
to keep it around in a different location.
2017-12-29 08:00:30 -07:00
Lucas Nicodemus
f74a0f6a70 Merge remote-tracking branch 'origin/general-devel' into oop 2017-12-27 19:03:03 -07:00
Lucas Nicodemus
fc689dbbc5 Remove TSPlayer.KickAll
" Ivan - Today at 6:20 PM
@ ハクサロ wouldnt TSPlayer.All.Kick() do the trick?"
2017-12-27 18:21:16 -07:00
Lucas Nicodemus
8301d6a6f3 Remove Utils.ForceKickAll; add TSPlayer.KickAll. 2017-12-27 18:07:28 -07:00