Skip to content

Commit 125b0eb

Browse files
committed
Merge release/1.0.3.5 into main
2 parents 597a761 + 722bb87 commit 125b0eb

118 files changed

Lines changed: 1722 additions & 172 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

API/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ rootProject.extra.properties["sha"]?.let { sha ->
88

99
dependencies {
1010
compileOnly("io.papermc.paper:paper-api:1.21.5-R0.1-SNAPSHOT")
11-
compileOnly(files("../libs/zMenu-1.1.0.9.jar"))
11+
compileOnly(files("../libs/zMenu-1.1.1.0.jar"))
1212

1313
implementation("fr.maxlego08.sarah:sarah:1.20")
1414
implementation("com.tcoded:FoliaLib:0.5.1")

API/src/main/java/fr/maxlego08/essentials/api/cache/SimpleCache.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ public V get(K key, Loader<V> loader) {
4242
}
4343

4444

45+
/**
46+
* Clears all entries from the cache.
47+
*/
48+
public void clear() {
49+
this.cache.clear();
50+
}
51+
4552
/**
4653
* Functional interface for loading values into the cache. Implementations of this interface
4754
* provide a method to load a value, typically involving an operation such as fetching data

API/src/main/java/fr/maxlego08/essentials/api/commands/Permission.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ public enum Permission {
193193
ESSENTIALS_PAY_TOGGLE,
194194
ESSENTIALS_PAY_TOGGLE_OTHER,
195195
ESSENTIALS_MESSAGE_TOGGLE_OTHER,
196+
ESSENTIALS_TP_TOGGLE("Toggle receiving teleport requests"),
197+
ESSENTIALS_TP_TOGGLE_OTHER("Toggle receiving teleport requests for other players"),
196198
ESSENTIALS_GIVE,
197199
ESSENTIALS_GIVE_ALL,
198200
ESSENTIALS_ITEM_LORE_CLEAR,
@@ -303,7 +305,13 @@ public enum Permission {
303305
ESSENTIALS_SIGN_RESET("Allows you to use the <reset> mini message format"),
304306
ESSENTIALS_SIGN_FONT("Allows you to use the <font> mini message format"),
305307
ESSENTIALS_SIGN_KEYBIND("Allows you to use the <key> mini message format"),
306-
ESSENTIALS_STEP_START, ESSENTIALS_STEP_FINISH;
308+
ESSENTIALS_STEP_START,
309+
ESSENTIALS_STEP_FINISH,
310+
ESSENTIALS_ITEMFRAME,
311+
ESSENTIALS_SILENT_DEATH("Allows you to die silently without a death message"),
312+
ESSENTIALS_DEATH_MESSAGE_TELEPORT("Allows clicking death messages to teleport to death location"),
313+
ESSENTIALS_DEATH_MESSAGE_TOGGLE("Allows toggling death messages visibility"),
314+
ESSENTIALS_DEATH_MESSAGE_TOGGLE_OTHER("Allows toggling death messages for other players");
307315

308316
private final String description;
309317
private final String[] args;

API/src/main/java/fr/maxlego08/essentials/api/messages/Message.java

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ public enum Message {
140140
COMMAND_TELEPORT_WORLD("<error>You need to be in the same world to teleport."),
141141
COMMAND_TPA_ERROR_TO_LATE("<error>You do not have a teleport request."),
142142
COMMAND_TPA_ERROR_TO_LATE_2("<error>The request has expired."),
143+
COMMAND_TPA_ERROR_NO_REQUEST_FROM_PLAYER("<error>You do not have a teleport request from &f%player%<error>."),
144+
COMMAND_TPA_ACCEPT_ALL_SUCCESS("<success>You have accepted &f%count% <success>teleport request(s)."),
145+
COMMAND_TPA_DENY_ALL_SUCCESS("<success>You have denied &f%count% <success>teleport request(s)."),
143146
COMMAND_TP_DENY_SENDER("Denied %player% teleport request."),
144147
COMMAND_TP_DENY_RECEIVER("%player% has denied your teleport request"),
145148
COMMAND_TP_CANCEL_ERROR("<error>You did not send a teleport request at &f%player%<error>."),
@@ -278,6 +281,7 @@ public enum Message {
278281
DESCRIPTION_MESSAGE("Send a private message to a player"),
279282
DESCRIPTION_REPLY("Reply to a private message"),
280283
DESCRIPTION_MESSAGE_TOGGLE("Toggle private message"),
284+
DESCRIPTION_TP_TOGGLE("Toggle receiving teleport requests"),
281285
DESCRIPTION_POWER_TOOLS_TOGGLE("Toggle power tools"),
282286
DESCRIPTION_SOCIALSPY("Display private messages of players"),
283287
DESCRIPTION_COMPACT_ALL("Compact items in your inventories"),
@@ -432,6 +436,9 @@ public enum Message {
432436

433437
TELEPORT_DAMAGE("<error>You must not take damage during teleportation."),
434438
TELEPORT_ERROR_LOCATION("<error>Unable to teleport you safely."),
439+
TELEPORT_CROSS_SERVER_NOT_SUPPORTED("<error>Cross-server teleportation is not supported on this server."),
440+
TELEPORT_CROSS_SERVER_CONNECTING("<success>Connecting to server &f%server%<success>..."),
441+
TELEPORT_CROSS_SERVER_PLAYER_NOT_FOUND("<error>Player &f%player% <error>was not found on any server."),
435442

436443
// RTP Queue System Messages
437444
TELEPORT_ALREADY_IN_QUEUE("<error>You are already in the teleportation queue!"),
@@ -685,6 +692,9 @@ public enum Message {
685692
COMMAND_PAY_TOGGLE_DISABLE("<error>All of your power tools have been disabled &7for &f%player%<error>."),
686693
COMMAND_POWER_TOOLS_TOGGLE_ENABLE("<success>All of your power tools have been enabled &7for &f%player%<success>."),
687694
COMMAND_POWER_TOOLS_TOGGLE_DISABLE("&7Pay <error>disable &7for &f%player%<error>."),
695+
COMMAND_TELEPORT_REQUEST_DISABLED("<error>The player &f%player%<error> has disabled teleport requests."),
696+
COMMAND_TP_TOGGLE_ENABLE("&7Teleport requests <success>enabled &7for &f%player%<success>."),
697+
COMMAND_TP_TOGGLE_DISABLE("&7Teleport requests <error>disabled &7for &f%player%<error>."),
688698

689699
COMMAND_FURNACE_TYPE("<error>Impossible to smelt the material &f%material%<error>."),
690700
COMMAND_FURNACE_ERROR("<error>You have no &f%item%<error> in your inventory."),
@@ -956,6 +966,55 @@ public enum Message {
956966
STEP_DOESNT_EXIST("<error>Step &f%step% <error>does not exist."),
957967
STEP_ALREADY_EXIST("<error>Step &f%step% <error>already started."),
958968
STEP_DOESNT_STARTED("<error>Step &f%step% <error>doesn't started."),
969+
970+
// ItemFrame
971+
DESCRIPTION_ITEMFRAME("Toggle item frame visibility"),
972+
COMMAND_ITEMFRAME_INVISIBLE("<success>Item frame is now <white>invisible<success>."),
973+
COMMAND_ITEMFRAME_VISIBLE("<success>Item frame is now <white>visible<success>."),
974+
COMMAND_ITEMFRAME_NOT_FOUND("<error>No item frame found. Look at an item frame and try again."),
975+
976+
// Death Message Module
977+
DESCRIPTION_DEATH_MESSAGE("Custom death messages"),
978+
979+
DEATH_GENERIC("#C084FC☠ #E9D5FF%player% #B794F4died."),
980+
DEATH_BY_PLAYER("#C084FC⚔ #E9D5FF%player% #B794F4was slain by #E9D5FF%killer%#B794F4."),
981+
DEATH_BY_MOB("#C084FC☠ #E9D5FF%player% #B794F4was killed by #E9D5FF%killer%#B794F4."),
982+
DEATH_BY_PROJECTILE("#C084FC🏹 #E9D5FF%player% #B794F4was shot by #E9D5FF%killer%#B794F4."),
983+
DEATH_BY_MOB_EXPLOSION("#C084FC💥 #E9D5FF%player% #B794F4was blown up by #E9D5FF%killer%#B794F4."),
984+
DEATH_BY_FALL("#C084FC⬇ #E9D5FF%player% #B794F4fell from a high place."),
985+
DEATH_BY_FIRE("#C084FC🔥 #E9D5FF%player% #B794F4burned to death."),
986+
DEATH_BY_LAVA("#C084FC🌋 #E9D5FF%player% #B794F4tried to swim in lava."),
987+
DEATH_BY_DROWNING("#C084FC💧 #E9D5FF%player% #B794F4drowned."),
988+
DEATH_BY_EXPLOSION("#C084FC💥 #E9D5FF%player% #B794F4was blown up."),
989+
DEATH_BY_LIGHTNING("#C084FC⚡ #E9D5FF%player% #B794F4was struck by lightning."),
990+
DEATH_BY_SUFFOCATION("#C084FC▓ #E9D5FF%player% #B794F4suffocated in a wall."),
991+
DEATH_BY_STARVATION("#C084FC🍖 #E9D5FF%player% #B794F4starved to death."),
992+
DEATH_BY_POISON("#C084FC☣ #E9D5FF%player% #B794F4was poisoned."),
993+
DEATH_BY_MAGIC("#C084FC✦ #E9D5FF%player% #B794F4was killed by magic."),
994+
DEATH_BY_WITHER("#C084FC💀 #E9D5FF%player% #B794F4withered away."),
995+
DEATH_BY_FALLING_BLOCK("#C084FC▼ #E9D5FF%player% #B794F4was squashed by a falling block."),
996+
DEATH_BY_FLY_INTO_WALL("#C084FC💨 #E9D5FF%player% #B794F4experienced kinetic energy."),
997+
DEATH_BY_VOID("#C084FC✧ #E9D5FF%player% #B794F4fell out of the world."),
998+
DEATH_BY_CACTUS("#C084FC🌵 #E9D5FF%player% #B794F4was pricked to death."),
999+
DEATH_BY_CRAMMING("#C084FC⊞ #E9D5FF%player% #B794F4was squished too much."),
1000+
DEATH_BY_FREEZE("#C084FC❄ #E9D5FF%player% #B794F4froze to death."),
1001+
DEATH_BY_SONIC_BOOM("#C084FC◈ #E9D5FF%player% #B794F4was obliterated by a sonic boom."),
1002+
DEATH_BY_MAGMA("#C084FC♨ #E9D5FF%player% #B794F4discovered that the floor was lava."),
1003+
DEATH_BY_THORNS("#C084FC✵ #E9D5FF%player% #B794F4was killed trying to hurt someone."),
1004+
DEATH_BY_CAMPFIRE("#C084FC🔥 #E9D5FF%player% #B794F4walked into a campfire."),
1005+
1006+
DEATH_HOVER_DETAILS("#D8B4FE☠ Death Location#B794F4:\n#E9D5FF▸ World: #D8B4FE%world%\n#E9D5FF▸ Position: #D8B4FE%x%#E9D5FF, #D8B4FE%y%#E9D5FF, #D8B4FE%z%\n\n#9F7AEA&oClick to teleport"),
1007+
1008+
COMMAND_DEATH_MESSAGE_TOGGLE_DISABLE("#C084FC☠ #B794F4Death messages are now #E9D5FFhidden #B794F4for %player%#B794F4."),
1009+
COMMAND_DEATH_MESSAGE_TOGGLE_ENABLE("#C084FC☠ #B794F4Death messages are now #E9D5FFvisible #B794F4for %player%#B794F4."),
1010+
DESCRIPTION_DEATH_MESSAGE_TOGGLE("Toggle death messages visibility"),
1011+
1012+
// Death messages used by DeathMessageModule (fallback messages when no custom config is set)
1013+
DEATH_MESSAGE_GENERIC("#99E0FF%player% &7died."),
1014+
DEATH_MESSAGE_PLAYER("#99E0FF%player% &7was slain by #34cfe0%killer% &7using %weapon%&7."),
1015+
DEATH_MESSAGE_MOB("#99E0FF%player% &7was killed by &c%mob%&7."),
1016+
DEATH_MESSAGE_MYTHIC_MOB("#99E0FF%player% &7was slain by <gradient:#ff6600:#ff0000>%mob%</gradient>&7!"),
1017+
DEATH_MESSAGE_FISTS("&7fists"),
9591018
;
9601019

9611020
private EssentialsPlugin plugin;

API/src/main/java/fr/maxlego08/essentials/api/modules/Module.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,11 @@ public interface Module extends Listener {
5757
*/
5858
boolean isRegisterEvent();
5959

60+
/**
61+
* Called when the module is being disabled.
62+
*/
63+
default void onDisable() {
64+
}
65+
6066
}
6167

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package fr.maxlego08.essentials.api.modules.death;
2+
3+
public enum DeathMessageType {
4+
5+
DISABLE,
6+
DEFAULT,
7+
CUSTOM
8+
9+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package fr.maxlego08.essentials.api.modules.death;
2+
3+
import org.bukkit.entity.Entity;
4+
5+
import java.util.Optional;
6+
7+
public interface MythicMobsHook {
8+
9+
/**
10+
* Checks if the given entity is a MythicMob.
11+
*
12+
* @param entity the entity to check
13+
* @return true if the entity is a MythicMob, false otherwise
14+
*/
15+
boolean isMythicMob(Entity entity);
16+
17+
/**
18+
* Gets the display name of a MythicMob entity.
19+
*
20+
* @param entity the entity to get the name of
21+
* @return an Optional containing the MythicMob's display name, or empty if not a MythicMob
22+
*/
23+
Optional<String> getMythicMobName(Entity entity);
24+
25+
}

API/src/main/java/fr/maxlego08/essentials/api/user/Option.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ public enum Option {
3131
PHANTOMS_DISABLE,
3232
WORLDEDIT_INVENTORY,
3333
WORLDEDIT_BOSSBAR_DISABLE,
34+
TELEPORT_REQUEST_DISABLE,
35+
DEATH_MESSAGE_DISABLE,
3436
}

API/src/main/java/fr/maxlego08/essentials/api/user/User.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,35 @@ public interface User {
135135
*/
136136
void removeTeleportRequest(User user);
137137

138+
/**
139+
* Gets teleport request from specific player.
140+
*
141+
* @param fromUser The player who sent the request
142+
* @return The request from specified player, or null if none exists
143+
*/
144+
TeleportRequest getTeleportRequestFrom(User fromUser);
145+
146+
/**
147+
* Gets all incoming teleport requests.
148+
*
149+
* @return Collection of all valid incoming requests
150+
*/
151+
Collection<TeleportRequest> getIncomingTeleportRequests();
152+
153+
/**
154+
* Adds or updates incoming teleport request.
155+
*
156+
* @param teleportRequest The request to add/update
157+
*/
158+
void setIncomingTeleportRequest(TeleportRequest teleportRequest);
159+
160+
/**
161+
* Removes incoming request from specific player.
162+
*
163+
* @param fromUser The player whose request should be removed
164+
*/
165+
void removeIncomingTeleportRequest(User fromUser);
166+
138167
/**
139168
* Teleports the user to the specified location immediately.
140169
*

API/src/main/java/fr/maxlego08/essentials/api/utils/SafeLocation.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public void setPitch(float pitch) {
7878

7979
public Location getLocation() {
8080
if (this.location == null) {
81-
this.location = new Location(Bukkit.getWorld(this.world), this.x, this.y, this.z, this.yaw, this.pitch);
81+
var bukkitWorld = Bukkit.getWorld(this.world);
82+
if (bukkitWorld == null) return null;
83+
this.location = new Location(bukkitWorld, this.x, this.y, this.z, this.yaw, this.pitch);
8284
}
8385
return location;
8486
}

0 commit comments

Comments
 (0)