Merge pull request #102 from Drc-DEV/patch-2
Fixes NPC, BONE_MEAL and Essentials related exceptions
This commit is contained in:
commit
8b90488e4c
@ -654,9 +654,15 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
//For Blocking Homes and Blocking Teleportation To Homes
|
//For Blocking Homes and Blocking Teleportation To Homes
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerHomeCheck(PlayerTeleportEvent event) throws Exception {
|
public void onPlayerHomeCheck(PlayerTeleportEvent event) throws Exception {
|
||||||
|
if (event.getPlayer().hasMetadata("NPC")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event.getPlayer().hasPermission("factions.homes.bypass")) {
|
if (event.getPlayer().hasPermission("factions.homes.bypass")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("Essentials") == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean isHome = false;
|
boolean isHome = false;
|
||||||
for (String str : SavageFactions.plugin.ess.getUser(event.getPlayer()).getHomes()) {
|
for (String str : SavageFactions.plugin.ess.getUser(event.getPlayer()).getHomes()) {
|
||||||
Location home = SavageFactions.plugin.ess.getUser(event.getPlayer()).getHome(str);
|
Location home = SavageFactions.plugin.ess.getUser(event.getPlayer()).getHome(str);
|
||||||
@ -953,7 +959,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == MultiversionMaterials.GRASS_BLOCK.parseMaterial()
|
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)) {
|
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) {
|
||||||
FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString());
|
FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString());
|
||||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
|
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
|
||||||
|
Loading…
Reference in New Issue
Block a user