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:
@@ -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
|
||||
// -------------------------------------------- //
|
||||
|
||||
Reference in New Issue
Block a user