change to talking

This commit is contained in:
aPunch 2012-03-04 12:06:33 -06:00
parent de6d1b7e18
commit adfe76c65e
6 changed files with 9 additions and 11 deletions

View File

@ -19,13 +19,6 @@
<pathelement location="${lib}/bukkit-1.2.2-R0.1-SNAPSHOT.jar" />
<pathelement location="${lib}/craftbukkit-1.2.2-R0.1-SNAPSHOT.jar" />
<pathelement location="${lib}/CitizensAPI.jar" />
<pathelement location="${lib}/hamcrest.jar" />
<pathelement location="${lib}/junit-dep-4.10.jar" />
<pathelement location="${lib}/hamcrest-library-1.2.1.jar" />
<pathelement location="${lib}/hamcrest-core-1.2.1.jar" />
<fileset dir="lib">
<include name="CitizensAPI.jar" />
</fileset>
</classpath>
</javac>
<antcall target="distcore" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -113,8 +113,9 @@ public class EventListen implements Listener {
return;
}
}
if ((player.hasPermission("citizens.npc.talk") || player.hasPermission("citizens.admin"))
&& player.getItemInHand().getTypeId() == Setting.TALK_ITEM.asInt())
// If the NPC isn't a close talker
if (player.getItemInHand().getTypeId() == Setting.TALK_ITEM.asInt()
&& !npc.getTrait(Text.class).shouldTalkClose())
npc.getTrait(Text.class).sendText(player);
if (npc.getCharacter() != null)

View File

@ -101,6 +101,10 @@ public class Text extends Trait implements Runnable, Toggleable {
return builder.toString();
}
public boolean shouldTalkClose() {
return talkClose;
}
public Editor getEditor(final Player player) {
final StartPrompt startPrompt = new StartPrompt(this);
return new Editor() {
@ -146,6 +150,8 @@ public class Text extends Trait implements Runnable, Toggleable {
}
public boolean sendText(Player player) {
if (!player.hasPermission("citizens.admin") && !player.hasPermission("citizens.npc.talk"))
return false;
if (text.size() == 0)
return false;
@ -157,8 +163,6 @@ public class Text extends Trait implements Runnable, Toggleable {
currentIndex = 0;
index = currentIndex++;
}
Messaging.log("current: " + currentIndex);
Messaging.log("index: " + index);
npc.chat(player, text.get(index));
return true;
}