fix guildchat being sent to discord

This commit is contained in:
speedxx 2020-07-21 15:21:51 -04:00
parent 8c93da758a
commit 2bf78bcccf
5 changed files with 66 additions and 6 deletions

View File

@ -237,6 +237,12 @@
<version>1.18.10</version> <version>1.18.10</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.speedxx</groupId>
<artifactId>TFGuilds</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -79,7 +79,6 @@ public class ChatManager extends FreedomService
FSync.playerMsg(player, "Message was shortened because it was too long to send."); FSync.playerMsg(player, "Message was shortened because it was too long to send.");
} }
final FPlayer fPlayer = plugin.pl.getPlayerSync(player); final FPlayer fPlayer = plugin.pl.getPlayerSync(player);
if (fPlayer.isLockedUp()) if (fPlayer.isLockedUp())
{ {
@ -137,7 +136,7 @@ public class ChatManager extends FreedomService
event.setFormat(format); event.setFormat(format);
// Send to discord // Send to discord
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted()) if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player))
{ {
plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message)); plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message));
} }

View File

@ -21,6 +21,7 @@ import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge; import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge; import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge; import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge; import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge; import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
import me.totalfreedom.totalfreedommod.caging.Cager; import me.totalfreedom.totalfreedommod.caging.Cager;
@ -134,6 +135,7 @@ public class TotalFreedomMod extends JavaPlugin
public SignBlocker snp; public SignBlocker snp;
public EntityWiper ew; public EntityWiper ew;
public Sitter st; public Sitter st;
//public HubWorldRestrictions hwr; //public HubWorldRestrictions hwr;
// //
// Bridges // Bridges
@ -141,6 +143,7 @@ public class TotalFreedomMod extends JavaPlugin
public EssentialsBridge esb; public EssentialsBridge esb;
public LibsDisguisesBridge ldb; public LibsDisguisesBridge ldb;
public CoreProtectBridge cpb; public CoreProtectBridge cpb;
public TFGuildsBridge tfg;
public WorldEditBridge web; public WorldEditBridge web;
public WorldGuardBridge wgb; public WorldGuardBridge wgb;
@ -254,7 +257,6 @@ public class TotalFreedomMod extends JavaPlugin
ae = new AutoEject(); ae = new AutoEject();
mo = new Monitors(); mo = new Monitors();
mv = new MovementValidator(); mv = new MovementValidator();
sp = new ServerPing(); sp = new ServerPing();
@ -273,6 +275,7 @@ public class TotalFreedomMod extends JavaPlugin
cpb = new CoreProtectBridge(); cpb = new CoreProtectBridge();
esb = new EssentialsBridge(); esb = new EssentialsBridge();
ldb = new LibsDisguisesBridge(); ldb = new LibsDisguisesBridge();
tfg = new TFGuildsBridge();
web = new WorldEditBridge(); web = new WorldEditBridge();
wgb = new WorldGuardBridge(); wgb = new WorldGuardBridge();
@ -376,4 +379,4 @@ public class TotalFreedomMod extends JavaPlugin
{ {
return new CleanroomChunkGenerator(id); return new CleanroomChunkGenerator(id);
} }
} }

View File

@ -0,0 +1,52 @@
package me.totalfreedom.totalfreedommod.bridge;
import me.totalfreedom.tfguilds.Common;
import me.totalfreedom.tfguilds.TFGuilds;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
public class TFGuildsBridge extends FreedomService
{
private TFGuilds tfGuildsPlugin = null;
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
public TFGuilds getTfGuildsPlugin()
{
if (tfGuildsPlugin == null)
{
try
{
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
if (tfGuilds != null)
{
if (tfGuilds instanceof TFGuilds)
{
tfGuildsPlugin = (TFGuilds)tfGuilds;
}
}
}
catch (Exception ex)
{
FLog.severe(ex);
}
}
return tfGuildsPlugin;
}
public boolean inGuildChat(Player player)
{
return Common.IN_GUILD_CHAT.contains(player);
}
}

View File

@ -2,6 +2,6 @@ name: TotalFreedomMod
main: me.totalfreedom.totalfreedommod.TotalFreedomMod main: me.totalfreedom.totalfreedommod.TotalFreedomMod
version: ${project.version} version: ${project.version}
description: Plugin for the Total Freedom server. description: Plugin for the Total Freedom server.
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit] softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit, TFGuilds]
authors: [Madgeek1450, Prozza] authors: [Madgeek1450, Prozza]
api-version: 1.15 api-version: 1.15