diff --git a/.travis.yml b/.travis.yml
index 9bcf999..dfd0224 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,26 @@
+cache:
+ directories:
+ - $HOME/.m2/repository/org/
+before_install: | # Wget BuildTools and run if cached folder not found
+ if [ ! -d "$HOME/.m2/repository/org/spigotmc/spigot/1.12.1-R0.1-SNAPSHOT" ]; then
+ wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
+ # grep so that download counts don't appear in log files
+ java -jar BuildTools.jar --rev 1.12.1 | grep -vE "[^/ ]*/[^/ ]*\s*KB\s*$" | grep -v "^\s*$"
+ fi
language: java
jdk:
- oraclejdk8
+sudo: true
+deploy:
+ # deploy develop to the staging environment
+ - provider: script
+ script: chmod +x deploy.sh && sh deploy.sh staging
+ on:
+ branch: dev
+ skip_cleanup: true
+ # deploy master to production
+ - provider: script
+ script: chmod +x deploy.sh && sh deploy.sh production
+ on:
+ branch: master
+ skip_cleanup: true
diff --git a/deploy.sh b/deploy.sh
new file mode 100644
index 0000000..606423b
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+FILENAME=$(find target/ -maxdepth 1 ! -name '*original*' -name '*.jar')
+echo Found file: $FILENAME
+
+if [ $1 = 'production' ]; then
+echo Production mode
+echo $UPLOAD_KEY > upload_key
+chmod 400 upload_key
+yes | scp -B -i upload_key -o StrictHostKeyChecking=no $FILENAME travis@server.figytuna.com:/minecraft/main/plugins
+fi
diff --git a/pom.xml b/pom.xml
index c1b0016..58c30ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -82,6 +82,22 @@
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.12.4
+
+
+
+ integration-test
+ verify
+
+
+
+
+ true
+
+
buttondevteam
@@ -121,7 +137,7 @@
org.spigotmc
spigot-api
- 1.12-R0.1-SNAPSHOT
+ 1.12.1-R0.1-SNAPSHOT
com.github.TBMCPlugins.ButtonCore
@@ -169,6 +185,12 @@
1.16.16
provided
+
+ org.spigotmc
+ spigot
+ 1.12.1-R0.1-SNAPSHOT
+ provided
+
ButtonChat
diff --git a/src/main/java/buttondevteam/chat/ChatProcessing.java b/src/main/java/buttondevteam/chat/ChatProcessing.java
index 4b40d66..b45db0a 100644
--- a/src/main/java/buttondevteam/chat/ChatProcessing.java
+++ b/src/main/java/buttondevteam/chat/ChatProcessing.java
@@ -131,9 +131,11 @@ public class ChatProcessing {
if (channel.filteranderrormsg != null) {
Objective obj = PluginMain.SB.getObjective(channel.ID);
int score = -1;
- for (Player p : Bukkit.getOnlinePlayers())
- obj.getScore(p.getName()).setScore(
- p.getUniqueId().equals(player.getUniqueId()) ? score = e.getMCScore(p) : e.getMCScore(p));
+ for (Player p : Bukkit.getOnlinePlayers()) {
+ final int mcScore = VanillaUtils.getMCScoreIfChatOn(p, e);
+ obj.getScore(p.getName())
+ .setScore(p.getUniqueId().equals(player.getUniqueId()) ? score = mcScore : mcScore);
+ }
PluginMain.Instance.getServer().dispatchCommand(PluginMain.Console, String.format(
"tellraw @a[score_%s=%d,score_%s_min=%d] %s", channel.ID, score, channel.ID, score, jsonstr));
} else
diff --git a/src/main/java/buttondevteam/chat/VanillaUtils.java b/src/main/java/buttondevteam/chat/VanillaUtils.java
new file mode 100644
index 0000000..68f749b
--- /dev/null
+++ b/src/main/java/buttondevteam/chat/VanillaUtils.java
@@ -0,0 +1,18 @@
+package buttondevteam.chat;
+
+import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+import buttondevteam.lib.TBMCChatEvent;
+import lombok.experimental.UtilityClass;
+import net.minecraft.server.v1_12_R1.EntityHuman.EnumChatVisibility;
+
+@UtilityClass
+public class VanillaUtils {
+ public int getMCScoreIfChatOn(Player p, TBMCChatEvent e) {
+ if (!(p instanceof CraftPlayer) || ((CraftPlayer) p).getHandle().getChatFlags() == EnumChatVisibility.FULL) // Only send if client allows chat
+ return e.getMCScore(p);
+ else
+ return -1;
+ }
+}
diff --git a/src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java b/src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java
new file mode 100644
index 0000000..8d04cf2
--- /dev/null
+++ b/src/main/java/buttondevteam/chat/commands/appendtext/LennyCommand.java
@@ -0,0 +1,18 @@
+package buttondevteam.chat.commands.appendtext;
+
+public final class LennyCommand extends AppendTextCommandBase {
+
+ @Override
+ public String[] GetHelpText(String alias) {
+ return new String[] { "§6---- Lenny ----", //
+ "This command appends a Lenny face after your message", //
+ "Or just sends one", //
+ "Use either /" + alias + " or just /" + alias }; //
+ }
+
+ @Override
+ public String GetAppendedText() {
+ return "( ͡° ͜ʖ ͡°)";
+ }
+
+}
diff --git a/src/test/java/buttondevteam/chat/ChatFormatTest.java b/src/test/java/buttondevteam/chat/ChatFormatIT.java
similarity index 74%
rename from src/test/java/buttondevteam/chat/ChatFormatTest.java
rename to src/test/java/buttondevteam/chat/ChatFormatIT.java
index 9e97bf0..19c8f59 100644
--- a/src/test/java/buttondevteam/chat/ChatFormatTest.java
+++ b/src/test/java/buttondevteam/chat/ChatFormatIT.java
@@ -21,7 +21,7 @@ import buttondevteam.lib.chat.Color;
import junit.framework.TestCase;
@RunWith(ObjectTestRunner.class)
-public class ChatFormatTest extends TestCase {
+public class ChatFormatIT extends TestCase {
@Objects
public static List