org.spongepowered.api.plugin.PluginContainer Java Examples

The following examples show how to use org.spongepowered.api.plugin.PluginContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Metrics.java    From EagleFactions with MIT License 6 votes vote down vote up
@Inject
private Metrics(PluginContainer plugin, Logger logger, @ConfigDir(sharedRoot = true) Path configDir)
{
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;

    try
    {
        loadConfig();
    }
    catch (IOException e)
    {
        // Failed to load configuration
        logger.warn("Failed to load bStats config!", e);
        return;
    }

    // We are not allowed to send data about this server :(
    if (!enabled)
    {
        return;
    }

    startSubmitting();
}
 
Example #2
Source File: VirtualChestCommandAliases.java    From VirtualChest with GNU Lesser General Public License v3.0 6 votes vote down vote up
private CommandMapping testMapping(String alias, CommandMapping mapping)
{
    if (!commandManager.get(alias).get().equals(mapping))
    {
        PluginContainer pluginContainer = commandManager.get(alias).flatMap(commandManager::getOwner).get();
        this.plugin.getLogger().warn("The command '" + alias + "' is not actually registered because " +
                "it conflicts with the command '" + pluginContainer.getId() + ":" + alias + "'.");
        this.plugin.getLogger().warn("Because of the low priority this command could only be used with " +
                "a prefix such as '" + VirtualChestPlugin.PLUGIN_ID + ":" + alias + "'.");
        this.plugin.getLogger().warn("Please configure the part of command aliases in " +
                "'config/sponge/global.conf' to enable it manually:");
        this.plugin.getLogger().warn("commands {");
        this.plugin.getLogger().warn("    aliases {");
        this.plugin.getLogger().warn("        " + alias + "=" + VirtualChestPlugin.PLUGIN_ID);
        this.plugin.getLogger().warn("    }");
        this.plugin.getLogger().warn("}");
        this.plugin.getLogger().warn("For more information about command priorities, please refer to:");
        this.plugin.getLogger().warn("https://docs.spongepowered.org/" +
                "stable/en/server/getting-started/configuration/sponge-conf.html");
    }
    return mapping;
}
 
Example #3
Source File: GPDebugData.java    From GriefPrevention with MIT License 6 votes vote down vote up
public GPDebugData(CommandSource source, User target, boolean verbose) {
    this.source = source;
    this.target = target;
    this.verbose = verbose;
    this.records = new ArrayList<>();
    this.header = new ArrayList<>();
    this.header.add("# GriefPrevention Debug Log");
    this.header.add("#### This file was automatically generated by [GriefPrevention](https://github.com/MinecraftPortCentral/GriefPrevention) ");
    this.header.add("");
    this.header.add("### Metadata");
    this.header.add("| Key | Value |");
    this.header.add("|-----|-------|");
    this.header.add("| GP Version | " + GriefPreventionPlugin.IMPLEMENTATION_VERSION + "|");
    this.header.add("| Sponge Version | " + GriefPreventionPlugin.SPONGE_VERSION + "|");
    final PluginContainer lpContainer = Sponge.getPluginManager().getPlugin("luckperms").orElse(null);
    if (lpContainer != null) {
        final String version = lpContainer.getVersion().orElse(null);
        if (version != null) {
            this.header.add("| LuckPerms Version | " + version);
        }
    }
    this.header.add("| User | " + (this.target == null ? "ALL" : this.target.getName()) + "|");
    this.header.add("| Record start | " + DATE_FORMAT.format(new Date(this.startTime)) + "|");
}
 
Example #4
Source File: SpongePlugin.java    From ViaVersion with MIT License 6 votes vote down vote up
@Override
public JsonObject getDump() {
    JsonObject platformSpecific = new JsonObject();

    List<PluginInfo> plugins = new ArrayList<>();
    for (PluginContainer p : game.getPluginManager().getPlugins()) {
        plugins.add(new PluginInfo(
                true,
                p.getName(),
                p.getVersion().orElse("Unknown Version"),
                p.getInstance().isPresent() ? p.getInstance().get().getClass().getCanonicalName() : "Unknown",
                p.getAuthors()
        ));
    }
    platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));

    return platformSpecific;
}
 
