Fix players being sent they are allowed disguises when they're not

This commit is contained in:
libraryaddict 2020-06-21 20:18:48 +12:00
parent b501147b63
commit c3fc37182e
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
6 changed files with 24 additions and 7 deletions

View File

@ -112,6 +112,12 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
@Override
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) {
sender.sendMessage(LibsMsg.NO_PERM.get());
return;
}
sender.sendMessage(LibsMsg.DISG_HELP1.get());
sender.sendMessage(
LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())));

View File

@ -92,6 +92,11 @@ public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCom
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) {
sender.sendMessage(LibsMsg.NO_PERM.get());
return;
}
sender.sendMessage(LibsMsg.DISG_ENT_HELP1.get());
sender.sendMessage(
LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())));

View File

@ -171,6 +171,11 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) {
sender.sendMessage(LibsMsg.NO_PERM.get());
return;
}
sender.sendMessage(LibsMsg.D_HELP1.get());
sender.sendMessage(
LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())));

View File

@ -277,6 +277,11 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
protected void sendCommandUsage(CommandSender sender, DisguisePermissions permissions) {
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
if (allowedDisguises.isEmpty()) {
sender.sendMessage(LibsMsg.NO_PERM.get());
return;
}
sender.sendMessage(LibsMsg.DRADIUS_HELP1.get(maxRadius));
sender.sendMessage(
LibsMsg.CAN_USE_DISGS.get(StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get())));

View File

@ -1,17 +1,11 @@
package me.libraryaddict.disguise.commands.utils;
import com.comphenix.protocol.wrappers.WrappedGameProfile;
import me.libraryaddict.disguise.DisguiseAPI;
import me.libraryaddict.disguise.LibsDisguises;
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
import me.libraryaddict.disguise.utilities.LibsPremium;
import me.libraryaddict.disguise.utilities.SkinUtils;
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.Material;

View File

@ -121,7 +121,8 @@ public class ParamInfoManager {
// Add these last as it's what we want to present to be called the least
for (String methodName : new String[]{"setSelfDisguiseVisible", "setHideHeldItemFromSelf",
"setHideArmorFromSelf", "setHearSelfDisguise", "setHidePlayer", "setExpires", "setNotifyBar",
"setBossBarColor", "setBossBarStyle", "setTallDisguisesVisible", "setDynamicName", "setSoundGroup"}) {
"setBossBarColor", "setBossBarStyle", "setTallDisguisesVisible", "setDynamicName", "setSoundGroup",
"setDisguiseName"}) {
try {
Class cl = boolean.class;
@ -139,6 +140,7 @@ public class ParamInfoManager {
cl = BarStyle.class;
break;
case "setSoundGroup":
case "setDisguiseName":
cl = String.class;
break;
default: