Skip to content

Commit

Permalink
Enable line of sight check in Chat Trigger again. Remove thread check…
Browse files Browse the repository at this point in the history
… that doesn't do anything.
  • Loading branch information
davidcernat committed Aug 20, 2013
1 parent c55a07c commit 1aa1498
Showing 1 changed file with 2 additions and 10 deletions.
Expand Up @@ -39,8 +39,6 @@ public void onEnable() {
public void chatTrigger(final AsyncPlayerChatEvent event) {
if (event.isCancelled()) return;

boolean wasInterrupted = Thread.interrupted();

Callable<Boolean> call = new Callable<Boolean>() {
public Boolean call() {

Expand Down Expand Up @@ -74,10 +72,8 @@ public Boolean call() {
// if enabled. Should the Player chat only when looking at the NPC? This may
// reduce accidental chats with NPCs.

// TODO: CraftBukkit 1.6 broke the two lines below. Think of a workaround.

//if (Settings.ChatMustSeeNPC())
// if (!npc.getEntity().hasLineOfSight(event.getPlayer())) return null;
if (Settings.ChatMustSeeNPC())
if (!npc.getEntity().hasLineOfSight(event.getPlayer())) return null;

if (Settings.ChatMustLookAtNPC())
if (!Rotation.isFacingEntity(event.getPlayer(), npc.getEntity(), 45)) return null;
Expand Down Expand Up @@ -205,10 +201,6 @@ else if (event.getMessage().toUpperCase().contains(keyword.toUpperCase()))
e.printStackTrace();
}

if (wasInterrupted) {
Thread.currentThread().interrupt();
}

if (cancelled == null)
return;
event.setCancelled(cancelled);
Expand Down

0 comments on commit 1aa1498

Please sign in to comment.