Fix imports, run code formatter
This commit is contained in:
parent
7c0eb550e7
commit
e0bbcbd43e
@ -3,13 +3,6 @@ package me.libraryaddict.disguise;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
@ -36,6 +29,14 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class DisguiseAPI {
|
public class DisguiseAPI {
|
||||||
private static int selfDisguiseId;
|
private static int selfDisguiseId;
|
||||||
private static int entityAttachmentId;
|
private static int entityAttachmentId;
|
||||||
|
@ -1,17 +1,5 @@
|
|||||||
package me.libraryaddict.disguise;
|
package me.libraryaddict.disguise;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -41,6 +29,19 @@ import org.bukkit.permissions.Permission;
|
|||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class DisguiseConfig {
|
public class DisguiseConfig {
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ -738,8 +739,9 @@ public class DisguiseConfig {
|
|||||||
ArrayList<String> returns = doOutput(config, changed, verbose);
|
ArrayList<String> returns = doOutput(config, changed, verbose);
|
||||||
|
|
||||||
if (!returns.isEmpty()) {
|
if (!returns.isEmpty()) {
|
||||||
DisguiseUtilities.getLogger().info("This is not an error! Now outputting " + (verbose ? "missing " : "") +
|
DisguiseUtilities.getLogger().info(
|
||||||
(changed ? (verbose ? "and " : "") + "changed/invalid " : "") + "config values");
|
"This is not an error! Now outputting " + (verbose ? "missing " : "") + (changed ? (verbose ? "and " : "") + "changed/invalid " : "") +
|
||||||
|
"config values");
|
||||||
|
|
||||||
for (String v : returns) {
|
for (String v : returns) {
|
||||||
DisguiseUtilities.getLogger().info(v);
|
DisguiseUtilities.getLogger().info(v);
|
||||||
@ -829,8 +831,8 @@ public class DisguiseConfig {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModdedManager
|
ModdedManager.registerModdedEntity(new NamespacedKey(key.substring(0, key.indexOf(":")), key.substring(key.indexOf(":") + 1)), entity,
|
||||||
.registerModdedEntity(new NamespacedKey(key.substring(0, key.indexOf(":")), key.substring(key.indexOf(":") + 1)), entity, register);
|
register);
|
||||||
|
|
||||||
DisguiseUtilities.getLogger().info("Modded entity " + name + " has been " + (register ? "registered" : "added"));
|
DisguiseUtilities.getLogger().info("Modded entity " + name + " has been " + (register ? "registered" : "added"));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package me.libraryaddict.disguise;
|
package me.libraryaddict.disguise;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.commands.LibsDisguisesCommand;
|
import me.libraryaddict.disguise.commands.LibsDisguisesCommand;
|
||||||
import me.libraryaddict.disguise.commands.disguise.DisguiseCommand;
|
import me.libraryaddict.disguise.commands.disguise.DisguiseCommand;
|
||||||
@ -53,6 +48,12 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class LibsDisguises extends JavaPlugin {
|
public class LibsDisguises extends JavaPlugin {
|
||||||
private static LibsDisguises instance;
|
private static LibsDisguises instance;
|
||||||
private DisguiseListener listener;
|
private DisguiseListener listener;
|
||||||
@ -94,8 +95,8 @@ public class LibsDisguises extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getLogger().severe(
|
getLogger().severe(
|
||||||
"Looks like ProtocolLib's site may be down! MythicCraft/MythicMobs has a discord server https://discord.gg/EErRhJ4qgx you" +
|
"Looks like ProtocolLib's site may be down! MythicCraft/MythicMobs has a discord server https://discord.gg/EErRhJ4qgx you" + " can " +
|
||||||
" can " + "join. Check the pins in #libs-support for a ProtocolLib.jar you can download!");
|
"join. Check the pins in #libs-support for a ProtocolLib.jar you can download!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,16 +3,6 @@ package me.libraryaddict.disguise.commands;
|
|||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.commands.disguise.DisguiseCommand;
|
import me.libraryaddict.disguise.commands.disguise.DisguiseCommand;
|
||||||
import me.libraryaddict.disguise.commands.disguise.DisguiseEntityCommand;
|
import me.libraryaddict.disguise.commands.disguise.DisguiseEntityCommand;
|
||||||
@ -40,6 +30,17 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author libraryaddict
|
* @author libraryaddict
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands;
|
package me.libraryaddict.disguise.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.commands.libsdisguises.LDChangelog;
|
import me.libraryaddict.disguise.commands.libsdisguises.LDChangelog;
|
||||||
@ -30,6 +26,11 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||||
@Getter
|
@Getter
|
||||||
private final ArrayList<LDCommand> commands = new ArrayList<>();
|
private final ArrayList<LDCommand> commands = new ArrayList<>();
|
||||||
@ -53,8 +54,9 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected ArrayList<String> filterTabs(ArrayList<String> list, String[] origArgs) {
|
protected ArrayList<String> filterTabs(ArrayList<String> list, String[] origArgs) {
|
||||||
if (origArgs.length == 0)
|
if (origArgs.length == 0) {
|
||||||
return list;
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<String> itel = list.iterator();
|
Iterator<String> itel = list.iterator();
|
||||||
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
||||||
@ -62,8 +64,9 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
|||||||
while (itel.hasNext()) {
|
while (itel.hasNext()) {
|
||||||
String name = itel.next();
|
String name = itel.next();
|
||||||
|
|
||||||
if (name.toLowerCase(Locale.ENGLISH).startsWith(label))
|
if (name.toLowerCase(Locale.ENGLISH).startsWith(label)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
itel.remove();
|
itel.remove();
|
||||||
}
|
}
|
||||||
@ -77,8 +80,9 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
|||||||
for (int i = 0; i < args.length - 1; i++) {
|
for (int i = 0; i < args.length - 1; i++) {
|
||||||
String s = args[i];
|
String s = args[i];
|
||||||
|
|
||||||
if (s.trim().isEmpty())
|
if (s.trim().isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
newArgs.add(s);
|
newArgs.add(s);
|
||||||
}
|
}
|
||||||
@ -107,9 +111,8 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
|||||||
" by libraryaddict, formerly maintained by Byteflux and NavidK0.");
|
" by libraryaddict, formerly maintained by Byteflux and NavidK0.");
|
||||||
|
|
||||||
if (sender.hasPermission("libsdisguises.reload")) {
|
if (sender.hasPermission("libsdisguises.reload")) {
|
||||||
sender.sendMessage(ChatColor.DARK_GREEN + "Use " + ChatColor.GREEN + "/libsdisguises " + "reload" +
|
sender.sendMessage(ChatColor.DARK_GREEN + "Use " + ChatColor.GREEN + "/libsdisguises " + "reload" + ChatColor.DARK_GREEN +
|
||||||
ChatColor.DARK_GREEN + " to reload the config. All disguises will be blown by doing this" +
|
" to reload the config. All disguises will be blown by doing this" + ".");
|
||||||
".");
|
|
||||||
sender.sendMessage(ChatColor.DARK_GREEN + "Use /libsdisguises help to see more help");
|
sender.sendMessage(ChatColor.DARK_GREEN + "Use /libsdisguises help to see more help");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.disguise;
|
package me.libraryaddict.disguise.commands.disguise;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -19,6 +17,9 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
@ -43,8 +44,8 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
|||||||
Disguise disguise;
|
Disguise disguise;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
disguise = DisguiseParser
|
disguise = DisguiseParser.parseDisguise(sender, (Entity) sender, getPermNode(), DisguiseUtilities.split(StringUtils.join(args, " ")),
|
||||||
.parseDisguise(sender, (Entity) sender, getPermNode(), DisguiseUtilities.split(StringUtils.join(args, " ")), getPermissions(sender));
|
getPermissions(sender));
|
||||||
} catch (DisguiseParseException ex) {
|
} catch (DisguiseParseException ex) {
|
||||||
ex.send(sender);
|
ex.send(sender);
|
||||||
|
|
||||||
@ -68,7 +69,8 @@ public class DisguiseCommand extends DisguiseBaseCommand implements TabCompleter
|
|||||||
|
|
||||||
if (!setViewDisguise(args)) {
|
if (!setViewDisguise(args)) {
|
||||||
// They prefer to have the opposite of whatever the view disguises option is
|
// They prefer to have the opposite of whatever the view disguises option is
|
||||||
if (DisguiseAPI.hasSelfDisguisePreference(disguise.getEntity()) && disguise.isSelfDisguiseVisible() == DisguiseConfig.isViewSelfDisguisesDefault()) {
|
if (DisguiseAPI.hasSelfDisguisePreference(disguise.getEntity()) &&
|
||||||
|
disguise.isSelfDisguiseVisible() == DisguiseConfig.isViewSelfDisguisesDefault()) {
|
||||||
disguise.setViewSelfDisguise(!disguise.isSelfDisguiseVisible());
|
disguise.setViewSelfDisguise(!disguise.isSelfDisguiseVisible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.disguise;
|
package me.libraryaddict.disguise.commands.disguise;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -18,6 +16,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseEntityCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.disguise;
|
package me.libraryaddict.disguise.commands.disguise;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -22,6 +19,10 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -106,7 +107,8 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
|
|
||||||
if (!setViewDisguise(args)) {
|
if (!setViewDisguise(args)) {
|
||||||
// They prefer to have the opposite of whatever the view disguises option is
|
// They prefer to have the opposite of whatever the view disguises option is
|
||||||
if (DisguiseAPI.hasSelfDisguisePreference(disguise.getEntity()) && disguise.isSelfDisguiseVisible() == DisguiseConfig.isViewSelfDisguisesDefault()) {
|
if (DisguiseAPI.hasSelfDisguisePreference(disguise.getEntity()) &&
|
||||||
|
disguise.isSelfDisguiseVisible() == DisguiseConfig.isViewSelfDisguisesDefault()) {
|
||||||
disguise.setViewSelfDisguise(!disguise.isSelfDisguiseVisible());
|
disguise.setViewSelfDisguise(!disguise.isSelfDisguiseVisible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,9 +123,8 @@ public class DisguisePlayerCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
LibsMsg.DISG_PLAYER_AS_DISG.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(),
|
LibsMsg.DISG_PLAYER_AS_DISG.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(),
|
||||||
disguise.getDisguiseName());
|
disguise.getDisguiseName());
|
||||||
} else {
|
} else {
|
||||||
LibsMsg.DISG_PLAYER_AS_DISG_FAIL
|
LibsMsg.DISG_PLAYER_AS_DISG_FAIL.send(sender,
|
||||||
.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(),
|
entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable(), disguise.getDisguiseName());
|
||||||
disguise.getDisguiseName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.disguise;
|
package me.libraryaddict.disguise.commands.disguise;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -27,6 +23,11 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
private ArrayList<Class<? extends Entity>> validClasses = new ArrayList<>();
|
private ArrayList<Class<? extends Entity>> validClasses = new ArrayList<>();
|
||||||
|
|
||||||
@ -188,7 +189,8 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
|
|
||||||
if (!setViewDisguise(args)) {
|
if (!setViewDisguise(args)) {
|
||||||
// They prefer to have the opposite of whatever the view disguises option is
|
// They prefer to have the opposite of whatever the view disguises option is
|
||||||
if (DisguiseAPI.hasSelfDisguisePreference(disguise.getEntity()) && disguise.isSelfDisguiseVisible() == DisguiseConfig.isViewSelfDisguisesDefault()) {
|
if (DisguiseAPI.hasSelfDisguisePreference(disguise.getEntity()) &&
|
||||||
|
disguise.isSelfDisguiseVisible() == DisguiseConfig.isViewSelfDisguisesDefault()) {
|
||||||
disguise.setViewSelfDisguise(!disguise.isSelfDisguiseVisible());
|
disguise.setViewSelfDisguise(!disguise.isSelfDisguiseVisible());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,10 @@ public class CopyDisguiseInteraction implements LibsEntityInteract {
|
|||||||
Disguise disguise = DisguiseAPI.getDisguise(player, entity);
|
Disguise disguise = DisguiseAPI.getDisguise(player, entity);
|
||||||
String disguiseString = DisguiseParser.parseToString(disguise, false);
|
String disguiseString = DisguiseParser.parseToString(disguise, false);
|
||||||
|
|
||||||
getCopyDisguiseCommand()
|
getCopyDisguiseCommand().sendMessage(player, LibsMsg.CLICK_TO_COPY, LibsMsg.COPY_DISGUISE_NO_COPY, disguiseString, false);
|
||||||
.sendMessage(player, LibsMsg.CLICK_TO_COPY, LibsMsg.COPY_DISGUISE_NO_COPY, disguiseString, false);
|
|
||||||
|
|
||||||
if (disguise instanceof PlayerDisguise) {
|
if (disguise instanceof PlayerDisguise) {
|
||||||
getCopyDisguiseCommand()
|
getCopyDisguiseCommand().sendMessage(player, LibsMsg.CLICK_TO_COPY_WITH_SKIN, LibsMsg.CLICK_TO_COPY_WITH_SKIN_NO_COPY,
|
||||||
.sendMessage(player, LibsMsg.CLICK_TO_COPY_WITH_SKIN, LibsMsg.CLICK_TO_COPY_WITH_SKIN_NO_COPY,
|
|
||||||
DisguiseParser.parseToString(disguise), true);
|
DisguiseParser.parseToString(disguise), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.interactions;
|
package me.libraryaddict.disguise.commands.interactions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
@ -15,6 +13,9 @@ import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 4/04/2020.
|
* Created by libraryaddict on 4/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -24,15 +24,17 @@ public class UndisguiseEntityInteraction implements LibsEntityInteract {
|
|||||||
if (DisguiseAPI.isDisguised(entity)) {
|
if (DisguiseAPI.isDisguised(entity)) {
|
||||||
DisguiseAPI.undisguiseToAll(p, entity);
|
DisguiseAPI.undisguiseToAll(p, entity);
|
||||||
|
|
||||||
if (entity instanceof Player)
|
if (entity instanceof Player) {
|
||||||
LibsMsg.LISTEN_UNDISG_PLAYER.send(p, entityName);
|
LibsMsg.LISTEN_UNDISG_PLAYER.send(p, entityName);
|
||||||
else
|
|
||||||
LibsMsg.LISTEN_UNDISG_ENT.send(p, entityName);
|
|
||||||
} else {
|
} else {
|
||||||
if (entity instanceof Player)
|
LibsMsg.LISTEN_UNDISG_ENT.send(p, entityName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (entity instanceof Player) {
|
||||||
LibsMsg.LISTEN_UNDISG_PLAYER_FAIL.send(p, entityName);
|
LibsMsg.LISTEN_UNDISG_PLAYER_FAIL.send(p, entityName);
|
||||||
else
|
} else {
|
||||||
LibsMsg.LISTEN_UNDISG_ENT_FAIL.send(p, entityName);
|
LibsMsg.LISTEN_UNDISG_ENT_FAIL.send(p, entityName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import me.libraryaddict.disguise.utilities.updates.UpdateChecker;
|
import me.libraryaddict.disguise.utilities.updates.UpdateChecker;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 27/04/2020.
|
* Created by libraryaddict on 27/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -43,8 +44,7 @@ public class LDChangelog implements LDCommand {
|
|||||||
|
|
||||||
if (!checker.getUpdate().isReleaseBuild()) {
|
if (!checker.getUpdate().isReleaseBuild()) {
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
ChatColor.GOLD + "You are on build " + (LibsDisguises.getInstance().isNumberedBuild() ? "#" : "") +
|
ChatColor.GOLD + "You are on build " + (LibsDisguises.getInstance().isNumberedBuild() ? "#" : "") + LibsDisguises.getInstance().getBuildNo());
|
||||||
LibsDisguises.getInstance().getBuildNo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String msg : checker.getUpdate().getChangelog()) {
|
for (String msg : checker.getUpdate().getChangelog()) {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
|
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
|
||||||
@ -13,6 +8,12 @@ import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
|||||||
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
import me.libraryaddict.disguise.utilities.translations.TranslateType;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -40,18 +41,16 @@ public class LDCount implements LDCommand {
|
|||||||
if (counts.isEmpty()) {
|
if (counts.isEmpty()) {
|
||||||
LibsMsg.NO_DISGUISES_IN_USE.send(sender);
|
LibsMsg.NO_DISGUISES_IN_USE.send(sender);
|
||||||
} else {
|
} else {
|
||||||
LibsMsg.ACTIVE_DISGUISES_COUNT.send(sender,
|
LibsMsg.ACTIVE_DISGUISES_COUNT.send(sender, counts.values().stream().reduce(Integer::sum).get());
|
||||||
counts.values().stream().reduce(Integer::sum).get());
|
|
||||||
|
|
||||||
ArrayList<DisguiseType> types = new ArrayList<>(counts.keySet());
|
ArrayList<DisguiseType> types = new ArrayList<>(counts.keySet());
|
||||||
types.sort((d1, d2) -> String.CASE_INSENSITIVE_ORDER.compare(TranslateType.DISGUISES.get(d1.toReadable()),
|
types.sort(
|
||||||
TranslateType.DISGUISES.get(d2.toReadable())));
|
(d1, d2) -> String.CASE_INSENSITIVE_ORDER.compare(TranslateType.DISGUISES.get(d1.toReadable()), TranslateType.DISGUISES.get(d2.toReadable())));
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
for (int i = 0; i < types.size(); i++) {
|
for (int i = 0; i < types.size(); i++) {
|
||||||
builder.append(LibsMsg.ACTIVE_DISGUISES_DISGUISE
|
builder.append(LibsMsg.ACTIVE_DISGUISES_DISGUISE.get(TranslateType.DISGUISES.get(types.get(i).toReadable()), counts.get(types.get(i))));
|
||||||
.get(TranslateType.DISGUISES.get(types.get(i).toReadable()), counts.get(types.get(i))));
|
|
||||||
|
|
||||||
if (i + 1 < types.size()) {
|
if (i + 1 < types.size()) {
|
||||||
builder.append(LibsMsg.ACTIVE_DISGUISES_SEPERATOR.get());
|
builder.append(LibsMsg.ACTIVE_DISGUISES_SEPERATOR.get());
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.mineskin.MineSkinAPI;
|
import me.libraryaddict.disguise.utilities.mineskin.MineSkinAPI;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 22/05/2021.
|
* Created by libraryaddict on 22/05/2021.
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
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;
|
||||||
@ -18,6 +16,9 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 24/04/2020.
|
* Created by libraryaddict on 24/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -49,18 +50,14 @@ public class LDDebugPlayer implements LDCommand {
|
|||||||
DisguiseUtilities.DScoreTeam name = disg.getScoreboardName();
|
DisguiseUtilities.DScoreTeam name = disg.getScoreboardName();
|
||||||
|
|
||||||
player.sendMessage(ChatColor.RED +
|
player.sendMessage(ChatColor.RED +
|
||||||
String.format("Prefix: '%s', Suffix: '%s', Disguise Name: '%s', Team '%s'",
|
String.format("Prefix: '%s', Suffix: '%s', Disguise Name: '%s', Team '%s'", name.getPrefix().replace(ChatColor.COLOR_CHAR, '&'),
|
||||||
name.getPrefix().replace(ChatColor.COLOR_CHAR, '&'),
|
name.getSuffix().replace(ChatColor.COLOR_CHAR, '&'), name.getPlayer().replace(ChatColor.COLOR_CHAR, '&'), name.getTeamName()));
|
||||||
name.getSuffix().replace(ChatColor.COLOR_CHAR, '&'),
|
|
||||||
name.getPlayer().replace(ChatColor.COLOR_CHAR, '&'), name.getTeamName()));
|
|
||||||
|
|
||||||
if (DisguiseConfig.isArmorstandsName()) {
|
if (DisguiseConfig.isArmorstandsName()) {
|
||||||
player.sendMessage(
|
player.sendMessage(ChatColor.AQUA + "Oh! You're using armorstands! Lets give some debug for that too..");
|
||||||
ChatColor.AQUA + "Oh! You're using armorstands! Lets give some debug for that too..");
|
player.sendMessage(ChatColor.RED +
|
||||||
player.sendMessage(ChatColor.RED + String.format("Names: %s, Length: %s, Custom Name: '%s'",
|
String.format("Names: %s, Length: %s, Custom Name: '%s'", new Gson().toJson(disg.getMultiName()).replace(ChatColor.COLOR_CHAR, '&'),
|
||||||
new Gson().toJson(disg.getMultiName()).replace(ChatColor.COLOR_CHAR, '&'),
|
disg.getMultiNameLength(), disg.getWatcher().getCustomName().replace(ChatColor.COLOR_CHAR, '&')));
|
||||||
disg.getMultiNameLength(),
|
|
||||||
disg.getWatcher().getCustomName().replace(ChatColor.COLOR_CHAR, '&')));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = player.getScoreboard().getTeam(name.getTeamName());
|
Team team = player.getScoreboard().getTeam(name.getTeamName());
|
||||||
@ -75,9 +72,8 @@ public class LDDebugPlayer implements LDCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.sendMessage(ChatColor.RED +
|
player.sendMessage(ChatColor.RED +
|
||||||
String.format("Prefix Matches: %s, Suffix Matches: %s, In Team: %s, Name Visibility: %s",
|
String.format("Prefix Matches: %s, Suffix Matches: %s, In Team: %s, Name Visibility: %s", team.getPrefix().equals(name.getPrefix()),
|
||||||
team.getPrefix().equals(name.getPrefix()), team.getSuffix().equals(name.getSuffix()),
|
team.getSuffix().equals(name.getSuffix()), team.hasEntry(name.getPlayer()), team.getOption(Team.Option.NAME_TAG_VISIBILITY)));
|
||||||
team.hasEntry(name.getPlayer()), team.getOption(Team.Option.NAME_TAG_VISIBILITY)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.commands.LibsDisguisesCommand;
|
import me.libraryaddict.disguise.commands.LibsDisguisesCommand;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 22/04/2020.
|
* Created by libraryaddict on 22/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
@ -17,6 +14,10 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -114,8 +115,7 @@ public class LDJson implements LDCommand {
|
|||||||
|
|
||||||
builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub));
|
builder.event(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, sub));
|
||||||
builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
builder.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||||
new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append((string.length() <= 256 ? "" : " " + msg))
|
new ComponentBuilder("").append(LibsMsg.CLICK_TO_COPY_HOVER.getBase()).append((string.length() <= 256 ? "" : " " + msg)).create()));
|
||||||
.create()));
|
|
||||||
msg += 1;
|
msg += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
@ -12,6 +8,11 @@ import net.md_5.bungee.api.chat.HoverEvent;
|
|||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.utilities.modded.ModdedManager;
|
import me.libraryaddict.disguise.utilities.modded.ModdedManager;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@ -9,6 +7,9 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -51,8 +52,7 @@ public class LDMods implements LDCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibsMsg.MODS_LIST.send(sender, player.getName(),
|
LibsMsg.MODS_LIST.send(sender, player.getName(), StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "));
|
||||||
StringUtils.join((List<String>) player.getMetadata("forge_mods").get(0).value(), ", "));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
@ -13,6 +11,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.permissions.Permissible;
|
import org.bukkit.permissions.Permissible;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -65,8 +66,7 @@ public class LDPermTest implements LDCommand {
|
|||||||
LibsMsg.NORMAL_PERM_CHECK_FAIL.send(sender);
|
LibsMsg.NORMAL_PERM_CHECK_FAIL.send(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.hasPermission("libsdisguises.disguise.zombie") ||
|
if (player.hasPermission("libsdisguises.disguise.zombie") || permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.ZOMBIE))) {
|
||||||
permissions.isAllowedDisguise(new DisguisePerm(DisguiseType.ZOMBIE))) {
|
|
||||||
LibsMsg.LIBS_PERM_CHECK_ZOMBIE_PERMISSIONS.send(sender);
|
LibsMsg.LIBS_PERM_CHECK_ZOMBIE_PERMISSIONS.send(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.utilities.sounds.SoundManager;
|
import me.libraryaddict.disguise.utilities.sounds.SoundManager;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -3,11 +3,6 @@ package me.libraryaddict.disguise.commands.libsdisguises;
|
|||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketListener;
|
import com.comphenix.protocol.events.PacketListener;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
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;
|
||||||
@ -27,6 +22,12 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -78,7 +79,6 @@ public class LDScoreboard implements LDCommand {
|
|||||||
|
|
||||||
checked.add(board);
|
checked.add(board);
|
||||||
|
|
||||||
|
|
||||||
Team team = board.getTeam(scoreboardName.getTeamName());
|
Team team = board.getTeam(scoreboardName.getTeamName());
|
||||||
|
|
||||||
if (team == null) {
|
if (team == null) {
|
||||||
@ -125,8 +125,8 @@ public class LDScoreboard implements LDCommand {
|
|||||||
LibsMsg.LIBS_SCOREBOARD_NAMES_DISABLED.send(sender);
|
LibsMsg.LIBS_SCOREBOARD_NAMES_DISABLED.send(sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PacketListener> listeners = ProtocolLibrary.getProtocolManager().getPacketListeners().stream()
|
List<PacketListener> listeners = ProtocolLibrary.getProtocolManager().getPacketListeners().stream().filter(
|
||||||
.filter(listener -> listener.getPlugin() != LibsDisguises.getInstance() &&
|
listener -> listener.getPlugin() != LibsDisguises.getInstance() &&
|
||||||
listener.getSendingWhitelist().getTypes().contains(PacketType.Play.Server.SCOREBOARD_TEAM)).collect(Collectors.toList());
|
listener.getSendingWhitelist().getTypes().contains(PacketType.Play.Server.SCOREBOARD_TEAM)).collect(Collectors.toList());
|
||||||
|
|
||||||
if (!listeners.isEmpty()) {
|
if (!listeners.isEmpty()) {
|
||||||
@ -149,8 +149,8 @@ public class LDScoreboard implements LDCommand {
|
|||||||
builder.append(listener.getPlugin().getName());
|
builder.append(listener.getPlugin().getName());
|
||||||
builder.color(net.md_5.bungee.api.ChatColor.AQUA);
|
builder.color(net.md_5.bungee.api.ChatColor.AQUA);
|
||||||
|
|
||||||
String plugin = ChatColor.GOLD + "Plugin: " + ChatColor.YELLOW + listener.getPlugin().getName() + " v" +
|
String plugin =
|
||||||
listener.getPlugin().getDescription().getVersion();
|
ChatColor.GOLD + "Plugin: " + ChatColor.YELLOW + listener.getPlugin().getName() + " v" + listener.getPlugin().getDescription().getVersion();
|
||||||
String listenerClass = ChatColor.GOLD + "Listener: " + ChatColor.YELLOW + listener.getClass().toString();
|
String listenerClass = ChatColor.GOLD + "Listener: " + ChatColor.YELLOW + listener.getClass().toString();
|
||||||
String packets = ChatColor.GOLD + "Packets: " + ChatColor.YELLOW + StringUtils.join(listener.getSendingWhitelist().getTypes(), ", ");
|
String packets = ChatColor.GOLD + "Packets: " + ChatColor.YELLOW + StringUtils.join(listener.getSendingWhitelist().getTypes(), ", ");
|
||||||
String priority = ChatColor.GOLD + "Priority: " + ChatColor.YELLOW + listener.getSendingWhitelist().getPriority();
|
String priority = ChatColor.GOLD + "Priority: " + ChatColor.YELLOW + listener.getSendingWhitelist().getPriority();
|
||||||
@ -165,8 +165,8 @@ public class LDScoreboard implements LDCommand {
|
|||||||
|
|
||||||
LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.send(sender);
|
LibsMsg.LIBS_SCOREBOARD_IGNORE_TEST.send(sender);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.RED +
|
sender.sendMessage(
|
||||||
"This command is somewhat outdated and needs to be changed, pushing is now disabled on the entities themselves and not players");
|
ChatColor.RED + "This command is somewhat outdated and needs to be changed, pushing is now disabled on the entities themselves and not players");
|
||||||
|
|
||||||
Player player;
|
Player player;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
@ -12,6 +10,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/04/2020.
|
* Created by libraryaddict on 20/04/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
@ -11,6 +7,11 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 30/06/2020.
|
* Created by libraryaddict on 30/06/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
package me.libraryaddict.disguise.commands.libsdisguises;
|
package me.libraryaddict.disguise.commands.libsdisguises;
|
||||||
|
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import lombok.Data;
|
||||||
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
|
import me.libraryaddict.disguise.utilities.config.ConfigLoader;
|
||||||
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -15,18 +28,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import lombok.Data;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
|
||||||
import me.libraryaddict.disguise.utilities.config.ConfigLoader;
|
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 18/06/2020.
|
* Created by libraryaddict on 18/06/2020.
|
||||||
@ -230,8 +231,8 @@ public class LDUploadLogs implements LDCommand {
|
|||||||
sender.sendMessage(ChatColor.GOLD + "Click on the below message to have it appear in your chat input");
|
sender.sendMessage(ChatColor.GOLD + "Click on the below message to have it appear in your chat input");
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = "My log file: " + latestPaste + ", my combined config files: " + configPaste + " and my disguises file: " +
|
String text =
|
||||||
disguisesPaste;
|
"My log file: " + latestPaste + ", my combined config files: " + configPaste + " and my disguises file: " + disguisesPaste;
|
||||||
|
|
||||||
ComponentBuilder builder = new ComponentBuilder("");
|
ComponentBuilder builder = new ComponentBuilder("");
|
||||||
builder.append(text);
|
builder.append(text);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.modify;
|
package me.libraryaddict.disguise.commands.modify;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
@ -18,6 +16,9 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
@ -57,15 +58,12 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
options = DisguiseParser.parsePlaceholders(options, sender, sender);
|
options = DisguiseParser.parsePlaceholders(options, sender, sender);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DisguiseParser.callMethods(sender, disguise, permissions, disguisePerm, new ArrayList<>(), options,
|
DisguiseParser.callMethods(sender, disguise, permissions, disguisePerm, new ArrayList<>(), options, "DisguiseModify");
|
||||||
"DisguiseModify");
|
} catch (DisguiseParseException ex) {
|
||||||
}
|
|
||||||
catch (DisguiseParseException ex) {
|
|
||||||
ex.send(sender);
|
ex.send(sender);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Throwable ex) {
|
||||||
catch (Throwable ex) {
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -77,13 +75,15 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] origArgs) {
|
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] origArgs) {
|
||||||
if (!(sender instanceof Player))
|
if (!(sender instanceof Player)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender);
|
Disguise disguise = DisguiseAPI.getDisguise((Player) sender, (Entity) sender);
|
||||||
|
|
||||||
if (disguise == null)
|
if (disguise == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
String[] args = getPreviousArgs(origArgs);
|
String[] args = getPreviousArgs(origArgs);
|
||||||
|
|
||||||
@ -105,7 +105,6 @@ public class DisguiseModifyCommand extends DisguiseBaseCommand implements TabCom
|
|||||||
|
|
||||||
LibsMsg.DMODIFY_HELP1.send(sender);
|
LibsMsg.DMODIFY_HELP1.send(sender);
|
||||||
LibsMsg.DMODIFY_HELP2.send(sender);
|
LibsMsg.DMODIFY_HELP2.send(sender);
|
||||||
LibsMsg.DMODIFY_HELP3.send(sender,
|
LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
|
||||||
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.modify;
|
package me.libraryaddict.disguise.commands.modify;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -16,6 +14,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,8 +40,8 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
|||||||
|
|
||||||
// TODO Validate if any disguises have this arg
|
// TODO Validate if any disguises have this arg
|
||||||
|
|
||||||
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(),
|
LibsDisguises.getInstance().getListener()
|
||||||
new DisguiseModifyInteraction(DisguiseUtilities.split(StringUtils.join(args, " "))),
|
.addInteraction(sender.getName(), new DisguiseModifyInteraction(DisguiseUtilities.split(StringUtils.join(args, " "))),
|
||||||
DisguiseConfig.getDisguiseEntityExpire());
|
DisguiseConfig.getDisguiseEntityExpire());
|
||||||
|
|
||||||
LibsMsg.DMODIFYENT_CLICK.send(sender, DisguiseConfig.getDisguiseEntityExpire());
|
LibsMsg.DMODIFYENT_CLICK.send(sender, DisguiseConfig.getDisguiseEntityExpire());
|
||||||
@ -78,7 +79,6 @@ public class DisguiseModifyEntityCommand extends DisguiseBaseCommand implements
|
|||||||
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
|
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
|
||||||
|
|
||||||
LibsMsg.DMODENT_HELP1.send(sender);
|
LibsMsg.DMODENT_HELP1.send(sender);
|
||||||
LibsMsg.DMODIFY_HELP3.send(sender,
|
LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
|
||||||
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.modify;
|
package me.libraryaddict.disguise.commands.modify;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
@ -20,6 +17,10 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,8 +43,7 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
|||||||
if (args[0].contains("-")) {
|
if (args[0].contains("-")) {
|
||||||
try {
|
try {
|
||||||
entityTarget = Bukkit.getEntity(UUID.fromString(args[0]));
|
entityTarget = Bukkit.getEntity(UUID.fromString(args[0]));
|
||||||
}
|
} catch (Exception ignored) {
|
||||||
catch (Exception ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,11 +63,13 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
|||||||
|
|
||||||
Disguise disguise = null;
|
Disguise disguise = null;
|
||||||
|
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player) {
|
||||||
disguise = DisguiseAPI.getDisguise((Player) sender, entityTarget);
|
disguise = DisguiseAPI.getDisguise((Player) sender, entityTarget);
|
||||||
|
}
|
||||||
|
|
||||||
if (disguise == null)
|
if (disguise == null) {
|
||||||
disguise = DisguiseAPI.getDisguise(entityTarget);
|
disguise = DisguiseAPI.getDisguise(entityTarget);
|
||||||
|
}
|
||||||
|
|
||||||
if (disguise == null) {
|
if (disguise == null) {
|
||||||
LibsMsg.DMODPLAYER_NODISGUISE.send(sender, entityTarget.getName());
|
LibsMsg.DMODPLAYER_NODISGUISE.send(sender, entityTarget.getName());
|
||||||
@ -86,15 +88,11 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
|||||||
options = DisguiseParser.parsePlaceholders(options, sender, entityTarget);
|
options = DisguiseParser.parsePlaceholders(options, sender, entityTarget);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
DisguiseParser.callMethods(sender, disguise, permissions, disguisePerm, new ArrayList<>(), options,
|
DisguiseParser.callMethods(sender, disguise, permissions, disguisePerm, new ArrayList<>(), options, "DisguiseModifyPlayer");
|
||||||
"DisguiseModifyPlayer");
|
} catch (DisguiseParseException ex) {
|
||||||
}
|
|
||||||
catch (DisguiseParseException ex) {
|
|
||||||
ex.send(sender);
|
ex.send(sender);
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Throwable ex) {
|
||||||
|
|
||||||
catch (Throwable ex) {
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -133,11 +131,13 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
|||||||
|
|
||||||
Disguise disguise = null;
|
Disguise disguise = null;
|
||||||
|
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player) {
|
||||||
disguise = DisguiseAPI.getDisguise((Player) sender, player);
|
disguise = DisguiseAPI.getDisguise((Player) sender, player);
|
||||||
|
}
|
||||||
|
|
||||||
if (disguise == null)
|
if (disguise == null) {
|
||||||
disguise = DisguiseAPI.getDisguise(player);
|
disguise = DisguiseAPI.getDisguise(player);
|
||||||
|
}
|
||||||
|
|
||||||
if (disguise == null) {
|
if (disguise == null) {
|
||||||
return tabs;
|
return tabs;
|
||||||
@ -159,7 +159,6 @@ public class DisguiseModifyPlayerCommand extends DisguiseBaseCommand implements
|
|||||||
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
|
ArrayList<String> allowedDisguises = getAllowedDisguises(permissions);
|
||||||
|
|
||||||
LibsMsg.DMODPLAYER_HELP1.send(sender);
|
LibsMsg.DMODPLAYER_HELP1.send(sender);
|
||||||
LibsMsg.DMODIFY_HELP3.send(sender,
|
LibsMsg.DMODIFY_HELP3.send(sender, StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
|
||||||
StringUtils.join(allowedDisguises, LibsMsg.CAN_USE_DISGS_SEPERATOR.get()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.modify;
|
package me.libraryaddict.disguise.commands.modify;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -29,6 +24,12 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseModifyRadiusCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
private Collection<Entity> getNearbyEntities(CommandSender sender, int radius) {
|
private Collection<Entity> getNearbyEntities(CommandSender sender, int radius) {
|
||||||
Location center;
|
Location center;
|
||||||
|
@ -16,7 +16,9 @@ public class UndisguiseCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
if (sender instanceof Player && !sender.isOp() &&
|
if (sender instanceof Player && !sender.isOp() &&
|
||||||
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
||||||
sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!");
|
sender.sendMessage(ChatColor.RED +
|
||||||
|
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
|
||||||
|
"usage!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,9 @@ public class UndisguiseEntityCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
if (sender instanceof Player && !sender.isOp() &&
|
if (sender instanceof Player && !sender.isOp() &&
|
||||||
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
||||||
sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!");
|
sender.sendMessage(ChatColor.RED +
|
||||||
|
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
|
||||||
|
"usage!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,8 +32,7 @@ public class UndisguiseEntityCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(),
|
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(), DisguiseConfig.getDisguiseEntityExpire());
|
||||||
DisguiseConfig.getDisguiseEntityExpire());
|
|
||||||
LibsMsg.UND_ENTITY.send(sender);
|
LibsMsg.UND_ENTITY.send(sender);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.undisguise;
|
package me.libraryaddict.disguise.commands.undisguise;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
@ -18,10 +13,17 @@ import org.bukkit.command.TabCompleter;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
||||||
protected ArrayList<String> filterTabs(ArrayList<String> list, String[] origArgs) {
|
protected ArrayList<String> filterTabs(ArrayList<String> list, String[] origArgs) {
|
||||||
if (origArgs.length == 0)
|
if (origArgs.length == 0) {
|
||||||
return list;
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<String> itel = list.iterator();
|
Iterator<String> itel = list.iterator();
|
||||||
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
||||||
@ -29,8 +31,9 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
|||||||
while (itel.hasNext()) {
|
while (itel.hasNext()) {
|
||||||
String name = itel.next();
|
String name = itel.next();
|
||||||
|
|
||||||
if (name.toLowerCase(Locale.ENGLISH).startsWith(label))
|
if (name.toLowerCase(Locale.ENGLISH).startsWith(label)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
itel.remove();
|
itel.remove();
|
||||||
}
|
}
|
||||||
@ -44,8 +47,9 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
|||||||
for (int i = 0; i < args.length - 1; i++) {
|
for (int i = 0; i < args.length - 1; i++) {
|
||||||
String s = args[i];
|
String s = args[i];
|
||||||
|
|
||||||
if (s.trim().isEmpty())
|
if (s.trim().isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
newArgs.add(s);
|
newArgs.add(s);
|
||||||
}
|
}
|
||||||
@ -57,7 +61,9 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
|||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
if (sender instanceof Player && !sender.isOp() &&
|
if (sender instanceof Player && !sender.isOp() &&
|
||||||
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
||||||
sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!");
|
sender.sendMessage(ChatColor.RED +
|
||||||
|
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
|
||||||
|
"usage!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,8 +83,7 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
|||||||
if (args[0].contains("-")) {
|
if (args[0].contains("-")) {
|
||||||
try {
|
try {
|
||||||
entityTarget = Bukkit.getEntity(UUID.fromString(args[0]));
|
entityTarget = Bukkit.getEntity(UUID.fromString(args[0]));
|
||||||
}
|
} catch (Exception ignored) {
|
||||||
catch (Exception ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,13 +95,9 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
if (DisguiseAPI.isDisguised(entityTarget)) {
|
if (DisguiseAPI.isDisguised(entityTarget)) {
|
||||||
DisguiseAPI.undisguiseToAll(sender, entityTarget);
|
DisguiseAPI.undisguiseToAll(sender, entityTarget);
|
||||||
LibsMsg.UNDISG_PLAYER.send(sender,
|
LibsMsg.UNDISG_PLAYER.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable());
|
||||||
entityTarget instanceof Player ? entityTarget.getName() :
|
|
||||||
DisguiseType.getType(entityTarget).toReadable());
|
|
||||||
} else {
|
} else {
|
||||||
LibsMsg.UNDISG_PLAYER_FAIL.send(sender,
|
LibsMsg.UNDISG_PLAYER_FAIL.send(sender, entityTarget instanceof Player ? entityTarget.getName() : DisguiseType.getType(entityTarget).toReadable());
|
||||||
entityTarget instanceof Player ? entityTarget.getName() :
|
|
||||||
DisguiseType.getType(entityTarget).toReadable());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -107,8 +108,9 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
|||||||
ArrayList<String> tabs = new ArrayList<>();
|
ArrayList<String> tabs = new ArrayList<>();
|
||||||
String[] args = getArgs(origArgs);
|
String[] args = getArgs(origArgs);
|
||||||
|
|
||||||
if (args.length != 0)
|
if (args.length != 0) {
|
||||||
return filterTabs(tabs, origArgs);
|
return filterTabs(tabs, origArgs);
|
||||||
|
}
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
// If command user cannot see player online, don't tab-complete name
|
// If command user cannot see player online, don't tab-complete name
|
||||||
|
@ -18,8 +18,7 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
|
|||||||
try {
|
try {
|
||||||
Integer.parseInt(string);
|
Integer.parseInt(string);
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +27,9 @@ public class UndisguiseRadiusCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
if (sender instanceof Player && !sender.isOp() &&
|
if (sender instanceof Player && !sender.isOp() &&
|
||||||
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
||||||
sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!");
|
sender.sendMessage(ChatColor.RED +
|
||||||
|
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
|
||||||
|
"usage!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.utils;
|
package me.libraryaddict.disguise.commands.utils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
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;
|
||||||
@ -23,6 +21,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/01/2020.
|
* Created by libraryaddict on 1/01/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.utils;
|
package me.libraryaddict.disguise.commands.utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
@ -16,6 +14,9 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -57,8 +58,7 @@ public class DisguiseCloneCommand extends DisguiseBaseCommand implements TabComp
|
|||||||
DisguiseUtilities.createClonedDisguise((Player) sender, player, options);
|
DisguiseUtilities.createClonedDisguise((Player) sender, player, options);
|
||||||
} else {
|
} else {
|
||||||
LibsDisguises.getInstance().getListener()
|
LibsDisguises.getInstance().getListener()
|
||||||
.addInteraction(sender.getName(), new DisguiseCloneInteraction(options),
|
.addInteraction(sender.getName(), new DisguiseCloneInteraction(options), DisguiseConfig.getDisguiseCloneExpire());
|
||||||
DisguiseConfig.getDisguiseCloneExpire());
|
|
||||||
|
|
||||||
LibsMsg.CLICK_TIMER.send(sender, DisguiseConfig.getDisguiseCloneExpire());
|
LibsMsg.CLICK_TIMER.send(sender, DisguiseConfig.getDisguiseCloneExpire());
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.commands.utils;
|
package me.libraryaddict.disguise.commands.utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
import me.libraryaddict.disguise.commands.DisguiseBaseCommand;
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfo;
|
import me.libraryaddict.disguise.utilities.params.ParamInfo;
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
||||||
@ -19,6 +15,11 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompleter {
|
public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,12 +48,10 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
|||||||
|
|
||||||
if (help != null) {
|
if (help != null) {
|
||||||
if (help.hasValues() && help.canTranslateValues()) {
|
if (help.hasValues() && help.canTranslateValues()) {
|
||||||
LibsMsg.DHELP_HELP4.send(sender, help.getName(),
|
LibsMsg.DHELP_HELP4.send(sender, help.getName(), StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get()));
|
||||||
StringUtils.join(help.getEnums(""), LibsMsg.DHELP_HELP4_SEPERATOR.get()));
|
|
||||||
} else {
|
} else {
|
||||||
if (!help.getName().equals(help.getDescriptiveName())) {
|
if (!help.getName().equals(help.getDescriptiveName())) {
|
||||||
LibsMsg.DHELP_HELP6
|
LibsMsg.DHELP_HELP6.send(sender, help.getName(), help.getDescriptiveName(), help.getDescription());
|
||||||
.send(sender, help.getName(), help.getDescriptiveName(), help.getDescription());
|
|
||||||
} else {
|
} else {
|
||||||
LibsMsg.DHELP_HELP5.send(sender, help.getName(), help.getDescription());
|
LibsMsg.DHELP_HELP5.send(sender, help.getName(), help.getDescription());
|
||||||
}
|
}
|
||||||
@ -80,8 +79,7 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
|||||||
try {
|
try {
|
||||||
for (WatcherMethod method : ParamInfoManager.getDisguiseWatcherMethods(watcher)) {
|
for (WatcherMethod method : ParamInfoManager.getDisguiseWatcherMethods(watcher)) {
|
||||||
if (args.length < 2 || !args[1].equalsIgnoreCase(LibsMsg.DHELP_SHOW.get())) {
|
if (args.length < 2 || !args[1].equalsIgnoreCase(LibsMsg.DHELP_SHOW.get())) {
|
||||||
if (!perms.isAllowedDisguise(type, Collections.singleton(method.getName().toLowerCase(
|
if (!perms.isAllowedDisguise(type, Collections.singleton(method.getName().toLowerCase(Locale.ENGLISH)))) {
|
||||||
Locale.ENGLISH)))) {
|
|
||||||
ignored++;
|
ignored++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -98,13 +96,12 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
|||||||
methodColor = ChatColor.GRAY;
|
methodColor = ChatColor.GRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = TranslateType.DISGUISE_OPTIONS.get(method.getName()) + ChatColor.DARK_RED + "(" +
|
String str = TranslateType.DISGUISE_OPTIONS.get(method.getName()) + ChatColor.DARK_RED + "(" + ChatColor.GREEN + info.getName() +
|
||||||
ChatColor.GREEN + info.getName() + ChatColor.DARK_RED + ")";
|
ChatColor.DARK_RED + ")";
|
||||||
|
|
||||||
methods.add(methodColor + str);
|
methods.add(methodColor + str);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,8 +109,7 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
|||||||
methods.add(LibsMsg.DHELP_NO_OPTIONS.get());
|
methods.add(LibsMsg.DHELP_NO_OPTIONS.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
LibsMsg.DHELP_OPTIONS.send(sender, ChatColor.DARK_RED + type.toReadable(),
|
LibsMsg.DHELP_OPTIONS.send(sender, ChatColor.DARK_RED + type.toReadable(), StringUtils.join(methods, ChatColor.DARK_RED + ", "));
|
||||||
StringUtils.join(methods, ChatColor.DARK_RED + ", "));
|
|
||||||
|
|
||||||
if (ignored > 0) {
|
if (ignored > 0) {
|
||||||
LibsMsg.NO_PERMS_USE_OPTIONS.send(sender, ignored);
|
LibsMsg.NO_PERMS_USE_OPTIONS.send(sender, ignored);
|
||||||
@ -137,8 +133,9 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
|||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
for (DisguisePerm type : perms.getAllowed()) {
|
for (DisguisePerm type : perms.getAllowed()) {
|
||||||
if (type.isUnknown())
|
if (type.isUnknown()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
tabs.add(type.toReadable().replaceAll(" ", "_"));
|
tabs.add(type.toReadable().replaceAll(" ", "_"));
|
||||||
}
|
}
|
||||||
@ -163,9 +160,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
|||||||
LibsMsg.DHELP_HELP2.send(sender);
|
LibsMsg.DHELP_HELP2.send(sender);
|
||||||
|
|
||||||
for (ParamInfo s : ParamInfoManager.getParamInfos()) {
|
for (ParamInfo s : ParamInfoManager.getParamInfos()) {
|
||||||
LibsMsg.DHELP_HELP3.send(sender, s.getName().replaceAll(" ", "") +
|
LibsMsg.DHELP_HELP3.send(sender,
|
||||||
(!s.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""),
|
s.getName().replaceAll(" ", "") + (!s.getName().equals(s.getDescriptiveName()) ? " ~ " + s.getDescriptiveName() : ""), s.getDescription());
|
||||||
s.getDescription());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.commands.utils;
|
package me.libraryaddict.disguise.commands.utils;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
@ -19,6 +18,8 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/06/2020.
|
* Created by libraryaddict on 20/06/2020.
|
||||||
*/
|
*/
|
||||||
@ -27,7 +28,9 @@ public class GrabHeadCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
|
||||||
if (sender instanceof Player && !sender.isOp() &&
|
if (sender instanceof Player && !sender.isOp() &&
|
||||||
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
||||||
sender.sendMessage(ChatColor.RED + "This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin usage!");
|
sender.sendMessage(ChatColor.RED +
|
||||||
|
"This is the free version of Lib's Disguises, player commands are limited to console and Operators only! Purchase the plugin for non-admin " +
|
||||||
|
"usage!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +96,7 @@ public class GrabHeadCommand implements CommandExecutor {
|
|||||||
Field field = meta.getClass().getDeclaredField("profile");
|
Field field = meta.getClass().getDeclaredField("profile");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
field.set(meta, profile.getHandle());
|
field.set(meta, profile.getHandle());
|
||||||
}
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
catch (NoSuchFieldException | IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package me.libraryaddict.disguise.commands.utils;
|
package me.libraryaddict.disguise.commands.utils;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import java.util.Arrays;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
@ -20,6 +19,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 28/12/2019.
|
* Created by libraryaddict on 28/12/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -6,27 +6,23 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public enum AnimalColor {
|
public enum AnimalColor {
|
||||||
BLACK(DyeColor.BLACK,
|
BLACK(DyeColor.BLACK, NmsVersion.v1_13.isSupported() ? Material.getMaterial("INK_SAC") : Material.getMaterial("INK_SACK")),
|
||||||
NmsVersion.v1_13.isSupported() ? Material.getMaterial("INK_SAC") : Material.getMaterial("INK_SACK")),
|
|
||||||
BLUE(DyeColor.BLUE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LAPIS_LAZULI") : null),
|
BLUE(DyeColor.BLUE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LAPIS_LAZULI") : null),
|
||||||
BROWN(DyeColor.BROWN, NmsVersion.v1_13.isSupported() ? Material.getMaterial("COCOA_BEANS") : null),
|
BROWN(DyeColor.BROWN, NmsVersion.v1_13.isSupported() ? Material.getMaterial("COCOA_BEANS") : null),
|
||||||
CYAN(DyeColor.CYAN, NmsVersion.v1_13.isSupported() ? Material.getMaterial("CYAN_DYE") : null),
|
CYAN(DyeColor.CYAN, NmsVersion.v1_13.isSupported() ? Material.getMaterial("CYAN_DYE") : null),
|
||||||
GRAY(DyeColor.GRAY, NmsVersion.v1_13.isSupported() ? Material.getMaterial("GRAY_DYE") : null),
|
GRAY(DyeColor.GRAY, NmsVersion.v1_13.isSupported() ? Material.getMaterial("GRAY_DYE") : null),
|
||||||
GREEN(DyeColor.GREEN,
|
GREEN(DyeColor.GREEN, NmsVersion.v1_14.isSupported() ? Material.getMaterial("GREEN_DYE") : Material.getMaterial("CACTUS_GREEN")),
|
||||||
NmsVersion.v1_14.isSupported() ? Material.getMaterial("GREEN_DYE") : Material.getMaterial("CACTUS_GREEN")),
|
|
||||||
LIGHT_BLUE(DyeColor.LIGHT_BLUE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIGHT_BLUE_DYE") : null),
|
LIGHT_BLUE(DyeColor.LIGHT_BLUE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIGHT_BLUE_DYE") : null),
|
||||||
LIME(DyeColor.LIME, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIME_DYE") : null),
|
LIME(DyeColor.LIME, NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIME_DYE") : null),
|
||||||
MAGENTA(DyeColor.MAGENTA, NmsVersion.v1_13.isSupported() ? Material.getMaterial("MAGENTA_DYE") : null),
|
MAGENTA(DyeColor.MAGENTA, NmsVersion.v1_13.isSupported() ? Material.getMaterial("MAGENTA_DYE") : null),
|
||||||
ORANGE(DyeColor.ORANGE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("ORANGE_DYE") : null),
|
ORANGE(DyeColor.ORANGE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("ORANGE_DYE") : null),
|
||||||
PINK(DyeColor.PINK, NmsVersion.v1_13.isSupported() ? Material.getMaterial("PINK_DYE") : null),
|
PINK(DyeColor.PINK, NmsVersion.v1_13.isSupported() ? Material.getMaterial("PINK_DYE") : null),
|
||||||
PURPLE(DyeColor.PURPLE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("PURPLE_DYE") : null),
|
PURPLE(DyeColor.PURPLE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("PURPLE_DYE") : null),
|
||||||
RED(DyeColor.RED,
|
RED(DyeColor.RED, NmsVersion.v1_14.isSupported() ? Material.getMaterial("RED_DYE") : Material.getMaterial("ROSE_RED")),
|
||||||
NmsVersion.v1_14.isSupported() ? Material.getMaterial("RED_DYE") : Material.getMaterial("ROSE_RED")),
|
|
||||||
LIGHT_GRAY(DyeColor.valueOf(NmsVersion.v1_13.isSupported() ? "LIGHT_GRAY" : "SILVER"),
|
LIGHT_GRAY(DyeColor.valueOf(NmsVersion.v1_13.isSupported() ? "LIGHT_GRAY" : "SILVER"),
|
||||||
NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIGHT_GRAY_DYE") : null),
|
NmsVersion.v1_13.isSupported() ? Material.getMaterial("LIGHT_GRAY_DYE") : null),
|
||||||
WHITE(DyeColor.WHITE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("BONE_MEAL") : null),
|
WHITE(DyeColor.WHITE, NmsVersion.v1_13.isSupported() ? Material.getMaterial("BONE_MEAL") : null),
|
||||||
YELLOW(DyeColor.YELLOW, NmsVersion.v1_14.isSupported() ? Material.getMaterial("YELLOW_DYE") :
|
YELLOW(DyeColor.YELLOW, NmsVersion.v1_14.isSupported() ? Material.getMaterial("YELLOW_DYE") : Material.getMaterial("DANDELION_YELLOW"));
|
||||||
Material.getMaterial("DANDELION_YELLOW"));
|
|
||||||
|
|
||||||
public static AnimalColor getColorByWool(int woolId) {
|
public static AnimalColor getColorByWool(int woolId) {
|
||||||
for (AnimalColor color : values()) {
|
for (AnimalColor color : values()) {
|
||||||
|
@ -7,16 +7,6 @@ import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
|||||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -54,6 +44,17 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public abstract class Disguise {
|
public abstract class Disguise {
|
||||||
private transient boolean disguiseInUse;
|
private transient boolean disguiseInUse;
|
||||||
private DisguiseType disguiseType;
|
private DisguiseType disguiseType;
|
||||||
@ -511,8 +512,9 @@ public abstract class Disguise {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public Disguise setWatcher(FlagWatcher newWatcher) {
|
public Disguise setWatcher(FlagWatcher newWatcher) {
|
||||||
if (!getType().getWatcherClass().isInstance(newWatcher)) {
|
if (!getType().getWatcherClass().isInstance(newWatcher)) {
|
||||||
throw new IllegalArgumentException((newWatcher == null ? "null" : newWatcher.getClass().getSimpleName()) + " is not a instance of " +
|
throw new IllegalArgumentException(
|
||||||
getType().getWatcherClass().getSimpleName() + " for DisguiseType " + getType().name());
|
(newWatcher == null ? "null" : newWatcher.getClass().getSimpleName()) + " is not a instance of " + getType().getWatcherClass().getSimpleName() +
|
||||||
|
" for DisguiseType " + getType().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
watcher = newWatcher;
|
watcher = newWatcher;
|
||||||
@ -784,8 +786,8 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) {
|
if (isHidePlayer() && getEntity() instanceof Player && ((Player) getEntity()).isOnline()) {
|
||||||
PlayerInfoData playerInfo = new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
|
PlayerInfoData playerInfo =
|
||||||
NativeGameMode.fromBukkit(((Player) getEntity()).getGameMode()),
|
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0, NativeGameMode.fromBukkit(((Player) getEntity()).getGameMode()),
|
||||||
WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())));
|
WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())));
|
||||||
|
|
||||||
PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
||||||
|
@ -4,7 +4,6 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.BatWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.BatWatcher;
|
||||||
@ -17,6 +16,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 20/05/2021.
|
* Created by libraryaddict on 20/05/2021.
|
||||||
*/
|
*/
|
||||||
@ -183,8 +184,8 @@ class DisguiseRunnable extends BukkitRunnable {
|
|||||||
|
|
||||||
mods.write(4,
|
mods.write(4,
|
||||||
DisguiseUtilities.getYaw(disguise.getType(), disguise.getEntity().getType(), (byte) Math.floor(loc.getYaw() * 256.0F / 360.0F)));
|
DisguiseUtilities.getYaw(disguise.getType(), disguise.getEntity().getType(), (byte) Math.floor(loc.getYaw() * 256.0F / 360.0F)));
|
||||||
mods.write(5, DisguiseUtilities
|
mods.write(5,
|
||||||
.getPitch(disguise.getType(), disguise.getEntity().getType(), (byte) Math.floor(loc.getPitch() * 256.0F / 360.0F)));
|
DisguiseUtilities.getPitch(disguise.getType(), disguise.getEntity().getType(), (byte) Math.floor(loc.getPitch() * 256.0F / 360.0F)));
|
||||||
|
|
||||||
if (disguise.isSelfDisguiseVisible() && disguise.getEntity() instanceof Player) {
|
if (disguise.isSelfDisguiseVisible() && disguise.getEntity() instanceof Player) {
|
||||||
PacketContainer selfLookPacket = lookPacket.shallowClone();
|
PacketContainer selfLookPacket = lookPacket.shallowClone();
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsRemovedIn;
|
import me.libraryaddict.disguise.utilities.reflection.NmsRemovedIn;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
@ -9,6 +8,8 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public enum DisguiseType {
|
public enum DisguiseType {
|
||||||
AREA_EFFECT_CLOUD(3, 0),
|
AREA_EFFECT_CLOUD(3, 0),
|
||||||
|
|
||||||
|
@ -10,14 +10,6 @@ import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
|||||||
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
@ -41,6 +33,15 @@ import org.bukkit.inventory.EntityEquipment;
|
|||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FlagWatcher {
|
public class FlagWatcher {
|
||||||
private boolean addEntityAnimations = DisguiseConfig.isAddEntityAnimations();
|
private boolean addEntityAnimations = DisguiseConfig.isAddEntityAnimations();
|
||||||
/**
|
/**
|
||||||
|
@ -10,16 +10,6 @@ import com.comphenix.protocol.wrappers.WrappedParticle;
|
|||||||
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
import com.comphenix.protocol.wrappers.nbt.NbtBase;
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
import com.comphenix.protocol.wrappers.nbt.NbtFactory;
|
||||||
import com.comphenix.protocol.wrappers.nbt.NbtType;
|
import com.comphenix.protocol.wrappers.nbt.NbtType;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.OptionalInt;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractHorseWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractHorseWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractSkeletonWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractSkeletonWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractVillagerWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.AbstractVillagerWatcher;
|
||||||
@ -113,6 +103,17 @@ import org.bukkit.Particle;
|
|||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.OptionalInt;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class MetaIndex<Y> {
|
public class MetaIndex<Y> {
|
||||||
private static MetaIndex[] _values = new MetaIndex[0];
|
private static MetaIndex[] _values = new MetaIndex[0];
|
||||||
|
|
||||||
@ -697,8 +698,8 @@ public class MetaIndex<Y> {
|
|||||||
public static MetaIndex<Integer> ABSTRACT_VILLAGER_ANGRY = new MetaIndex<>(AbstractVillagerWatcher.class, 0, 0);
|
public static MetaIndex<Integer> ABSTRACT_VILLAGER_ANGRY = new MetaIndex<>(AbstractVillagerWatcher.class, 0, 0);
|
||||||
|
|
||||||
@NmsAddedIn(NmsVersion.v1_14)
|
@NmsAddedIn(NmsVersion.v1_14)
|
||||||
public static MetaIndex<VillagerData> VILLAGER_DATA = new MetaIndex<>(VillagerWatcher.class, 0,
|
public static MetaIndex<VillagerData> VILLAGER_DATA =
|
||||||
NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) : null);
|
new MetaIndex<>(VillagerWatcher.class, 0, NmsVersion.v1_14.isSupported() ? new VillagerData(Villager.Type.PLAINS, Villager.Profession.NONE, 1) : null);
|
||||||
|
|
||||||
public static MetaIndex<Boolean> WITCH_AGGRESSIVE = new MetaIndex<>(WitchWatcher.class, 0, false);
|
public static MetaIndex<Boolean> WITCH_AGGRESSIVE = new MetaIndex<>(WitchWatcher.class, 0, false);
|
||||||
|
|
||||||
@ -1002,8 +1003,9 @@ public class MetaIndex<Y> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisguiseUtilities.getLogger().severe("MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " + metaIndex.getIndex() +
|
DisguiseUtilities.getLogger().severe(
|
||||||
" has already registered this! (" + metaIndex.getDefault() + "," + index.getDefault() + ")");
|
"MetaIndex " + metaIndex.getFlagWatcher().getSimpleName() + " at index " + metaIndex.getIndex() + " has already registered this! (" +
|
||||||
|
metaIndex.getDefault() + "," + index.getDefault() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
values()[i] = metaIndexes[a];
|
values()[i] = metaIndexes[a];
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.PaintingWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.PaintingWatcher;
|
||||||
@ -12,6 +11,8 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
public class MiscDisguise extends TargetedDisguise {
|
public class MiscDisguise extends TargetedDisguise {
|
||||||
private int id = -1, data = 0;
|
private int id = -1, data = 0;
|
||||||
|
|
||||||
@ -27,8 +28,7 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
super(disguiseType);
|
super(disguiseType);
|
||||||
|
|
||||||
if (disguiseType != DisguiseType.FALLING_BLOCK && disguiseType != DisguiseType.DROPPED_ITEM) {
|
if (disguiseType != DisguiseType.FALLING_BLOCK && disguiseType != DisguiseType.DROPPED_ITEM) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("This constructor requires a DROPPED_ITEM or FALLING_BLOCK disguise type!");
|
||||||
"This constructor requires a DROPPED_ITEM or FALLING_BLOCK disguise type!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(0, itemStack);
|
apply(0, itemStack);
|
||||||
@ -38,8 +38,7 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
super(disguiseType);
|
super(disguiseType);
|
||||||
|
|
||||||
if (disguiseType != DisguiseType.FALLING_BLOCK && disguiseType != DisguiseType.DROPPED_ITEM) {
|
if (disguiseType != DisguiseType.FALLING_BLOCK && disguiseType != DisguiseType.DROPPED_ITEM) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("This constructor requires a DROPPED_ITEM or FALLING_BLOCK disguise type!");
|
||||||
"This constructor requires a DROPPED_ITEM or FALLING_BLOCK disguise type!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(0, new ItemStack(material));
|
apply(0, new ItemStack(material));
|
||||||
@ -55,9 +54,8 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
|
|
||||||
if (!disguiseType.isMisc()) {
|
if (!disguiseType.isMisc()) {
|
||||||
throw new InvalidParameterException(
|
throw new InvalidParameterException(
|
||||||
"Expected a non-living DisguiseType while constructing MiscDisguise. Received " + disguiseType +
|
"Expected a non-living DisguiseType while constructing MiscDisguise. Received " + disguiseType + " instead. Please use " +
|
||||||
" instead. Please use " + (disguiseType.isPlayer() ? "PlayerDisguise" : "MobDisguise") +
|
(disguiseType.isPlayer() ? "PlayerDisguise" : "MobDisguise") + " instead");
|
||||||
" instead");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(id, new ItemStack(Material.STONE));
|
apply(id, new ItemStack(Material.STONE));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.ArmorStandWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.ArmorStandWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
|
||||||
@ -10,6 +9,8 @@ import me.libraryaddict.disguise.utilities.DisguiseValues;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
public class MobDisguise extends TargetedDisguise {
|
public class MobDisguise extends TargetedDisguise {
|
||||||
private boolean isAdult;
|
private boolean isAdult;
|
||||||
|
|
||||||
@ -22,9 +23,8 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
|
|
||||||
if (!disguiseType.isMob()) {
|
if (!disguiseType.isMob()) {
|
||||||
throw new InvalidParameterException(
|
throw new InvalidParameterException(
|
||||||
"Expected a living DisguiseType while constructing MobDisguise. Received " + disguiseType +
|
"Expected a living DisguiseType while constructing MobDisguise. Received " + disguiseType + " instead. Please use " +
|
||||||
" instead. Please use " + (disguiseType.isPlayer() ? "PlayerDisguise" : "MiscDisguise") +
|
(disguiseType.isPlayer() ? "PlayerDisguise" : "MiscDisguise") + " instead");
|
||||||
" instead");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isAdult = isAdult;
|
this.isAdult = isAdult;
|
||||||
@ -46,8 +46,7 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
|
|
||||||
if (getWatcher() != null) {
|
if (getWatcher() != null) {
|
||||||
if (getType() == DisguiseType.ARMOR_STAND) {
|
if (getType() == DisguiseType.ARMOR_STAND) {
|
||||||
return (((ArmorStandWatcher) getWatcher()).isSmall() ? values.getBabyBox() : values.getAdultBox())
|
return (((ArmorStandWatcher) getWatcher()).isSmall() ? values.getBabyBox() : values.getAdultBox()).getY();
|
||||||
.getY();
|
|
||||||
} else if (getType() == DisguiseType.SLIME || getType() == DisguiseType.MAGMA_CUBE) {
|
} else if (getType() == DisguiseType.SLIME || getType() == DisguiseType.MAGMA_CUBE) {
|
||||||
return 0.51 * (0.255 * ((SlimeWatcher) getWatcher()).getSize());
|
return 0.51 * (0.255 * ((SlimeWatcher) getWatcher()).getSize());
|
||||||
}
|
}
|
||||||
@ -76,8 +75,7 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean doesDisguiseAge() {
|
public boolean doesDisguiseAge() {
|
||||||
return getWatcher() != null &&
|
return getWatcher() != null && (getWatcher() instanceof AgeableWatcher || getWatcher() instanceof ZombieWatcher);
|
||||||
(getWatcher() instanceof AgeableWatcher || getWatcher() instanceof ZombieWatcher);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes;
|
package me.libraryaddict.disguise.disguisetypes;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.disguisetypes.watchers.ModdedWatcher;
|
import me.libraryaddict.disguise.disguisetypes.watchers.ModdedWatcher;
|
||||||
import me.libraryaddict.disguise.utilities.modded.ModdedEntity;
|
import me.libraryaddict.disguise.utilities.modded.ModdedEntity;
|
||||||
@ -8,6 +7,8 @@ import me.libraryaddict.disguise.utilities.modded.ModdedManager;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 15/04/2020.
|
* Created by libraryaddict on 15/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -30,8 +31,7 @@ public class ModdedDisguise extends TargetedDisguise {
|
|||||||
super(disguiseType);
|
super(disguiseType);
|
||||||
|
|
||||||
if (disguiseType != DisguiseType.UNKNOWN) {
|
if (disguiseType != DisguiseType.UNKNOWN) {
|
||||||
throw new InvalidParameterException(
|
throw new InvalidParameterException("CustomDisguise is only for DisguiseType.MODDED_LIVING/MISC and DisguiseType.UNKNOWN");
|
||||||
"CustomDisguise is only for DisguiseType.MODDED_LIVING/MISC and DisguiseType.UNKNOWN");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createDisguise();
|
createDisguise();
|
||||||
|
@ -4,7 +4,6 @@ import com.comphenix.protocol.ProtocolLibrary;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
@ -19,6 +18,8 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
public class PlayerDisguise extends TargetedDisguise {
|
public class PlayerDisguise extends TargetedDisguise {
|
||||||
private transient LibsProfileLookup currentLookup;
|
private transient LibsProfileLookup currentLookup;
|
||||||
private WrappedGameProfile gameProfile;
|
private WrappedGameProfile gameProfile;
|
||||||
|
@ -7,17 +7,18 @@ import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
|||||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||||
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
import com.comphenix.protocol.wrappers.PlayerInfoData;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class TargetedDisguise extends Disguise {
|
public abstract class TargetedDisguise extends Disguise {
|
||||||
|
|
||||||
public TargetedDisguise(DisguiseType disguiseType) {
|
public TargetedDisguise(DisguiseType disguiseType) {
|
||||||
@ -61,17 +62,14 @@ public abstract class TargetedDisguise extends Disguise {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
PacketContainer deleteTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
PacketContainer deleteTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
||||||
|
|
||||||
deleteTab.getPlayerInfoAction().write(0,
|
deleteTab.getPlayerInfoAction().write(0, canSee(player) ? PlayerInfoAction.REMOVE_PLAYER : PlayerInfoAction.ADD_PLAYER);
|
||||||
canSee(player) ? PlayerInfoAction.REMOVE_PLAYER : PlayerInfoAction.ADD_PLAYER);
|
|
||||||
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
|
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
|
||||||
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
|
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0, NativeGameMode.SURVIVAL,
|
||||||
NativeGameMode.SURVIVAL, WrappedChatComponent
|
WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())))));
|
||||||
.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())))));
|
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
|
||||||
}
|
}
|
||||||
}
|
} catch (InvocationTargetException e) {
|
||||||
catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,17 +132,14 @@ public abstract class TargetedDisguise extends Disguise {
|
|||||||
if (player != null) {
|
if (player != null) {
|
||||||
PacketContainer deleteTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
PacketContainer deleteTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
|
||||||
|
|
||||||
deleteTab.getPlayerInfoAction().write(0,
|
deleteTab.getPlayerInfoAction().write(0, canSee(player) ? PlayerInfoAction.ADD_PLAYER : PlayerInfoAction.REMOVE_PLAYER);
|
||||||
canSee(player) ? PlayerInfoAction.ADD_PLAYER : PlayerInfoAction.REMOVE_PLAYER);
|
|
||||||
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
|
deleteTab.getPlayerInfoDataLists().write(0, Arrays.asList(
|
||||||
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0,
|
new PlayerInfoData(ReflectionManager.getGameProfile((Player) getEntity()), 0, NativeGameMode.SURVIVAL,
|
||||||
NativeGameMode.SURVIVAL, WrappedChatComponent
|
WrappedChatComponent.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())))));
|
||||||
.fromText(DisguiseUtilities.getPlayerListName((Player) getEntity())))));
|
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
|
ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab);
|
||||||
}
|
}
|
||||||
}
|
} catch (InvocationTargetException e) {
|
||||||
catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
|
||||||
|
|
||||||
public abstract class AbstractHorseWatcher extends AgeableWatcher {
|
public abstract class AbstractHorseWatcher extends AgeableWatcher {
|
||||||
private static final int TAMED = 2, SADDLED = 4, REPRODUCED = 8, GRAZING = 16, REARING = 32, EATING = 64;
|
private static final int TAMED = 2, SADDLED = 4, REPRODUCED = 8, GRAZING = 16, REARING = 32, EATING = 64;
|
||||||
|
@ -31,8 +31,9 @@ public class ArmorStandWatcher extends LivingWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private EulerAngle getPose(MetaIndex<Vector3F> type) {
|
private EulerAngle getPose(MetaIndex<Vector3F> type) {
|
||||||
if (!hasValue(type))
|
if (!hasValue(type)) {
|
||||||
return new EulerAngle(0, 0, 0);
|
return new EulerAngle(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
Vector3F vec = getData(type);
|
Vector3F vec = getData(type);
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
@ -11,6 +10,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
|||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.entity.Cat;
|
import org.bukkit.entity.Cat;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 6/05/2019.
|
* Created by libraryaddict on 6/05/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -17,10 +17,8 @@ public class CreeperWatcher extends InsentientWatcher {
|
|||||||
|
|
||||||
public void setIgnited(boolean ignited) {
|
public void setIgnited(boolean ignited) {
|
||||||
// If creeper is already ignited and they want to set it to unignited, then resend disguise
|
// If creeper is already ignited and they want to set it to unignited, then resend disguise
|
||||||
boolean resend = !ignited && getDisguise() != null && getDisguise().isDisguiseInUse() &&
|
boolean resend = !ignited && getDisguise() != null && getDisguise().isDisguiseInUse() && ((hasValue(MetaIndex.CREEPER_IGNITED) && isIgnited()) ||
|
||||||
((hasValue(MetaIndex.CREEPER_IGNITED) && isIgnited()) ||
|
(getDisguise().getEntity() instanceof Creeper && ((Creeper) getDisguise().getEntity()).isPowered()));
|
||||||
(getDisguise().getEntity() instanceof Creeper &&
|
|
||||||
((Creeper) getDisguise().getEntity()).isPowered()));
|
|
||||||
|
|
||||||
setData(MetaIndex.CREEPER_IGNITED, ignited);
|
setData(MetaIndex.CREEPER_IGNITED, ignited);
|
||||||
sendData(MetaIndex.CREEPER_IGNITED);
|
sendData(MetaIndex.CREEPER_IGNITED);
|
||||||
|
@ -24,8 +24,7 @@ public class DroppedItemWatcher extends FlagWatcher {
|
|||||||
|
|
||||||
if (!getDisguise().isCustomDisguiseName()) {
|
if (!getDisguise().isCustomDisguiseName()) {
|
||||||
getDisguise().setDisguiseName(TranslateType.DISGUISES.get(DisguiseType.DROPPED_ITEM.toReadable()) + " " +
|
getDisguise().setDisguiseName(TranslateType.DISGUISES.get(DisguiseType.DROPPED_ITEM.toReadable()) + " " +
|
||||||
TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(ReflectionManager
|
TranslateType.DISGUISE_OPTIONS_PARAMETERS.get(ReflectionManager.toReadable((item == null ? Material.AIR : item.getType()).name(), " ")));
|
||||||
.toReadable((item == null ? Material.AIR : item.getType()).name(), " ")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
import java.util.Optional;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Navid
|
* @author Navid
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||||
import java.util.Optional;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class EndermanWatcher extends InsentientWatcher {
|
public class EndermanWatcher extends InsentientWatcher {
|
||||||
|
|
||||||
public EndermanWatcher(Disguise disguise) {
|
public EndermanWatcher(Disguise disguise) {
|
||||||
|
@ -4,7 +4,6 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
@ -19,6 +18,8 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
public class FallingBlockWatcher extends FlagWatcher {
|
public class FallingBlockWatcher extends FlagWatcher {
|
||||||
private int blockCombinedId = 1;
|
private int blockCombinedId = 1;
|
||||||
private boolean gridLocked;
|
private boolean gridLocked;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.OptionalInt;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
@ -9,6 +8,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
public class FireworkWatcher extends FlagWatcher {
|
public class FireworkWatcher extends FlagWatcher {
|
||||||
public FireworkWatcher(Disguise disguise) {
|
public FireworkWatcher(Disguise disguise) {
|
||||||
super(disguise);
|
super(disguise);
|
||||||
|
@ -12,8 +12,9 @@ public class FishingHookWatcher extends FlagWatcher {
|
|||||||
public int getHookedId() {
|
public int getHookedId() {
|
||||||
int hooked = getData(MetaIndex.FISHING_HOOK_HOOKED_ID);
|
int hooked = getData(MetaIndex.FISHING_HOOK_HOOKED_ID);
|
||||||
|
|
||||||
if (hooked > 0)
|
if (hooked > 0) {
|
||||||
hooked--;
|
hooked--;
|
||||||
|
}
|
||||||
|
|
||||||
return hooked;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
@ -9,6 +8,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
|||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
import org.bukkit.entity.Fox;
|
import org.bukkit.entity.Fox;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 6/05/2019.
|
* Created by libraryaddict on 6/05/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -49,8 +49,9 @@ public class GuardianWatcher extends InsentientWatcher {
|
|||||||
public void setTarget(String playername) {
|
public void setTarget(String playername) {
|
||||||
Player player = Bukkit.getPlayer(playername);
|
Player player = Bukkit.getPlayer(playername);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setData(MetaIndex.GUARDIAN_TARGET, player.getEntityId());
|
setData(MetaIndex.GUARDIAN_TARGET, player.getEntityId());
|
||||||
sendData(MetaIndex.GUARDIAN_TARGET);
|
sendData(MetaIndex.GUARDIAN_TARGET);
|
||||||
|
@ -6,13 +6,6 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
import com.comphenix.protocol.wrappers.WrappedAttribute;
|
import com.comphenix.protocol.wrappers.WrappedAttribute;
|
||||||
import com.comphenix.protocol.wrappers.WrappedAttribute.Builder;
|
import com.comphenix.protocol.wrappers.WrappedAttribute.Builder;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
@ -26,6 +19,14 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class LivingWatcher extends FlagWatcher {
|
public class LivingWatcher extends FlagWatcher {
|
||||||
private double maxHealth;
|
private double maxHealth;
|
||||||
private boolean maxHealthSet;
|
private boolean maxHealthSet;
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
import org.bukkit.entity.MushroomCow;
|
import org.bukkit.entity.MushroomCow;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 6/05/2019.
|
* Created by libraryaddict on 6/05/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||||
@ -9,6 +7,9 @@ import me.libraryaddict.disguise.utilities.reflection.NmsRemovedIn;
|
|||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
import org.bukkit.entity.Ocelot;
|
import org.bukkit.entity.Ocelot;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class OcelotWatcher extends AgeableWatcher {
|
public class OcelotWatcher extends AgeableWatcher {
|
||||||
|
|
||||||
public OcelotWatcher(Disguise disguise) {
|
public OcelotWatcher(Disguise disguise) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
@ -9,6 +8,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
|||||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||||
import org.bukkit.entity.Panda;
|
import org.bukkit.entity.Panda;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 6/05/2019.
|
* Created by libraryaddict on 6/05/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -26,8 +26,9 @@ public class PlayerWatcher extends LivingWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplayedInTab(boolean showPlayerInTab) {
|
public void setDisplayedInTab(boolean showPlayerInTab) {
|
||||||
if (getDisguise().isDisguiseInUse())
|
if (getDisguise().isDisguiseInUse()) {
|
||||||
throw new IllegalStateException("Cannot set this while disguise is in use!");
|
throw new IllegalStateException("Cannot set this while disguise is in use!");
|
||||||
|
}
|
||||||
|
|
||||||
alwaysShowInTab = showPlayerInTab;
|
alwaysShowInTab = showPlayerInTab;
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,14 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
|||||||
|
|
||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
|
import com.comphenix.protocol.wrappers.EnumWrappers.Direction;
|
||||||
import java.util.Optional;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
import me.libraryaddict.disguise.disguisetypes.AnimalColor;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Navid
|
* @author Navid
|
||||||
*/
|
*/
|
||||||
@ -41,11 +42,13 @@ public class ShulkerWatcher extends InsentientWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setShieldHeight(int newHeight) {
|
public void setShieldHeight(int newHeight) {
|
||||||
if (newHeight < 0)
|
if (newHeight < 0) {
|
||||||
newHeight = 0;
|
newHeight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (newHeight > 127)
|
if (newHeight > 127) {
|
||||||
newHeight = 127;
|
newHeight = 127;
|
||||||
|
}
|
||||||
|
|
||||||
setData(MetaIndex.SHULKER_PEEKING, (byte) newHeight);
|
setData(MetaIndex.SHULKER_PEEKING, (byte) newHeight);
|
||||||
sendData(MetaIndex.SHULKER_PEEKING);
|
sendData(MetaIndex.SHULKER_PEEKING);
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
|
||||||
|
|
||||||
public class TameableWatcher extends AgeableWatcher {
|
public class TameableWatcher extends AgeableWatcher {
|
||||||
public TameableWatcher(Disguise disguise) {
|
public TameableWatcher(Disguise disguise) {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
@ -10,6 +8,9 @@ import org.apache.commons.lang.math.RandomUtils;
|
|||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.entity.TropicalFish;
|
import org.bukkit.entity.TropicalFish;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 6/08/2018.
|
* Created by libraryaddict on 6/08/2018.
|
||||||
*/
|
*/
|
||||||
@ -75,8 +76,7 @@ public class TropicalFishWatcher extends FishWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getData(final DyeColor patternColor, final DyeColor bodyColor, final TropicalFish.Pattern type) {
|
private int getData(final DyeColor patternColor, final DyeColor bodyColor, final TropicalFish.Pattern type) {
|
||||||
return patternColor.getWoolData() << 24 | bodyColor.getWoolData() << 16 |
|
return patternColor.getWoolData() << 24 | bodyColor.getWoolData() << 16 | CraftPattern.values()[type.ordinal()].getDataValue();
|
||||||
CraftPattern.values()[type.ordinal()].getDataValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DyeColor getBodyColor() {
|
public DyeColor getBodyColor() {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
public class WitherWatcher extends InsentientWatcher {
|
public class WitherWatcher extends InsentientWatcher {
|
||||||
|
|
||||||
public WitherWatcher(Disguise disguise) {
|
public WitherWatcher(Disguise disguise) {
|
||||||
@ -21,8 +22,7 @@ public class WitherWatcher extends InsentientWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int[] getTargets() {
|
public int[] getTargets() {
|
||||||
return new int[]{getData(MetaIndex.WITHER_TARGET_1), getData(MetaIndex.WITHER_TARGET_2),
|
return new int[]{getData(MetaIndex.WITHER_TARGET_1), getData(MetaIndex.WITHER_TARGET_2), getData(MetaIndex.WITHER_TARGET_3)};
|
||||||
getData(MetaIndex.WITHER_TARGET_3)};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,8 +35,7 @@ public class WitherWatcher extends InsentientWatcher {
|
|||||||
|
|
||||||
public void setTargets(int... targets) {
|
public void setTargets(int... targets) {
|
||||||
if (targets.length != 3) {
|
if (targets.length != 3) {
|
||||||
throw new InvalidParameterException(
|
throw new InvalidParameterException(ChatColor.RED + "Expected 3 numbers for wither setTargets. Received " + targets.length);
|
||||||
ChatColor.RED + "Expected 3 numbers for wither setTargets. Received " + targets.length);
|
|
||||||
}
|
}
|
||||||
setData(MetaIndex.WITHER_TARGET_1, targets[0]);
|
setData(MetaIndex.WITHER_TARGET_1, targets[0]);
|
||||||
setData(MetaIndex.WITHER_TARGET_2, targets[1]);
|
setData(MetaIndex.WITHER_TARGET_2, targets[1]);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.disguisetypes.watchers;
|
package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
@ -11,6 +10,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
|||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.entity.Villager.Profession;
|
import org.bukkit.entity.Villager.Profession;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class ZombieVillagerWatcher extends ZombieWatcher {
|
public class ZombieVillagerWatcher extends ZombieWatcher {
|
||||||
|
|
||||||
public ZombieVillagerWatcher(Disguise disguise) {
|
public ZombieVillagerWatcher(Disguise disguise) {
|
||||||
|
@ -22,47 +22,6 @@ import com.google.gson.JsonSerializer;
|
|||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.mojang.authlib.properties.PropertyMap;
|
import com.mojang.authlib.properties.PropertyMap;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
@ -135,6 +94,48 @@ import org.bukkit.scoreboard.Team.Option;
|
|||||||
import org.bukkit.scoreboard.Team.OptionStatus;
|
import org.bukkit.scoreboard.Team.OptionStatus;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DisguiseUtilities {
|
public class DisguiseUtilities {
|
||||||
@Setter
|
@Setter
|
||||||
public static class DScoreTeam {
|
public static class DScoreTeam {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package me.libraryaddict.disguise.utilities;
|
package me.libraryaddict.disguise.utilities;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.FakeBoundingBox;
|
import me.libraryaddict.disguise.utilities.reflection.FakeBoundingBox;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 19/02/2020.
|
* Created by libraryaddict on 19/02/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.utilities;
|
package me.libraryaddict.disguise.utilities;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
|
import me.libraryaddict.disguise.utilities.plugin.BisectHosting;
|
||||||
|
import me.libraryaddict.disguise.utilities.plugin.PluginInformation;
|
||||||
|
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.util.FileUtil;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -8,13 +16,6 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.Getter;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
|
||||||
import me.libraryaddict.disguise.utilities.plugin.BisectHosting;
|
|
||||||
import me.libraryaddict.disguise.utilities.plugin.PluginInformation;
|
|
||||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.util.FileUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 2/06/2017.
|
* Created by libraryaddict on 2/06/2017.
|
||||||
@ -171,8 +172,8 @@ public class LibsPremium {
|
|||||||
try {
|
try {
|
||||||
plugin = getInformation(file);
|
plugin = getInformation(file);
|
||||||
} catch (ClassNotFoundException | NoClassDefFoundError ex) {
|
} catch (ClassNotFoundException | NoClassDefFoundError ex) {
|
||||||
DisguiseUtilities.getLogger().warning("Found an unrecognized jar in the LibsDisguises folder (" + file.getName() +
|
DisguiseUtilities.getLogger().warning(
|
||||||
") - It may need replacing with a newer jar from SpigotMC");
|
"Found an unrecognized jar in the LibsDisguises folder (" + file.getName() + ") - It may need replacing with a newer jar from SpigotMC");
|
||||||
continue;
|
continue;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
DisguiseUtilities.getLogger().warning("Error while trying to handle the file " + file.getName());
|
DisguiseUtilities.getLogger().warning("Error while trying to handle the file " + file.getName());
|
||||||
|
@ -2,10 +2,6 @@ package me.libraryaddict.disguise.utilities;
|
|||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.io.File;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.utilities.mineskin.MineSkinResponse;
|
import me.libraryaddict.disguise.utilities.mineskin.MineSkinResponse;
|
||||||
import me.libraryaddict.disguise.utilities.reflection.LibsProfileLookup;
|
import me.libraryaddict.disguise.utilities.reflection.LibsProfileLookup;
|
||||||
@ -13,6 +9,11 @@ import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
|||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/01/2020.
|
* Created by libraryaddict on 1/01/2020.
|
||||||
*/
|
*/
|
||||||
@ -35,8 +36,7 @@ public class SkinUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
MineSkinResponse response = DisguiseUtilities.getMineSkinAPI()
|
MineSkinResponse response = DisguiseUtilities.getMineSkinAPI().generateFromFile(callback, file, modelType);
|
||||||
.generateFromFile(callback, file, modelType);
|
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -51,8 +51,7 @@ public class SkinUtils {
|
|||||||
handleProfile(response.getGameProfile(), modelType, callback);
|
handleProfile(response.getGameProfile(), modelType, callback);
|
||||||
}
|
}
|
||||||
}.runTask(LibsDisguises.getInstance());
|
}.runTask(LibsDisguises.getInstance());
|
||||||
}
|
} catch (IllegalArgumentException e) {
|
||||||
catch (IllegalArgumentException e) {
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -68,8 +67,7 @@ public class SkinUtils {
|
|||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MineSkinResponse response = DisguiseUtilities.getMineSkinAPI()
|
MineSkinResponse response = DisguiseUtilities.getMineSkinAPI().generateFromUrl(callback, url, modelType);
|
||||||
.generateFromUrl(callback, url, modelType);
|
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -130,8 +128,7 @@ public class SkinUtils {
|
|||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
WrappedGameProfile profile = ReflectionManager
|
WrappedGameProfile profile = ReflectionManager.getSkullBlob(new WrappedGameProfile(uuid, "AutoGenerated"));
|
||||||
.getSkullBlob(new WrappedGameProfile(uuid, "AutoGenerated"));
|
|
||||||
|
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -183,8 +180,8 @@ public class SkinUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File(LibsDisguises.getInstance().getDataFolder(),
|
File file =
|
||||||
"/Skins/" + param + (param.toLowerCase(Locale.ENGLISH).endsWith(".png") ? "" : ".png"));
|
new File(LibsDisguises.getInstance().getDataFolder(), "/Skins/" + param + (param.toLowerCase(Locale.ENGLISH).endsWith(".png") ? "" : ".png"));
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file = null;
|
file = null;
|
||||||
@ -208,8 +205,7 @@ public class SkinUtils {
|
|||||||
callback.onInfo(LibsMsg.SKIN_API_USING_UUID);
|
callback.onInfo(LibsMsg.SKIN_API_USING_UUID);
|
||||||
handleUUID(uuid, modelType, callback);
|
handleUUID(uuid, modelType, callback);
|
||||||
return;
|
return;
|
||||||
}
|
} catch (Exception ignored) {
|
||||||
catch (Exception ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.utilities.config;
|
package me.libraryaddict.disguise.utilities.config;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
@ -15,6 +10,12 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 31/01/2021.
|
* Created by libraryaddict on 31/01/2021.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
package me.libraryaddict.disguise.utilities.config;
|
package me.libraryaddict.disguise.utilities.config;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -12,13 +20,6 @@ import java.util.Collection;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 28/01/2021.
|
* Created by libraryaddict on 28/01/2021.
|
||||||
|
@ -6,18 +6,17 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 27/11/2018.
|
* Created by libraryaddict on 27/11/2018.
|
||||||
*/
|
*/
|
||||||
public class SerializerBlockData implements JsonDeserializer<BlockData>,
|
public class SerializerBlockData implements JsonDeserializer<BlockData>, JsonSerializer<BlockData> {
|
||||||
JsonSerializer<BlockData> {
|
|
||||||
@Override
|
@Override
|
||||||
public BlockData deserialize(JsonElement json, Type typeOfT,
|
public BlockData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
|
||||||
return Bukkit.createBlockData(json.getAsString());
|
return Bukkit.createBlockData(json.getAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,17 +7,16 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 27/11/2018.
|
* Created by libraryaddict on 27/11/2018.
|
||||||
*/
|
*/
|
||||||
public class SerializerChatComponent implements JsonDeserializer<WrappedChatComponent>,
|
public class SerializerChatComponent implements JsonDeserializer<WrappedChatComponent>, JsonSerializer<WrappedChatComponent> {
|
||||||
JsonSerializer<WrappedChatComponent> {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WrappedChatComponent deserialize(JsonElement json, Type typeOfT,
|
public WrappedChatComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
|
||||||
if (json.isJsonPrimitive()) {
|
if (json.isJsonPrimitive()) {
|
||||||
return WrappedChatComponent.fromJson(json.getAsString());
|
return WrappedChatComponent.fromJson(json.getAsString());
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import com.google.gson.JsonDeserializer;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
import me.libraryaddict.disguise.disguisetypes.MiscDisguise;
|
||||||
@ -14,6 +13,8 @@ import me.libraryaddict.disguise.disguisetypes.MobDisguise;
|
|||||||
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
import me.libraryaddict.disguise.disguisetypes.PlayerDisguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
|
import me.libraryaddict.disguise.disguisetypes.TargetedDisguise;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/06/2017.
|
* Created by libraryaddict on 1/06/2017.
|
||||||
*/
|
*/
|
||||||
|
@ -9,12 +9,6 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.internal.LinkedTreeMap;
|
import com.google.gson.internal.LinkedTreeMap;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
import me.libraryaddict.disguise.disguisetypes.EntityPose;
|
import me.libraryaddict.disguise.disguisetypes.EntityPose;
|
||||||
@ -28,6 +22,13 @@ import me.libraryaddict.disguise.utilities.params.types.custom.ParamInfoParticle
|
|||||||
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
import me.libraryaddict.disguise.utilities.parser.DisguiseParseException;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/06/2017.
|
* Created by libraryaddict on 1/06/2017.
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,7 @@ import com.google.gson.JsonParseException;
|
|||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -23,14 +24,13 @@ public class SerializerGameProfile implements JsonSerializer<WrappedGameProfile>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WrappedGameProfile deserialize(JsonElement json, Type typeOfT,
|
public WrappedGameProfile deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
|
||||||
JsonObject obj = json.getAsJsonObject();
|
JsonObject obj = json.getAsJsonObject();
|
||||||
|
|
||||||
if (obj.has("id") && !obj.get("id").getAsString().contains("-")) {
|
if (obj.has("id") && !obj.get("id").getAsString().contains("-")) {
|
||||||
obj.addProperty("id",
|
obj.addProperty("id",
|
||||||
Pattern.compile("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)")
|
Pattern.compile("([0-9a-fA-F]{8})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]{4})([0-9a-fA-F]+)").matcher(obj.get("id").getAsString())
|
||||||
.matcher(obj.get("id").getAsString()).replaceFirst("$1-$2-$3-$4-$5"));
|
.replaceFirst("$1-$2-$3-$4-$5"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return WrappedGameProfile.fromHandle(context.deserialize(json, GameProfile.class));
|
return WrappedGameProfile.fromHandle(context.deserialize(json, GameProfile.class));
|
||||||
|
@ -6,13 +6,14 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
import me.libraryaddict.disguise.utilities.reflection.ReflectionManager;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/06/2017.
|
* Created by libraryaddict on 1/06/2017.
|
||||||
*/
|
*/
|
||||||
@ -30,8 +31,7 @@ public class SerializerItemStack implements JsonSerializer<ItemStack>, JsonDeser
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack deserialize(JsonElement json, Type typeOfT,
|
public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
|
||||||
HashMap map = context.deserialize(json, HashMap.class);
|
HashMap map = context.deserialize(json, HashMap.class);
|
||||||
|
|
||||||
if (map.containsKey("meta")) {
|
if (map.containsKey("meta")) {
|
||||||
|
@ -7,9 +7,10 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
import me.libraryaddict.disguise.disguisetypes.MetaIndex;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/06/2017.
|
* Created by libraryaddict on 1/06/2017.
|
||||||
*/
|
*/
|
||||||
@ -24,18 +25,19 @@ public class SerializerMetaIndex implements JsonSerializer<MetaIndex>, JsonDeser
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MetaIndex deserialize(JsonElement json, Type typeOfT,
|
public MetaIndex deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
|
||||||
JsonObject obj = json.getAsJsonObject();
|
JsonObject obj = json.getAsJsonObject();
|
||||||
String name = obj.get("flagwatcher").getAsString();
|
String name = obj.get("flagwatcher").getAsString();
|
||||||
int index = obj.get("index").getAsInt();
|
int index = obj.get("index").getAsInt();
|
||||||
|
|
||||||
for (MetaIndex i : MetaIndex.values()) {
|
for (MetaIndex i : MetaIndex.values()) {
|
||||||
if (i.getIndex() != index)
|
if (i.getIndex() != index) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!i.getFlagWatcher().getSimpleName().equals(name))
|
if (!i.getFlagWatcher().getSimpleName().equals(name)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,10 @@ import com.comphenix.protocol.wrappers.WrappedParticle;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
import me.libraryaddict.disguise.utilities.params.ParamInfoManager;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 5/12/2020.
|
* Created by libraryaddict on 5/12/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -8,14 +8,14 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import com.google.gson.JsonSerializationContext;
|
import com.google.gson.JsonSerializationContext;
|
||||||
import com.google.gson.JsonSerializer;
|
import com.google.gson.JsonSerializer;
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 1/06/2017.
|
* Created by libraryaddict on 1/06/2017.
|
||||||
*/
|
*/
|
||||||
public class SerializerWrappedBlockData implements JsonSerializer<WrappedBlockData>,
|
public class SerializerWrappedBlockData implements JsonSerializer<WrappedBlockData>, JsonDeserializer<WrappedBlockData> {
|
||||||
JsonDeserializer<WrappedBlockData> {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonElement serialize(WrappedBlockData src, Type typeOfSrc, JsonSerializationContext context) {
|
public JsonElement serialize(WrappedBlockData src, Type typeOfSrc, JsonSerializationContext context) {
|
||||||
@ -26,8 +26,7 @@ public class SerializerWrappedBlockData implements JsonSerializer<WrappedBlockDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WrappedBlockData deserialize(JsonElement json, Type typeOfT,
|
public WrappedBlockData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
JsonDeserializationContext context) throws JsonParseException {
|
|
||||||
JsonObject obj = json.getAsJsonObject();
|
JsonObject obj = json.getAsJsonObject();
|
||||||
|
|
||||||
return WrappedBlockData.createData(Material.valueOf(obj.get("type").getAsString()), obj.get("data").getAsInt());
|
return WrappedBlockData.createData(Material.valueOf(obj.get("type").getAsString()), obj.get("data").getAsInt());
|
||||||
|
@ -6,11 +6,6 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
import me.libraryaddict.disguise.DisguiseAPI;
|
||||||
@ -64,6 +59,12 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class DisguiseListener implements Listener {
|
public class DisguiseListener implements Listener {
|
||||||
private HashMap<String, LibsEntityInteract> interactions = new HashMap<>();
|
private HashMap<String, LibsEntityInteract> interactions = new HashMap<>();
|
||||||
private HashMap<String, BukkitRunnable> disguiseRunnable = new HashMap<>();
|
private HashMap<String, BukkitRunnable> disguiseRunnable = new HashMap<>();
|
||||||
|
@ -14,15 +14,17 @@ import org.bukkit.event.Listener;
|
|||||||
public class PaperDisguiseListener implements Listener {
|
public class PaperDisguiseListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityLoad(EntityAddToWorldEvent event) {
|
public void onEntityLoad(EntityAddToWorldEvent event) {
|
||||||
if (!DisguiseConfig.isSaveEntityDisguises())
|
if (!DisguiseConfig.isSaveEntityDisguises()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
Disguise[] disguises = DisguiseUtilities.getSavedDisguises(entity.getUniqueId(), true);
|
Disguise[] disguises = DisguiseUtilities.getSavedDisguises(entity.getUniqueId(), true);
|
||||||
|
|
||||||
if (disguises.length <= 0)
|
if (disguises.length <= 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DisguiseUtilities.resetPluginTimer();
|
DisguiseUtilities.resetPluginTimer();
|
||||||
|
|
||||||
|
@ -10,13 +10,6 @@ import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
|||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.RemovalCause;
|
import com.google.common.cache.RemovalCause;
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -37,6 +30,14 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 15/09/2020.
|
* Created by libraryaddict on 15/09/2020.
|
||||||
*/
|
*/
|
||||||
|
@ -3,6 +3,13 @@ package me.libraryaddict.disguise.utilities.metrics;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.plugin.ServicePriority;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -20,12 +27,6 @@ import java.util.TimerTask;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.plugin.ServicePriority;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bStats collects some data for plugin authors.
|
* bStats collects some data for plugin authors.
|
||||||
@ -37,11 +38,9 @@ public class Metrics {
|
|||||||
static {
|
static {
|
||||||
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
|
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
|
||||||
final String defaultPackage = new String(new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's'});
|
final String defaultPackage = new String(new byte[]{'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's'});
|
||||||
final String examplePackage = new String(
|
final String examplePackage = new String(new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
|
||||||
new byte[]{'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e'});
|
|
||||||
// We want to make sure nobody just copy & pastes the example and use the wrong package names
|
// We want to make sure nobody just copy & pastes the example and use the wrong package names
|
||||||
if (Metrics.class.getPackage().getName().equals(defaultPackage) ||
|
if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) {
|
||||||
Metrics.class.getPackage().getName().equals(examplePackage)) {
|
|
||||||
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
|
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,16 +94,13 @@ public class Metrics {
|
|||||||
config.addDefault("logFailedRequests", false);
|
config.addDefault("logFailedRequests", false);
|
||||||
|
|
||||||
// Inform the server owners about bStats
|
// Inform the server owners about bStats
|
||||||
config.options()
|
config.options().header("bStats collects some data for plugin authors like how many servers are using their " + "plugins.\n" +
|
||||||
.header("bStats collects some data for plugin authors like how many servers are using their " +
|
"To honor their work, you should not disable it.\n" + "This has nearly no effect on the server performance!\n" +
|
||||||
"plugins.\n" + "To honor their work, you should not disable it.\n" +
|
|
||||||
"This has nearly no effect on the server performance!\n" +
|
|
||||||
"Check out https://bStats.org/ to learn more :)").copyDefaults(true);
|
"Check out https://bStats.org/ to learn more :)").copyDefaults(true);
|
||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
DisguiseUtilities.getLogger().info("Saved bStats config");
|
DisguiseUtilities.getLogger().info("Saved bStats config");
|
||||||
}
|
} catch (IOException ignored) {
|
||||||
catch (IOException ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +115,7 @@ public class Metrics {
|
|||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||||
found = true; // We aren't the first
|
found = true; // We aren't the first
|
||||||
break;
|
break;
|
||||||
}
|
} catch (NoSuchFieldException ignored) {
|
||||||
catch (NoSuchFieldException ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Register our service
|
// Register our service
|
||||||
@ -249,15 +244,13 @@ public class Metrics {
|
|||||||
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
|
||||||
try {
|
try {
|
||||||
service.getField("B_STATS_VERSION"); // Our identifier :)
|
service.getField("B_STATS_VERSION"); // Our identifier :)
|
||||||
}
|
} catch (NoSuchFieldException ignored) {
|
||||||
catch (NoSuchFieldException ignored) {
|
|
||||||
continue; // Continue "searching"
|
continue; // Continue "searching"
|
||||||
}
|
}
|
||||||
// Found one!
|
// Found one!
|
||||||
try {
|
try {
|
||||||
pluginData.add(new Gson().toJson(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service))));
|
pluginData.add(new Gson().toJson(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service))));
|
||||||
}
|
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
||||||
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,12 +263,10 @@ public class Metrics {
|
|||||||
try {
|
try {
|
||||||
// Send the data
|
// Send the data
|
||||||
sendData(data);
|
sendData(data);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
|
||||||
// Something went wrong! :(
|
// Something went wrong! :(
|
||||||
if (logFailedRequests) {
|
if (logFailedRequests) {
|
||||||
plugin.getLogger()
|
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
||||||
.log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,8 +358,7 @@ public class Metrics {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
chart.add("data", data);
|
chart.add("data", data);
|
||||||
}
|
} catch (Throwable t) {
|
||||||
catch (Throwable t) {
|
|
||||||
if (logFailedRequests) {
|
if (logFailedRequests) {
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
|
Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package me.libraryaddict.disguise.utilities.metrics;
|
package me.libraryaddict.disguise.utilities.metrics;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Set;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
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;
|
||||||
@ -12,6 +9,10 @@ import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|||||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||||
import me.libraryaddict.disguise.utilities.plugin.PluginInformation;
|
import me.libraryaddict.disguise.utilities.plugin.PluginInformation;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 3/01/2019.
|
* Created by libraryaddict on 3/01/2019.
|
||||||
*/
|
*/
|
||||||
@ -49,8 +50,8 @@ public class MetricsInitalizer {
|
|||||||
info = LibsPremium.getPluginInformation();
|
info = LibsPremium.getPluginInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean customPremium = !info.getUserID().matches("[0-9]+") || info.getUserID().equals("1") ||
|
boolean customPremium = !info.getUserID().matches("[0-9]+") || info.getUserID().equals("1") || !info.getResourceID().equals("32453") ||
|
||||||
!info.getResourceID().equals("32453") || !info.getDownloadID().matches("-?[0-9]+");
|
!info.getDownloadID().matches("-?[0-9]+");
|
||||||
|
|
||||||
if (customPremium) {
|
if (customPremium) {
|
||||||
if (plugin.isReleaseBuild() && LibsPremium.getPaidInformation() == null) {
|
if (plugin.isReleaseBuild() && LibsPremium.getPaidInformation() == null) {
|
||||||
@ -137,8 +138,9 @@ public class MetricsInitalizer {
|
|||||||
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) {
|
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) {
|
||||||
for (Set<TargetedDisguise> list : DisguiseUtilities.getDisguises().values()) {
|
for (Set<TargetedDisguise> list : DisguiseUtilities.getDisguises().values()) {
|
||||||
for (Disguise disg : list) {
|
for (Disguise disg : list) {
|
||||||
if (disg.getEntity() == null || !disg.isDisguiseInUse())
|
if (disg.getEntity() == null || !disg.isDisguiseInUse()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String name = disg.getEntity().getType().name();
|
String name = disg.getEntity().getType().name();
|
||||||
|
|
||||||
@ -155,8 +157,9 @@ public class MetricsInitalizer {
|
|||||||
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) {
|
public HashMap<String, Integer> getValues(HashMap<String, Integer> hashMap) {
|
||||||
for (Set<TargetedDisguise> list : DisguiseUtilities.getDisguises().values()) {
|
for (Set<TargetedDisguise> list : DisguiseUtilities.getDisguises().values()) {
|
||||||
for (Disguise disg : list) {
|
for (Disguise disg : list) {
|
||||||
if (disg.getEntity() == null || !disg.isDisguiseInUse())
|
if (disg.getEntity() == null || !disg.isDisguiseInUse()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String name = disg.getType().name();
|
String name = disg.getType().name();
|
||||||
|
|
||||||
@ -194,20 +197,22 @@ public class MetricsInitalizer {
|
|||||||
disgs += set.size();
|
disgs += set.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disgs == 0)
|
if (disgs == 0) {
|
||||||
return "0";
|
return "0";
|
||||||
if (disgs <= 5)
|
}
|
||||||
|
if (disgs <= 5) {
|
||||||
return "1 to 5";
|
return "1 to 5";
|
||||||
else if (disgs <= 15)
|
} else if (disgs <= 15) {
|
||||||
return "6 to 15";
|
return "6 to 15";
|
||||||
else if (disgs <= 30)
|
} else if (disgs <= 30) {
|
||||||
return "16 to 30";
|
return "16 to 30";
|
||||||
else if (disgs <= 60)
|
} else if (disgs <= 60) {
|
||||||
return "30 to 60";
|
return "30 to 60";
|
||||||
else if (disgs <= 100)
|
} else if (disgs <= 100) {
|
||||||
return "60 to 100";
|
return "60 to 100";
|
||||||
else if (disgs <= 200)
|
} else if (disgs <= 200) {
|
||||||
return "100 to 200";
|
return "100 to 200";
|
||||||
|
}
|
||||||
|
|
||||||
return "More than 200";
|
return "More than 200";
|
||||||
}
|
}
|
||||||
@ -233,8 +238,7 @@ public class MetricsInitalizer {
|
|||||||
try {
|
try {
|
||||||
Class.forName("org.spigotmc.SpigotConfig");
|
Class.forName("org.spigotmc.SpigotConfig");
|
||||||
return "Yes";
|
return "Yes";
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
return "No";
|
return "No";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,13 +279,15 @@ public class MetricsInitalizer {
|
|||||||
|
|
||||||
Collection<Set<TargetedDisguise>> list = DisguiseUtilities.getDisguises().values();
|
Collection<Set<TargetedDisguise>> list = DisguiseUtilities.getDisguises().values();
|
||||||
|
|
||||||
if (list.isEmpty())
|
if (list.isEmpty()) {
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
for (Set<TargetedDisguise> dList : list) {
|
for (Set<TargetedDisguise> dList : list) {
|
||||||
for (TargetedDisguise disg : dList) {
|
for (TargetedDisguise disg : dList) {
|
||||||
if (disg.getObservers().isEmpty())
|
if (disg.getObservers().isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
targetedDisguises = true;
|
targetedDisguises = true;
|
||||||
return "Yes";
|
return "Yes";
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
package me.libraryaddict.disguise.utilities.mineskin;
|
package me.libraryaddict.disguise.utilities.mineskin;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
|
import me.libraryaddict.disguise.utilities.SkinUtils;
|
||||||
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -18,12 +25,6 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
|
||||||
import me.libraryaddict.disguise.utilities.SkinUtils;
|
|
||||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 28/12/2019.
|
* Created by libraryaddict on 28/12/2019.
|
||||||
@ -164,8 +165,8 @@ public class MineSkinAPI {
|
|||||||
printDebug("Received status code: " + connection.getResponseCode());
|
printDebug("Received status code: " + connection.getResponseCode());
|
||||||
|
|
||||||
if (connection.getResponseCode() == 500) {
|
if (connection.getResponseCode() == 500) {
|
||||||
String errorMessage = new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8)).lines()
|
String errorMessage =
|
||||||
.collect(Collectors.joining("\n"));
|
new BufferedReader(new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
|
||||||
|
|
||||||
APIError error = new Gson().fromJson(errorMessage, APIError.class);
|
APIError error = new Gson().fromJson(errorMessage, APIError.class);
|
||||||
|
|
||||||
|
@ -3,10 +3,11 @@ package me.libraryaddict.disguise.utilities.mineskin;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import java.util.UUID;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 29/12/2019.
|
* Created by libraryaddict on 29/12/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -4,14 +4,6 @@ import com.comphenix.protocol.ProtocolLibrary;
|
|||||||
import com.comphenix.protocol.utility.StreamSerializer;
|
import com.comphenix.protocol.utility.StreamSerializer;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.libraryaddict.disguise.DisguiseConfig;
|
import me.libraryaddict.disguise.DisguiseConfig;
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
@ -25,6 +17,15 @@ import org.bukkit.NamespacedKey;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 14/04/2020.
|
* Created by libraryaddict on 14/04/2020.
|
||||||
*/
|
*/
|
||||||
@ -36,8 +37,7 @@ public class ModdedManager {
|
|||||||
@Getter
|
@Getter
|
||||||
private static byte[] fmlRegistries;
|
private static byte[] fmlRegistries;
|
||||||
@Getter
|
@Getter
|
||||||
private static final Cache<String, ArrayList<String>> forgeMods = CacheBuilder.newBuilder()
|
private static final Cache<String, ArrayList<String>> forgeMods = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).build();
|
||||||
.expireAfterWrite(1, TimeUnit.MINUTES).build();
|
|
||||||
|
|
||||||
public ModdedManager(ArrayList<String> channels) {
|
public ModdedManager(ArrayList<String> channels) {
|
||||||
if (getEntities().isEmpty()) {
|
if (getEntities().isEmpty()) {
|
||||||
@ -80,8 +80,7 @@ public class ModdedManager {
|
|||||||
|
|
||||||
// Only this one thx
|
// Only this one thx
|
||||||
// s.serializeString(output, "minecraft:entity_type");
|
// s.serializeString(output, "minecraft:entity_type");
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,8 +122,7 @@ public class ModdedManager {
|
|||||||
|
|
||||||
// Or dummied. What is dummied anyways. What are these others?
|
// Or dummied. What is dummied anyways. What are these others?
|
||||||
s.serializeVarInt(output, 0);
|
s.serializeVarInt(output, 0);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,9 +200,7 @@ public class ModdedManager {
|
|||||||
ArrayList<DisguisePerm> perms = new ArrayList<>();
|
ArrayList<DisguisePerm> perms = new ArrayList<>();
|
||||||
|
|
||||||
for (Map.Entry<NamespacedKey, ModdedEntity> entry : entities.entrySet()) {
|
for (Map.Entry<NamespacedKey, ModdedEntity> entry : entities.entrySet()) {
|
||||||
perms.add(new DisguisePerm(
|
perms.add(new DisguisePerm(entry.getValue().isLiving() ? DisguiseType.MODDED_LIVING : DisguiseType.MODDED_MISC, entry.getValue().getName()));
|
||||||
entry.getValue().isLiving() ? DisguiseType.MODDED_LIVING : DisguiseType.MODDED_MISC,
|
|
||||||
entry.getValue().getName()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return perms;
|
return perms;
|
||||||
|
@ -5,11 +5,6 @@ import com.comphenix.protocol.ProtocolLibrary;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
import com.mojang.datafixers.util.Pair;
|
import com.mojang.datafixers.util.Pair;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -23,6 +18,12 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 3/01/2019.
|
* Created by libraryaddict on 3/01/2019.
|
||||||
*/
|
*/
|
||||||
|
@ -2,8 +2,6 @@ package me.libraryaddict.disguise.utilities.packets;
|
|||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import me.libraryaddict.disguise.LibsDisguises;
|
import me.libraryaddict.disguise.LibsDisguises;
|
||||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||||
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
||||||
@ -22,6 +20,9 @@ import me.libraryaddict.disguise.utilities.packets.packethandlers.PacketHandlerV
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by libraryaddict on 3/01/2019.
|
* Created by libraryaddict on 3/01/2019.
|
||||||
*/
|
*/
|
||||||
@ -45,8 +46,7 @@ public class PacketsHandler {
|
|||||||
packetHandlers.add(new PacketHandlerHeadRotation());
|
packetHandlers.add(new PacketHandlerHeadRotation());
|
||||||
|
|
||||||
// If not prem, if build is from jenkins, else its a custom and needs paid info
|
// If not prem, if build is from jenkins, else its a custom and needs paid info
|
||||||
if (!LibsPremium.isPremium() || LibsDisguises.getInstance().getBuildNo().matches("[0-9]+") ||
|
if (!LibsPremium.isPremium() || LibsDisguises.getInstance().getBuildNo().matches("[0-9]+") || LibsPremium.getPaidInformation() != null) {
|
||||||
LibsPremium.getPaidInformation() != null) {
|
|
||||||
packetHandlers.add(new PacketHandlerMetadata(this));
|
packetHandlers.add(new PacketHandlerMetadata(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.PacketType.Play.Server;
|
import com.comphenix.protocol.PacketType.Play.Server;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketListener;
|
import com.comphenix.protocol.events.PacketListener;
|
||||||
import java.util.ArrayList;
|
|
||||||
import me.libraryaddict.disguise.DisguiseAPI;
|
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;
|
||||||
@ -23,6 +22,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class PacketsManager {
|
public class PacketsManager {
|
||||||
private static PacketListener clientInteractEntityListener;
|
private static PacketListener clientInteractEntityListener;
|
||||||
private static PacketListener inventoryListener;
|
private static PacketListener inventoryListener;
|
||||||
@ -177,8 +178,7 @@ public class PacketsManager {
|
|||||||
ProtocolLibrary.getProtocolManager().addPacketListener(mainListener);
|
ProtocolLibrary.getProtocolManager().addPacketListener(mainListener);
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(destroyListener);
|
ProtocolLibrary.getProtocolManager().addPacketListener(destroyListener);
|
||||||
|
|
||||||
if (NmsVersion.v1_13.isSupported() &&
|
if (NmsVersion.v1_13.isSupported() && DisguiseConfig.getPlayerNameType() != DisguiseConfig.PlayerNameType.ARMORSTANDS) {
|
||||||
DisguiseConfig.getPlayerNameType() != DisguiseConfig.PlayerNameType.ARMORSTANDS) {
|
|
||||||
scoreboardTeamListener = new PacketListenerScoreboardTeam();
|
scoreboardTeamListener = new PacketListenerScoreboardTeam();
|
||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(scoreboardTeamListener);
|
ProtocolLibrary.getProtocolManager().addPacketListener(scoreboardTeamListener);
|
||||||
@ -207,8 +207,7 @@ public class PacketsManager {
|
|||||||
DisguiseUtilities.removeSelfDisguise(disguise);
|
DisguiseUtilities.removeSelfDisguise(disguise);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventoryModifierEnabled &&
|
if (inventoryModifierEnabled && (disguise.isHidingArmorFromSelf() || disguise.isHidingHeldItemFromSelf())) {
|
||||||
(disguise.isHidingArmorFromSelf() || disguise.isHidingHeldItemFromSelf())) {
|
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user