Skip to content

Commit

Permalink
Made /reload affect Craftbook as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lymia committed Dec 13, 2010
1 parent c8d63e8 commit 537b8ce
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/CraftBookListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public BlockSource createBlockSource(Vector v) {
logger.log(Level.INFO, "cauldron-recipes.txt not loaded: "
+ e.getMessage());
}
}
} else cauldronModule = null;

if(properties.getBoolean("custom-ics", true)) {
try {
Expand Down Expand Up @@ -1416,12 +1416,11 @@ public boolean onComplexBlockChange(Player player, ComplexBlock cblock) {
if (!redstonePLCs) {
player.sendMessage(Colors.Rose + "PLCs are not enabled.");
CraftBook.dropSign(cblock.getX(), cblock.getY(), cblock.getZ());
return true;
return false;
}
}

if (( ic.ic.requiresPermission() || ( ic.isPlc && redstonePLCsRequirePermission ) ) && !player.canUseCommand("/allic")
&& !player.canUseCommand("/" + id.toLowerCase())) {
if (canCreateIC(player,id,ic)) {
player.sendMessage(Colors.Rose
+ "You don't have permission to make " + id + ".");
CraftBook.dropSign(cblock.getX(), cblock.getY(), cblock.getZ());
Expand Down Expand Up @@ -1472,6 +1471,14 @@ public boolean onComplexBlockChange(Player player, ComplexBlock cblock) {

return false;
}

/**
* Checks if the player can create an IC.
*/
private boolean canCreateIC(Player player, String id, RegisteredIC ic) {
return ( ic.ic.requiresPermission() || ( ic.isPlc && redstonePLCsRequirePermission ) ) && !player.canUseCommand("/allic")
&& !player.canUseCommand("/" + id.toLowerCase());
}

/**
*
Expand Down Expand Up @@ -1547,6 +1554,10 @@ public boolean runCommand(Player player, String[] split)

return true;
}

if (split[0].equalsIgnoreCase("/reload") && canUse(player, "/reload")) {
loadConfiguration();
}

return false;
}
Expand Down

0 comments on commit 537b8ce

Please sign in to comment.