Commit graph

721 commits

Author SHA1 Message Date
ReinforceZwei
3434d95b81
Add packet palettes (#1236)
* Add packet type palette
* Fix
* test new palette
* Fix 1.16.2 palette
* Add packet ID dumper
* Add document
* Update naming
* Delete old implementation of packet type
* Rename PacketTypeHandler to PacketType18Handler
* Fix packet type namespace
* Add dump to file method for packet type
* Rename packet palette version number
* Replace unknown packet type to explicit type name
Prevent duplicated key while creating reverse mapping
* Include packets ID in packet palette
Add packet palette helper class
* Remove packet ID dumper methods
As packets ID are included in source code now
2020-08-26 19:19:59 +02:00
Рома Данилов
896cabb6ce
Improve /entity, add entity equipment and item lore (#1238)
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Color fix
* Update Entitycmd.cs
* Update Entitycmd.cs
* Entities list CustomName fix
* Update Entity.cs
* Update McClient.cs
* Update Entity.cs
* Update Entity.cs
* Update Entitycmd.cs
* Crash fixes
* Update Entitycmd.cs
* Update McClient.cs
* Update Entitycmd.cs
* Remove extra space
* Space add
* Update Item.cs
* Update McClient.cs
* Update Entitycmd.cs
* Replace item slot if already set
2020-08-26 18:58:45 +02:00
ReinforceZwei
9b8213eca5 Fix metadata optional blockID type 2020-08-25 20:43:37 +02:00
ReinforceZwei
b648e4f86d
Fix crash on custom item IDs from Forge servers (#1233)
* Fix unknown item id cause crashes for handling non-vanilla item (i.e. forge item)
* Add Unknown item type and use ItemType.Unknown for unknown items
Co-authored-by: ORelio <ORelio@users.noreply.github.com>
2020-08-24 22:38:08 +02:00
ORelio
70c991cd30 Calulate dig range using eyes location (#1228) 2020-08-24 00:06:52 +02:00
ORelio
ee164dfcc2 Replace ZombiePigman with ZombifiedPiglin
Use "ZombifiedPiglin" in place of "ZombiePigman" for older versions of Minecraft.
2020-08-23 23:48:22 +02:00
ReinforceZwei
dc5ca8c79a Update hostile mobs list 2020-08-23 23:48:22 +02:00
ORelio
676c6a68a7
Allow digging up to 5 blocks away (#1228)
Current calculation was limiting to >= 4 blocks away, but vanilla Minecraft can dig up to 5 blocks away.
2020-08-23 20:35:54 +02:00
Рома Данилов
017d9b1840
Crash Fix, add Respawn method (#1227)
* Crashes Fix
* Add Respawn
* Crashes Fix
* Update McClient.cs
* Update McClient.cs
* Fix Air item count to 0
2020-08-22 11:17:31 +02:00
Рома Данилов
c2e2e85063
Add Entity.Item, Entity.CustomName, OnEntityMetadata event (#1222)
* Add New Event
* new Event
* Add OnEntityMetadaTa
* Update ChatBot.cs
* Update Protocol18.cs
* Update Entity.cs
* EntityCMD Update
* Update IMinecraftComHandler.cs
* Update Protocol18.cs
* Update IMinecraftComHandler.cs
* Update McClient.cs
* Update IMinecraftComHandler.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update ChatBot.cs
* Update McClient.cs
* Update Entity.cs
* Create EntityPose.cs
* Update MinecraftClient.csproj
* Update McClient.cs
* Update EntityPose.cs
* Update Entity.cs
* Update McClient.cs
* Remove debug line
* Update Entitycmd.cs
* Update Entity.cs
* Update McClient.cs
* Update Entity.cs
* Update McClient.cs
* Update McClient.cs
* Update Entity.cs
* Update McClient.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update McClient.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entity.cs
* Update McClient.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Update Entitycmd.cs
* Crash Fix on Item
* Crashes Fix
* Update McClient.cs
* Crashes fix
* Update McClient.cs
* Update Entity.cs
* Update Entity.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update McClient.cs
* Update ChatBot.cs
* Update IMinecraftComHandler.cs
* Update McClient.cs
* Update Protocol18.cs
* Update ChatBot.cs
* Update IMinecraftComHandler.cs
* Update Protocol18.cs
* Update McClient.cs
* Fix unaddressed issues
Co-authored-by: ORelio <oreliogitantispam.l0gin@spamgourmet.com>
2020-08-20 18:36:50 +02:00
ORelio
a6a5f0c333 Fix TimeoutDetector killing itself (#1219) 2020-08-20 13:29:02 +02:00
ORelio
e6bd2090ab Fix AutoAttack variable name 2020-08-20 13:28:40 +02:00
ReinforceZwei
fb3f5ed040
Use MC 1.16 translation files (#1223)
In order to support newer translations like piglin-related kill messages
* Update translation file indexes web URL to the latest
* Update translation file local assets location
2020-08-20 13:07:13 +02:00
Рома Данилов
3adf7c4468
Add OnDeath event for ChatBots (#1220)
* Add New Event
* new Event
2020-08-18 21:08:19 +02:00
ReinforceZwei
e71d0e2383
Improve AutoAttack (#1218)
* Improve AutoAttack
- New attack mode
- Fix abnormally low attack damage
* Add document for AutoCraft
* Improve code style and user feedback
* Correct spelling mistakes
2020-08-18 13:02:36 +02:00
ReinforceZwei
2fd610aa65
Fix SetSlot (#1144)
* Fix SetSlot - Pull request no #1217
2020-08-18 12:57:56 +02:00
ReinforceZwei
d8afda34fb Fix AutoDrop being loaded when inventory handling is disabled 2020-08-17 18:13:01 +02:00
ReinforceZwei
6bbb7236e3
Add support for Minecraft 1.16.2 (#1214)
* Implement MC version 1.16.2 basic support
All packets ID update done
Tested in 1.16.2 craftbukkit server
* Implement MC 1.16.2 entity handling
New EntityPalette
* Add back protocol version checking for entity handling
Was removed during testing and forgot to add it back
* Implement inventory handling for MC 1.16+
Item ID got changed in 1.16+ so a palette is needed.
* Fix ChangeSlot command
What a joke
* Handle 1.16 new entity properties name
Convert new naming style to old style
* Revert "Handle 1.16 new entity properties name"
This reverts commit 52c7d29062.
* Update AutoAttack to use the new entity properties key
* Fix item type to ID conversion
* Sort item types by name
* Remove ZombiePigmanSpawnEgg
User ZombifiedPiglinSpawnEgg instead (new name for same item)
* Add missing 1.16.2 version strings
* Remove old ItemTypeGenerator
* Sort entity types by name
* Palette loading, instructions, NotImplemented err
Co-authored-by: ORelio <ORelio@users.noreply.github.com>
2020-08-17 17:08:50 +02:00
ReinforceZwei
ee5199f760 Fix AutoCraft still being loaded when inventory handling is disabled 2020-08-17 16:31:51 +02:00
Рома Данилов
33781c5de5
Inventory: Show item Damage (#1213)
* /inventory add show item Damage
* Removing unnecessary using
* Upgrade
* Fix
* Update Inventory.cs
* add Damage
* Done
* Done, Fix
* Remove extra space, Fix documentation
2020-08-17 12:27:15 +02:00
ReinforceZwei
08db87e5f6
Fix 1.16 entity metadata and equipment (#1211)
* Fix 1.16 Entity Equipment
* Fix #1209
Rename variable to meet naming rule
* Remove key checking
* Revert "Fix 1.16 Entity Equipment"
This reverts commit 6c46fc3ba4.
* Remove comment related to `data[key] = value`
Comment is not needed anymore as the value is set or overwritten automatically (no catch)
2020-08-17 11:43:10 +02:00
ReinforceZwei
236e077e44
Add TPS command and improve the calculation of TPS (#1210)
* Add tps command
* Improve tps calculation and tps command
* Remove debug log line
* Improve if-else statement
2020-08-17 11:40:06 +02:00
ORelio
4fb47f20c7 Improve WindowActionType doc (#1208) 2020-08-15 21:32:30 +02:00
ReinforceZwei
2c8ec4aa4a
Implemented entity metadata to keep track of entity health (#1205)
* Implement entity metadata protocol handling
* Add health information for entity
* Make AutoAttack check entity health
* LivingEntity: Default health is 1.0 as per https://wiki.vg/Entity_metadata#Living_Entity
* Fix entity metadata for lower MC versions
* Fix commit  888297d (1.0f instead of 1.0)
* Add OnEntityHealth ChatBot event (Remove protocol-dependant stuff from McClient (undo part of 85c32b9))
* Remove OnEntityMetadata in favor of OnEntityHealth
Co-authored-by: ORelio <ORelio@users.noreply.github.com>
2020-08-15 15:32:46 +02:00
ReinforceZwei
526dabd1e7
Implement inventory mouse item dragging (#1208)
* Implement inventory mouse item dragging
* SendWindowAction: Format switch/align statements
* Document window action types
Co-authored-by: ORelio <ORelio@users.noreply.github.com>
2020-08-15 14:17:18 +02:00
Рома Данилов
4a3a23eb1d
Update VkMessager.cs (#1203)
* Update VkMessager.cs
* Fix
* Complite
* Update VkMessager.cs
2020-08-14 20:43:59 +02:00
ReinforceZwei
dbffe98cd0
Update AutoAttack (#1204)
Move animation packet out of the loop to reduce the packet sent per second
2020-08-14 20:43:06 +02:00
ORelio
c3ace103c6 Fix crash on MC 1.7 update score (#1199) 2020-08-13 23:05:23 +02:00
Рома Данилов
3c30b34b91
Update VK API (#1201)
* Update VK API
* Fix copy paste
2020-08-13 10:30:35 +02:00
ORelio
59981c785b Fix crash on MC 1.7 chat message (#1199) 2020-08-12 22:05:48 +02:00
Рома Данилов
3f94814bda
VkMessager: New SendMessage RandomID core (#1198) 2020-08-12 21:47:20 +02:00
ReinforceZwei
e6d34c3cf1
Add entity handling for 1.10 to 1.12.2 (#1195)
* Fix entity type data type for 1.13 below
* Add entity handling for 1.10 to 1.12.2
* Update comments for EntityPalette113
2020-08-11 13:44:18 +02:00
ORelio
a28409043c Implement Forge FML2 protocol (MC 1.13+) (#1184)
Forge uses a different handshake scheme in FML2 protocol.
This handshake scheme uses LoginPluginRequest/Response packets.
2020-08-11 12:52:38 +02:00
ReinforceZwei
aeac56890b Fix AutoCraft bugs
Fix recipe parse error
Fix crashes on crafting failure
2020-08-11 10:34:32 +02:00
Рома Данилов
d33677a245 Update VK API Version 2020-08-10 20:13:20 +02:00
ORelio
294d85d5e1 Fix joining Forge servers without mods (#1189)
Regression from 74151097ff
2020-08-09 18:41:13 +02:00
ORelio
b4d99eb8a3 Add color test in debug mode (#1187) 2020-08-09 18:38:24 +02:00
ORelio
74151097ff Implement FML2 mod list in server ping (#1184) 2020-08-08 22:08:38 +02:00
ORelio
24b3dac2a3 Show server ping json in debug messages (#1184) 2020-08-08 14:30:39 +02:00
ORelio
1485612f29 Fix FileMonitor.WriteAllLinesWithRetries (#1186) 2020-08-08 14:08:12 +02:00
ORelio
ce83cc0a33 Use FileMonitor to synchronize Mailer bot (#1108) (v2)
Move SessionFileMonitor into a generic FileMonitor class
Use FileMonintor for both SessionCache and the Mailer bot
Allows multiple MCC instances to share the same database files

(Add files missing in the previous commit)
2020-08-07 11:58:44 +02:00
ORelio
5028cce2a5 Use FileMonitor to synchronize Mailer bot (#1108)
Move SessionFileMonitor into a generic FileMonitor class
Use FileMonintor for both SessionCache and the Mailer bot
Allows multiple MCC instances to share the same database files
2020-08-07 11:55:15 +02:00
Рома Данилов
ccc364df34
Add OnTimeUpdate() and OnRespawn() to ChatBot API 2020-08-07 10:35:23 +02:00
ORelio
2034729f74 OnPlayerLeave: keep username before deleting (#1181) 2020-08-06 16:01:14 +02:00
ReinforceZwei
4a8fb08f4b
Add player join/leave event to ChatBot API (#1181)
* Add player join/leave event to ChatBot API (#1180)
* Add method documentation
* Dispatch Join/Leave after updating player list
Co-authored-by: ORelio <ORelio@users.noreply.github.com>
2020-08-06 15:57:23 +02:00
ORelio
a17d60047a Mailer: Fix case insensitivity for recipient (#1176) 2020-08-04 18:18:30 +02:00
Daenges
92e776cebc
Add Mailer bot (#1108)
* Update for the mail script.

As requested, I added the synchronization between the config debugmessage bool and the one in the script. Furthermore, I added a way to send anonymous mails by writing "tellonym". The messages are saved as normal mails, which lets them count to the mail cap, due to the fact that the host knows the sender.

I added the script to the chat bots because of the problems, that the scripts have with serialization. Instead of rewriting the whole serialization part, my idea was to add the script to the other chat bots, to avoid the compiling issues. Then the serialization would work perfectly fine. Then you could remove the option class at some point and move all the settings to the config file with the addition to activate the whole script.

* Correction of debug message loading.

The object was missing and the change would be overridden a few lines later.

* Update McClient.cs

* Add Mail to config file

* Correcting the safe file.

* Small correction of Settings.c

* Update Mailscript

Added a failsafe version of the path changing commands. If a path could not be found, an error will be created and the path will be reseted to standart, to avoid endless chains of errors.

* Fix for the mail script

Removed a wrong option call. Removed the debug_msg condition around the path functions. => Users are aware of what happened (if they see the error) although they turned off debug_msg.

* Added some features.

Added a try statement to all number changing commands. Added a command to list all moderators to the console.

* Serialization Fix

There was a chance, that if two bots work on one file, and two users send messages in a short time period, that one bot deserializes the message and then the other bot deserialize the same file, before the other one could save its changes. This would lead to one message disappearing, because one bot never deserialized this message. For this I changed the whole serialization process. 
All changes are now committed after the interval and not after an incoming mail command directly. All mails are safed temporarily in cache and get serialized after the interval. Due to this changes, you can determit when the individual bot changes the file (there are no more direct interactions with the file after a command, which lead to a certain randomness). Furthermore you can now set an interval of e.g. 2 mins and reset the interval of one bot with "resettimer" after one minute so that the bots won't disturb eachother and no files get lost.

* My idea of a manual.

This is my idea of a manual for the bot. Improvements of my language / further ideas are welcome! :D

* addIgnored [NAME] and removeIgnored[NAME]

Added an ignored list. Moderators can add players to the list. The bot won't react to them and just log to the console that they are ignored, everytime they are sending a message, to ensure that they are not accidently ignored. (Just if debug_msg is active.)
 Especially useful if there are other chat bots on the server, which spam many messages that aren't useful for the mail system. Or block spammers etc.

* Add the three commands to the manual.

Added addignored, removeignored and getignored to the manual.

* Remove moderators. Implement Console Control.

Due to security concerns, I converted all moderator commands to console internal commands. Thereby only the host can change crucial settings. Special thanks to ORelio for the hint!

* Added empty statement check

Added if to all commands, where the syntax is not already protected by a try, so that an incorrect syntax (Empty args[] due to missing statement) won't crash the script.

* Changed the serialization fail

If the programm can't safe the file, because of some strange character for instance, it first tries to change the path back to normal and if this not helps, it creates a new, file.

* toggle mail sending/receiving

Add an option to turn mailsending and the listening to commands in chat on/off.

* Updated manual.

- Removed moderator commands.
- Removed moderator part in the network manual
+ added the two new commands
+ added a waring for nick plugins and minecraft renames
+ added a small syntax example

* Updated the Settings.cs file.

* Smaller fixes and additions

+ improved command reading of 'mail' & 'tellonym'
+ sorted internal commands alphabetically
+ host can set a maximum message length
+ host can accept commands from public chat
+ host can decide if 'self mailing' (mailing yourself) is accepted
+ new order makes 'getsettings' easier to read
+ new internal commands to toggle 'publiccommands' and 'selfmailing' as well as the maximum mail size
- removed the old command interpreter

* Small improvements and additions

Added a few commands and settings

* Completing getsettings

+ added 'publiccomands'

* Completed getsettings

+ Added 'publiccommand' to 'getsettings'

* Removed single bolean, added Dictionary

- removed all boleans in the option class
- removed all functions relating them
+ added Dictionary for the booleans
+ added a single function to set/toggle all booleans

* Removed Commands, added interpreter

- Removed all Register commands
- removed all integer methods
+ added a single mail command
+ added integer dictionary
+ added integer handling similar like bool handling

* Small fix

+ Changed the numbers in several methods to adjust them to the new syntax.
- removed parameters in several methods, because they got unneccesary

* Even smaller fix

+ Sorted 'getsettings' alphabetically
+ corrected a typo

* New Serialization method.

Now serializing through the .INI format! Thanks to ORelio, who helped me a lot! :)

* Added different time

Added the option to switch between utc and the time of the local machine for timestamps.

* Made timeinutc serializable

Added the bool to the serialization method.

* Adding the INIFile.cs

For Dictionary serialization.

* Reworked ignore feature

Ignored players are now serialized in a file and reloaded, after the bot enters a server.

* Mailer bot refactoring

Rename Mail to Mailer
Move options to MinecraftClient.ini
Make the bot much simpler by removing some settings
Create specific MailDatabase and IgnoreList classes
However the core functionality for users is the same

Settings removed:
 - allow_sendmail: Cannot use Mailer if it's disabled
 - allow_receivemail: Cannot use Mailer if it's disabled
 - path_setting: Settings moved to MinecraftClient.ini
 - debug_msg: MCC already has a setting for that with LogDebugToConsole()
 - auto_respawn: MCC already has a built-in auto-respawn feature
 - allow_selfmail: Is it really necessary to block self mails? ;)
 - maxcharsinmsg: Automatically calculated based on max chat message length
 - timeinutc: DateTime is not show to the recipient so I think it's not absolutely necessary
 - interval_sendmail: Set to 10 seconds for now

Internal Commands removed:
 - changemailpath: Now a static setting in config
 - changesettingspath: Now a static setting in config
 - updatemails: Already updated every 10 seconds
 - getsettings: Shown on startup with debugmessages=true
 - resettimer: Seems only useful for debugging
 - setbool: Settings are static in config file
 - setinteger: Settings are static in config file

All user commands are retained:
 - mail
 - tellonym

* Reload database for mailer network feature

* Merge Mail documentation to Readme.md

Co-authored-by: ORelio <oreliogitantispam.l0gin@spamgourmet.com>
2020-08-03 21:44:39 +02:00
ReinforceZwei
ca1e902307
Add help information for inventory command (#1170)
* Add help information for inventory command

* Change optional parameter representation
2020-08-03 14:13:07 +02:00
Рома Данилов
712875251e
Add UnLoadBot to ChatBot API (#1164)
Add UnloadBot
Add BotList
Update VkMessager
Remove debug info
2020-08-01 14:24:17 +02:00
Рома Данилов
55f8988bbc
Allow DLLs in scripts, Update VKAPI (#1158)
* Update VKAPI
* KeyBoard Update
* Add Custom Libs
* Change add method
2020-08-01 13:02:58 +02:00