A plugin that controls the ChromaBot Discord bot and provides Minecraft chat functionality and other features.
Go to file
Norbi Peti 6b60135867
NorbiPeti has completed the challenge [Bullseye]
Using the custom event to detect player /stop as now restarts can come from there too (btw it defaults to stop unless a command is ran)
Added support for advancements in 1.16:
- Now each player gets effectively a reference to the player list for advancements, and since I simply call the method on the original object, it will pass that on, instead of my mock
- I tried calling the method that sends the reference on the mock in that case, but that just results in Mockito's version being called which means infinite recursion or something like that (I didn't get a StackOverflowError actually but the server didn't respond)
- I tried implementing the method myself but actually I never tested it because at that point I was convinced I can call the original the right way
- I had an educated guess that the mock is a subclass of the original class, so I just need to call super.method() right?
- But how do you call that reflectively? Apparently Method.invoke() will always respect overriden methods; but thanks to StackOverflow I found out about MethodHandles, and it has the perfect thing I need, findSpecial / unreflectSpecial
- Only problem is, kind of like how you can only use super.method() inside the class, you can only use the 'special' methods inside the class... So how could I make it run inside the mocked class? I have no idea since I can only supply an Answer object which has no connection to it, but apparently all the lookup() method actually does is call a constructor with the caller's class - so let's call the constructor! Which is, of course private
- So now I have a reflection call creating a Lookup object which can get a handle to the method without checking any overrides and then using that handle to call the original method with the 'this' parameter being the mock
#128
2020-07-30 01:54:58 +02:00
.github Create ISSUE_TEMPLATE.md 2018-06-16 23:08:47 +02:00
src NorbiPeti has completed the challenge [Bullseye] 2020-07-30 01:54:58 +02:00
.editorconfig Use VCL14 for 1.15, player sender mock 2020-03-11 12:00:20 +01:00
.gitignore Channel connect, fixes 2018-05-22 22:43:36 +02:00
.travis.yml Set up GitHub Releases deploy 2020-02-10 12:56:48 +01:00
deploy.sh Fix update dir 2018-06-15 20:07:24 +02:00
License.md Finished game roles 2018-05-07 01:11:08 +02:00
lombok.config Fixed channelcon echo 2018-07-22 13:11:24 +02:00
pom.xml NorbiPeti has completed the challenge [Bullseye] 2020-07-30 01:54:58 +02:00
README.md Fix custom chat PL update NPE (#124) 2020-02-17 13:02:15 +01:00

Chroma-Discord

A plugin that provides Minecraft chat functionality and other features.

Setup

This plugin needs Chroma-Core to work. If you have that and this plugin, start the server, and follow the instructions. You'll need a Discord application made, and a bot account created for it. You can restart the plugin using /discord reset without having to restart the whole server.

Building

Maven is used to build this project with all of its dependencies. You will need Spigot 1.12.2 and 1.14.4 built using BuildTools.