From a34b15e7b1f22c2a7c3ccb554a4ee69935b032ea Mon Sep 17 00:00:00 2001 From: darksoulq Date: Mon, 6 Jan 2025 19:17:06 +0530 Subject: [PATCH] initial wiki --- .idea/.gitignore | 3 - .idea/WhatIsThat.iml | 8 ++ .idea/compiler.xml | 13 -- .idea/discord.xml | 14 -- .idea/encodings.xml | 7 - .idea/jarRepositories.xml | 55 -------- .idea/material_theme_project_new.xml | 12 -- .idea/misc.xml | 14 -- .idea/modules.xml | 2 +- .idea/uiDesigner.xml | 124 ------------------ .idea/vcs.xml | 2 +- Writerside/topics/Block-Handlers.md | 42 ++++++ Writerside/topics/Default-Handlers.md | 22 ++++ Writerside/topics/Entity-Handlers.md | 30 +++++ Writerside/topics/api.md | 7 + Writerside/w.tree | 13 ++ dependency-reduced-pom.xml | 10 ++ pom.xml | 33 ++--- .../me/darksoul/whatIsThat/WAILAManager.java | 2 + .../me/darksoul/whatIsThat/WhatIsThat.java | 1 - .../compatibility/ItemsAdderCompat.java | 9 +- .../compatibility/MinecraftCompat.java | 1 - src/main/resources/plugin.yml | 2 +- 23 files changed, 162 insertions(+), 264 deletions(-) delete mode 100644 .idea/.gitignore create mode 100644 .idea/WhatIsThat.iml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/discord.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/jarRepositories.xml delete mode 100644 .idea/material_theme_project_new.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/uiDesigner.xml create mode 100644 Writerside/topics/Block-Handlers.md create mode 100644 Writerside/topics/Default-Handlers.md create mode 100644 Writerside/topics/Entity-Handlers.md create mode 100644 Writerside/topics/api.md create mode 100644 Writerside/w.tree diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/WhatIsThat.iml b/.idea/WhatIsThat.iml new file mode 100644 index 0000000..6102194 --- /dev/null +++ b/.idea/WhatIsThat.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 878deaf..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml deleted file mode 100644 index 912db82..0000000 --- a/.idea/discord.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index aa00ffa..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index 0d2fbbd..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml deleted file mode 100644 index 51ca384..0000000 --- a/.idea/material_theme_project_new.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index fdc35ea..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 1a03a22..dcaa45a 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index 2b63946..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Writerside/topics/Block-Handlers.md b/Writerside/topics/Block-Handlers.md new file mode 100644 index 0000000..97d31eb --- /dev/null +++ b/Writerside/topics/Block-Handlers.md @@ -0,0 +1,42 @@ +# Block Handlers + +Block Handlers can be used to display info for the blocks that the player is looking at. + + +Make a class which will hold our handler funtion. +Make a function which will be the handler. + +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 +} + + +Now that you have made a handler, you must register the handler so it's actually used by WIT, this can be done by: + +WITAPI.addBlockHandler(YourClass::handleMyBlock); + + +That's it! you have now successfully made a Block Handler! +A complete example of a block handler (this uses the internal [WAILAManager]): + + + + + + +Removing a block handler is a one-liner!: + +WITAPI.removeBlockHandler(YourClass::BlockHandlerFunc) + + + \ No newline at end of file diff --git a/Writerside/topics/Default-Handlers.md b/Writerside/topics/Default-Handlers.md new file mode 100644 index 0000000..af27436 --- /dev/null +++ b/Writerside/topics/Default-Handlers.md @@ -0,0 +1,22 @@ +# Default Handlers + + + + +LiteFarmCompat::handleLitefarmCrop +MinetorioCompat::handleMTDisplay +ItemsAdderCompat::handleIABlocks +SlimefunCompat::handleSlimefunMachines +NexoCompat::handleNexoBlock + + + + +ValhallaMMOCompat::handleVMMOEntity +ItemsAdderCompat::handleIAEntity +EliteMobsCompat::handleEMEntity +AuraMobsCompat::handleAuraMobs +NexoCompat::handleNexoEntity + + + \ No newline at end of file diff --git a/Writerside/topics/Entity-Handlers.md b/Writerside/topics/Entity-Handlers.md new file mode 100644 index 0000000..2cf52c1 --- /dev/null +++ b/Writerside/topics/Entity-Handlers.md @@ -0,0 +1,30 @@ +# Entity Handlers + +Entity handlers can be used to display info about the entity the player is looking at. + + +Make a class which will hold our Handler. +Make a function which will be our handler. + +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 +} + + +Now that you have made the Handler, you must register it. + +WITAPI.addEntityHandler(YourClass::handleMyEntity); + + +That's it, you have made you entity handler! +A complete example of an entity handler (this uses the internal [WAILAManager]): + + + + \ No newline at end of file diff --git a/Writerside/topics/api.md b/Writerside/topics/api.md new file mode 100644 index 0000000..7975613 --- /dev/null +++ b/Writerside/topics/api.md @@ -0,0 +1,7 @@ +# API + +## What can you do: + +- Inject Handlers for Blocks +- Inject Handlers for Entities +- Remove Handlers (Including Defaults) \ No newline at end of file diff --git a/Writerside/w.tree b/Writerside/w.tree new file mode 100644 index 0000000..65da3bc --- /dev/null +++ b/Writerside/w.tree @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 9225277..f845f9f 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -63,6 +63,10 @@ Reposilite Repository https://repo.nexomc.com/releases + + dmulloy2-repo + https://repo.dmulloy2.net/repository/public/ + @@ -130,6 +134,12 @@ + + com.comphenix.protocol + ProtocolLib + 5.3.0 + provided + com.MT Minetorio diff --git a/pom.xml b/pom.xml index 55fc8b0..193e6ad 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.darksoul whatisthat - 1.4.3 + 1.4.4 jar whatisthat @@ -138,21 +138,7 @@ - - - com.MT - Minetorio - 0.81 - system - C:\Users\amaan\Downloads\pluginLibs\MTP-0.81.jar - - - dev.aurelium - AuraMobs - 2.1.0 - system - C:\Users\amaan\Downloads\pluginLibs\AuraMobs-2.1.0.jar - + com.magmaguy EliteMobs @@ -169,6 +155,21 @@ + + + com.MT + Minetorio + 0.81 + system + C:\Users\amaan\Downloads\pluginLibs\MTP-0.81.jar + + + dev.aurelium + AuraMobs + 2.1.0 + system + C:\Users\amaan\Downloads\pluginLibs\AuraMobs-2.1.0.jar + me.athlaoes ValhallaMMO diff --git a/src/main/java/me/darksoul/whatIsThat/WAILAManager.java b/src/main/java/me/darksoul/whatIsThat/WAILAManager.java index f5e27c4..dbbafed 100644 --- a/src/main/java/me/darksoul/whatIsThat/WAILAManager.java +++ b/src/main/java/me/darksoul/whatIsThat/WAILAManager.java @@ -1,7 +1,9 @@ package me.darksoul.whatIsThat; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TranslatableComponent; import org.bukkit.Bukkit; +import org.bukkit.Server; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.boss.BossBar; diff --git a/src/main/java/me/darksoul/whatIsThat/WhatIsThat.java b/src/main/java/me/darksoul/whatIsThat/WhatIsThat.java index cdb0bb3..799118b 100644 --- a/src/main/java/me/darksoul/whatIsThat/WhatIsThat.java +++ b/src/main/java/me/darksoul/whatIsThat/WhatIsThat.java @@ -29,7 +29,6 @@ public void onEnable() { @Override public void onDisable() { - // Plugin shutdown logic } public static WhatIsThat getInstance() { diff --git a/src/main/java/me/darksoul/whatIsThat/compatibility/ItemsAdderCompat.java b/src/main/java/me/darksoul/whatIsThat/compatibility/ItemsAdderCompat.java index 6a6cd32..b4aebd3 100644 --- a/src/main/java/me/darksoul/whatIsThat/compatibility/ItemsAdderCompat.java +++ b/src/main/java/me/darksoul/whatIsThat/compatibility/ItemsAdderCompat.java @@ -7,6 +7,7 @@ import me.darksoul.whatIsThat.WhatIsThat; import org.bukkit.block.Block; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -20,11 +21,14 @@ public class ItemsAdderCompat { private static boolean isIAInstalled; private static final List> suffixIACrop = new ArrayList<>(); + private static final List elligibleFurniture = new ArrayList<>(); private static void setup() { if (WAILAListener.getConfig().getBoolean("itemsadder.blocks.cropinfo", true)) { suffixIACrop.add(ItemsAdderCompat::getIAHarvestInfo); } + elligibleFurniture.add(EntityType.ARMOR_STAND); + elligibleFurniture.add(EntityType.ITEM_DISPLAY); } public static boolean checkIA() { Plugin pl = WhatIsThat.getInstance().getServer().getPluginManager().getPlugin("ItemsAdder"); @@ -68,7 +72,10 @@ public static boolean handleIABlocks(Block block, Player player) { } public static boolean handleIAEntity(Entity entity, Player player) { CustomEntity IAEntity = CustomEntity.byAlreadySpawned(entity); - CustomFurniture furniture = CustomFurniture.byAlreadySpawned(entity); + CustomFurniture furniture = null; + if (elligibleFurniture.contains(entity.getType())) { + furniture = CustomFurniture.byAlreadySpawned(entity); + } if (furniture != null) { handleFurniture(furniture, player); return true; diff --git a/src/main/java/me/darksoul/whatIsThat/compatibility/MinecraftCompat.java b/src/main/java/me/darksoul/whatIsThat/compatibility/MinecraftCompat.java index 5c6cadc..61787f4 100644 --- a/src/main/java/me/darksoul/whatIsThat/compatibility/MinecraftCompat.java +++ b/src/main/java/me/darksoul/whatIsThat/compatibility/MinecraftCompat.java @@ -6,7 +6,6 @@ import me.darksoul.whatIsThat.misc.ConfigUtils; import me.darksoul.whatIsThat.misc.ItemGroups; import org.bukkit.block.Block; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d70ad54..3d4a517 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: WhatIsThat -version: '1.4.3' +version: '1.4.4' main: me.darksoul.whatIsThat.WhatIsThat api-version: '1.20' author: DarkSoul