Skip to content

Commit

Permalink
fix: essentials.home.bed permission
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunh0w committed Dec 11, 2024
1 parent f2af952 commit 5ce1075
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ public void run(final Server server, final User user, final String commandLabel,
final List<String> homes = finalPlayer.getHomes();
if (homes.isEmpty() && finalPlayer.equals(user)) {
if (ess.getSettings().isSpawnIfNoHome()) {
final UserTeleportHomeEvent event = new UserTeleportHomeEvent(user, null, bed != null ? bed : finalPlayer.getWorld().getSpawnLocation(), bed != null ? UserTeleportHomeEvent.HomeType.BED : UserTeleportHomeEvent.HomeType.SPAWN);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
user.getAsyncTeleport().respawn(charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
if(bed == null || finalPlayer.isAuthorized("essentials.home.bed")){
final UserTeleportHomeEvent event = new UserTeleportHomeEvent(user, null, bed != null ? bed : finalPlayer.getWorld().getSpawnLocation(), bed != null ? UserTeleportHomeEvent.HomeType.BED : UserTeleportHomeEvent.HomeType.SPAWN);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
user.getAsyncTeleport().respawn(charge, TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), commandLabel));
}
}else {
showError(user.getBase(), new TranslatableException("noPerm", "essentials.home.bed"), commandLabel);
}
} else {
showError(user.getBase(), new TranslatableException("noHomeSetPlayer"), commandLabel);
Expand Down

0 comments on commit 5ce1075

Please sign in to comment.