-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Block Handlers | ||
|
||
Block Handlers can be used to display info for the blocks that the player is looking at. | ||
|
||
<procedure title="Adding a Block Handler" id="adding_a_block_handler"> | ||
<step>Make a class which will hold our handler funtion.</step> | ||
<step>Make a function which will be the handler. | ||
<code-block lang="java"> | ||
private static boolean handleMyBlock(Block block, Player player) { | ||
// Check if this block belongs to your blocks | ||
if (/* your condition */) { | ||
// Add your logic | ||
WITAPI.updateBar(yourInfo, player); | ||
// `yourInfo` is the string shown on the boss bar. | ||
// `player` is the one received by the handler from the plugin. | ||
|
||
return true; // Block successfully handled | ||
} | ||
|
||
return false; // Not your block, skip it | ||
} | ||
</code-block> | ||
</step> | ||
<step>Now that you have made a handler, you must register the handler so it's actually used by WIT, this can be done by: | ||
<code-block lang="Java"> | ||
WITAPI.addBlockHandler(YourClass::handleMyBlock); | ||
</code-block> | ||
</step> | ||
<step>That's it! you have now successfully made a Block Handler!</step> | ||
<step>A complete example of a block handler (this uses the internal [WAILAManager]): | ||
<code-block lang="Java" src="../../src/main/java/me/darksoul/whatIsThat/compatibility/MinetorioCompat.java"> | ||
</code-block> | ||
</step> | ||
</procedure> | ||
|
||
<procedure title="Removing a Block Handler" id="removing_a_block_handler"> | ||
<step>Removing a block handler is a one-liner!: | ||
<code-block lang="Java"> | ||
WITAPI.removeBlockHandler(YourClass::BlockHandlerFunc) | ||
</code-block> | ||
</step> | ||
</procedure> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Default Handlers | ||
|
||
<tabs xmlns=""> | ||
<tab title="Block Handlers"> | ||
<code-block lang="Java"> | ||
LiteFarmCompat::handleLitefarmCrop | ||
MinetorioCompat::handleMTDisplay | ||
ItemsAdderCompat::handleIABlocks | ||
SlimefunCompat::handleSlimefunMachines | ||
NexoCompat::handleNexoBlock | ||
</code-block> | ||
</tab> | ||
<tab title="Entity Handlers"> | ||
<code-block lang="Java"> | ||
ValhallaMMOCompat::handleVMMOEntity | ||
ItemsAdderCompat::handleIAEntity | ||
EliteMobsCompat::handleEMEntity | ||
AuraMobsCompat::handleAuraMobs | ||
NexoCompat::handleNexoEntity | ||
</code-block> | ||
</tab> | ||
</tabs> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Entity Handlers | ||
|
||
Entity handlers can be used to display info about the entity the player is looking at. | ||
|
||
<procedure title="Adding an Entity Handler" id="adding_an_entity_handler"> | ||
<step>Make a class which will hold our Handler.</step> | ||
<step>Make a function which will be our handler. | ||
<code-block lang="Java"> | ||
private static boolean handleMyEntity(Entity entity, Player player) { | ||
if (/* your condition */) { | ||
// Your logic here | ||
WITAPI.updateBar(yourInfo, player); | ||
return true; // Successfully handled the entity | ||
} | ||
|
||
return false; // Not your entity, skip it | ||
} | ||
</code-block> | ||
</step> | ||
<step>Now that you have made the Handler, you must register it. | ||
<code-block lang="Java"> | ||
WITAPI.addEntityHandler(YourClass::handleMyEntity); | ||
</code-block> | ||
</step> | ||
<step>That's it, you have made you entity handler!</step> | ||
<step>A complete example of an entity handler (this uses the internal [WAILAManager]): | ||
<code-block lang="Java" src="../../src/main/java/me/darksoul/whatIsThat/compatibility/EliteMobsCompat.java"> | ||
</code-block> | ||
</step> | ||
</procedure> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# API | ||
|
||
## What can you do: | ||
|
||
- Inject Handlers for Blocks | ||
- Inject Handlers for Entities | ||
- Remove Handlers (Including Defaults) |