No longer sending messages to "commands only" mode players, added /lenny, fixes related to testing #69

Merged
NorbiPeti merged 3 commits from dev into master 2017-08-17 16:12:56 +00:00
5 changed files with 62 additions and 3 deletions
Showing only changes of commit 0de469e514 - Show all commits

View file

@ -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

10
deploy.sh Normal file
View file

@ -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

View file

@ -169,6 +169,12 @@
<version>1.16.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ButtonChat</artifactId>
<organization>

View file

@ -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

View file

@ -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;
}
}