Commit graph

195 commits

Author SHA1 Message Date
Lucas Nicodemus
17d151b8f8 Move HasBanExpired to Bans.RemoveBanIfExpired().
The ban system needs a full rewrite anyway, but this move removes
something from Utils, puts it closer to its operating point, simplifies
the method, and clarifies what it actually does.
2017-12-29 08:32:45 -07:00
Lucas Nicodemus
f06d1fd238 Remove Utils.GetPlayers().
This is a public method that only has two uses in TShock and both of
them are listing players to a player. A foreach isn't rocket science and
this method was originally created just because there was no good object
to iterate on (e.g., a TSPlayer array).
2017-12-29 08:26:51 -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
afdedee1c4 Change Utils.Reload to not take a player.
There are two occasions in the codebase when Utils.Reload is called and
we're competent enough that we can just call the event when the reload
happens. Unrelated note, but shouldn't this event be called prior to
reloading? I've kept it the same to preserve existing behavior, but I
think it should probably happen before the reload event takes place.

Either way, I think this is fine.
2017-12-29 08:04:20 -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
a5a3aae599 Remove Utils.GetPlayerIP() 2017-12-27 19:29:45 -07:00
Lucas Nicodemus
f74a0f6a70 Merge remote-tracking branch 'origin/general-devel' into oop 2017-12-27 19:03:03 -07:00
Lucas Nicodemus
70f22c1e70 Fix Travis 2017-12-27 18:23:11 -07:00
Lucas Nicodemus
8301d6a6f3 Remove Utils.ForceKickAll; add TSPlayer.KickAll. 2017-12-27 18:07:28 -07:00
Lucas Nicodemus
1ea04ffd4f Remove Utils.ForceKick; use TSPlayer.Kick.
Some anti-cheat calls were changed to "You have been Bounced." I don't
think we need to tell clients why they were disconnected so they can
tune their hacks better.
2017-12-27 18:01:53 -07:00
Lucas Nicodemus
f79c6a2962 Move Utils.Kick to TSPlayer.Kick 2017-12-27 13:00:13 -07:00
Lucas Nicodemus
e705e398e8 Return real nulls as opposed to string nulls 2017-12-27 11:30:39 -07:00
Lucas Nicodemus
b613fdcda6 Remove Utils.ActivePlayers
Duplicated what an array already stored and told us, but added code and
was obscure. It predated TSPlayers existing.
2017-12-26 21:14:16 -07:00
Lucas Nicodemus
9648e9ac0c Remove excess space 2017-12-26 20:55:33 -07:00
Lucas Nicodemus
11920cde48 Move Utils.FindPlayer -> TSPlayer.FindByNameOrID.
This makes TShock more OOP like (get the matching players from the
player as opposed to getting the players from a random class that
shouldn't exist).
2017-12-26 20:53:00 -07:00
Lucas Nicodemus
cb47240c7e Fix indentation on one line in utils 2017-12-26 20:17:11 -07:00
Lucas Nicodemus
846386f98a Merge remote-tracking branch 'origin/general-devel' into old-code 2017-12-26 20:07:34 -07:00
Lucas Nicodemus
903bd5bb75 Migrate AddBan2 calls to AddBan
No more deprecation warnings on this release #yolo
2017-12-26 20:05:52 -07:00
Lucas Nicodemus
0b98ac5fc1 Remove deprecated motd, color code support 2017-12-26 19:54:21 -07:00
Lucas Nicodemus
f942a6c98a Revert "Change Utils.SearchProjectile to return -1 in error"
This reverts commit e19fd22fe0.
2017-12-24 20:09:12 -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
5f647f087c (Probably) fix invasions started by TShock being weird
TShock used to call the StartInvasion method in Main with a type
and a size, but then in some update it stopped taking a size. So
you have to change a field to change the size, but the problem is
that the field is reset when StartInavsion is called. This means
that any effort to manually change the size would have failed due
to the fact that the field is reset at the end. The order has been
changed to account for this.

In addition, the start size is now set, so the game can report
progress correctly on the current invasion.
2017-12-14 08:08:57 -07:00
Lucas Nicodemus
3f22c52698 Move StartInvasion() out of the TShock main class 2017-12-14 07:56:41 -07:00
Lucas Nicodemus
b808ad8e4c Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-11 16:28:20 -07:00
Lucas Nicodemus
3bed40ec65 Remove Utils.RestartServer (thanks @QuiCM!) 2017-12-11 16:01:09 -07:00
Lucas Nicodemus
e19fd22fe0 Change Utils.SearchProjectile to return -1 in error
Thanks for checking this out, @bartico6. Fixes #1549.

Note: this method only returns 1 because the game won't allocate
more identity/index combo. Apparently, according to RL.
2017-12-11 08:18:23 -07:00
Lucas Nicodemus
3e5c1bf0c5 Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-09 21:06:47 -07:00
Lucas Nicodemus
434e817b68
Merge branch 'general-devel' into fix-permdump 2017-12-09 19:29:34 -07:00
Zaicon Kiroshu
4638b85adc Fixed IndexOutOfRange exception 2017-12-09 18:48:40 -06:00
Lucas Nicodemus
14c071350c Mark Utils.DumpPemrissionMatrix as internal 2017-12-09 17:15:21 -07:00
Lucas Nicodemus
985dcebda9 Comment what DumpPermissionMatrix does 2017-12-09 17:14:59 -07:00
Lucas Nicodemus
63179deaa5 Adds /dumpdata which dumps the permission table & ref data. 2017-12-09 15:54:51 -07:00
Lucas Nicodemus
031398591a Merge remote-tracking branch 'origin/general-devel' into fragments 2017-12-09 08:44:49 -07: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
349770e6ed Remove more silly comment style problems 2017-12-06 17:10:05 -07:00
Lucas Nicodemus
215fc4a9b1
Merge branch 'general-devel' into rps 2017-12-06 13:00:36 -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
c869464d81 Add DumpPermissionMatrix() which dumps a markdown permission matrix
Note that -dump apparently isn't working lately. You probably want
to call Utils.Dump() manually and invoke it in a custom build.
2017-12-03 12:56:34 -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
ProfessorXZ
5a04b66514 Make Utils.GetBuffDescription actually return the buff's description & properly read 'buffTime' from the stream. Fixes #1469 2017-09-08 21:59:13 +02:00
ZIT WANG
961c857c4b Resolve duplicate negative ids items in Utils.GetItemByName 2017-05-02 19:43:30 +08:00
ZIT WANG
58e2b85f59 Fix an issue that causes client crash after receiving long text 2017-04-25 20:01:24 +08:00
ZIT WANG
a026c5809f Fix duplicate items shown in Utils.GetItemByName
* Remove unused usings
2017-04-25 15:10:24 +08:00
Lucas Nicodemus
36538caa43 Merge pull request #1426 from mistzzt/t-1.3.5
Add Localization support
2017-04-22 10:01:34 -06:00
ZIT WANG
f47c6505ab Add null check for English name 2017-04-22 07:34:59 +08:00
ZIT WANG
08d37eb6de Fix duplicate statement 2017-04-22 07:21:48 +08:00