Merge pull request #102 from Drc-DEV/patch-2

Fixes NPC, BONE_MEAL and Essentials related exceptions
This commit is contained in:
Naman 2019-02-18 12:02:55 -04:00 committed by GitHub
commit 8b90488e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -654,9 +654,15 @@ public class FactionsPlayerListener implements Listener {
//For Blocking Homes and Blocking Teleportation To Homes
@EventHandler
public void onPlayerHomeCheck(PlayerTeleportEvent event) throws Exception {
if (event.getPlayer().hasMetadata("NPC")){
return;
}
if (event.getPlayer().hasPermission("factions.homes.bypass")) {
return;
}
if (Bukkit.getPluginManager().getPlugin("Essentials") == null) {
return;
}
boolean isHome = false;
for (String str : SavageFactions.plugin.ess.getUser(event.getPlayer()).getHomes()) {
Location home = SavageFactions.plugin.ess.getUser(event.getPlayer()).getHome(str);
@ -953,7 +959,7 @@ public class FactionsPlayerListener implements Listener {
Block block = event.getClickedBlock();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == MultiversionMaterials.GRASS_BLOCK.parseMaterial()
&& event.hasItem() && event.getItem().getType() == Material.BONE_MEAL) {
&& event.hasItem() && event.getItem().getType() == MultiversionMaterials.BONE_MEAL.parseMaterial()) {
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) {
FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString());
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));