Skip to content

Commit

Permalink
Fix trade permissions checks
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Sep 5, 2017
1 parent 7135ec1 commit 245ea3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12-pre5-SNAPSHOT</version>
<version>1.12.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/trophonix/tradeplus/commands/TradeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
final Player player = (Player)sender;

boolean permissionRequired = pl.getConfig().getBoolean("permissions.required", false);
String sendPermission = pl.getConfig().getString("permissions.send");
if (permissionRequired) {
if (!player.hasPermission(sendPermission)) {
MsgUtils.send(player, pl.getLang().getString("noperms").split("%NEWLINE%"));
return true;
}
}

if (args.length == 1) {
final Player receiver = Bukkit.getPlayer(args[0]);
Expand Down Expand Up @@ -116,6 +109,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
new Trade(player, receiver);
requests.removeIf(req -> (req.sender.equals(player) && req.receiver.equals(receiver)) || (req.sender.equals(receiver) && req.receiver.equals(player)));
} else {
String sendPermission = pl.getConfig().getString("permissions.send");
if (permissionRequired) {
if (!player.hasPermission(sendPermission)) {
MsgUtils.send(player, pl.getLang().getString("noperms").split("%NEWLINE%"));
return true;
}
}
TradeRequestEvent event = new TradeRequestEvent(player, receiver);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) return true;
Expand Down

0 comments on commit 245ea3d

Please sign in to comment.