Example #5
Source File: PermissionServiceProxy.java    From LuckPerms with MIT License 5 votes vote down vote up
@Override
public Optional<PermissionDescription.Builder> newDescriptionBuilder(@NonNull Object o) {
    Optional<PluginContainer> container = Sponge.getGame().getPluginManager().fromInstance(o);
    if (!container.isPresent()) {
        throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
    }

    return Optional.of(new DescriptionBuilder(this.handle, container.get()));
}
 
Example #6
Source File: NucleusApiProvider.java    From GriefPrevention with MIT License 5 votes vote down vote up
public void registerTokens() {
    NucleusMessageTokenService messageTokenService = NucleusAPI.getMessageTokenService();
    PluginContainer pc = GriefPreventionPlugin.instance.pluginContainer;
    final DataStore dataStore = GriefPreventionPlugin.instance.dataStore;
    try {
        messageTokenService.register(GriefPreventionPlugin.instance.pluginContainer,
                (tokenInput, commandSource, variables) -> {
                    // Each token will require something like this.

                    // This token, town, will give the name of the town the player is currently in.
                    // Will be registered in Nucleus as "{{pl:griefprevention:town}}", with the shortened version of "{{town}}"
                    // This will return the name of the town the player is currently in.
                    if (tokenInput.equalsIgnoreCase("town") && commandSource instanceof Player) {
                        Player player = (Player) commandSource;
                        final GPPlayerData data = dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());

                        // Shamelessly stolen from PlayerEventHandler
                        if (data.inTown) {
                            return dataStore.getClaimAtPlayer(data, player.getLocation()).getTownClaim().getTownData().getTownTag();
                        }
                    }

                    return Optional.empty();
                });
    } catch (PluginAlreadyRegisteredException ignored) {
        // already been done.
    }

    // register {{town}} from {{pl:griefprevention:town}}
    messageTokenService.registerPrimaryToken("town", pc, "town");
}
 
Example #7
Source File: Metrics2.java    From bStats-Metrics with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Metrics2(PluginContainer plugin, Logger logger, Path configDir, int pluginId) {
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;
    this.pluginId = pluginId;

    Sponge.getEventManager().registerListeners(plugin, this);
}
 
Example #8
Source File: SpongeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public SpongeMetrics(final Game game, final PluginContainer plugin) throws IOException {
    if (plugin == null) {
        throw new IllegalArgumentException("Plugin cannot be null");
    }

    this.game = game;
    this.plugin = plugin;

    loadConfiguration();
}
 
Example #9
Source File: SpongeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public SpongeMetrics(final Game game, final PluginContainer plugin) throws IOException {
    if (plugin == null) {
        throw new IllegalArgumentException("Plugin cannot be null");
    }

    this.game = game;
    this.plugin = plugin;

    loadConfiguration();
}
 
Example #10
Source File: NucleusProvider.java    From GriefDefender with MIT License 5 votes vote down vote up
public void registerTokens() {
    NucleusMessageTokenService messageTokenService = NucleusAPI.getMessageTokenService();
    PluginContainer pc = GDBootstrap.getInstance().pluginContainer;
    final BaseStorage dataStore = GriefDefenderPlugin.getInstance().dataStore;
    try {
        messageTokenService.register(GDBootstrap.getInstance().pluginContainer,
                (tokenInput, commandSource, variables) -> {
                    // Each token will require something like this.

                    // This token, town, will give the name of the town the player is currently in.
                    // Will be registered in Nucleus as "{{pl:griefdefender:town}}", with the shortened version of "{{town}}"
                    // This will return the name of the town the player is currently in.
                    if (tokenInput.equalsIgnoreCase("town") && commandSource instanceof Player) {
                        Player player = (Player) commandSource;
                        final GDPlayerData data = dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());

                        // Shamelessly stolen from PlayerEventHandler
                        if (data.inTown) {
                            final Component component = dataStore.getClaimAtPlayer(data, player.getLocation()).getTownClaim().getTownData().getTownTag().orElse(null);
                            return Optional.ofNullable(SpongeUtil.getSpongeText(component));
                        }
                    }

                    return Optional.empty();
                });
    } catch (PluginAlreadyRegisteredException ignored) {
        // already been done.
    }

    // register {{town}} from {{pl:griefdefender:town}}
    messageTokenService.registerPrimaryToken("town", pc, "town");
}
 
