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}/bukkit-1.2.2-R0.1-SNAPSHOT.jar" />
<pathelement location="${lib}/craftbukkit-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}/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> </classpath>
</javac> </javac>
<antcall target="distcore" /> <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; return;
} }
} }
if ((player.hasPermission("citizens.npc.talk") || player.hasPermission("citizens.admin")) // If the NPC isn't a close talker
&& player.getItemInHand().getTypeId() == Setting.TALK_ITEM.asInt()) if (player.getItemInHand().getTypeId() == Setting.TALK_ITEM.asInt()
&& !npc.getTrait(Text.class).shouldTalkClose())
npc.getTrait(Text.class).sendText(player); npc.getTrait(Text.class).sendText(player);
if (npc.getCharacter() != null) if (npc.getCharacter() != null)

View File

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