silent joining and leaving fixes

This commit is contained in:
speedxx 2020-08-04 15:11:16 -04:00
parent 4555a7e3f2
commit 5c50f8f27d
4 changed files with 16 additions and 30 deletions

View File

@ -8,10 +8,10 @@ import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class VanishBridge extends FreedomService
{
@Override
public void onStart()
{
@ -22,15 +22,19 @@ public class VanishBridge extends FreedomService
{
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler
public void onPlayerUnvanish(PlayerShowEvent event)
{
Player player = event.getPlayer();
Displayable display = plugin.rm.getDisplay(player);
String tag = display.getColoredTag();
FUtil.bcastMsg(plugin.rm.craftLoginMessage(event.getPlayer(), null));
plugin.dc.messageChatChannel("**" + player.getName() + " joined the server" + "**");
if (!event.isSilent())
{
FUtil.bcastMsg(plugin.rm.craftLoginMessage(event.getPlayer(), null));
plugin.dc.messageChatChannel("**" + player.getName() + " joined the server" + "**");
}
PlayerData playerData = plugin.pl.getData(player);
if (playerData.getTag() != null)
{
@ -39,10 +43,13 @@ public class VanishBridge extends FreedomService
playerData.setTag(tag);
}
@EventHandler(priority = EventPriority.HIGH)
@EventHandler
public void onPlayerVanish(PlayerHideEvent event)
{
Player player = event.getPlayer();
plugin.dc.messageChatChannel("**" + player.getName() + " left the server" + "**");
if (!event.isSilent())
{
plugin.dc.messageChatChannel("**" + player.getName() + " left the server" + "**");
}
}
}

View File

@ -44,12 +44,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class Discord extends FreedomService
{
public static HashMap<String, PlayerData> LINK_CODES = new HashMap<>();
public static HashMap<String, PlayerData> VERIFICATION_CODES = new HashMap<>();
public ScheduledThreadPoolExecutor RATELIMIT_EXECUTOR;
@ -251,24 +249,6 @@ public class Discord extends FreedomService
return VERIFICATION_CODES;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerJoin(PlayerJoinEvent event)
{
if (!plugin.al.isVanished(event.getPlayer()))
{
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**");
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLeave(PlayerQuitEvent event)
{
if (!plugin.al.isVanished(event.getPlayer()))
{
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**");
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event)
{
@ -374,7 +354,7 @@ public class Discord extends FreedomService
embedBuilder.setDescription(reason);
embedBuilder.setFooter("Reported by " + reporter.getName(), "https://minotar.net/helm/" + reporter.getName() + ".png");
embedBuilder.setTimestamp(Instant.from(ZonedDateTime.now()));
String location = "World: " + reported.getLocation().getWorld().getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
String location = "World: " + reported.getLocation().getWorld().getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
embedBuilder.addField("Location", location, true);
embedBuilder.addField("Game Mode", WordUtils.capitalizeFully(reported.getGameMode().name()), true);
User user = plugin.esb.getEssentialsUser(reported.getName());

View File

@ -5,7 +5,6 @@ import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;

View File

@ -41,7 +41,7 @@ operators:
- "libsdisguises.noactionbar"
# WorldGuard
- "worldgyardregion.list.own"
- "worldguardregion.list.own"
- "worldguard.region.addmember.own.*"
- "worldguard.region.removemember.own.*"
- "worldguard.region.info.*"