Example #11
Source File: RecordingQueueManager.java    From Prism with MIT License 5 votes vote down vote up
@Override
public synchronized void run() {
    List<DataContainer> eventsSaveBatch = new ArrayList<>();

    // Assume we're iterating everything in the queue
    while (!RecordingQueue.getQueue().isEmpty()) {
        // Poll the next event, append to list
        PrismRecord record = RecordingQueue.getQueue().poll();

        if (record != null) {
            // Prepare PrismRecord for sending to a PrismRecordEvent
            PluginContainer plugin = Prism.getInstance().getPluginContainer();
            EventContext eventContext = EventContext.builder().add(EventContextKeys.PLUGIN, plugin).build();

            PrismRecordPreSaveEvent preSaveEvent = new PrismRecordPreSaveEvent(record,
                Cause.of(eventContext, plugin));

            // Tell Sponge that this PrismRecordEvent has occurred
            Sponge.getEventManager().post(preSaveEvent);

            if (!preSaveEvent.isCancelled()) {
                eventsSaveBatch.add(record.getDataContainer());
            }
        }
    }

    if (eventsSaveBatch.size() > 0) {
        try {
            Prism.getInstance().getStorageAdapter().records().write(eventsSaveBatch);
        } catch (Exception e) {
            // @todo handle failures
            e.printStackTrace();
        }
    }
}
 
Example #12
Source File: VirtualChestPlugin.java    From VirtualChest with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addMetricsInformation()
{
    PluginContainer p = Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION);
    this.metrics.addCustomChart(
            new Metrics.SingleLineChart("onlineInventories",
                    () -> this.dispatcher.ids().size()));
    this.metrics.addCustomChart(
            new Metrics.AdvancedPie("placeholderapiVersion",
                    () -> ImmutableMap.of(this.placeholderManager.getPlaceholderAPIVersion(), 1)));
    this.metrics.addCustomChart(
            new Metrics.DrilldownPie("platformImplementation",
                    () -> ImmutableMap.of(p.getName(), ImmutableMap.of(p.getVersion().orElse("unknown"), 1))));
}
 
Example #13
Source File: Metrics2.java    From bStats-Metrics with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Links a bStats 1 metrics class with this instance.
 *
 * @param metrics An object of the metrics class to link.
 */
private void linkOldMetrics(Object metrics) {
    try {
        Field field = metrics.getClass().getDeclaredField("plugin");
        field.setAccessible(true);
        PluginContainer plugin = (PluginContainer) field.get(metrics);
        Method method = metrics.getClass().getMethod("getPluginData");
        linkMetrics(new OutdatedInstance(metrics, method, plugin));
    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        // Move on, this bStats is broken
    }
}
 
Example #14
Source File: Metrics2.java    From GriefPrevention with MIT License 5 votes vote down vote up
/**
 * Links a bStats 1 metrics class with this instance.
 *
 * @param metrics An object of the metrics class to link.
 */
private void linkOldMetrics(Object metrics) {
    try {
        Field field = metrics.getClass().getDeclaredField("plugin");
        field.setAccessible(true);
        PluginContainer plugin = (PluginContainer) field.get(metrics);
        Method method = metrics.getClass().getMethod("getPluginData");
        linkMetrics(new OutdatedInstance(metrics, method, plugin));
    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        // Move on, this bStats is broken
    }
}
 
Example #15
Source File: Metrics2.java    From GriefPrevention with MIT License 5 votes vote down vote up
@Inject
private Metrics2(PluginContainer plugin, Logger logger, @ConfigDir(sharedRoot = true) Path configDir) {
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;

    Sponge.getEventManager().registerListeners(plugin, this);
}
 
Example #16
Source File: MetricsLite2.java    From bStats-Metrics with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Links a bStats 1 metrics class with this instance.
 *
 * @param metrics An object of the metrics class to link.
 */
private void linkOldMetrics(Object metrics) {
    try {
        Field field = metrics.getClass().getDeclaredField("plugin");
        field.setAccessible(true);
        PluginContainer plugin = (PluginContainer) field.get(metrics);
        Method method = metrics.getClass().getMethod("getPluginData");
        linkMetrics(new OutdatedInstance(metrics, method, plugin));
    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        // Move on, this bStats is broken
    }
}
 
