Coder Social home page Coder Social logo

miniplaceholders / miniplaceholders Goto Github PK

View Code? Open in Web Editor NEW
61.0 1.0 9.0 760 KB

MiniMessage Component-based Placeholders for Paper, Fabric, Sponge, Folia and Velocity platforms

Home Page: https://modrinth.com/plugin/miniplaceholders

License: Apache License 2.0

Kotlin 2.39% Java 97.61%
velocity-plugin paper-plugin minimessage placeholderapi krypton-plugin minecraft-plugin java kotlin fabric-mod folia-plugin

miniplaceholders's Introduction

MiniPlaceholders

WorkFlow Latest Version Discord Modrinth Downloads GitHub Downloads

MiniMessage Component-based Placeholders for Paper, Fabric, Sponge, Folia and Velocity platforms

Compatibility

  • Paper 1.19.3, 1.19.4+
  • Folia 1.19.4+
  • Velocity 3.1.2+
  • Fabric 1.19.4+
  • Sponge API 8+

Commands

Velocity

  • /vminiplaceholders parse me "[message with placeholders]"
  • /vminiplaceholders parse player [some-player] "[message with placeholders]"

Paper | Folia | Fabric | Krypton

  • /miniplaceholders <parse|help> player [some-player] "[message with placeholders]
  • /miniplaceholders parse player [some-player] "[message with placeholders]"

Example:

  • /miniplaceholders parse me "<player_xp>"
  • /vminiplaceholders parse player 4drian3d "<player_name>"

User Usage

Check our user usage wiki here

API

Check the available Javadocs

Or check the Developer Wiki

Java

class Main {
    public static void registerExpansion() {
        final Expansion expansion = Expansion.builder("my-expansion")
                .filter(Player.class)
                .audiencePlaceholder("name", (audience, ctx, queue) -> {
                    final Player player = (player) audience;
                    return Tag.selfClosingInserting(player.getName());
                })
                .globalPlaceholder("tps", (ctx, queue) ->
                    Tag.selfClosingInserting(Component.text(Bukkit.getTps()[0]))
                ).build;
        
        expansion.register();
        
        Player player;
        final TagResolver playerResolver = MiniPlaceholders.getAudiencePlaceholders(player);
        player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", playerResolver));
    }
}

Kotlin

fun register() {
      val expansion = expansion("my-expansion") {
          audiencePlaceholder("name") { aud, _, _ ->
              aud.getName().asClosingTag()
          }
          globalPlaceholder("tps") { _, _ ->
              Component.text(Bukkit.getTps()[0]).asInsertingTag()
          }
      }
    
    expansion.register()
    
    val player: Player
    val playerResolver = MiniPlaceholders.getAudiencePlaceholders(player)
    player.sendMessage(miniMessage().deserialize("Player Name: <my-expansion_name>", playerResolver))
}

miniplaceholders's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

miniplaceholders's Issues

Separate each platform release into its own jar

With the recent inclusion of Cloud in MiniPlaceholders, the project went from less than 100kb to 1MB with the inclusion of Sponge.

There is no reason to include all platforms in a single jar, besides it would solve a possible confusion in the next release of MiniPlaceholders in Modrinth after the inclusion of Sponge, since in the Paper, Krypton and Fabric modules only 1.19.4 is supported, while in the Sponge module API 8, 9 and 10 (1.16.5-1.19.4) would be supported

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Package lookup failures

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update runtask to v2.2.4 (xyz.jpenilla.run-velocity, xyz.jpenilla.run-paper)
  • fix(deps): update dependency me.lucko:fabric-permissions-api to v0.3.1
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Warning

Renovate failed to look up the following dependencies: Failed to look up maven package com.mojang:minecraft.

Files affected: gradle/libs.versions.toml


Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
.gitpod.Dockerfile
github-actions
.github/workflows/build.yml
  • actions/checkout v4
  • actions/setup-java v4
  • nick-invision/retry v3
  • actions/upload-artifact v4
gradle
gradle.properties
settings.gradle.kts
  • fabric-loom 1.5.8
  • org.spongepowered.gradle.plugin 2.2.0
  • org.gradle.toolchains.foojay-resolver-convention 0.8.0
build.gradle.kts
  • org.jetbrains.kotlin.jvm 1.9.22
api/build.gradle.kts
build-logic/settings.gradle.kts
  • org.gradle.toolchains.foojay-resolver-convention 0.8.0
