mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-11 23:00:36 +01:00
Added ominous comments
This commit is contained in:
parent
6781dbde5b
commit
1ec92801df
@ -48,6 +48,20 @@ public class AnvilListeners extends PluginDependent<EcoPlugin> implements Listen
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onAnvilPrepare(@NotNull final PrepareAnvilEvent event) {
|
||||
/*
|
||||
This code is almost as bad as AnvilMerge#doMerge
|
||||
Inventory events fire three times so I have to do weird workarounds
|
||||
I also don't know how any of this works - so many things are null
|
||||
|
||||
Do I know when the items are changed? No
|
||||
Do I know when the experience and name is set? No
|
||||
Do I know when the merge has failed? No
|
||||
But it works and I won't touch it.
|
||||
|
||||
I wrote this code in July 2020 and I'm amazed that it holds up.
|
||||
*/
|
||||
|
||||
|
||||
ItemStack left = event.getInventory().getItem(0);
|
||||
ItemStack right = event.getInventory().getItem(1);
|
||||
ItemStack out = event.getResult();
|
||||
|
@ -51,7 +51,14 @@ public class AnvilMerge {
|
||||
@Nullable final ItemStack old,
|
||||
@NotNull final String itemName,
|
||||
@NotNull final Player player) {
|
||||
// Here so it can be accessed later (scope)
|
||||
/*
|
||||
If you're currently looking at this code,
|
||||
pray to whatever god you have that any changes
|
||||
don't cause things to break.
|
||||
|
||||
I have no idea how this code works, it does - and it scares me.
|
||||
I'll just pretend that I understand it and never look at it again.
|
||||
*/
|
||||
|
||||
// Copied to non-final string.
|
||||
String name = itemName;
|
||||
|
Loading…
Reference in New Issue
Block a user