Example #17
Source File: CachedPluginContainer.java    From Web-API with MIT License 5 votes vote down vote up
public CachedPluginContainer(PluginContainer plugin) {
    super(plugin);

    this.id = plugin.getId();
    this.name = plugin.getName();
    this.description = plugin.getDescription().orElse(null);
    this.version = plugin.getVersion().orElse(null);
    this.url = plugin.getUrl().orElse(null);
    this.authors = new ArrayList<>(plugin.getAuthors());
    plugin.getDependencies().forEach(d -> this.dependencies.add(new CachedPluginDependency(d)));
    this.source = plugin.getSource().map(p -> p.normalize().toString()).orElse(null);
    this.state = PluginState.Loaded;

    this.checkType();
}
 
Example #18
Source File: PermissionServiceProxy.java    From LuckPerms with MIT License 5 votes vote down vote up
@Override
public PermissionDescription.Builder newDescriptionBuilder(@NonNull Object o) {
    Optional<PluginContainer> container = Sponge.getGame().getPluginManager().fromInstance(o);
    if (!container.isPresent()) {
        throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
    }

    return new DescriptionBuilder(this.handle, container.get());
}
 
Example #19
Source File: MMCRestrictServlet.java    From Web-API with MIT License 5 votes vote down vote up
private Main getMMCRestrictPlugin() {
    Optional<PluginContainer> optContainer = Sponge.getPluginManager().getPlugin("mmcrestrict");
    if (!optContainer.isPresent()) {
        throw new InternalServerErrorException("MMCRestrict plugin not found");
    }

    Optional<?> optPlugin = optContainer.get().getInstance();
    if (!optPlugin.isPresent()) {
        throw new InternalServerErrorException("MMCRestrict plugin instance not found");
    }

    return (Main)optPlugin.get();
}
 
Example #20
Source File: MMCTicketsServlet.java    From Web-API with MIT License 5 votes vote down vote up
private Main getMMCTicketsPlugin() {
    Optional<PluginContainer> optContainer = Sponge.getPluginManager().getPlugin("mmctickets");
    if (!optContainer.isPresent()) {
        throw new InternalServerErrorException("MMCTickets plugin not found");
    }

    Optional<?> optPlugin = optContainer.get().getInstance();
    if (!optPlugin.isPresent()) {
        throw new InternalServerErrorException("MMCTickets plugin instance not found");
    }

    return (Main)optPlugin.get();
}
 
Example #21
Source File: UniversalMarketServlet.java    From Web-API with MIT License 5 votes vote down vote up
private UniversalMarket getUMPlugin() {
    Optional<PluginContainer> optContainer = Sponge.getPluginManager().getPlugin("universalmarket");
    if (!optContainer.isPresent()) {
        throw new InternalServerErrorException("UniversalMarket plugin not found");
    }

    Optional<?> optPlugin = optContainer.get().getInstance();
    if (!optPlugin.isPresent()) {
        throw new InternalServerErrorException("UniversalMarket plugin instance not found");
    }

    return (UniversalMarket)optPlugin.get();
}
 
Example #22
Source File: SubAPI.java    From SubServers-2 with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the Server Version
 *
 * @return Server Version
 */
public Version getServerVersion() {
    PluginContainer container = null;
    if (container == null) container = Util.getDespiteException(() -> (PluginContainer) Platform.class.getMethod("getContainer", Class.forName("org.spongepowered.api.Platform$Component")).invoke(Sponge.getPlatform(), Enum.valueOf((Class<Enum>) Class.forName("org.spongepowered.api.Platform$Component"), "IMPLEMENTATION")), null);
    if (container == null) container = Util.getDespiteException(() -> (PluginContainer) Platform.class.getMethod("getImplementation").invoke(Sponge.getPlatform()), null);
    return (container == null || !container.getVersion().isPresent())?null:new Version(container.getVersion().get());
}
 
