Search in sources :

Example 1 with BasicConfigurationFile

use of net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile in project PotPvPReprised by DevDrizzy.

the class GlobalHologram method spawn.

/**
 * Spawn the hologram for all players on the server
 * at the given location in the constructor
 */
public void spawn() {
    Preconditions.checkNotNull(this.meta, "Hologram Meta can not be null!");
    BasicConfigurationFile config = plugin.getHologramsConfig();
    Hologram apiHologram = HologramsAPI.createHologram(plugin, meta.getLocation());
    apiHologram.clearLines();
    apiHologram.getVisibilityManager().setVisibleByDefault(true);
    if (!apiHologram.getLocation().getChunk().isLoaded()) {
        apiHologram.getLocation().getChunk().load();
    }
    for (String line : config.getStringList("SETTINGS.DEFAULT.LINES")) {
        if (line.contains("<top>")) {
            int position = 1;
            for (Map.Entry<String, Integer> entry : plugin.getEloHandler().topElo(null).entrySet()) {
                apiHologram.appendTextLine(config.getString("SETTINGS.DEFAULT.FORMAT").replace("<number>", String.valueOf(position)).replace("<value>", String.valueOf(entry.getValue())).replace("<name>", entry.getKey()));
                position++;
            }
            continue;
        }
        String replace = line.replace("<update>", String.valueOf(updateIn));
        apiHologram.appendTextLine(replace);
    }
    meta.setHologram(apiHologram);
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) PracticeHologram(net.frozenorb.potpvp.hologram.PracticeHologram) BasicConfigurationFile(net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile) Map(java.util.Map)

Example 2 with BasicConfigurationFile

use of net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile in project PotPvPReprised by DevDrizzy.

the class PotPvPRP method onEnable.

@Override
public void onEnable() {
    this.consoleLog("&c------------------------------------------------");
    this.setupMongo();
    this.uuidCache = new UUIDCache();
    this.commandHandler = new CommandHandler(this);
    this.commandHandler.bind(KitType.class).toProvider(new KitTypeProvider());
    this.commandHandler.bind(ChatColor.class).toProvider(new ChatColorProvider());
    this.commandHandler.bind(UUID.class).toProvider(new UUIDDrinkProvider());
    this.registerCommands();
    this.registerPermission();
    ScoreboardAdapter scoreboardAdapter = new ScoreboardAdapter();
    NameTagAdapter nameTagAdapter = new NameTagAdapter();
    // TablistAdapter tablistAdapter = new TablistAdapter();
    this.scoreboardHandler = new ScoreboardHandler(this, scoreboardAdapter);
    this.scoreboardHandler.setAssembleStyle(AssembleStyle.KOHI);
    this.scoreboardHandler.setTicks(2);
    this.nameTagHandler = new NameTagHandler(this);
    this.nameTagHandler.registerAdapter(nameTagAdapter);
    if (this.getServer().getPluginManager().isPluginEnabled("HolographicDisplays")) {
        this.logger("&7Found &cHolographicDisplays&7, Hooking holograms....");
        hologramsConfig = new BasicConfigurationFile(this, "holograms");
        this.hologramHandler = new HologramHandler(this, hologramsConfig);
        this.hologramHandler.init();
    }
    for (World world : Bukkit.getWorlds()) {
        world.setGameRuleValue("doDaylightCycle", "false");
        world.setGameRuleValue("doMobSpawning", "false");
        world.setTime(6_000L);
    }
    kitHandler = new KitHandler();
    eloHandler = new EloHandler();
    duelHandler = new DuelHandler();
    lobbyHandler = new LobbyHandler();
    arenaHandler = new ArenaHandler();
    matchHandler = new MatchHandler();
    partyHandler = new PartyHandler();
    queueHandler = new QueueHandler();
    followHandler = new FollowHandler();
    rematchHandler = new RematchHandler();
    settingHandler = new SettingHandler();
    pvpClassHandler = new PvPClassHandler();
    tournamentHandler = new TournamentHandler();
    postMatchInvHandler = new PostMatchInvHandler();
    this.getServer().getPluginManager().registerEvents(new BasicPreventionListener(), this);
    this.getServer().getPluginManager().registerEvents(new BowHealthListener(), this);
    this.getServer().getPluginManager().registerEvents(new ChatToggleListener(), this);
    this.getServer().getPluginManager().registerEvents(new NightModeListener(), this);
    this.getServer().getPluginManager().registerEvents(new PearlCooldownListener(), this);
    this.getServer().getPluginManager().registerEvents(new TabCompleteListener(), this);
    this.getServer().getPluginManager().registerEvents(new StatisticsHandler(), this);
    this.getServer().getPluginManager().registerEvents(new EventListeners(), this);
    this.getServer().getPluginManager().registerEvents(new TournamentListener(), this);
    this.getServer().getPluginManager().registerEvents(new ButtonListener(), this);
    this.logger("Registering listeners...");
    this.setupHourEvents();
    this.getServer().getScheduler().runTaskTimerAsynchronously(this, cache, 20L, 20L);
    new Morpheus(this);
    this.consoleLog("");
    this.consoleLog("&7Initialized &cPotPvP &7Successfully!");
    this.consoleLog("&c------------------------------------------------");
}
Also used : KitTypeProvider(net.frozenorb.potpvp.command.binds.KitTypeProvider) UUIDDrinkProvider(net.frozenorb.potpvp.command.binds.UUIDDrinkProvider) DuelHandler(net.frozenorb.potpvp.match.duel.DuelHandler) TournamentListener(net.frozenorb.potpvp.tournament.TournamentListener) PvPClassHandler(net.frozenorb.potpvp.pvpclasses.PvPClassHandler) ArenaHandler(net.frozenorb.potpvp.arena.ArenaHandler) CommandHandler(xyz.refinedev.command.CommandHandler) World(org.bukkit.World) UUIDCache(net.frozenorb.potpvp.util.uuid.UUIDCache) QueueHandler(net.frozenorb.potpvp.queue.QueueHandler) PostMatchInvHandler(net.frozenorb.potpvp.match.postmatchinv.PostMatchInvHandler) FollowHandler(net.frozenorb.potpvp.profile.follow.FollowHandler) KitHandler(net.frozenorb.potpvp.kit.KitHandler) RematchHandler(net.frozenorb.potpvp.match.rematch.RematchHandler) UUID(java.util.UUID) ScoreboardAdapter(net.frozenorb.potpvp.adapter.scoreboard.ScoreboardAdapter) BasicConfigurationFile(net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile) LobbyHandler(net.frozenorb.potpvp.lobby.LobbyHandler) ButtonListener(net.frozenorb.potpvp.util.menu.ButtonListener) NameTagHandler(net.frozenorb.potpvp.util.nametag.NameTagHandler) SettingHandler(net.frozenorb.potpvp.profile.setting.SettingHandler) ChatColorProvider(net.frozenorb.potpvp.command.binds.ChatColorProvider) Morpheus(com.qrakn.morpheus.Morpheus) PartyHandler(net.frozenorb.potpvp.party.PartyHandler) TournamentHandler(net.frozenorb.potpvp.tournament.TournamentHandler) HologramHandler(net.frozenorb.potpvp.hologram.HologramHandler) EloHandler(net.frozenorb.potpvp.profile.elo.EloHandler) ScoreboardHandler(net.frozenorb.potpvp.util.scoreboard.api.ScoreboardHandler) MatchHandler(net.frozenorb.potpvp.match.MatchHandler) EventListeners(net.frozenorb.potpvp.events.EventListeners) KitType(net.frozenorb.potpvp.kit.kittype.KitType) NameTagAdapter(net.frozenorb.potpvp.adapter.nametag.NameTagAdapter) StatisticsHandler(net.frozenorb.potpvp.profile.statistics.StatisticsHandler) ChatColor(org.bukkit.ChatColor)

