|
| 1 | +# **Level Plugin Documentation** |
| 2 | + |
| 3 | +📌 **Repository:** [BentoBoxWorld/Level](https://github.com/BentoBoxWorld/Level) |
| 4 | +📌 **Purpose:** This document provides documentation for all major classes in the Level plugin. |
| 5 | +📌 **Target Audience:** Programmers or maintainers of this code. |
| 6 | + |
| 7 | +## **Table of Contents** |
| 8 | +- [Core Classes](#core-classes) |
| 9 | +- [Managers](#managers) |
| 10 | +- [Calculators](#calculators) |
| 11 | +- [Commands](#commands) |
| 12 | +- [Events](#events) |
| 13 | +- [Panels (GUI)](#panels-gui) |
| 14 | +- [Utilities](#utilities) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## **1️⃣ Core Classes** |
| 19 | +### **Level** |
| 20 | +📍 [`Level.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/Level.java) |
| 21 | +Handles configuration, plugin hooks, and initialization. Level uses the BentoBox Addon API, which follows the Plugin style. |
| 22 | +**Main Methods:** |
| 23 | +- `onLoad()`, `onEnable()`, `allLoaded()`, `getIslandLevel()`, `setIslandLevel()` |
| 24 | + |
| 25 | +`allLoaded()` is a method that BentoBox calls when all the Addons have been loaded, which usually means that all the BentoBox worlds have been loaded. This is important because Level will be referencing worlds. |
| 26 | +`getIslandLevel()` is used by the Level addon, but is also used by external Plugins to obtain island levels for players. |
| 27 | + |
| 28 | +### **LevelPladdon** |
| 29 | +📍 [`LevelPladdon.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/LevelPladdon.java) |
| 30 | +A wrapper for registering the Level addon. Pladdons are wrappers that make Addons Plugins. This is required because servers like Paper |
| 31 | +do byte-code-level conversions when the code is loaded and so the Addons have to be Plugins to benefit from this. |
| 32 | +**Main Method:** |
| 33 | +- `getAddon()` |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## **2️⃣ Managers** |
| 38 | +### **LevelsManager** |
| 39 | +📍 [`LevelsManager.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/LevelsManager.java) |
| 40 | +Manages island level calculations, leaderboards, and formatting. |
| 41 | +**Main Methods:** |
| 42 | +- `calculateLevel()`, `getIslandLevel()`, `getTopTen()` |
| 43 | + |
| 44 | +### **PlaceholderManager** |
| 45 | +📍 [`PlaceholderManager.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/PlaceholderManager.java) |
| 46 | +Handles dynamic placeholders. |
| 47 | +**Main Methods:** |
| 48 | +- `registerPlaceholders()`, `getRankName()`, `getVisitedIslandLevel()` |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## **3️⃣ Calculators** |
| 53 | +### **EquationEvaluator** |
| 54 | +📍 [`EquationEvaluator.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/calculators/EquationEvaluator.java) |
| 55 | +Evaluates mathematical expressions dynamically. |
| 56 | +**Main Method:** |
| 57 | +- `eval(String)` |
| 58 | + |
| 59 | +### **IslandLevelCalculator** |
| 60 | +📍 [`IslandLevelCalculator.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/calculators/IslandLevelCalculator.java) |
| 61 | +Computes island levels by scanning blocks and entities. |
| 62 | +**Main Methods:** |
| 63 | +- `scanIsland()`, `calculateLevel()` |
| 64 | + |
| 65 | +### **UltimateStackerCalc** |
| 66 | +📍 [`UltimateStackerCalc.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/calculators/UltimateStackerCalc.java) |
| 67 | +Handles calculations for stacked blocks from the plugin UltimateStacker. |
| 68 | +**Main Method:** |
| 69 | +- `addStackers()` |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## **4️⃣ Commands** |
| 74 | +📌 [Command Handlers Directory](https://github.com/BentoBoxWorld/Level/tree/develop/src/main/java/world/bentobox/level/commands) |
| 75 | + |
| 76 | +- **Admin Commands** |
| 77 | + - [`AdminLevelStatusCommand.java`](#) → Displays islands in calculation queue. |
| 78 | + - [`AdminSetInitialLevelCommand.java`](#) → Sets initial island level. |
| 79 | + |
| 80 | +- **Player Commands** |
| 81 | + - [`IslandLevelCommand.java`](#) → Triggers level calculation. |
| 82 | + - [`IslandTopCommand.java`](#) → Shows top island levels. |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## **5️⃣ Events** |
| 87 | +### **IslandActivitiesListeners** |
| 88 | +📍 [`IslandActivitiesListeners.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/listeners/IslandActivitiesListeners.java) |
| 89 | +Handles **island creation, deletion, and ownership changes**. |
| 90 | +**Main Events:** |
| 91 | +- `onNewIsland()`, `onIslandDelete()`, `onNewIslandOwner()` |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## **6️⃣ Panels (GUI)** |
| 96 | +### **TopLevelPanel** |
| 97 | +📍 [`TopLevelPanel.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/panels/TopLevelPanel.java) |
| 98 | +Displays the **top 10 ranked islands** in a GUI. |
| 99 | +**Main Methods:** |
| 100 | +- `build()`, `createPlayerButton()`, `openPanel()` |
| 101 | + |
| 102 | +### **ValuePanel** |
| 103 | +📍 [`ValuePanel.java`](https://github.com/BentoBoxWorld/Level/blob/develop/src/main/java/world/bentobox/level/panels/ValuePanel.java) |
| 104 | +Displays **block values** for island levels. |
| 105 | +**Main Methods:** |
| 106 | +- `build()`, `createMaterialButton()`, `openPanel()` |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## **7️⃣ Utilities** |
| 111 | +📌 [Utility Classes Directory](https://github.com/BentoBoxWorld/Level/tree/develop/src/main/java/world/bentobox/level/util) |
| 112 | + |
| 113 | +- **Utils.java** → General helper methods. |
| 114 | +- **ConversationUtils.java** → Handles player text input in conversations. |
| 115 | + |
0 commit comments