Make storage command check owner sooner.
This commit is contained in:
parent
ff3c3e3888
commit
a54386c98d
@ -82,6 +82,23 @@ public final class StorageCommand implements Command {
|
||||
Itemcase itemcase =
|
||||
ItemCaseCore.instance.getItemcaseManager().getItemcase(target);
|
||||
|
||||
// Get owner.
|
||||
OfflinePlayer owner = itemcase.getOwner();
|
||||
|
||||
// Check if this player owns this itemcase.
|
||||
if(!owner.equals(player)) {
|
||||
|
||||
// Check if player is allowed to modify other peoples itemcases.
|
||||
if(!player.hasPermission("itemcase.modify.other")) {
|
||||
|
||||
// Show message.
|
||||
chatLogger.message(player, "command.not-owner");
|
||||
|
||||
// Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if itemcase is a shop.
|
||||
if(itemcase.getType() == Type.SHOWCASE) {
|
||||
|
||||
@ -102,23 +119,6 @@ public final class StorageCommand implements Command {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get owner.
|
||||
OfflinePlayer owner = itemcase.getOwner();
|
||||
|
||||
// Check if this player owns this itemcase.
|
||||
if(!owner.equals(player)) {
|
||||
|
||||
// Check if player is allowed to modify other peoples itemcases.
|
||||
if(!player.hasPermission("itemcase.modify.other")) {
|
||||
|
||||
// Show message.
|
||||
chatLogger.message(player, "command.not-owner");
|
||||
|
||||
// Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Open itemcase storage to player.
|
||||
player.openInventory(itemcase.getStorage());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user