Merge pull request #257 from speedxx/development

silent joining and leaving fixes
This commit is contained in:
Telesphoreo 2020-08-04 14:29:19 -05:00 committed by GitHub
commit 8832d5c870
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 31 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,8 +44,6 @@ 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
{
@ -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"
- "worldguard.region.list.own"
- "worldguard.region.addmember.own.*"
- "worldguard.region.removemember.own.*"
- "worldguard.region.info.*"