Better /libsdisguises
This commit is contained in:
		| @@ -104,6 +104,8 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter { | ||||
|             sender.sendMessage(ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v" + version + | ||||
|                     " by libraryaddict, formerly maintained by Byteflux and NavidK0."); | ||||
|  | ||||
|             // TODO You can use the following arguments, hover over them for more information | ||||
|  | ||||
|             if (sender.hasPermission("libsdisguises.reload")) { | ||||
|                 sender.sendMessage(ChatColor.DARK_GREEN + "Use " + ChatColor.GREEN + "/libsdisguises " + "reload" + | ||||
|                         ChatColor.DARK_GREEN + " to reload the config. All disguises will be blown by doing this" + | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.command.CommandSender; | ||||
|  | ||||
| import java.util.List; | ||||
| @@ -13,4 +14,6 @@ public interface LDCommand { | ||||
|     String getPermission(); | ||||
|  | ||||
|     void onCommand(CommandSender sender, String[] args); | ||||
|  | ||||
|     LibsMsg getHelp(); | ||||
| } | ||||
|   | ||||
| @@ -37,4 +37,9 @@ public class LDConfig implements LDCommand { | ||||
|             sender.sendMessage(ChatColor.AQUA + "[LibsDisguises] " + s); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -35,23 +35,6 @@ public class LDCount implements LDCommand { | ||||
|  | ||||
|         for (Set<TargetedDisguise> disguises : DisguiseUtilities.getDisguises().values()) { | ||||
|             for (Disguise disguise : disguises) { | ||||
|                 if (disguise.isPlayerDisguise() && DisguiseConfig.isScoreboardDisguiseNames()) { | ||||
|                     if (((PlayerDisguise) disguise).hasScoreboardName()) { | ||||
|                         for (Player player : Bukkit.getOnlinePlayers()) { | ||||
|                             Scoreboard board = player.getScoreboard(); | ||||
|  | ||||
|                             if (board.getEntryTeam(((PlayerDisguise) disguise).getProfileName()) == null) { | ||||
|                                 DisguiseUtilities.getLogger().warning( | ||||
|                                         "The player disguise " + ((PlayerDisguise) disguise).getName() + | ||||
|                                                 " is missing a scoreboard team on " + player.getName() + | ||||
|                                                 " and possibly more players!"); | ||||
|  | ||||
|                                 break; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                 counts.compute(disguise.getType(), (a, b) -> (b != null ? b : 0) + 1); | ||||
|             } | ||||
|         } | ||||
| @@ -79,4 +62,9 @@ public class LDCount implements LDCommand { | ||||
|             sender.sendMessage(LibsMsg.ACTIVE_DISGUISES.get(builder.toString())); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -122,4 +122,9 @@ public class LDJson implements LDCommand { | ||||
|  | ||||
|         sender.spigot().sendMessage(builder.create()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -73,4 +73,9 @@ public class LDMetaInfo implements LDCommand { | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -56,4 +56,9 @@ public class LDMods implements LDCommand { | ||||
|         sender.sendMessage(LibsMsg.MODS_LIST.get(player.getName(), | ||||
|                 StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "))); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -56,4 +56,9 @@ public class LDPermTest implements LDCommand { | ||||
|             sender.sendMessage(LibsMsg.NORMAL_PERM_CHECK_FAIL.get()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -26,4 +26,9 @@ public class LDReload implements LDCommand { | ||||
|         DisguiseConfig.loadConfig(); | ||||
|         sender.sendMessage(LibsMsg.RELOADED_CONFIG.get()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -2,6 +2,11 @@ package me.libraryaddict.disguise.commands.libsdisguises; | ||||
|  | ||||
| import me.libraryaddict.disguise.DisguiseAPI; | ||||
| import me.libraryaddict.disguise.DisguiseConfig; | ||||
| import me.libraryaddict.disguise.disguisetypes.Disguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.DisguiseType; | ||||
| import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; | ||||
| import me.libraryaddict.disguise.disguisetypes.TargetedDisguise; | ||||
| import me.libraryaddict.disguise.utilities.DisguiseUtilities; | ||||
| import me.libraryaddict.disguise.utilities.translations.LibsMsg; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.command.CommandSender; | ||||
| @@ -10,7 +15,9 @@ import org.bukkit.scoreboard.Scoreboard; | ||||
| import org.bukkit.scoreboard.Team; | ||||
|  | ||||
| import java.util.Arrays; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
|  | ||||
| /** | ||||
|  * Created by libraryaddict on 20/04/2020. | ||||
| @@ -28,6 +35,32 @@ public class LDScoreboard implements LDCommand { | ||||
|  | ||||
|     @Override | ||||
|     public void onCommand(CommandSender sender, String[] args) { | ||||
|         if (DisguiseConfig.isScoreboardDisguiseNames()) { | ||||
|             for (Set<TargetedDisguise> disguises : DisguiseUtilities.getDisguises().values()) { | ||||
|                 for (Disguise disguise : disguises) { | ||||
|                     if (!disguise.isPlayerDisguise()) { | ||||
|                         continue; | ||||
|                     } | ||||
|  | ||||
|                     if (!((PlayerDisguise) disguise).hasScoreboardName()) { | ||||
|                         continue; | ||||
|                     } | ||||
|  | ||||
|                     for (Player player : Bukkit.getOnlinePlayers()) { | ||||
|                         Scoreboard board = player.getScoreboard(); | ||||
|  | ||||
|                         if (board.getTeam(((PlayerDisguise) disguise).getScoreboardName().getTeamName()) != null) { | ||||
|                             continue; | ||||
|                         } | ||||
|  | ||||
|                         sender.sendMessage("The player disguise " + ((PlayerDisguise) disguise).getName() + | ||||
|                                 " is missing a scoreboard team on " + player.getName() + " and possibly more players!"); | ||||
|  | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (DisguiseConfig.getPushingOption() == DisguiseConfig.DisguisePushing.IGNORE_SCOREBOARD) { | ||||
|             sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_DISABLED.get()); | ||||
| @@ -76,4 +109,9 @@ public class LDScoreboard implements LDCommand { | ||||
|  | ||||
|         sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_SUCCESS.get(team.getName())); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -72,4 +72,9 @@ public class LDUpdate implements LDCommand { | ||||
|             } | ||||
|         }.runTaskAsynchronously(LibsDisguises.getInstance()); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public LibsMsg getHelp() { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user