Example 3 with BasicConfigurationFile

use of net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile in project PotPvPReprised by DevDrizzy.

the class KitHologram method spawn.

/**
 * Spawn the hologram for all players on the server
 * at the given location in the constructor
 */
public void spawn() {
    Preconditions.checkNotNull(this.meta, "Hologram Meta can not be null!");
    BasicConfigurationFile config = plugin.getHologramsConfig();
    Hologram apiHologram = HologramsAPI.createHologram(plugin, meta.getLocation());
    apiHologram.clearLines();
    apiHologram.getVisibilityManager().setVisibleByDefault(true);
    if (!apiHologram.getLocation().getChunk().isLoaded()) {
        apiHologram.getLocation().getChunk().load();
    }
    for (String line : config.getStringList("SETTINGS.KIT.LINES")) {
        if (line.contains("<top>")) {
            int position = 1;
            for (Map.Entry<String, Integer> entry : plugin.getEloHandler().topElo(kit).entrySet()) {
                apiHologram.appendTextLine(config.getString("SETTINGS.KIT.FORMAT").replace("<number>", String.valueOf(position)).replace("<value>", String.valueOf(entry.getValue())).replace("<name>", entry.getKey()));
                position++;
            }
            continue;
        }
        String replace = line.replace("<kit>", kit.getDisplayName()).replace("<update>", String.valueOf(updateIn));
        apiHologram.appendTextLine(replace);
    }
    meta.setHologram(apiHologram);
}
Also used : Hologram(com.gmail.filoghost.holographicdisplays.api.Hologram) PracticeHologram(net.frozenorb.potpvp.hologram.PracticeHologram) BasicConfigurationFile(net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile) Map(java.util.Map)

Aggregations

BasicConfigurationFile (net.frozenorb.potpvp.util.config.impl.BasicConfigurationFile)3 Hologram (com.gmail.filoghost.holographicdisplays.api.Hologram)2 Map (java.util.Map)2 PracticeHologram (net.frozenorb.potpvp.hologram.PracticeHologram)2 Morpheus (com.qrakn.morpheus.Morpheus)1 UUID (java.util.UUID)1 NameTagAdapter (net.frozenorb.potpvp.adapter.nametag.NameTagAdapter)1 ScoreboardAdapter (net.frozenorb.potpvp.adapter.scoreboard.ScoreboardAdapter)1 ArenaHandler (net.frozenorb.potpvp.arena.ArenaHandler)1 ChatColorProvider (net.frozenorb.potpvp.command.binds.ChatColorProvider)1 KitTypeProvider (net.frozenorb.potpvp.command.binds.KitTypeProvider)1 UUIDDrinkProvider (net.frozenorb.potpvp.command.binds.UUIDDrinkProvider)1 EventListeners (net.frozenorb.potpvp.events.EventListeners)1 HologramHandler (net.frozenorb.potpvp.hologram.HologramHandler)1 KitHandler (net.frozenorb.potpvp.kit.KitHandler)1 KitType (net.frozenorb.potpvp.kit.kittype.KitType)1 LobbyHandler (net.frozenorb.potpvp.lobby.LobbyHandler)1 MatchHandler (net.frozenorb.potpvp.match.MatchHandler)1 DuelHandler (net.frozenorb.potpvp.match.duel.DuelHandler)1 PostMatchInvHandler (net.frozenorb.potpvp.match.postmatchinv.PostMatchInvHandler)1