Example #23
Source File: SpongeEventBus.java    From LuckPerms with MIT License 5 votes vote down vote up
@Override
protected PluginContainer checkPlugin(Object plugin) throws IllegalArgumentException {
    if (plugin instanceof PluginContainer) {
        return (PluginContainer) plugin;
    }

    PluginContainer pluginContainer = Sponge.getPluginManager().fromInstance(plugin).orElse(null);
    if (pluginContainer != null) {
        return pluginContainer;
    }

    throw new IllegalArgumentException("Object " + plugin + " (" + plugin.getClass().getName() + ") is not a plugin.");
}
 
Example #24
Source File: LuckPermsService.java    From LuckPerms with MIT License 5 votes vote down vote up
@Override
public LPPermissionDescription registerPermissionDescription(String id, Text description, PluginContainer owner) {
    Objects.requireNonNull(id, "id");
    SimplePermissionDescription desc = new SimplePermissionDescription(this, id, description, owner);
    this.permissionDescriptions.put(id, desc);
    this.plugin.getPermissionRegistry().insert(id);
    return desc;
}
 
Example #25
Source File: MetricsLite2.java    From bStats-Metrics with GNU Lesser General Public License v3.0 5 votes vote down vote up
private MetricsLite2(PluginContainer plugin, Logger logger, Path configDir, int pluginId) {
    this.plugin = plugin;
    this.logger = logger;
    this.configDir = configDir;
    this.pluginId = pluginId;

    Sponge.getEventManager().registerListeners(plugin, this);
}
 
Example #26
Source File: ChangeBlockListener.java    From Prism with MIT License 4 votes vote down vote up
/**
 * Listens to the base change block event.
 *
 * @param event ChangeBlockEvent
 */
@Listener(order = Order.POST)
public void onChangeBlock(ChangeBlockEvent event) {

    if (event.getCause().allOf(PluginContainer.class).stream().map(PluginContainer::getId).anyMatch(id ->
            Prism.getInstance().getConfig().getGeneralCategory().getBlacklist().contains(id))) {
        // Don't do anything
        return;
    }

    if (event.getCause().first(Player.class).map(Player::getUniqueId).map(Prism.getInstance().getActiveWands()::contains).orElse(false)) {
        // Cancel and exit event here, not supposed to place/track a block with an active wand.
        event.setCancelled(true);
        return;
    }

    if (event.getTransactions().isEmpty()
            || (!Prism.getInstance().getConfig().getEventCategory().isBlockBreak()
            && !Prism.getInstance().getConfig().getEventCategory().isBlockDecay()
            && !Prism.getInstance().getConfig().getEventCategory().isBlockGrow()
            && !Prism.getInstance().getConfig().getEventCategory().isBlockPlace())) {
        return;
    }

    for (Transaction<BlockSnapshot> transaction : event.getTransactions()) {
        if (!transaction.isValid() || !transaction.getOriginal().getLocation().isPresent()) {
            continue;
        }

        BlockType originalBlockType = transaction.getOriginal().getState().getType();
        BlockType finalBlockType = transaction.getFinal().getState().getType();

        PrismRecord.EventBuilder eventBuilder = PrismRecord.create()
                .source(event.getCause())
                .blockOriginal(transaction.getOriginal())
                .blockReplacement(transaction.getFinal())
                .location(transaction.getOriginal().getLocation().get());

        if (event instanceof ChangeBlockEvent.Break) {
            if (!Prism.getInstance().getConfig().getEventCategory().isBlockBreak()
                    || BlockUtil.rejectBreakCombination(originalBlockType, finalBlockType)
                    || EventUtil.rejectBreakEventIdentity(originalBlockType, finalBlockType, event.getCause())) {
                continue;
            }

            eventBuilder
                    .event(PrismEvents.BLOCK_BREAK)
                    .target(originalBlockType.getId().replace("_", " "))
                    .buildAndSave();
        } else if (event instanceof ChangeBlockEvent.Decay) {
            if (!Prism.getInstance().getConfig().getEventCategory().isBlockDecay()) {
                continue;
            }

            eventBuilder
                    .event(PrismEvents.BLOCK_DECAY)
                    .target(originalBlockType.getId().replace("_", " "))
                    .buildAndSave();
        } else if (event instanceof ChangeBlockEvent.Grow) {
            if (!Prism.getInstance().getConfig().getEventCategory().isBlockGrow()) {
                continue;
            }

            eventBuilder
                    .event(PrismEvents.BLOCK_GROW)
                    .target(finalBlockType.getId().replace("_", " "))
                    .buildAndSave();
        } else if (event instanceof ChangeBlockEvent.Place) {
            if (!Prism.getInstance().getConfig().getEventCategory().isBlockPlace()
                    || BlockUtil.rejectPlaceCombination(originalBlockType, finalBlockType)
                    || EventUtil.rejectPlaceEventIdentity(originalBlockType, finalBlockType, event.getCause())) {
                continue;
            }

            eventBuilder
                    .event(PrismEvents.BLOCK_PLACE)
                    .target(finalBlockType.getId().replace("_", " "))
                    .buildAndSave();
        }
    }
}
 
