Fix hotbar message spam and translations

This commit is contained in:
ShinyDialga 2018-07-19 17:29:32 -05:00
parent 7f26cf911f
commit 8150624ce1
2 changed files with 7 additions and 2 deletions

View File

@ -19,10 +19,14 @@ import tc.oc.pgm.match.MatchScheduler;
import tc.oc.pgm.match.MatchScope;
import tc.oc.pgm.match.inject.ForRunningMatch;
import static tc.oc.minecraft.protocol.MinecraftVersion.lessThan;
import static tc.oc.minecraft.protocol.MinecraftVersion.MINECRAFT_1_8;
@ListenerScope(MatchScope.RUNNING)
public class StatsPlayerFacet implements MatchPlayerFacet, Listener {
private static final int DISPLAY_TICKS = 60;
private static final int LEGACY_TICKS = 2;
private static final DecimalFormat FORMAT = new DecimalFormat("0.00");
private final MatchScheduler scheduler;
@ -49,8 +53,9 @@ public class StatsPlayerFacet implements MatchPlayerFacet, Listener {
if (task != null) {
task.cancel();
}
task = scheduler.createRepeatingTask(1, 1, new Runnable() {
int ticks = DISPLAY_TICKS;
int ticks = lessThan(MINECRAFT_1_8, player.getBukkit().getProtocolVersion()) ? LEGACY_TICKS : DISPLAY_TICKS;
@Override
public void run() {
if (--ticks > 0) {

View File

@ -110,7 +110,7 @@ public class Audiences extends AbstractAudiences<CommandSender> {
@Override
public void sendHotbarMessage(BaseComponent message) {
sender().sendMessage(ChatMessageType.ACTION_BAR, message);
sender().sendMessage(ChatMessageType.ACTION_BAR, ComponentRenderers.render(message, sender()));
}
@Override