Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.gamecreep</groupId>
<artifactId>BasicHomes</artifactId>
<version>1.9.8-BETA-26.2</version>
<version>1.9.8.1-DEV-26.2</version>
<packaging>jar</packaging>

<name>BasicHomes</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ protected DeleteCommand(@NonNull final BasicHomes plugin, final PositionType typ

public boolean onCommand(@NonNull final CommandSender commandSender, @NonNull final String[] args) {
if (commandSender instanceof final Player playerSender) {
if (!playerSender.hasPermission(this.permission.getName())) {
ChatUtils.sendNoPermission(playerSender, this.permission);
return true;
}

if (args.length < 1) {
ChatUtils.sendPlayerError(playerSender, String.format("Please add the name of the %s to delete !", this.type.getDisplayName()));
return false;
Expand All @@ -46,6 +41,13 @@ public boolean onCommand(@NonNull final CommandSender commandSender, @NonNull fi
return true;
}

if (!playerSender.hasPermission(this.permission.getName())
&& !pos.getOwnerUuid().equals(playerSender.getUniqueId().toString())
) {
ChatUtils.sendNoPermission(playerSender, this.permission);
return true;
}

this.handler.delete(pos);

ChatUtils.sendPlayerInfo(playerSender, String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ protected final void populateMenu(final List<SavedPosition> data) {
final int homeItemSlot = 10 + ((i - startIndex) * 9);
this.menu.setItem(homeItemSlot, item);

if (player.hasPermission(this.permissionToDelete.getName())) {
if (
player.hasPermission(this.permissionToDelete.getName())
|| pos.getOwnerUuid().equals(player.getUniqueId().toString())
) {
final ItemStack delItem = createDeleteItem(pos);
final int delItemSlot = 16 + ((i - startIndex) * 9);
this.menu.setItem(delItemSlot, delItem);
Expand Down
Loading