Skip to content

Commit

Permalink
clean pom file, remove old chat bot stuff
Browse files Browse the repository at this point in the history
also explicitly shade JSON in, instead of that really weird mess
  • Loading branch information
mcmonkey4eva committed Feb 9, 2019
1 parent 5bca969 commit 43b2c96
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 185 deletions.
58 changes: 17 additions & 41 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@

<!-- Dependencies -->
<dependencies>
<!-- Required APIs -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${craftbukkit.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizencore</artifactId>
<version>${dcore.version}</version>
<scope>compile</scope>
</dependency>
<!-- NMS Modules -->
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizen-nmshandler</artifactId>
Expand Down Expand Up @@ -64,64 +72,26 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<!-- Basic dependencies -->
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens</artifactId>
<version>${citizens.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.aufdemrand</groupId>
<artifactId>denizencore</artifactId>
<version>${dcore.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
<scope>provided</scope>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.5.6</version>
<scope>provided</scope>
</dependency>
<!-- Removed due to jar space concerns, and minimal realistic need for this dependency anyway. -->
<!--
<dependency>
<groupId>org.abstractmeta</groupId>
<artifactId>compilation-toolbox</artifactId>
<version>0.3.2-MODIFIED</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
-->
<dependency>
<groupId>org.alicebot</groupId>
<artifactId>ab</artifactId>
<version>0.0.4.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>org.json</artifactId>
<version>chargebee-1.0</version>
</dependency>
<!--<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.5.1</version>
<scope>test</scope>
</dependency>-->
</dependencies>

<build>
Expand Down Expand Up @@ -163,6 +133,12 @@
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.json:json</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>net.aufdemrand:denizen-v**</artifact>
<includes>
Expand Down
7 changes: 0 additions & 7 deletions plugin/src/main/java/net/aufdemrand/denizen/Denizen.java
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,6 @@ public void onEnable() {
CitizensAPI.getSpeechFactory().register(DenizenChat.class, "denizen_chat");
}

// If Program AB, used for reading Artificial Intelligence Markup Language
// 2.0, is included as a dependency at Denizen/lib/Ab.jar, register the
// ChatbotTrait
if (Depends.hasProgramAB) {
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(ChatbotTrait.class).withName("chatbot"));
}

// Compile and load Denizen externals
runtimeCompiler = new RuntimeCompiler(this);
runtimeCompiler.loader();
Expand Down
30 changes: 0 additions & 30 deletions plugin/src/main/java/net/aufdemrand/denizen/NPCCommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -664,34 +664,4 @@ else if (args.hasFlag('r')) {
Messaging.sendInfo(sender, npc.getName() + "'s health is '" + trait.getHealth() + "/" + trait.getMaxhealth() + "'.");
}
}

/*
* Chatbot
*/
@Command(
aliases = {"npc"}, usage = "chatbot",
desc = "Turns the NPC into a chatbot.", flags = "", modifiers = {"chatbot", "bot"},
min = 1, max = 2, permission = "denizen.npc.chatbot")
@Requirements(selected = true, ownership = true)
public void chatbot(CommandContext args, CommandSender sender, NPC npc) throws CommandException {

if (!Depends.hasProgramAB) {
Messaging.sendError(sender, "The Chatbot Trait " +
" cannot be used if Program AB is missing from Denizen/lib");
return;
}

if (!npc.hasTrait(ChatbotTrait.class)) {
npc.addTrait(ChatbotTrait.class);
Messaging.send(sender, ChatColor.BLUE + npc.getName() +
" has become a chatbot!");
}
ChatbotTrait trait = npc.getTrait(ChatbotTrait.class);

if (args.argsLength() > 1) {
trait.setBot(args.getString(1));
Messaging.send(sender, ChatColor.BLUE + npc.getName() +
" is now the chatbot " + args.getString(1));
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.aufdemrand.denizen.Settings;
import net.aufdemrand.denizen.nms.NMSHandler;
import net.aufdemrand.denizen.npc.traits.ChatbotTrait;
import net.aufdemrand.denizen.npc.traits.TriggerTrait;
import net.aufdemrand.denizen.objects.dNPC;
import net.aufdemrand.denizen.objects.dPlayer;
Expand Down Expand Up @@ -188,19 +187,8 @@ public ChatContext process(Player player, String message) {
InteractScriptHelper.getCurrentStep(denizenPlayer,
script.getName()), ChatTrigger.class)) {

// If this is a Chatbot, make it chat anything it wants if
// it has no chat triggers for this step
if (npc.getCitizen().hasTrait(ChatbotTrait.class)) {
Utilities.talkToNPC(message, denizenPlayer, npc, Settings.chatToNpcOverhearingRange());
npc.getCitizen().getTrait(ChatbotTrait.class).chatTo(player, message);
if (HyperDebug) {
dB.log("chatbot");
}
return new ChatContext(false);
}

// No chat trigger for this step.. do we chat globally, or to the NPC?
else if (!Settings.chatGloballyIfNoChatTriggers()) {
if (!Settings.chatGloballyIfNoChatTriggers()) {
dB.echoDebug(script, player.getName() + " says to "
+ npc.getNicknameTrait().getNickname() + ", " + message);
return new ChatContext(false);
Expand Down Expand Up @@ -315,17 +303,7 @@ else if (message.toUpperCase().contains(keyword.toUpperCase())) {
return new ChatContext(true);
}
else {
// If this is a Chatbot, make it chat anything it wants if
// none of its chat triggers worked
if (npc.getCitizen().hasTrait(ChatbotTrait.class)) {
Utilities.talkToNPC(message, denizenPlayer, npc, Settings.chatToNpcOverhearingRange());
npc.getCitizen().getTrait(ChatbotTrait.class).chatTo(player, message);
if (HyperDebug) {
dB.log("Chatbot");
}
return new ChatContext(true);
}
else if (!Settings.chatGloballyIfFailedChatTriggers()) {
if (!Settings.chatGloballyIfFailedChatTriggers()) {
Utilities.talkToNPC(message, denizenPlayer, npc, Settings.chatToNpcOverhearingRange());
if (HyperDebug) {
dB.log("Chat globally");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,13 @@ public class Depends {
public static Permission permissions = null;
public static Chat chat = null;

public static boolean hasProgramAB = false;

public void initialize() {
hasProgramAB = checkProgramAB();
setupEconomy();
setupPermissions();
setupChat();
setupCitizens();
}

// Check if Program AB, used for reading Artificial Intelligence Markup
// Language 2.0, is included as a dependency at Denizen/lib/Ab.jar
private boolean checkProgramAB() {

try {
Class.forName("org.alicebot.ab.Bot");
}
catch (ClassNotFoundException e) {
return false;
}

return true;
}

private boolean setupEconomy() {
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("Vault");
if (plugin == null || !plugin.isEnabled()) {
Expand Down
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<craftbukkit.version>1.13.2-R0.1-SNAPSHOT</craftbukkit.version>
<json.version>20090211</json.version>
<citizens.version>2.0.24-SNAPSHOT</citizens.version>
<dcore.version>1.30</dcore.version>
<BUILD_NUMBER>Unknown</BUILD_NUMBER>
Expand Down Expand Up @@ -44,12 +43,12 @@

<ciManagement>
<system>jenkins</system>
<url>http://ci.citizensnpcs.co</url>
<url>https://ci.citizensnpcs.co</url>
</ciManagement>
<scm>
<connection>scm:git:git://github.com/aufdemrand/Denizen.git</connection>
<developerConnection>scm:git:git:@github.com:aufdemrand/Denizen.git</developerConnection>
<url>https://github.com/aufdemrand/Denizen/tree/master/</url>
<connection>scm:git:git://github.com/DenizenScript/Denizen-For-Bukkit.git</connection>
<developerConnection>scm:git:git:@github.com:DenizenScript/Denizen-For-Bukkit.git</developerConnection>
<url>https://github.com/DenizenScript/Denizen-For-Bukkit/tree/dev/</url>
</scm>

<build>
Expand All @@ -68,5 +67,5 @@
</plugins>
</build>

<url>http://wiki.citizensnpcs.co/Denizen</url>
<url>https://wiki.citizensnpcs.co/Denizen</url>
</project>

0 comments on commit 43b2c96

Please sign in to comment.