mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-28 12:47:36 +00:00
parent
da80f1b69e
commit
e77d92407c
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -7,5 +7,5 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="adopt-openj9-1.8" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
13
pom.xml
13
pom.xml
@ -140,6 +140,13 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.MyzelYam</groupId>
|
||||
<artifactId>SuperVanish</artifactId>
|
||||
<version>6.1.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
@ -202,6 +209,12 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.rayzr522</groupId>
|
||||
<artifactId>jsonmessage</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.vexsoftware</groupId>
|
||||
<artifactId>votifier</artifactId>
|
||||
|
@ -22,6 +22,7 @@ import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.FAWEBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.VanishBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||
@ -136,7 +137,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public SignBlocker snp;
|
||||
public EntityWiper ew;
|
||||
public Sitter st;
|
||||
public VanishHandler vh;
|
||||
public VanishBridge vb;
|
||||
public AMP amp;
|
||||
|
||||
//public HubWorldRestrictions hwr;
|
||||
@ -235,7 +236,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
snp = new SignBlocker();
|
||||
ew = new EntityWiper();
|
||||
st = new Sitter();
|
||||
vh = new VanishHandler();
|
||||
vb = new VanishBridge();
|
||||
amp = new AMP();
|
||||
|
||||
// Single admin utils
|
||||
|
@ -1,83 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class VanishHandler extends FreedomService
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(player) && plugin.al.isVanished(p.getName()))
|
||||
{
|
||||
player.hidePlayer(plugin, p);
|
||||
}
|
||||
}
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(p) && plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
p.hidePlayer(plugin, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
plugin.esb.setVanished(player.getName(), true);
|
||||
FLog.info(player.getName() + " joined while still vanished.");
|
||||
plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has joined silently.");
|
||||
event.setJoinMessage(null);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD + "You are hidden from other players."));
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 4L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeave(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
FLog.info(player.getName() + " left while still vanished.");
|
||||
plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has left silently.");
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package me.totalfreedom.totalfreedommod.admin;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@ -31,7 +32,6 @@ public class AdminList extends FreedomService
|
||||
private final Map<String, Admin> ipTable = Maps.newHashMap();
|
||||
public final List<String> verifiedNoAdmins = new ArrayList<>();
|
||||
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
||||
public static List<String> vanished = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
@ -363,8 +363,8 @@ public class AdminList extends FreedomService
|
||||
updateTables();
|
||||
}
|
||||
|
||||
public boolean isVanished(String player)
|
||||
public boolean isVanished(Player player)
|
||||
{
|
||||
return vanished.contains(player);
|
||||
return VanishAPI.isInvisible(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import de.myzelyam.api.vanish.PlayerHideEvent;
|
||||
import de.myzelyam.api.vanish.PlayerShowEvent;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class VanishBridge extends FreedomService
|
||||
{
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerUnvanish(PlayerShowEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Displayable display = plugin.rm.getDisplay(player);
|
||||
String tag = display.getColoredTag();
|
||||
|
||||
if (event.isSilent())
|
||||
{
|
||||
plugin.al.messageAllAdmins(ChatColor.GOLD + player.getName() + " silently unvanished.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.al.messageAllAdmins(ChatColor.GOLD + player.getName() + " unvanished and is now visible to all players.");
|
||||
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)
|
||||
{
|
||||
tag = FUtil.colorize(playerData.getTag());
|
||||
}
|
||||
playerData.setTag(tag);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerVanish(PlayerHideEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (event.isSilent())
|
||||
{
|
||||
plugin.al.messageAllAdmins(ChatColor.GOLD + player.getName() + " vanished and is now only visible to admins.");
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.dc.messageChatChannel("**" + player.getName() + " left the server" + "**");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
@ -96,7 +96,7 @@ public class Command_list extends FreedomCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - AdminList.vanished.size())
|
||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - VanishAPI.getInvisiblePlayers().size())
|
||||
.append(ChatColor.BLUE)
|
||||
.append(" out of a maximum ")
|
||||
.append(ChatColor.RED)
|
||||
@ -109,11 +109,11 @@ public class Command_list extends FreedomCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && plugin.al.isVanished(p.getName()))
|
||||
if (listFilter == ListFilter.ADMINS && plugin.al.isVanished(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.isVanished(p.getName()))
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !plugin.al.isVanished(p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Hide yourself from other players", usage = "/<command> [-s]", aliases = "v,ev,evanish")
|
||||
public class Command_vanish extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
if (!VanishAPI.isInvisible(playerSender))
|
||||
{
|
||||
VanishAPI.hidePlayer(playerSender);
|
||||
}
|
||||
else
|
||||
{
|
||||
VanishAPI.showPlayer(playerSender);
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("-s") || args[0].equalsIgnoreCase("-v"))
|
||||
{
|
||||
if (!VanishAPI.isInvisible(playerSender))
|
||||
{
|
||||
VanishAPI.getPlugin().getVisibilityChanger().hidePlayer(playerSender, null, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
VanishAPI.getPlugin().getVisibilityChanger().showPlayer(playerSender, null, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user