|
1 | 1 | # Corpse |
2 | | -[](https://jitpack.io/#unldenis/Corpse)<br> |
3 | | -Dead bodies in minecraft for 1.8-1.20.x servers. |
| 2 | + |
| 3 | +[](https://jitpack.io/#unldenis/Corpse) |
| 4 | + |
| 5 | +Dead bodies in minecraft for 1.8-1.21.11 servers. |
| 6 | + |
4 | 7 | ## Installation |
5 | | -1. Put the jar in the plugins folder. |
6 | | -2. Reboot your server. Do not use /reload |
7 | | -## Developer Api |
| 8 | + |
| 9 | +1. Drop the jar into `plugins`. |
| 10 | +2. Restart the server (no `/reload`). |
| 11 | + |
| 12 | +## Commands |
| 13 | + |
| 14 | +| Command | Permission | Description | |
| 15 | +|--------|------------|-------------| |
| 16 | +| `/spawncorpse [player]` | `corpses.spawn` | Spawns your corpse at your feet, or another player’s if you give a name. | |
| 17 | +| `/removecorpse <radius>` | `corpses.remove` | Removes all corpses within the given radius. | |
| 18 | + |
| 19 | +## Config (`config.yml`) |
| 20 | + |
| 21 | +- `corpse-time` – Seconds before a corpse despawns (-1 = never). |
| 22 | +- `on-death` – Spawn a corpse when a player dies. |
| 23 | +- `show-tags` – Show name tags above corpses. |
| 24 | +- `render-armor` – Render armor/items on the corpse. |
| 25 | +- `corpse-distance` – Max blocks at which corpses are visible. |
| 26 | +- `lootable-corpses` – Right‑click to open inventory and loot. |
| 27 | + |
| 28 | +## API |
| 29 | + |
| 30 | +Add the dependency (e.g. JitPack) and use `CorpseAPI.getInstance()`: |
| 31 | + |
8 | 32 | ```java |
9 | | -public class CorpseAPI { |
10 | | - |
11 | | - /** |
12 | | - * Class method that allows you to use the API. |
13 | | - * |
14 | | - * @return an instance of this class |
15 | | - */ |
16 | | - @NotNull |
17 | | - public static synchronized CorpseAPI getInstance(); |
18 | | - |
19 | | - /** |
20 | | - * Method that creates a corpse in the player's position and with its skin and inventory |
21 | | - * |
22 | | - * @return a new Corpse object |
23 | | - */ |
24 | | - public Corpse spawnCorpse(@NotNull Player player); |
25 | | - |
26 | | - /** |
27 | | - * Method that creates a corpse in the given place and with the skin, name and inventory of the |
28 | | - * player |
29 | | - * |
30 | | - * @param location The location where to spawn the corpse |
31 | | - * @return a new Corpse object |
32 | | - */ |
33 | | - public Corpse spawnCorpse(@NotNull Player player, @NotNull Location location); |
34 | | - |
35 | | - /** |
36 | | - * Method that creates a corpse in the given place and with the skin and name of the |
37 | | - * offlinePlayer |
38 | | - * |
39 | | - * @param location The location where to spawn the corpse |
40 | | - * @return a new Corpse object |
41 | | - */ |
42 | | - public Corpse spawnCorpse(@NotNull OfflinePlayer offlinePlayer, @NotNull Location location); |
43 | | - |
44 | | - /** |
45 | | - * Method that creates a corpse in the given place and with the skin and name of the player with a |
46 | | - * custom inventory. |
47 | | - * |
48 | | - * @param location The location where to spawn the corpse |
49 | | - * @param helmet The helmet to put on the corpse |
50 | | - * @param chestPlate The chestPlate to put on the corpse |
51 | | - * @param leggings The leggings to put on the corpse |
52 | | - * @param boots The boots to put on the corpse |
53 | | - * @return a new Corpse object |
54 | | - */ |
55 | | - public Corpse spawnCorpse( |
56 | | - @NotNull Player player, |
57 | | - @NotNull Location location, |
58 | | - @Nullable ItemStack helmet, |
59 | | - @Nullable ItemStack chestPlate, |
60 | | - @Nullable ItemStack leggings, |
61 | | - @Nullable ItemStack boots |
62 | | - ); |
63 | | - |
64 | | - /** |
65 | | - * Method that creates a corpse in the given place and with the skin and name of the offlinePlayer |
66 | | - * with a custom inventory. |
67 | | - * |
68 | | - * @param location The location where to spawn the corpse |
69 | | - * @param helmet The helmet to put on the corpse |
70 | | - * @param chestPlate The chestPlate to put on the corpse |
71 | | - * @param leggings The leggings to put on the corpse |
72 | | - * @param boots The boots to put on the corpse |
73 | | - * @return a new Corpse object |
74 | | - */ |
75 | | - public Corpse spawnCorpse( |
76 | | - @NotNull OfflinePlayer offlinePlayer, |
77 | | - @NotNull Location location, |
78 | | - @Nullable ItemStack helmet, |
79 | | - @Nullable ItemStack chestPlate, |
80 | | - @Nullable ItemStack leggings, |
81 | | - @Nullable ItemStack boots |
82 | | - ); |
83 | | - |
84 | | - /** |
85 | | - * Method that removes a corpse |
86 | | - * |
87 | | - * @param corpse The corpse to be removed |
88 | | - */ |
89 | | - public void removeCorpse(@NotNull Corpse corpse); |
90 | | -} |
| 33 | +CorpseAPI api = CorpseAPI.getInstance(); |
| 34 | + |
| 35 | +// At player location, with their skin and inventory |
| 36 | +Corpse corpse = api.spawnCorpse(player); |
91 | 37 |
|
| 38 | +// At a specific location |
| 39 | +Corpse corpse = api.spawnCorpse(player, location); |
| 40 | +Corpse corpse = api.spawnCorpse(offlinePlayer, location); |
| 41 | + |
| 42 | +// Custom armor (player/offline + location + helmet, chestplate, leggings, boots) |
| 43 | +Corpse corpse = api.spawnCorpse(player, location, helmet, chestPlate, leggings, boots); |
| 44 | +Corpse corpse = api.spawnCorpse(offlinePlayer, location, helmet, chestPlate, leggings, boots); |
| 45 | + |
| 46 | +// Remove a corpse |
| 47 | +api.removeCorpse(corpse); |
92 | 48 | ``` |
| 49 | + |
| 50 | +Listen for right‑clicks (and attack) on corpses via `AsyncCorpseInteractEvent`; use `getAction()` to tell interact vs attack. |
0 commit comments