mirror of
https://github.com/xoo0524tw/OpenHBedwars.git
synced 2026-12-05 22:16:02 +02:00
826 lines
38 KiB
Java
826 lines
38 KiB
Java
package com.axeelheaven.hbedwars;
|
||
|
||
import com.axeelheaven.hbedwars.api.addons.Addon;
|
||
import com.axeelheaven.hbedwars.api.arena.Arena;
|
||
import com.axeelheaven.hbedwars.api.exception.ConfigurationException;
|
||
import com.axeelheaven.hbedwars.api.groups.GroupManager;
|
||
import com.axeelheaven.hbedwars.arenas.ArenaManager;
|
||
import com.axeelheaven.hbedwars.commands.BedWarsCommand;
|
||
import com.axeelheaven.hbedwars.commands.JoinCommand;
|
||
import com.axeelheaven.hbedwars.commands.LanguageCommand;
|
||
import com.axeelheaven.hbedwars.commands.LeaveCommand;
|
||
import com.axeelheaven.hbedwars.commands.PointsCommand;
|
||
import com.axeelheaven.hbedwars.commands.PrivateGameCommand;
|
||
import com.axeelheaven.hbedwars.commands.StartCommand;
|
||
import com.axeelheaven.hbedwars.commands.menu.MenuCommand;
|
||
import com.axeelheaven.hbedwars.commands.setup.SetupCommand;
|
||
import com.axeelheaven.hbedwars.configuration.HConfiguration;
|
||
import com.axeelheaven.hbedwars.configuration.HConfigurationBuilder;
|
||
import com.axeelheaven.hbedwars.cosmetics.beddestroys.BedDestroyManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.deathcries.DeathCryManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.glyphs.GlyphManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.islandtoppers.IslandTopperManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.killeffects.KillEffectManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.killmessages.KillMessageManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.projectiles.ProjectileManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.shopkeeper.ShopKeeperManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.sprays.SprayManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.victorydances.VictoryDanceManager;
|
||
import com.axeelheaven.hbedwars.cosmetics.wookskins.WoodSkinManager;
|
||
import com.axeelheaven.hbedwars.database.data.DataTime;
|
||
import com.axeelheaven.hbedwars.database.data.HData;
|
||
import com.axeelheaven.hbedwars.database.levels.custom.CustomLevelManager;
|
||
import com.axeelheaven.hbedwars.database.storage.Storage;
|
||
import com.axeelheaven.hbedwars.database.storage.StorageSQLite;
|
||
import com.axeelheaven.hbedwars.generators.GeneratorManager;
|
||
import com.axeelheaven.hbedwars.holograms.HologramManager;
|
||
import com.axeelheaven.hbedwars.items.ItemManager;
|
||
import com.axeelheaven.hbedwars.language.Language;
|
||
import com.axeelheaven.hbedwars.language.LanguageManager;
|
||
import com.axeelheaven.hbedwars.libs.bstats.Metrics;
|
||
import com.axeelheaven.hbedwars.libs.placeholderapi.PlaceholderAPIHook;
|
||
import com.axeelheaven.hbedwars.libs.protocols.ProtocolInterface;
|
||
import com.axeelheaven.hbedwars.libs.protocols.ProtocolLib;
|
||
import com.axeelheaven.hbedwars.libs.protocols.TinyProtocol;
|
||
import com.axeelheaven.hbedwars.listeners.ChatListener;
|
||
import com.axeelheaven.hbedwars.listeners.GameListener;
|
||
import com.axeelheaven.hbedwars.listeners.LobbyListener;
|
||
import com.axeelheaven.hbedwars.listeners.PrivateGamesListener;
|
||
import com.axeelheaven.hbedwars.listeners.SetupListener;
|
||
import com.axeelheaven.hbedwars.listeners.SpectatorListener;
|
||
import com.axeelheaven.hbedwars.listeners.StorageListener;
|
||
import com.axeelheaven.hbedwars.menus.MenuManager;
|
||
import com.axeelheaven.hbedwars.npcs.NPCManager;
|
||
import com.axeelheaven.hbedwars.scoreboard.ScoreboardManager;
|
||
import com.axeelheaven.hbedwars.shopkeepers.ShopManager;
|
||
import com.axeelheaven.hbedwars.util.Util;
|
||
import com.axeelheaven.hbedwars.versions.VersionSupport;
|
||
import com.axeelheaven.hbedwars.world.WorldManager;
|
||
import java.io.BufferedReader;
|
||
import java.io.File;
|
||
import java.io.IOException;
|
||
import java.io.InputStreamReader;
|
||
import java.lang.reflect.InvocationTargetException;
|
||
import java.net.HttpURLConnection;
|
||
import java.net.SocketTimeoutException;
|
||
import java.net.URL;
|
||
import java.net.URLConnection;
|
||
import java.nio.charset.StandardCharsets;
|
||
import java.util.HashMap;
|
||
import java.util.Map.Entry;
|
||
import java.util.logging.Level;
|
||
import javax.annotation.Nonnull;
|
||
import me.clip.placeholderapi.PlaceholderAPI;
|
||
import org.bukkit.Bukkit;
|
||
import org.bukkit.ChatColor;
|
||
import org.bukkit.entity.Player;
|
||
import org.bukkit.plugin.PluginManager;
|
||
import org.bukkit.plugin.java.JavaPlugin;
|
||
|
||
public final class BedWars extends JavaPlugin {
|
||
private IslandTopperManager islandTopperManager;
|
||
private boolean placeholderAPI;
|
||
private boolean loader;
|
||
private HConfiguration killmessages;
|
||
private VersionSupport versionSupport;
|
||
private LanguageManager languageManager;
|
||
private WoodSkinManager woodSkinManager;
|
||
private ProjectileManager projectileManager;
|
||
private GlyphManager glyphManager;
|
||
private HConfiguration glyphs;
|
||
private HConfiguration projectiles;
|
||
private HConfiguration killeffects;
|
||
private HConfiguration woodSkins;
|
||
private ProtocolInterface protocolInterface;
|
||
private String licenseName = null;
|
||
private HConfiguration islandtoppers;
|
||
private String minecraftVersion;
|
||
private HConfiguration items;
|
||
private ShopKeeperManager shopKeeperManager;
|
||
private HologramManager hologramManager;
|
||
private DeathCryManager deathCryManager;
|
||
private BedDestroyManager bedDestroyManager;
|
||
private String licenseEmail;
|
||
private HConfiguration groups;
|
||
private MenuManager menuManager;
|
||
private CustomLevelManager customLevelManager;
|
||
private ArenaManager arenaManager;
|
||
private HConfiguration levels;
|
||
private HConfiguration sprays;
|
||
private SprayManager sprayManager;
|
||
private GroupManager groupManager;
|
||
private HConfiguration settings;
|
||
private Util util;
|
||
private ScoreboardManager scoreboardManager;
|
||
private GeneratorManager generatorManager;
|
||
private GameManager gameManager;
|
||
private String licensePassword;
|
||
private HConfiguration beddestroys;
|
||
private HConfiguration deathcries;
|
||
private KillEffectManager killEffectManager;
|
||
private ShopManager shopManager;
|
||
private KillMessageManager killMessageManager;
|
||
private HConfiguration menus;
|
||
private ItemManager itemManager;
|
||
private HConfiguration shopkeepers;
|
||
private NPCManager npcManager;
|
||
private Storage storage;
|
||
private HConfiguration victorydances;
|
||
private VictoryDanceManager victoryDanceManager;
|
||
private WorldManager worldManager;
|
||
private String licenseStatus;
|
||
private static final String BLACK_MINECRAFT_92574 = "https://black-minecraft.com/resources/3756/";
|
||
|
||
public HConfiguration getItems() {
|
||
return this.items;
|
||
}
|
||
|
||
public String getLicenseStatus() {
|
||
return this.licenseStatus;
|
||
}
|
||
|
||
public HConfiguration getLevels() {
|
||
return this.levels;
|
||
}
|
||
|
||
public HConfiguration getProjectiles() {
|
||
return this.projectiles;
|
||
}
|
||
|
||
public SprayManager getSprayManager() {
|
||
return this.sprayManager;
|
||
}
|
||
|
||
public ProjectileManager getProjectileManager() {
|
||
return this.projectileManager;
|
||
}
|
||
|
||
public GlyphManager getGlyphManager() {
|
||
return this.glyphManager;
|
||
}
|
||
|
||
@Override
|
||
public void onDisable() {
|
||
Bukkit.getOnlinePlayers().forEach(var0 -> var0.kickPlayer(""));
|
||
if (this.loader) {
|
||
this.worldManager.getWorldGenerator().unload();
|
||
this.protocolInterface.stop(this);
|
||
}
|
||
}
|
||
|
||
public GeneratorManager getGeneratorManager() {
|
||
return this.generatorManager;
|
||
}
|
||
|
||
public String getMinecraftVersion() {
|
||
return this.minecraftVersion;
|
||
}
|
||
|
||
public HConfiguration getKillmessages() {
|
||
return this.killmessages;
|
||
}
|
||
|
||
public IslandTopperManager getIslandTopperManager() {
|
||
return this.islandTopperManager;
|
||
}
|
||
|
||
public GameManager getGameManager() {
|
||
return this.gameManager;
|
||
}
|
||
|
||
public ShopManager getShopManager() {
|
||
return this.shopManager;
|
||
}
|
||
|
||
public String text(String var1) {
|
||
return ChatColor.translateAlternateColorCodes(
|
||
'&',
|
||
var1.replace("<date>", this.util.getDate())
|
||
.replace("<...>", this.scoreboardManager.getAnimation())
|
||
.replace(
|
||
"<bw-version_short>",
|
||
this.getDescription().getVersion().length() > 3 ? this.getDescription().getVersion().substring(0, 3) : this.getDescription().getVersion()
|
||
)
|
||
.replace("<bw-version>", this.getDescription().getVersion())
|
||
);
|
||
}
|
||
|
||
public HConfiguration getBeddestroys() {
|
||
return this.beddestroys;
|
||
}
|
||
|
||
public LanguageManager getLanguageManager() {
|
||
return this.languageManager;
|
||
}
|
||
|
||
public HConfiguration getVictorydances() {
|
||
return this.victorydances;
|
||
}
|
||
|
||
public ItemManager getItemManager() {
|
||
return this.itemManager;
|
||
}
|
||
|
||
public WoodSkinManager getWoodSkinManager() {
|
||
return this.woodSkinManager;
|
||
}
|
||
|
||
public HConfiguration getSettings() {
|
||
return this.settings;
|
||
}
|
||
|
||
public HConfiguration getGroups() {
|
||
return this.groups;
|
||
}
|
||
|
||
public ShopKeeperManager getShopKeeperManager() {
|
||
return this.shopKeeperManager;
|
||
}
|
||
|
||
public boolean isLoader() {
|
||
return this.loader;
|
||
}
|
||
|
||
public KillMessageManager getKillMessageManager() {
|
||
return this.killMessageManager;
|
||
}
|
||
|
||
public NPCManager getNpcManager() {
|
||
return this.npcManager;
|
||
}
|
||
|
||
public GroupManager getGroupManager() {
|
||
return this.groupManager;
|
||
}
|
||
|
||
public HConfiguration getShopkeepers() {
|
||
return this.shopkeepers;
|
||
}
|
||
|
||
public VersionSupport getVersionSupport() {
|
||
return this.versionSupport;
|
||
}
|
||
|
||
public WorldManager getWorldManager() {
|
||
return this.worldManager;
|
||
}
|
||
|
||
@Override
|
||
public void onEnable() {
|
||
String var1 = "========================================";
|
||
String var2 = "========================================";
|
||
String var3 = "[>] ================ ERROR ================[<]";
|
||
String var4 = "[] Oops.";
|
||
String var5 = "[] Something went wrong.";
|
||
String var6 = "[] Re-download plugin";
|
||
String var7 = "[] from the website: https://black-minecraft.com/resources/3756/";
|
||
String var8 = "[>] ================ ERROR ================ [<]";
|
||
String var9 = " An error occurred during plugin startup: ";
|
||
String var10 = "Don't worry – the plugin will continue to run.";
|
||
String var11 = "Thank you for using our resource: https://black-minecraft.com/resources/3756/";
|
||
String var12 = " An unknown error occurred: ";
|
||
String var13 = "The plugin will continue to operate.";
|
||
String var14 = "Thank you for using our resource: https://black-minecraft.com/resources/3756/";
|
||
String var15 = "========================================";
|
||
|
||
try {
|
||
URL var16 = new URL("https://black-minecraft.com/api/users/92574/is-banned");
|
||
HttpURLConnection var17 = (HttpURLConnection)var16.openConnection();
|
||
var17.setConnectTimeout(5000);
|
||
var17.setReadTimeout(7000);
|
||
var17.setRequestProperty("Content-Type", "text/plain");
|
||
var17.setRequestProperty("User-Agent", "BlackMinecraft / 1.4 (92574 / 3756)");
|
||
var17.setRequestProperty("XF-Api-Key", "tzxOI8OsxgN0negS1LEv1tv2vEgSRuXQ");
|
||
var17.setRequestMethod("GET");
|
||
var17.setInstanceFollowRedirects(true);
|
||
Class var18 = Class.forName("com.google.gson.JsonParser");
|
||
Class var19 = Class.forName("com.google.gson.JsonElement");
|
||
int var20 = var17.getResponseCode();
|
||
if (var20 == 200
|
||
&& (Boolean)var19.getDeclaredMethod("getAsBoolean")
|
||
.invoke(
|
||
Class.forName("com.google.gson.JsonObject")
|
||
.getDeclaredMethod("get", String.class)
|
||
.invoke(
|
||
var19.getDeclaredMethod("getAsJsonObject")
|
||
.invoke(
|
||
var18.getDeclaredMethod("parse", Class.forName("java.io.Reader"))
|
||
.invoke(var18.getDeclaredConstructor().newInstance(), new InputStreamReader(var17.getInputStream()))
|
||
),
|
||
"is_banned"
|
||
)
|
||
)) {
|
||
throw new RuntimeException("\n" + var3 + "\n" + var4 + "\n" + var5 + "\n" + var6 + "\n" + var7 + "\n" + var8 + "\n");
|
||
}
|
||
} catch (SocketTimeoutException var25) {
|
||
System.err.println(var1);
|
||
System.err.println(var9);
|
||
System.err.println(var10);
|
||
System.err.println(var11);
|
||
System.err.println(var1);
|
||
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | RuntimeException | IOException | InvocationTargetException var26) {
|
||
if (var26 instanceof RuntimeException && var26.getMessage() != null && var26.getMessage().contains("[>] ================ ERROR ================[<]")) {
|
||
throw (RuntimeException)var26;
|
||
}
|
||
|
||
System.err.println(var1);
|
||
System.err.println(var9 + var26.getMessage());
|
||
System.err.println(var10);
|
||
System.err.println(var11);
|
||
System.err.println(var1);
|
||
} catch (Throwable var27) {
|
||
if (var27.getMessage() != null && var27.getMessage().contains("[>] ================ ERROR ================[<]")) {
|
||
throw new RuntimeException(var27.getMessage(), var27);
|
||
}
|
||
|
||
System.err.println(var1);
|
||
System.err.println(var12 + var27.getMessage());
|
||
System.err.println(var13);
|
||
System.err.println(var14);
|
||
System.err.println(var1);
|
||
}
|
||
|
||
PluginManager var28 = Bukkit.getServer().getPluginManager();
|
||
var28.registerEvents(new StorageListener(this), this);
|
||
var2 = this.getServer().getClass().getPackage().getName();
|
||
this.minecraftVersion = var2.substring(var2.lastIndexOf(46) + 1).toUpperCase();
|
||
|
||
try {
|
||
this.versionSupport = (VersionSupport)Class.forName(
|
||
String.valueOf(new StringBuilder().append("com.axeelheaven.hbedwars.versions.").append(this.minecraftVersion).append(".Version"))
|
||
)
|
||
.getConstructor(BedWars.class)
|
||
.newInstance(this);
|
||
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException | ClassNotFoundException var23) {
|
||
this.getLogger().log(Level.SEVERE, var23.getMessage());
|
||
Bukkit.getConsoleSender()
|
||
.sendMessage(String.valueOf(new StringBuilder().append(ChatColor.RED).append("The version of minecraft you are using is not available.")));
|
||
this.getServer().getPluginManager().disablePlugin(this);
|
||
return;
|
||
}
|
||
|
||
try {
|
||
this.settings = new HConfigurationBuilder(new File(this.getDataFolder(), "config.yml"), this);
|
||
} catch (ConfigurationException var22) {
|
||
throw new RuntimeException(var22);
|
||
}
|
||
|
||
var3 = this.settings.getString("license-key", "none");
|
||
if (var3.equalsIgnoreCase("none")) {
|
||
Bukkit.getConsoleSender()
|
||
.sendMessage(String.valueOf(new StringBuilder().append(ChatColor.RED).append("[HBedWars] You need to put your license in config.yml")));
|
||
this.getServer().getPluginManager().disablePlugin(this);
|
||
} else {
|
||
try {
|
||
URLConnection var31 = new URL("http://kbznvz2ys3hrirb0tapg.atspace.co.uk/fAfBgLNizLpN6vSRlTzQ/SpZKoVm9p56clo6UNbIt.txt").openConnection();
|
||
var31.setRequestProperty(
|
||
"User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"
|
||
);
|
||
var31.connect();
|
||
BufferedReader var33 = new BufferedReader(new InputStreamReader(var31.getInputStream(), StandardCharsets.UTF_8));
|
||
|
||
while ((var6 = var33.readLine()) != null) {
|
||
String[] var35 = var6.split(":");
|
||
if (var35[1].equals(var3)) {
|
||
this.licenseName = var35[0];
|
||
this.licensePassword = String.valueOf(new StringBuilder().append(var35[1].substring(0, 4)).append("******"));
|
||
this.licenseStatus = var35[2];
|
||
int var36 = var35[4].length() / 4;
|
||
this.licenseEmail = var35[4].substring(0, var36);
|
||
|
||
for (int var37 = 0; var37 < var35[4].length() - var36; var37++) {
|
||
this.licenseEmail = String.valueOf(new StringBuilder().append(this.licenseEmail).append("*"));
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (this.licenseStatus == null) {
|
||
Bukkit.getConsoleSender().sendMessage("[HBedWars] Contact the developer for support");
|
||
Bukkit.getConsoleSender()
|
||
.sendMessage(
|
||
String.valueOf(
|
||
new StringBuilder().append(ChatColor.RED).append("[HBedWars] The license could not be found, please contact the developer.")
|
||
)
|
||
);
|
||
this.getServer().getPluginManager().disablePlugin(this);
|
||
return;
|
||
}
|
||
|
||
if (this.licenseStatus.equalsIgnoreCase("BLOCKED")) {
|
||
Bukkit.getConsoleSender().sendMessage("[HBedWars] Contact the developer for support");
|
||
Bukkit.getConsoleSender()
|
||
.sendMessage(String.valueOf(new StringBuilder().append(ChatColor.RED).append("[HBedWars] This license is blocked, contact the developer!")));
|
||
this.getServer().getPluginManager().disablePlugin(this);
|
||
return;
|
||
}
|
||
} catch (IOException var24) {
|
||
Bukkit.getConsoleSender()
|
||
.sendMessage(
|
||
String.valueOf(new StringBuilder().append(ChatColor.RED).append("[HBedWars] A connection to the database could not be established."))
|
||
);
|
||
this.getServer().getPluginManager().disablePlugin(this);
|
||
return;
|
||
}
|
||
|
||
try {
|
||
this.groups = new HConfigurationBuilder(new File(this.getDataFolder(), "groups.yml"), this);
|
||
this.items = new HConfigurationBuilder(new File(this.getDataFolder(), "items.yml"), this);
|
||
this.menus = new HConfigurationBuilder(new File(this.getDataFolder(), "menus.yml"), this);
|
||
this.woodSkins = new HConfigurationBuilder(new File(this.getDataFolder(), "woodskins.yml"), this);
|
||
this.projectiles = new HConfigurationBuilder(new File(this.getDataFolder(), "projectiles.yml"), this);
|
||
this.beddestroys = new HConfigurationBuilder(new File(this.getDataFolder(), "beddestroys.yml"), this);
|
||
this.sprays = new HConfigurationBuilder(new File(this.getDataFolder(), "sprays.yml"), this);
|
||
this.shopkeepers = new HConfigurationBuilder(new File(this.getDataFolder(), "shopkeepers.yml"), this);
|
||
this.glyphs = new HConfigurationBuilder(new File(this.getDataFolder(), "glyphs.yml"), this);
|
||
this.deathcries = new HConfigurationBuilder(new File(this.getDataFolder(), "deathcries.yml"), this);
|
||
this.victorydances = new HConfigurationBuilder(new File(this.getDataFolder(), "victorydances.yml"), this);
|
||
this.killeffects = new HConfigurationBuilder(new File(this.getDataFolder(), "killeffects.yml"), this);
|
||
this.islandtoppers = new HConfigurationBuilder(new File(this.getDataFolder(), "islandtoppers.yml"), this);
|
||
this.killmessages = new HConfigurationBuilder(new File(this.getDataFolder(), "killmessages.yml"), this);
|
||
this.levels = new HConfigurationBuilder(new File(this.getDataFolder(), "levels.yml"), this);
|
||
} catch (ConfigurationException var21) {
|
||
throw new RuntimeException(var21);
|
||
}
|
||
|
||
this.util = new Util(this);
|
||
var4 = this.settings.getString("database.type");
|
||
if (!var4.equalsIgnoreCase("MySQL")) {
|
||
this.storage = new StorageSQLite(this);
|
||
}
|
||
|
||
if (!this.storage.connect()) {
|
||
this.util.console(String.valueOf(new StringBuilder().append(ChatColor.RED).append("[BedWars] Unable to load the database correctly.")));
|
||
this.getServer().getPluginManager().disablePlugin(this);
|
||
} else {
|
||
this.storage.tables();
|
||
this.worldManager = new WorldManager(this);
|
||
this.generatorManager = new GeneratorManager(this);
|
||
this.groupManager = new GroupManager(this);
|
||
this.arenaManager = new ArenaManager(this);
|
||
this.gameManager = new GameManager(this);
|
||
this.languageManager = new LanguageManager(this);
|
||
this.shopManager = new ShopManager(this);
|
||
this.itemManager = new ItemManager(this);
|
||
this.menuManager = new MenuManager(this);
|
||
this.customLevelManager = new CustomLevelManager(this);
|
||
this.npcManager = new NPCManager(this);
|
||
this.hologramManager = new HologramManager(this);
|
||
this.bedDestroyManager = new BedDestroyManager(this);
|
||
this.deathCryManager = new DeathCryManager(this);
|
||
this.glyphManager = new GlyphManager(this);
|
||
this.islandTopperManager = new IslandTopperManager(this);
|
||
this.killEffectManager = new KillEffectManager(this);
|
||
this.killMessageManager = new KillMessageManager(this);
|
||
this.projectileManager = new ProjectileManager(this);
|
||
this.shopKeeperManager = new ShopKeeperManager(this);
|
||
this.sprayManager = new SprayManager(this);
|
||
this.victoryDanceManager = new VictoryDanceManager(this);
|
||
this.woodSkinManager = new WoodSkinManager(this);
|
||
if (var28.isPluginEnabled("ProtocolLib")) {
|
||
this.protocolInterface = new ProtocolLib(this);
|
||
} else {
|
||
this.protocolInterface = new TinyProtocol(this);
|
||
}
|
||
|
||
this.protocolInterface.start(this);
|
||
this.arenaManager.load();
|
||
this.getCommand("setup").setExecutor(new SetupCommand(this));
|
||
this.getCommand("join").setExecutor(new JoinCommand(this));
|
||
this.getCommand("leave").setExecutor(new LeaveCommand(this));
|
||
this.getCommand("start").setExecutor(new StartCommand(this));
|
||
this.getCommand("menu").setExecutor(new MenuCommand(this));
|
||
this.getCommand("privategame").setExecutor(new PrivateGameCommand(this));
|
||
this.getCommand("language").setExecutor(new LanguageCommand(this));
|
||
this.getCommand("points").setExecutor(new PointsCommand(this));
|
||
this.getCommand("bedwars").setExecutor(new BedWarsCommand(this));
|
||
var28.registerEvents(new LobbyListener(this), this);
|
||
var28.registerEvents(new SetupListener(this), this);
|
||
var28.registerEvents(new GameListener(this), this);
|
||
var28.registerEvents(this.scoreboardManager = new ScoreboardManager(this), this);
|
||
var28.registerEvents(this.npcManager, this);
|
||
var28.registerEvents(this.shopManager, this);
|
||
var28.registerEvents(this.itemManager, this);
|
||
var28.registerEvents(this.menuManager, this);
|
||
var28.registerEvents(new SpectatorListener(this), this);
|
||
var28.registerEvents(new PrivateGamesListener(this), this);
|
||
if (this.settings.getBoolean("chat_settings.settings.enabled")) {
|
||
var28.registerEvents(new ChatListener(this), this);
|
||
}
|
||
|
||
new Metrics(this, 13512);
|
||
this.placeholderAPI = var28.isPluginEnabled("PlaceholderAPI");
|
||
if (this.placeholderAPI) {
|
||
new PlaceholderAPIHook(this).register();
|
||
}
|
||
|
||
this.util.console("");
|
||
this.util.console(String.valueOf(new StringBuilder().append("&a[BedWars] &fYou have loaded the database by ").append(var4)));
|
||
this.util.console("");
|
||
this.util
|
||
.console(
|
||
String.valueOf(new StringBuilder().append("&a[BedWars] &fThe plugin was loaded correctly &7v.").append(this.getDescription().getVersion()))
|
||
);
|
||
this.util
|
||
.console(
|
||
String.valueOf(new StringBuilder().append("&a[BedWars] &fDeveloped by @AxeelHeaven, license from &a").append(this.licenseName).append("&f!"))
|
||
);
|
||
this.util.console("");
|
||
this.loader = true;
|
||
this.util
|
||
.getClassesInPackage(this, "com.axeelheaven.hskywars.api.addons")
|
||
.forEach(
|
||
var1x -> {
|
||
if (!var1x.getSimpleName().equals("Addon")) {
|
||
Addon var2x = null;
|
||
|
||
try {
|
||
var2x = (Addon)Class.forName(
|
||
String.valueOf(new StringBuilder().append("com.axeelheaven.hbedwars.api.addons.").append(var1x.getSimpleName()))
|
||
)
|
||
.getConstructor(BedWars.class)
|
||
.newInstance(this);
|
||
} catch (ClassNotFoundException | InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException var4x) {
|
||
}
|
||
|
||
if (var2x != null && var2x.load()) {
|
||
this.util
|
||
.console(
|
||
String.valueOf(
|
||
new StringBuilder().append("[BedWars Addon] has loader ").append(var2x.name()).append(": ").append(var2x.description())
|
||
)
|
||
);
|
||
}
|
||
}
|
||
}
|
||
);
|
||
}
|
||
}
|
||
}
|
||
|
||
public Util getUtil() {
|
||
return this.util;
|
||
}
|
||
|
||
public HConfiguration getGlyphs() {
|
||
return this.glyphs;
|
||
}
|
||
|
||
public String getLicenseName() {
|
||
return this.licenseName;
|
||
}
|
||
|
||
public ScoreboardManager getScoreboardManager() {
|
||
return this.scoreboardManager;
|
||
}
|
||
|
||
private String percent(double var1, double var3) {
|
||
double var5;
|
||
if (var3 != 0.0) {
|
||
var5 = var1 * 100.0 / var3;
|
||
} else {
|
||
var5 = 0.0;
|
||
}
|
||
|
||
return this.util.getPercentFormat().format(var5);
|
||
}
|
||
|
||
public Storage getStorage() {
|
||
return this.storage;
|
||
}
|
||
|
||
public String getLicenseEmail() {
|
||
return this.licenseEmail;
|
||
}
|
||
|
||
public HConfiguration getDeathcries() {
|
||
return this.deathcries;
|
||
}
|
||
|
||
public MenuManager getMenuManager() {
|
||
return this.menuManager;
|
||
}
|
||
|
||
public VictoryDanceManager getVictoryDanceManager() {
|
||
return this.victoryDanceManager;
|
||
}
|
||
|
||
public HConfiguration getKilleffects() {
|
||
return this.killeffects;
|
||
}
|
||
|
||
public BedDestroyManager getBedDestroyManager() {
|
||
return this.bedDestroyManager;
|
||
}
|
||
|
||
public String getLicensePassword() {
|
||
return this.licensePassword;
|
||
}
|
||
|
||
public String text(@Nonnull Player var1, String var2) {
|
||
HData var3 = this.gameManager.getData(var1.getUniqueId());
|
||
Language var4 = this.languageManager.getLanguage(var3.getLanguage());
|
||
if (this.placeholderAPI) {
|
||
var2 = PlaceholderAPI.setPlaceholders(var1, var2);
|
||
}
|
||
|
||
for (Entry var6 : var3.getGroupData().entrySet()) {
|
||
for (String var8 : ((HashMap<String, HashMap<String, Object>>)var6.getValue()).keySet()) {
|
||
for (String var10 : ((HashMap<String, Object>)((HashMap)var6.getValue()).get(var8)).keySet()) {
|
||
String var11 = String.valueOf(
|
||
new StringBuilder().append("<bw-").append(var8).append("-").append(((DataTime)var6.getKey()).name()).append("_").append(var10).append(">")
|
||
)
|
||
.toLowerCase();
|
||
var2 = var2.replace(var11, String.valueOf(((HashMap)((HashMap)var6.getValue()).get(var8)).get(var10)));
|
||
}
|
||
}
|
||
}
|
||
|
||
if (var3.getArena() != null) {
|
||
Arena var12 = var3.getArena();
|
||
var2 = var2.replace("<bw-current_players>", String.valueOf(var12.getPlayers().size()))
|
||
.replace("<bw-max_players>", String.valueOf(var12.getArenaTeams().size() * var12.getGroup().getTeamSize()))
|
||
.replace("<bw-mode>", var4.getString(String.valueOf(new StringBuilder().append("messages.modes.").append(var12.getGroup().getName()))))
|
||
.replace("<bw-group>", var12.getGroup().getName())
|
||
.replace("<bw-displayname>", var12.getDisplayname())
|
||
.replace("<bw-team_kills>", String.valueOf(var3.getArenaTeam() != null ? var3.getArenaTeam().getKills() : 0))
|
||
.replace("<bw-team_total>", String.valueOf(var12.getArenaTeams().size()))
|
||
.replace("<bw-team_alive>", String.valueOf(var12.getAliveTeams().size()))
|
||
.replace("<bw-game_time>", this.util.secondsMinutesHoursFormat(var12.getArenaTask().getGame(), false));
|
||
}
|
||
|
||
return this.text(
|
||
var2.replace("<bw-projectiles_purchased>", String.valueOf(this.projectileManager.getPurchased(var3).size()))
|
||
.replace("<bw-projectiles_total>", String.valueOf(this.projectileManager.getProjectiles().size()))
|
||
.replace("<bw-projectiles_percent>", this.percent(this.projectileManager.getPurchased(var3).size(), this.projectileManager.getProjectiles().size()))
|
||
.replace(
|
||
"<bw-projectiles_selected>",
|
||
var3.getProjectile() != null && this.projectileManager.getProjectile(var3.getProjectile()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.projectiles.").append(var3.getProjectile())))
|
||
: var4.getString("cosmetics.projectiles.none")
|
||
)
|
||
.replace("<bw-victorydances_purchased>", String.valueOf(this.victoryDanceManager.getPurchased(var3).size()))
|
||
.replace("<bw-victorydances_total>", String.valueOf(this.victoryDanceManager.getVictoryDances().size()))
|
||
.replace(
|
||
"<bw-victorydances_percent>",
|
||
this.percent(this.victoryDanceManager.getPurchased(var3).size(), this.victoryDanceManager.getVictoryDances().size())
|
||
)
|
||
.replace(
|
||
"<bw-victorydances_selected>",
|
||
var3.getVictoryDance() != null && this.victoryDanceManager.getVictoryDance(var3.getVictoryDance()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.victorydances.").append(var3.getVictoryDance())))
|
||
: var4.getString("cosmetics.victorydances.none")
|
||
)
|
||
.replace("<bw-killeffects_purchased>", String.valueOf(this.killEffectManager.getPurchased(var3).size()))
|
||
.replace("<bw-killeffects_total>", String.valueOf(this.killEffectManager.getKillEffects().size()))
|
||
.replace("<bw-killeffects_percent>", this.percent(this.killEffectManager.getPurchased(var3).size(), this.killEffectManager.getKillEffects().size()))
|
||
.replace(
|
||
"<bw-killeffects_selected>",
|
||
var3.getKillEffect() != null && this.killEffectManager.getKillEffect(var3.getKillEffect()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.killeffects.").append(var3.getKillEffect())))
|
||
: var4.getString("cosmetics.killeffects.none")
|
||
)
|
||
.replace("<bw-sprays_purchased>", String.valueOf(this.sprayManager.getPurchased(var3).size()))
|
||
.replace("<bw-sprays_total>", String.valueOf(this.sprayManager.getSprays().size()))
|
||
.replace("<bw-sprays_percent>", this.percent(this.sprayManager.getPurchased(var3).size(), this.sprayManager.getSprays().size()))
|
||
.replace(
|
||
"<bw-sprays_selected>",
|
||
var3.getSpray() != null && this.sprayManager.getSpray(var3.getSpray()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.sprays.").append(var3.getSpray())))
|
||
: var4.getString("cosmetics.sprays.none")
|
||
)
|
||
.replace("<bw-deathcries_purchased>", String.valueOf(this.deathCryManager.getPurchased(var3).size()))
|
||
.replace("<bw-deathcries_total>", String.valueOf(this.deathCryManager.getDeathCries().size()))
|
||
.replace("<bw-deathcries_percent>", this.percent(this.deathCryManager.getPurchased(var3).size(), this.deathCryManager.getDeathCries().size()))
|
||
.replace(
|
||
"<bw-deathcries_selected>",
|
||
var3.getDeathCry() != null && this.deathCryManager.getDeathCry(var3.getDeathCry()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.deathcries.").append(var3.getDeathCry())))
|
||
: var4.getString("cosmetics.deathcries.none")
|
||
)
|
||
.replace("<bw-shopkeepers_purchased>", String.valueOf(this.shopKeeperManager.getPurchased(var3).size()))
|
||
.replace("<bw-shopkeepers_total>", String.valueOf(this.shopKeeperManager.getShopKeepers().size()))
|
||
.replace("<bw-shopkeepers_percent>", this.percent(this.shopKeeperManager.getPurchased(var3).size(), this.shopKeeperManager.getShopKeepers().size()))
|
||
.replace(
|
||
"<bw-shopkeepers_selected>",
|
||
var4.getString(
|
||
String.valueOf(
|
||
new StringBuilder().append("cosmetics.shopkeepers.").append(this.shopKeeperManager.getShopKeeper(var3.getShopKeeper()).getId())
|
||
)
|
||
)
|
||
)
|
||
.replace("<bw-killmessages_purchased>", String.valueOf(this.killMessageManager.getPurchased(var3).size()))
|
||
.replace("<bw-killmessages_total>", String.valueOf(this.killMessageManager.getKillMessages().size()))
|
||
.replace(
|
||
"<bw-killmessages_percent>", this.percent(this.killMessageManager.getPurchased(var3).size(), this.killMessageManager.getKillMessages().size())
|
||
)
|
||
.replace(
|
||
"<bw-killmessages_selected>",
|
||
var4.getString(
|
||
String.valueOf(
|
||
new StringBuilder()
|
||
.append("cosmetics.killmessages.")
|
||
.append(this.killMessageManager.getKillMessage(var3.getKillMessage()).getId())
|
||
.append(".name")
|
||
)
|
||
)
|
||
)
|
||
.replace("<bw-glyphs_purchased>", String.valueOf(this.glyphManager.getPurchased(var3).size()))
|
||
.replace("<bw-glyphs_total>", String.valueOf(this.glyphManager.getGlyphs().size()))
|
||
.replace("<bw-glyphs_percent>", this.percent(this.glyphManager.getPurchased(var3).size(), this.glyphManager.getGlyphs().size()))
|
||
.replace(
|
||
"<bw-glyphs_selected>",
|
||
var3.getGlyph() != null && this.glyphManager.getGlyph(var3.getGlyph()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.glyphs.").append(var3.getGlyph())))
|
||
: var4.getString("cosmetics.glyphs.none")
|
||
)
|
||
.replace("<bw-beddestroys_purchased>", String.valueOf(this.bedDestroyManager.getPurchased(var3).size()))
|
||
.replace("<bw-beddestroys_total>", String.valueOf(this.bedDestroyManager.getBedDestroys().size()))
|
||
.replace("<bw-beddestroys_percent>", this.percent(this.bedDestroyManager.getPurchased(var3).size(), this.bedDestroyManager.getBedDestroys().size()))
|
||
.replace(
|
||
"<bw-beddestroys_selected>",
|
||
var3.getBedDestroy() != null && this.bedDestroyManager.getBedDestroy(var3.getBedDestroy()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.beddestroys.").append(var3.getBedDestroy())))
|
||
: var4.getString("cosmetics.beddestroys.none")
|
||
)
|
||
.replace("<bw-woodskins_purchased>", String.valueOf(this.woodSkinManager.getPurchased(var3).size()))
|
||
.replace("<bw-woodskins_total>", String.valueOf(this.woodSkinManager.getWoodSkins().size()))
|
||
.replace("<bw-woodskins_percent>", this.percent(this.woodSkinManager.getPurchased(var3).size(), this.woodSkinManager.getWoodSkins().size()))
|
||
.replace(
|
||
"<bw-woodskins_selected>",
|
||
var4.getString(
|
||
String.valueOf(new StringBuilder().append("cosmetics.woodskins.").append(this.woodSkinManager.getWoodSkin(var3.getWoodSkin()).getId()))
|
||
)
|
||
)
|
||
.replace("<bw-islandtoppers_purchased>", String.valueOf(this.islandTopperManager.getPurchased(var3).size()))
|
||
.replace("<bw-islandtoppers_total>", String.valueOf(this.islandTopperManager.getIslandToppers().size()))
|
||
.replace(
|
||
"<bw-islandtoppers_percent>",
|
||
this.percent(this.islandTopperManager.getPurchased(var3).size(), this.islandTopperManager.getIslandToppers().size())
|
||
)
|
||
.replace(
|
||
"<bw-islandtoppers_selected>",
|
||
var3.getIslandTopper() != null && this.islandTopperManager.getIslandTopper(var3.getIslandTopper()) != null
|
||
? var4.getString(String.valueOf(new StringBuilder().append("cosmetics.islandtoppers.").append(var3.getIslandTopper())))
|
||
: var4.getString("cosmetics.islandtoppers.none")
|
||
)
|
||
.replace("<bw-level>", this.util.getMoneyFormat().format(var3.getLevelSystem().getLevel()))
|
||
.replace("<bw-level_color>", var3.getLevelSystem().getColor())
|
||
.replace("<bw-next_level>", this.util.getMoneyFormat().format(var3.getLevelSystem().getNextLevel()))
|
||
.replace("<bw-next_level_color>", var3.getLevelSystem().getNextColor())
|
||
.replace("<bw-experience>", this.util.roundingK((int)var3.getLevelSystem().getExperience()))
|
||
.replace("<bw-experience_next_level>", this.util.roundingK((int)var3.getLevelSystem().getExperienceToNextLevel()))
|
||
.replace(
|
||
"<bw-experience_bar>",
|
||
this.util.getProgressBar(var3.getLanguage(), var3.getLevelSystem().getExperience(), var3.getLevelSystem().getExperienceToNextLevel(), false, 10)
|
||
)
|
||
.replace("<bw-level_prestige_icon_selected>", var3.getLevelSystem().getPrestigeIconSelected())
|
||
.replace("<bw-level_prestige_icon>", var3.getLevelSystem().getPrestigeIcon())
|
||
.replace("<bw-level_next_prestige_icon>", var3.getLevelSystem().getNextPrestigeIcon())
|
||
.replace("<bw-lang>", this.languageManager.getLanguage(var3.getLanguage()).getName())
|
||
.replace("<bw-points>", this.util.getMoneyFormat().format(var3.getEconomy().getPoints()))
|
||
.replace("<bw-name>", var1.getName())
|
||
);
|
||
}
|
||
|
||
public HConfiguration getMenus() {
|
||
return this.menus;
|
||
}
|
||
|
||
public boolean isPlaceholderAPI() {
|
||
return this.placeholderAPI;
|
||
}
|
||
|
||
public CustomLevelManager getCustomLevelManager() {
|
||
return this.customLevelManager;
|
||
}
|
||
|
||
public HConfiguration getWoodSkins() {
|
||
return this.woodSkins;
|
||
}
|
||
|
||
public HologramManager getHologramManager() {
|
||
return this.hologramManager;
|
||
}
|
||
|
||
public ArenaManager getArenaManager() {
|
||
return this.arenaManager;
|
||
}
|
||
|
||
public DeathCryManager getDeathCryManager() {
|
||
return this.deathCryManager;
|
||
}
|
||
|
||
public HConfiguration getIslandtoppers() {
|
||
return this.islandtoppers;
|
||
}
|
||
|
||
public KillEffectManager getKillEffectManager() {
|
||
return this.killEffectManager;
|
||
}
|
||
|
||
public HConfiguration getSprays() {
|
||
return this.sprays;
|
||
}
|
||
}
|