build-logic/build.gradle.kts
build-logic/src/main/kotlin/miniplaceholders.auto.module.gradle.kts
build-logic/src/main/kotlin/miniplaceholders.base.gradle.kts
build-logic/src/main/kotlin/miniplaceholders.kotlin.publish.gradle.kts
build-logic/src/main/kotlin/miniplaceholders.publish.gradle.kts
build-logic/src/main/kotlin/miniplaceholders.shadow.gradle.kts
common/build.gradle.kts
connect/build.gradle.kts
fabric/build.gradle.kts
gradle/libs.versions.toml
  • com.velocitypowered:velocity-api 3.2.0-SNAPSHOT
  • io.papermc.paper:paper-api 1.20.2-R0.1-SNAPSHOT
  • com.mojang:minecraft 1.20.2
  • net.fabricmc.fabric-api:fabric-api 0.96.4+1.20.5
  • net.fabricmc:fabric-loader 0.15.7
  • me.lucko:fabric-permissions-api 0.2-SNAPSHOT
  • net.kyori:adventure-api 4.15.0
  • net.kyori:adventure-text-minimessage 4.15.0
  • net.kyori:adventure-platform-fabric 5.12.0
  • net.kyori:adventure-text-serializer-legacy 4.15.0
  • net.kyori:adventure-text-serializer-plain 4.15.0
  • cloud.commandframework:cloud-core 1.8.4
  • cloud.commandframework:cloud-annotations 1.8.4
  • cloud.commandframework:cloud-velocity 1.8.4
  • cloud.commandframework:cloud-paper 1.8.4
  • cloud.commandframework:cloud-fabric 1.8.4
  • cloud.commandframework:cloud-sponge 1.8.0-SNAPSHOT
  • cloud.commandframework:cloud-minecraft-extras 1.8.4
  • com.mojang:brigadier 1.0.500
  • com.github.johnrengelman:shadow 8.1.1
  • org.jetbrains.kotlin:kotlin-gradle-plugin 1.9.22
  • net.kyori:indra-common 3.1.3
  • net.kyori:indra-licenser-spotless 3.1.3
  • org.jetbrains.dokka:dokka-gradle-plugin 1.9.10
  • net.william278:DesertWell 2.0.4
  • org.junit:junit-bom 5.10.2
  • net.minecrell.plugin-yml.bukkit 0.6.0
  • io.papermc.paperweight.userdev 1.5.11
  • xyz.jpenilla.run-paper 2.2.3
  • xyz.jpenilla.run-velocity 2.2.3
  • net.kyori.blossom 2.1.0
  • com.github.johnrengelman.shadow 8.1.1
  • me.champeau.jmh 0.7.2
  • org.jetbrains.dokka 1.9.10
  • org.jetbrains.gradle.plugin.idea-ext 1.1.7
kotlin-ext/build.gradle.kts
paper/build.gradle.kts
sponge/build.gradle.kts
velocity/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.6

  • Check this box to trigger a request for Renovate to run again on this repository

Relational placeholders don't work (am I doing it wrong?)

so I've got an expansion of my plugin:

Expansion.builder("internal")
        .filter(Player.class)
        .audiencePlaceholder("player_name", (audience, queue, ctx) -> {
          return getPlayerNameTag(audience);
        })
        .filter(Player.class)
        .relationalPlaceholder("1_player_name", (audience, otherAudience, queue, ctx) -> {
          return getPlayerNameTag(audience);
        })
        .filter(Player.class)
        .relationalPlaceholder("2_player_name", (audience, otherAudience, queue, ctx) -> {
          return getPlayerNameTag(otherAudience);
        })
        .build();

But neither "internal_1_player_name" nor "internal_2_player_name" work, I just use the expansion.relationalPlaceholders(player, anotherPlayer)
I also tried with "rel_" prefix but didn't work either
internal_player_name when used with expansion.audiencePlaceholders(player) works though

Add methods to obtain placeholder names within an expansion

something like:

final Expansion expansion = Expansion.builder("test")
    .audienceExpansion("audience", (audience, ctx, queue) -> null)
    .build();

final Collection<String> audiencePlaceholdersNames = expansion.audiencePlaceholdersByName();
System.out.println(audiencePlaceholdersNames.get(0));
// "<test_audience>"
  • Expansion#audiencePlaceholdersByName
  • Expansion#relationalPlaceholdersByName
  • Expansion#globalPlaceholdersByName
  • Expansion#audiencePlaceholdersByNameRaw
  • Expansion#relationalPlaceholdersByNameRaw
  • Expansion#globalPlaceholdersByNameRaw

Expansion Metadata

Expansion.builder("asd")
  .author("4drian3d")
  .version("1.0.0")
  .audiencePlaceholder("some_placeholder", (audience, queue, ctx) -> null)
  .build();

This, in order to be able to display information in a future MiniPlaceholders subcommand to show the installed expansions.

Support legacy colors

hey can you please add legacy color code too it would be awesome cause most players still uses legacy color codes &1 &2

Fabric Support

As strange as it may seem, support for Fabric seems to be easier than adding support for Sponge

`/miniplaceholders` doesn't display placeholder count

It should display placeholder count for players with permission, and plugin version for players without permission. But PermissionChecker requires TriState.TRUE, and players may have a permission enabled by default. Server operators have all default: op permissions implicitly with NOT_SET, maybe there are other such cases. So even if I /op myself, I still get MiniPlaceholders' version in /miniplaceholders

Implement FilteredExpansion

FilteredExpansion.builder(String name, Class<A extends Audience>)
  .audiencePlaceholder(String placeholder, FilteredAudiencePlaceholder placeholder)
  .build()
  .register();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.