Released 9.9.2 and added scoreboard test command

This commit is contained in:
libraryaddict 2020-02-06 13:59:57 +13:00
parent 580ae37385
commit 0a5752dd67
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
4 changed files with 77 additions and 13 deletions

View File

@ -5,7 +5,7 @@
<!-- A good example on why temporary names for project identification shouldn't be used --> <!-- A good example on why temporary names for project identification shouldn't be used -->
<groupId>LibsDisguises</groupId> <groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId> <artifactId>LibsDisguises</artifactId>
<version>9.9.1-SNAPSHOT</version> <version>9.9.2</version>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>

View File

@ -1,5 +1,6 @@
package me.libraryaddict.disguise.commands; package me.libraryaddict.disguise.commands;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.DisguiseConfig;
import me.libraryaddict.disguise.LibsDisguises; import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.disguisetypes.DisguiseType; import me.libraryaddict.disguise.disguisetypes.DisguiseType;
@ -22,6 +23,8 @@ import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@ -98,6 +101,59 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
DisguiseConfig.loadConfig(); DisguiseConfig.loadConfig();
sender.sendMessage(LibsMsg.RELOADED_CONFIG.get()); sender.sendMessage(LibsMsg.RELOADED_CONFIG.get());
return true; return true;
} else if (args[0].equalsIgnoreCase("scoreboard") || args[0].equalsIgnoreCase("board")) {
if (!sender.hasPermission("libsdisguises.scoreboardtest")) {
sender.sendMessage(LibsMsg.NO_PERM.get());
return true;
}
if (DisguiseConfig.getPushingOption() == DisguiseConfig.DisguisePushing.IGNORE_SCOREBOARD) {
sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_DISABLED.get());
}
Player player;
if (args.length > 1) {
player = Bukkit.getPlayer(args[1]);
if (player == null) {
sender.sendMessage(LibsMsg.CANNOT_FIND_PLAYER.get(args[1]));
return true;
}
if (!DisguiseAPI.isDisguised(player)) {
sender.sendMessage(LibsMsg.DMODPLAYER_NODISGUISE.get(player.getName()));
return true;
}
} else if (sender instanceof Player) {
player = (Player) sender;
if (!DisguiseAPI.isDisguised(player)) {
sender.sendMessage(LibsMsg.NOT_DISGUISED.get());
return true;
}
} else {
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
return true;
}
Scoreboard board = player.getScoreboard();
Team team = board.getEntryTeam(sender.getName());
if (team == null) {
sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_NO_TEAM.get());
return true;
}
if (team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.NEVER &&
team.getOption(Team.Option.COLLISION_RULE) != Team.OptionStatus.FOR_OTHER_TEAMS) {
sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_NO_TEAM_PUSH.get());
return true;
}
sender.sendMessage(LibsMsg.LIBS_SCOREBOARD_SUCCESS.get());
return true;
} else if (args[0].equalsIgnoreCase("permtest")) { } else if (args[0].equalsIgnoreCase("permtest")) {
if (!sender.hasPermission("libsdisguises.permtest")) { if (!sender.hasPermission("libsdisguises.permtest")) {
sender.sendMessage(LibsMsg.NO_PERM.get()); sender.sendMessage(LibsMsg.NO_PERM.get());

View File

@ -113,7 +113,8 @@ public enum LibsMsg {
PLEASE_WAIT(ChatColor.GRAY + "Please wait..."), PLEASE_WAIT(ChatColor.GRAY + "Please wait..."),
INVALID_CLONE(ChatColor.DARK_RED + "Unknown option '%s' - Valid options are 'IgnoreEquipment' 'DoSneakSprint' " + INVALID_CLONE(ChatColor.DARK_RED + "Unknown option '%s' - Valid options are 'IgnoreEquipment' 'DoSneakSprint' " +
"'DoSneak' 'DoSprint'"), "'DoSneak' 'DoSprint'"),
LIBS_COMMAND_WRONG_ARG(ChatColor.RED + "[LibsDisguises] Did you mean 'reload', 'permtest', 'json' or 'metainfo'?"), LIBS_COMMAND_WRONG_ARG(
ChatColor.RED + "[LibsDisguises] Did you mean 'reload', 'scoreboard', 'permtest', 'json' or 'metainfo'?"),
LIMITED_RADIUS(ChatColor.RED + "Limited radius to %s! Don't want to make too much lag right?"), LIMITED_RADIUS(ChatColor.RED + "Limited radius to %s! Don't want to make too much lag right?"),
LISTEN_ENTITY_ENTITY_DISG_ENTITY(ChatColor.RED + "Disguised %s as a %s!"), LISTEN_ENTITY_ENTITY_DISG_ENTITY(ChatColor.RED + "Disguised %s as a %s!"),
LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL(ChatColor.RED + "Failed to disguise %s as a %s!"), LISTEN_ENTITY_ENTITY_DISG_ENTITY_FAIL(ChatColor.RED + "Failed to disguise %s as a %s!"),
@ -250,7 +251,15 @@ public enum LibsMsg {
SWITCH_WORLD_DISGUISE_REMOVED(ChatColor.RED + "Disguise removed as you've switched worlds!"), SWITCH_WORLD_DISGUISE_REMOVED(ChatColor.RED + "Disguise removed as you've switched worlds!"),
ACTION_BAR_MESSAGE(ChatColor.GOLD + "Currently disguised as %s"), ACTION_BAR_MESSAGE(ChatColor.GOLD + "Currently disguised as %s"),
ITEM_SERIALIZED(ChatColor.GOLD + "Serialized, click to copy: "), ITEM_SERIALIZED(ChatColor.GOLD + "Serialized, click to copy: "),
ITEM_SIMPLE_STRING(ChatColor.GOLD + "Simple, click to copy: "); ITEM_SIMPLE_STRING(ChatColor.GOLD + "Simple, click to copy: "),
LIBS_SCOREBOARD_NO_TEAM(ChatColor.RED + "Not on a scoreboard team!"),
LIBS_SCOREBOARD_NO_TEAM_PUSH(ChatColor.RED + "Scoreboard team has pushing enabled!"),
LIBS_SCOREBOARD_SUCCESS(ChatColor.GOLD +
"On a team and pushing is disabled! If you're still having issues and you are disguised right now, then " +
"you have a plugin modifying scoreboard through packets"),
LIBS_SCOREBOARD_DISABLED(
"The scoreboard modification has been disabled in config, will continue the debug incase this is intended" +
".");
private String string; private String string;

View File

@ -89,7 +89,6 @@ commands:
permissions: permissions:
libsdisguises.reload: libsdisguises.reload:
description: Allows the user to reload LibsDisguises. description: Allows the user to reload LibsDisguises.
default: op
libsdisguises.seethrough: libsdisguises.seethrough:
description: Allows player to see through disguises. description: Allows player to see through disguises.
default: false default: false
@ -99,18 +98,18 @@ permissions:
libsdisguises.pve: libsdisguises.pve:
description: Allows player to ignore pve restrictions. description: Allows player to ignore pve restrictions.
default: false default: false
libsdisguises.permtest:
description: Allows player to test permissions
default: false
libsdisguises.metainfo:
description: Allows player to get meta info
default: false
libsdisguises.json:
description: Allows player to parse held item to json
default: true
libsdisguises.pvp: libsdisguises.pvp:
description: Allows player to ignore pvp restrictions. description: Allows player to ignore pvp restrictions.
default: false default: false
libsdisguises.permtest:
description: Allows player to test permissions
libsdisguises.metainfo:
description: Allows player to get meta info
libsdisguises.json:
description: Allows player to parse held item to json
default: true
libsdisguises.scoreboardtest:
description: Test if the scoreboard is valid, this is a simple test.
libsdisguises.seecmd: libsdisguises.seecmd:
description: See all commands in tab-completion description: See all commands in tab-completion
default: true default: true