Added 3 new hookable functions to main Factions class, for use by other plugins:

boolean isPlayerAllowedToBuildHere(Player player, Location location)
boolean isPlayerAllowedToInteractWith(Player player, Block block)
boolean isPlayerAllowedToUseThisHere(Player player, Location location, Material material)
Also update Bukkit lib for new RB.
This commit is contained in:
Brettflan
2011-10-04 22:46:11 -05:00
parent 58d97076b8
commit 7c249e1884
4 changed files with 70 additions and 29 deletions

View File

@@ -12,7 +12,9 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.block.Block;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -266,7 +268,7 @@ public class Factions extends JavaPlugin {
// This value will be updated whenever new hooks are added
public int hookSupportVersion() {
return 2;
return 3;
}
// If another plugin is handling insertion of chat tags, this should be used to notify Factions
@@ -377,6 +379,21 @@ public class Factions extends JavaPlugin {
return players;
}
// check if player is allowed to build/destroy in a particular location
public boolean isPlayerAllowedToBuildHere(Player player, Location location) {
return FactionsBlockListener.playerCanBuildDestroyBlock(player, location, "", true);
}
// check if player is allowed to interact with the specified block (doors/chests/whatever)
public boolean isPlayerAllowedToInteractWith(Player player, Block block) {
return FactionsPlayerListener.canPlayerUseBlock(player, block, true);
}
// check if player is allowed to use a specified item (flint&steel, buckets, etc) in a particular location
public boolean isPlayerAllowedToUseThisHere(Player player, Location location, Material material) {
return FactionsPlayerListener.playerCanUseItemHere(player, location, material, true);
}
// -------------------------------------------- //
// Test rights
// -------------------------------------------- //