Example #27
Source File: UltimateCore.java    From UltimateCore with MIT License 4 votes vote down vote up
public static PluginContainer getContainer() {
    return Sponge.getPluginManager().fromInstance(get()).get();
}
 
Example #28
Source File: GDDebugData.java    From GriefDefender with MIT License 4 votes vote down vote up
public GDDebugData(CommandSource source, String filter, boolean verbose) {
    this.source = source;
    if (filter != null) {
        if (!filter.equalsIgnoreCase("claim")) {
            this.user = PermissionHolderCache.getInstance().getOrCreateUser(filter);
            if (this.user == null) {
                this.filter = filter;
            } else {
                this.filter = this.user.getName();
            }
        } else {
            if (source instanceof Player) {
                final Player player = (Player) source;
                final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAt(player.getLocation());
                this.claimUniqueId = claim.getUniqueId();
                this.filter = claim.getUniqueId().toString();
            }
        }
    }

    this.verbose = verbose;
    this.records = new ArrayList<>();
    this.header = new ArrayList<>();
    this.header.add("# GriefDefender Debug Log");
    this.header.add("#### This file was automatically generated by [GriefDefender](https://github.com/bloodmc/GriefDefender) ");
    this.header.add("");
    this.header.add("### Metadata");
    this.header.add("| Key | Value |");
    this.header.add("|-----|-------|");
    this.header.add("| GD Version | " + GriefDefenderPlugin.IMPLEMENTATION_VERSION + "|");
    this.header.add("| Sponge Version | " + GriefDefenderPlugin.SPONGE_VERSION + "|");
    final PluginContainer lpContainer = Sponge.getPluginManager().getPlugin("luckperms").orElse(null);
    if (lpContainer != null) {
        final String version = lpContainer.getVersion().orElse(null);
        if (version != null) {
            this.header.add("| LuckPerms Version | " + version);
        }
    }
    if (this.claimUniqueId != null) {
        this.header.add("| " + PlainComponentSerializer.INSTANCE.serialize(MessageCache.getInstance().LABEL_CLAIM) + " | " + this.claimUniqueId.toString() + "|");
    } else if (this.filter != null) {
        this.header.add("| " + PlainComponentSerializer.INSTANCE.serialize(MessageCache.getInstance().LABEL_FILTER) + " | " + filter + "|");
    }
    this.header.add("| " + PlainComponentSerializer.INSTANCE.serialize(MessageCache.getInstance().LABEL_USER) + " | " + (this.user == null ? PlainComponentSerializer.INSTANCE.serialize(MessageCache.getInstance().TITLE_ALL) : this.user.getName()) + "|");
    this.header.add("| " + PlainComponentSerializer.INSTANCE.serialize(MessageCache.getInstance().DEBUG_RECORD_START) + " | " + DATE_FORMAT.format(new Date(this.startTime)) + "|");
}
 
Example #29
Source File: Prism.java    From Prism with MIT License 4 votes vote down vote up
public PluginContainer getPluginContainer() {
    return pluginContainer;
}
 
Example #30
Source File: PermissionDescriptionProxy.java    From LuckPerms with MIT License 4 votes vote down vote up
@Override
public @NonNull PluginContainer getOwner() {
    return this.handle.getOwner().orElseGet(() -> Sponge.getGame().getPluginManager().fromInstance(this.service.getPlugin()).orElseThrow(() -> new RuntimeException("Unable to get LuckPerms instance.")));
}