Revert scoreboard/bossbar toggle

This commit is contained in:
LinsaFTW 2021-08-03 11:14:41 -03:00
parent 8cfe152791
commit 4a4735b80d

View File

@ -1,104 +0,0 @@
From a24de40ec3b2d81f2825843d88694e3891bd1010 Mon Sep 17 00:00:00 2001
From: LinsaFTW <25271111+linsaftw@users.noreply.github.com>
Date: Mon, 2 Aug 2021 21:32:30 -0300
Subject: [PATCH] Added scoreboard bossbar toggle
diff --git a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
index aafd99d8..423688c0 100644
--- a/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
+++ b/flamecord/src/main/java/dev/_2lstudios/flamecord/configuration/FlameCordConfiguration.java
@@ -31,6 +31,11 @@ public class FlameCordConfiguration {
@Getter
private Collection<String> firewallNames = new HashSet<>(Arrays.asList(new String[] { "mcspam" }));
+ @Getter
+ private boolean proxyScoreboard = false;
+ @Getter
+ private boolean proxyBossBar = false;
+
public FlameCordConfiguration(final ConfigurationProvider configurationProvider) {
try {
final String fileName = "./flamecord.yml";
@@ -54,6 +59,9 @@ public class FlameCordConfiguration {
this.firewallSeconds = setIfUnexistant("firewall.seconds", this.firewallSeconds, configuration);
this.firewallNames = setIfUnexistant("firewall.names", this.firewallNames, configuration);
+ this.proxyScoreboard = setIfUnexistant("proxy-scoreboard", this.proxyScoreboard, configuration);
+ this.proxyBossBar = setIfUnexistant("proxy-bossbar", this.proxyBossBar, configuration);
+
if (!configurationExists) {
configurationProvider.save(configuration, configurationFile);
}
diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
index e95431a0..309c18d3 100644
--- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
+++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java
@@ -2,6 +2,7 @@ package net.md_5.bungee.protocol;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
+
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.TObjectIntMap;
import gnu.trove.map.hash.TIntObjectHashMap;
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
index 40c016d6..9becb0ae 100644
--- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java
@@ -13,6 +13,7 @@ import com.mojang.brigadier.suggestion.Suggestion;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.tree.LiteralCommandNode;
+import dev._2lstudios.flamecord.FlameCord;
import io.github.waterfallmc.waterfall.event.ProxyDefineCommandsEvent; // Waterfall
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
@@ -175,6 +176,8 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(ScoreboardObjective objective) throws Exception
{
+ if (FlameCord.getInstance().getFlameCordConfiguration().isProxyScoreboard())
+ return;
Scoreboard serverScoreboard = con.getServerSentScoreboard();
switch ( objective.getAction() )
{
@@ -200,6 +203,8 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(ScoreboardScore score) throws Exception
{
+ if (FlameCord.getInstance().getFlameCordConfiguration().isProxyScoreboard())
+ return;
Scoreboard serverScoreboard = con.getServerSentScoreboard();
switch ( score.getAction() )
{
@@ -219,6 +224,8 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(ScoreboardDisplay displayScoreboard) throws Exception
{
+ if (FlameCord.getInstance().getFlameCordConfiguration().isProxyScoreboard())
+ return;
Scoreboard serverScoreboard = con.getServerSentScoreboard();
serverScoreboard.setName( displayScoreboard.getName() );
serverScoreboard.setPosition( Position.values()[displayScoreboard.getPosition()] );
@@ -227,6 +234,8 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(net.md_5.bungee.protocol.packet.Team team) throws Exception
{
+ if (FlameCord.getInstance().getFlameCordConfiguration().isProxyScoreboard())
+ return;
Scoreboard serverScoreboard = con.getServerSentScoreboard();
// Remove team and move on
if ( team.getMode() == 1 )
@@ -646,6 +655,8 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(BossBar bossBar)
{
+ if (FlameCord.getInstance().getFlameCordConfiguration().isProxyBossBar())
+ return;
switch ( bossBar.getAction() )
{
// Handle add bossbar
--
2.32.0.windows.1