Git Product home page Git Product logo

placeholderapi's Introduction

PlaceholderAPI Build Status Awesome

forthebadge forthebadge

If you were sent here from another plugin, simply download this plugin and install it in your mods folder. After the first start of this plugin, you will need to enable the default expansions in the config file to be able to use those placeholders. Example if you want Player placeholders, open the config and set Player to True. Now you can use %player_name% as a placeholder. This same method applies for every available expansion.

There is a chance that a plugin may update and cause one of the internal placeholder hooks to break. If this happens, please report the issue immediately so we can update the placeholder hook to the latest version of the plugin that broke.


FEATURES

  • No lag
  • Fast updates
  • Easy contribution

Planned

  • More built in placeholders
  • Vast plugin support (I'll try to create PR's to help the process)

USAGE

Server Owners

Just drop this plugin into your mods folder and enable any default expansions you want to use in the config file.

Developers

View tutorials on how to use the API here.

If you're looking to contribute, the source code is available here.


BUGS

If you find any bugs or would like to suggest features, please create an issue here

placeholderapi's People

Contributors

ronaldburns avatar wundero avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

placeholderapi's Issues

Version 5.0

This is my sort of idea list for version 5 that I would like to put out before working on it. Figured this time it would be better to make the complete update process transparent as migrating from 3 to 4 was quite interesting.

I have two streams, with separate ideas, that can be implemented:

  • Multiple @Token parameters in a method, parsed out as _ separated in order from left to right
    • Support lists/arrays as a "parse till you fail" style approach
    • String lists/arrays not allowed unless at the end of the param list
    • If final param is string and multiple token parts remain to parse, stick them in
    • Support for having middle parameters be @Nullable -> if parsing fails, try parsing to the next parameter from the same token
    • Class transformation to make small array types (like int[] or String[] with an expected size of 2 or 3) into separate parameters
    • Token parsing priority? (for instance, if tokens can be %a_b_c% or %a_b_d_5% and you put priority on 5, it will try to parse out that situation first) -> may not be worth it since it adds a layer of complexity.
  • Multiple methods under the same id using different token configurations
  • Custom, per placeholder token parsers attached to a specific parameter.

OR

  • Replace placeholder system with the Cause and Context system?
    • Throw an event when starting to parse a placeholder
    • Cause would contain sender, observer, and all parsed values from the token
    • Use command system (ValueParser, Parameter, etc.) to parse a placeholder's tokens
    • Event would contain:
      • placeholder id
      • a list of parsed token objects
      • the raw placeholder
      • the selected placeholder that will be used to parse
      • a cancellation boolean
    • If parsing fails, throw out an event for getting the error message + suggestions
  • Support an asynchronous event chain for the above AS WELL AS async/sync placeholder distinction
    • In placeholder declaration, define support for this (as in, @Async or something)
  • Placeholder method refactor:
    • Something like the following code block
      • Cause support (I'm not 100% sure about how causes work/will work, so if causes can support storing all the data needed, there will be no need for the object
      • If needed, some kind of object representing: the raw placeholder string, the parsed tokens as objects, the source, and the observer
      • Event filter parameters + a bit extra for support for this
@Placeholder("example")
@Async
public Object example(ParsedPlaceholder placeholder, Cause cause, @First Player source, ...) {
    /*...*/
}

As well as those two streams, there would be some common ground:

  • Sponge API 8 required (adapt commands + events to it)
  • Proper events -> throw events (advanced check to see if attaching plugins use events??? -> save performance to not throw them if no one cares)
  • Placeholder attaching: that is, an object attached to any object that can be a source for placeholders.
    • Methods would be refactored to not include source objects (as they are attached to the object), rather supporting a field representing the attached object
    • Use injection to do construction???
    • Parse against attached placeholders first; saves some performance.
    • Unattached placeholders attach to Sponge server???
  • Attach to Sponge internals:
    • Register builders to the Sponge registry
    • Better listener support
  • Better error handling for placeholders
  • Data API support within the Sponge API
  • Better Placeholder formatting:
    • There needs to be a better way of parsing and determining placeholders than is currently implemented. Some ideas:
      • Better regular expression support. The current support only works if the placeholder is contained within group 1. I might try to make a better system for this, where patterns attached to methods are given a group where placeholders exist, but I prefer:
      • Replace the regular expression system altogether with another parser. This parser would be more systematic and targeted to the plugin. This would also help simplify placeholder id finding, etc. This would look something like: {id:player,type:name}
      • The latter would quite help with token parsing, as well as having direct mappings instead of conditional logic (so type:name for id:player would directly correspond to a function getName in this case).

That's all I've got for now but it's pretty big so I will leave it as is. for a bit. Any suggestions are appreciated, as always

Config is being reset after server restart

Please provide these fields before submitting an issue.

SpongeAPI version: 7.0.0

PlaceholderAPI version: 4.2

Plugins installed:

VirtualChest

Error log [if any]: (please use PasteBin or similar services to shorten error logs)

Description:
Config of PlaceHolderAPI is same as the default config after server restart.
I changed economy from false to true and after the first server restart is everything okay.
Then, second restart - economy is false again.
I think, that it should be because of server - uptimes. I disabled it and it keeps logging the end-time and start-time of the server.

Steps to reproduce:
Start Sponge server with economy enabled, restart the server (maybe with the second restart) and economy is disabled again.

Verify method in expansion builder is broken

I need to fix the method. It doesn't properly recognize the types set when calling the method, so I will need to improve that before releasing 4.2. Really sucks that generic types are so hidden at run-time (I know they exist to an extent because I can obtain some information about them, just not what I need right now). I might end up having to add class types to the builder method in the service, which would honestly look a bit nicer than service.<source, observer, return>builder().{...}; but we will see. (See that service.builder(source.class, observer.class, return.class).{...}; looks cleaner at least, and you can actually store those classes as variables so it could be easier if you use the same vars for multiple placeholders)

Of course this is not particularly important since the presence of the load and loadAll methods is usually better and nicer to work with, but nonetheless I would like it to work.

Use Better Config Practices

From DualSpiral

It's about your Configurables and Configs classes. It's a structure that doesn't add anything or tries to reinvent the wheel. For example:

I don't think you need to use Files.createFile(configFile); in your "setup" method. In fact, surely it would be better to either pull a default config file using the Asset API, or to use Configurate's configNode.mergeValuesFrom(CommentedConfigurationNode defaults) to create your initial defaults - these are much better solutions. You could then do away with setup and populate, and either (with the second being my preference):
Check if the file exists, if not copy from the Asset API, or;
Load like normal, but have a CommentedConfigurationNode that holds your default config, so you could do (with try/catch omitted for brevity):
public void load() {
configNode = configLoader.load();
configNode.mergeValuesFrom(defaultConfig);
configLoader.save(configNode);
}
(In case you need it: Configurate Javadocs on mergeValuesFrom)

In this way, this would allow you to drop both setup() and populate(). You could also just then use Sponge's injected ConfigurationLoader to allow Sponge to select the correct file so you don't have to do the legwork and pass that into this file.

(I think that code would just about work, though it's more the point I'm trying to get across)

If you get an exception on setup() or load(), you swallow the exception, but then the node is null if this is the first access of the class, so by accessing the config, you'll end up creating a load of NullPointerExceptions.
What does having a static Configs class give you? All it does it operate on a Configurable class that you have control over (and must possess). It breaks the Object Oriented paradigm.
getConfig(Configurable) and saveConfig() just call public methods on your Configurable that you should just call directly.
All the other methods could (and probably should) just go on the Configurable, I can see "set value and save" being useful, though I would argue that it doesn't allow you to interact with more advanced features of Configurate.
However, rather than using strings throughout your plugin, which will be a nightmare to change if you update the config, why not have methods on your Config class that get and set the values you use in your plugin? That way, if you change your config file, you just need to change the one class, limiting the work you have to do.
As an aside, Configurate offers Versioned Transformers that allow you to update the schema of your config easily, though I don't know exactly how they work, because I've not used the versioned ones - only standard transformations.
Also, not that it matters so much, but HOCON convention is that config keys are lowercase and dash separated, so ConfigVersion should be config-version, but that is up to you.

Problem with statistic

Please provide these fields before submitting an issue.

SpongeAPI version: 5.2.0-SNAPSHOT-c675e80

PlaceholderAPI version: 4.1

Plugins (7): Minecraft, Minecraft Coder Pack, Forge Mod Loader, Minecraft Forge, SpongeAPI, SpongeForge, PlaceholderAPI

Error log [if any]: (No log error )

Description:
Connected on server when I try to use /papi parse GohuSan %player_time_played%
Plugin response is ERROR: Player must have statistics!

I try to enable it with papi enable statistic but nothing change

Getting the message receiver

Simply put, when creating an Expansion, you have the onPlaceholderRequest(Player, Identifier) method. The player obviously is the player who is writing the message. I am wondering if it's possible to get the person looking at the message, so that the format can be modified based on the relationship the players have? This all depends on how messages are sent obviously, and if there are any limitations preventing this. I'm using PlaceholderAPI along with DeluxeChat, and am wanting to have a placeholder for the colour relationship between two factions players (ally faction tags are green, enemy are red). I believe you could do this in the past with %faction_relation_color%, or something similar, however I've not been able to get it working.

A solution to either/both would be much appreciated! :)

Spams this error. Kicks players.

Please provide these fields before submitting an issue.

SpongeAPI version: 7.1 2931

PlaceholderAPI version: 4.4

Plugins installed: nucleus-info-20180313-153804.txt

Error log [if any]: https://gyazo.com/a1b7424a3cadf4b16d4137dbbe698d12

Description: Every so often, this error will get spammed and will kick players saying "A Fatal error has occurred. The connection has been terminated"

Steps to reproduce: Unknown. Occurred after we updated a core mod. Pixelmon Reforged from 6.2.1 to 6.2.2

Wiki updates

This is a collection of things I need to update on the wiki due to changes in the plugin.

  • Annotated placeholders
    • How to write a method that supports placeholders (public class AND method, params must be of supported types or higher level)
    • What every annotation (Source, Observer, Token, Nullable, Relational) does
    • Best practices
  • Expansion builder
    • How to use this in conjunction with annotated classes
    • How to create simple function-based placeholders
    • What each method does
    • What ExpansionFunction is and does
  • New PlaceholderService methods
    • builder, load, loadAll, registerExpansion, isRegistered
    • fillPlaceholders, parse, fill, parseNullable, replacePlaceholders
    • getDefaultPattern, verifySource, verifyObserver
  • Update placeholders list
  • JavaScript placeholders with example + explain for value
  • Parse command with relational support
  • General cleanup

Question

Is it possible to add the direction of the player? North, South, West, East, intermediate.

Licensing

I need to create a license for this plugin and put it in all of the files. I will be using the MIT license. I am unsure as to who (or what group/org) to denote it under but I will likely go with rojo8399. Any thoughts would be appreciated.

[Sponge API 7.0] Error on server start

SpongeAPI version:
7.0.0
PlaceholderAPI version:
4.3
Plugins installed:
PlaceHolderAPI, Command Utils, Nucleus, Badge, GriefPrevention, VirtualChest, UltimateChat, TotalEconomy, ProjectCore, ProjectPortals, LuckPerms
Error log [if any]: (please use PasteBin or similar services to shorten error logs)
https://pastebin.com/PV86Y5wv
Description:
After update to latest version of SpongeForge 1.12.2 (build 2757) PlaceHolderAPI is not working.
Steps to reproduce:
Use SpongeForge 1.12.2 API 7.0.0, build 2757
Start server and error appears.

[Sponge API 5.2.0]VirtualChest and Total Economy/EconomyLite

Please provide these fields before submitting an issue.

SpongeAPI version: 5.20

PlaceholderAPI version: 4.1

Plugins installed:

  • ActionMessage
  • BungeeTabListPlus
  • CatClearLag
  • CommandUtils
  • EasyScoreboards
  • GriefPrevention
  • LuckPerms
  • Nucleus
  • PixelAutoMessages
  • PlaceHolderAPI
  • ProjectCore
  • ProjectPortals
  • Total Economy
  • Ultimate Chat
  • VirtualChest
  • WorldEdit

Description:
Hello, first of all I would like to say, that I tried it just with installed VirtualChest, PlaceHolderAPI and Total Economy and the result was the same.

I want to use your place holder %economy_balance_[currency]%, because in Total Economy I have two currencies (Tokens and Kredits). In VirtualChest I want to have both currencies for buying items and it is using your place holders for this. I tried to use %economy_balance_kredits% and %economy_balance_[kredits]%. Neither of it works. Everytime it was using the default currency (tokens).
I contacted author of Total Economy, but he said, that he doesn't know how both of this plugins works.

Is it a problem on his side or this side?
I just need to be able to reference for the currencies.

PS: I tried to do the same with EconomyLite and the result was same and author said the same 😄
PPS: I tried to do the same on Sponge API 7.0.0 (but in scoreboard instead of VirtualChest) and result was same.

Steps to reproduce:
Just tried to use the placeholder anywhere (scoreboard, virtualchest, etc.) with Total Economy. It will always show the default currency.

Thank you a lot,
Krosta8

java.lang.NullPointerException

SpongeAPI version: spongeforge-1.11.2-2227-6.0.0-BETA-2159.jar

PlaceholderAPI version: Placeholders-3.5.jar

Plugins installed:
AntiWDL-1.1-all.jar
API6-BetterBoom.jar
AutoBroadcasterSponge-0.2.1.jar
CommandSigns-API-6.0.0-1.3.1.jar
CustomPlayerCount.-.1.1.jar
EasyScoreboards.jar
EconomyLite-5.0.0-2.9.0.jar
FlexibleLogin.jar
foxcore-0.10.3-208-server.jar
foxguard-0.20.2-api5-347-server.jar
Graveyards-v2.1.3.jar
helpme-5.0.0-0.2.2.jar
holograms-2.1.1.jar
IPLog-0.1.1.jar
JobsLite-1.7.0.jar
Launchpad-v1.0-FIXED.jar
MiscStuff-1.0-SNAPSHOT.jar
Nucleus-0.23.2-1.11.2-S6.0-plugin.jar
ore-plugin-1.1.0-SNAPSHOT.jar
PermissionsEx-Sponge.jar
Placeholders-3.5.jar
projectportals-5.1.0-0.13.6.jar
spongeforge-1.11.2-2227-6.0.0-BETA-2159.jar
Synonym-1.0.1.jar
TitleMOTD.-.1.0.jar
treepers-5.1.3.jar
twentyticks.jar
Vigilate-1.0.2.jar
walletdrop-5.1.0-0.2.1.jar
worldedit-sponge-6.1.7-SNAPSHOT-dist.jar

Error log [if any]: http://pastebin.com/pF51TrBn

Description: start the server

Steps to reproduce:

PlaceholderAPI Breaks Virtual Chest

SpongeAPI version: spongevanilla-1.10.2-5.2.0-BETA-393

PlaceholderAPI version: PlaceholderAPI v4.1

Plugins installed: Virtual Chest

Error log [if any]: (https://pastebin.com/vLwsuwi6)

Description: Virtual Chest is using PlaceholderAPI and if you don't use it and open the Menu it doesn't show the name and other placeholders but when I try to open the Menu with PlaceholderAPI it doesn't work. Tried the 1.11.2 and 1.12 versions still doesn't work I remove Nucleus and Nucleus Gluon to see if that breaks the plugins but still doesn't work

Ore Sponge Versions

Would it be possible to add SpongeAPI as a dependency, so it was possible to work out what major version of Sponge PlaceholderAPI was built against or compatible with?

Config Invalid! on load.

SpongeAPI version: Sponge Forge / 7.1.0-70763aa8 / 1.12.2-2768-7.1.4

PlaceholderAPI version: 4.5.1

Plugins installed: Installed on Sky Adventures 1.3.0 Server

  • CommandsUtils
  • Holograms
  • LuckPerms
  • PlaceholderAPI
  • ServerListPlus
  • WorldEdit

Error log [if any]: https://pastebin.com/b17J1vUk

Description: Getting error about config Invalid on load and every time after reload.

Steps to reproduce: Mystery. Started from blank configuration on Sky Adventure 1.3.0 Server.

Correct commit to use in plugins that add support for PlaceholderAPI

So it might be confusing for developers that don't know jitpack what the line compile "com.github.rojo8399:PlaceholderAPI:master-SNAPSHOT" does.

I just wanted to add support in another plugin for PAPI but looking at the current commits it may be not working with the latest commit of master(SNAPSHOT). So I had to dig to the commit that introduced version 4.0 and use that. I would very really highly recommend you to just add a version tag under the release section of this repo to point to this commit of v4.0. Then the dependency looks like this: com.github.rojo8399:PlaceholderAPI:v4.0. It would make things very easy.

I do this regularly: https://github.com/randombyte-developer/kosp/tags

Edit: 1b6fb7b is right for 4.0?

economy placeholder

Please provide these fields before submitting an issue.

SpongeAPI version: 6.0.0.0

Plugins installed: Total Economy 1.7.1

Description: when I try to use de %economy_balance_...% with my currency in the Total Economy, it didin´t show me the currency, and shows me as a text, Im doing something wrong? or there isn´t any compatibility with the plugins?

Enhance Errors

Thinking about catching errors when typing commands and handling them instead of Sponge so we can provide more help, and make it look good of course.

Errors To Enhance

  • /papi {error}
  • /papi enable {error}
  • /papi disable {error}
  • /papi parse {error}
  • /papi info {error}

Request - Add non admin command or subdivide perms.

Is just a suggestion:
It'd be awesome to allow an admin to parse a placeholder and it return to a defined player.
Usefull for setting custom commands.

Or, if not possible, subdivide the permissions so i could give placeholderapi.admin.parse for a player instead of the whole placeholderapi.admin

:)

[Easyscoreboard + Placeholder] Placeholders are one players not individual

Please provide these fields before submitting an issue.

SpongeAPI version: Sponge 7.1 - 3002

PlaceholderAPI version: 4.4

Plugins installed: EasyScoreboard, TotalEco, Pixelmon - These are the main ones the placeholders are using.

Description: The placeholder API is currently displaying one players placeholders rather than the individual players placeholder, the placeholders i'm using - %player_time_played_hours% and %economy_balance%

Steps to reproduce:

java.util.NoSuchElementException: No value present

SpongeAPI version: spongeforge-1.11.2-2227-6.0.0-BETA-2157.jar

PlaceholderAPI version: Placeholders-3.4.jar

Plugins installed:
AntiWDL-1.1-all.jar
API6-BetterBoom.jar
AutoBroadcasterSponge-0.2.1.jar
CommandSigns-API-6.0.0-1.3.1.jar
CustomPlayerCount.-.1.1.jar
EasyScoreboards.jar!
EconomyLite-5.0.0-2.9.0.jar
FlexibleLogin.jar
foxcore-0.10.3-208-server.jar
foxguard-0.20.2-api5-347-server.jar
Graveyards-v2.1.3.jar
helpme-5.0.0-0.2.2.jar
holograms-2.1.1.jar
IPLog-0.1.1.jar
JobsLite-1.7.0.jar
Launchpad-v1.0-FIXED.jar
MiscStuff-1.0-SNAPSHOT.jar
Nucleus-0.23.2-1.11.2-S6.0-plugin.jar
ore-plugin-1.1.0-SNAPSHOT.jar
PermissionsEx-Sponge.jar
Placeholders-3.4.jar
projectportals-5.1.0-0.13.6.jar
spongeforge-1.11.2-2227-6.0.0-BETA-2157.jar
Synonym-1.0.1.jar
TitleMOTD.-.1.0.jar
treepers-5.1.3.jar
twentyticks.jar
Vigilate-1.0.2.jar
walletdrop-5.1.0-0.2.1.jar
worldedit-sponge-6.1.7-SNAPSHOT-dist.jar

Error log [if any]: http://pastebin.com/EywHhmLh

Description:

Steps to reproduce: First start the server, after upgrading the plugin

Exception while parse player's statistic value

Please provide these fields before submitting an issue.

SpongeAPI version: 5.2.0-SNAPSHOT-c675e80

PlaceholderAPI version: 4.4

Plugins installed:

Error log [if any]: Gist

Description: Exception while parse player's statistic value

Steps to reproduce:
1.player is online
2.Command “/papi parse Tollainmear %player_time_played%” I ran.
3.Exception shown as Gist

Placeholders to add

List of expansions (hooks) to add:

  • Permissions hook
    • Permissions options
  • Economy hook
  • World token for Player
  • Date/Time hook
  • Unique players
  • Player ping
  • Numerous javascript placeholder starting points
  • Data placeholder -> takes in a data holder as a source, and uses tokens to determine the value to get.
    • Contextual support when that is supported

Note; placeholders involving non-Sponge systems (like plugins) should have support either implemented directly in the plugins or as a bridging plugin, for two reasons:

  • Adding dependencies to this plugin would bloat it beyond necessary levels. There is no reason to have soft dependencies as this is intended to be an API.
  • Support for this API in plugins that use it would make user support for placeholders nearly seamless
  • Bridge plugins would be a bit more bloating for the user but removes dependencies in projects that are trying to trim dependencies down; for instance, if NuVotifier ends up supporting services, a NuVotifier-PlaceholderAPI bridge would be a bridge plugin.

I will add more as suggestions come in/I come up with more.

What is wrong with my code?

Versions

SpongeAPI version: 5.1.0-BETA-370

PlaceholderAPI version: 3.7

Problem

Hi,
Here is the dev of EasyScoreboards.
This is the code I am currently trying to use, however the only thing it prints is %player%.

Optional<PlaceholderService> service = Sponge.getGame().getServiceManager().provide(PlaceholderService.class);
if (service.isPresent()) {
    PlaceholderService placeholderService = service.get();
    System.out.println(placeholderService.replacePlaceholdersLegacy(player, "%player%", "%", "%"));
}

Any idea what could be wrong with that. There is no error message or anything else.

Thanks in advance

Separate API/service from plugin

I suggest separating the pure API/PlaceholderSercive from the real plugin. Then the dependency would look like this: com.github.rojo8399.PlaceholderAPI:api:SNAPSHOT or com.github.rojo8399.PlaceholderAPI:api:v4.0. I can do this in a PR if you want to.

Sponge API Compatibility?

Hi there, just a quick question - does this plugin work with API 6/7 ?

It looks like it's been updated recently, but it's still listed under API 5 on the release on Ore, and I couldn't find anywhere if it's compatible with API 7. Just want to check before I attempt to install it and possibly break things.

PlaceholderAPI could not load the messages file

Please provide these fields before submitting an issue.

SpongeAPI version: 7.1.0-SNAPSHOT-7105dfc

PlaceholderAPI version: 4.5.1

Plugins installed: Doesn't seem to be related to other plugins

Error log [if any]: https://pastebin.com/RWp1BYkt

Description: PlaceholderAPI throws an error during startup, and all placeholders stop working.

Steps to reproduce:
Start the server with the latest PlaceholderAPI.
The problem persisted when I deleted the messages file, where PlaceholderAPI regenerated the file and still failed to load it.

Relational parameters incorrectly selected when both are available for a token

SpongeAPI version: 7

PlaceholderAPI version: 4.4

Plugins installed: Nucleus 1.2.2, Nucleus Gluon 1.0.4 snapshot

Error log [if any]: (please use PasteBin or similar services to shorten error logs)

None - exception is swallowed in PAPI.

Description:

See NucleusPowered/Gluon#2 (comment). API method parse will always select the relational placeholder if both options are available, causing problems with the %player(_*)% placeholders

Steps to reproduce:

Use parse("player", Player, Player) to parse a player token. It will fail with a no such value exception, return null and return no text. This is because the relational placeholder failed - the non-relational one should be selected as a fallback at the very least.

Replace is stripping my colors (return string instead text?)

Hi,

This is not exact an issue but a fix.

I hooked this on my chat plugin (UltimateChat) and on parse my chat messages it only returns Text.
Its ok, but problem is i using coloured Strings on my parse stage, and because your plugin only returns Text, its removing the last color of my string on text conversion, and this is crucial to not happen.

As example, i have a string like &4[&7MyRank&4]&7. On conversion to text, its removing (or adding a reset code) and removing that &7 from my tag.

There is a way to return a string?

Edit: And i added this placeholders to your plugin: https://github.com/FabioZumbi12/UltimateChat/wiki/(9)-PlaceholderAPI-Hook#sponge

Tag for v4.2

Please add a tag for v4.2 to compile against it via jitpack. Thanks!

Annotations update TODO

  • Finish JavaDocs for PlaceholderService
  • Figure out how to make tokens and other information dynamic (attach to obj not method??)
  • Test performance (no longer need to check expiry because I am not using loading caches)
  • PR for Nucleus-Gluon
  • Wiki Documentation update
  • Remove any notation of target in favour of observer
  • Support for directly adding implementers of interface rather than registering methods?
  • Clarify that Relational annotation only does two things:
    • Changes method registration id to "rel_"+id
    • Allows null backfiring to trigger regular id parsing for observer (useful for message recipient based chat among other things) (Default parsing should and would likely be for source)
  • Support more types for Source/Observer: (Methods specify min level requisites, will error if not provided) (I am unsure if I want to add these due to limited use cases. If use cases are suggested I will gladly add them)
    • Subject ?
    • MessageReceiver ?
    • Entity (or similar) ?
    • ItemStackSnapshot?
      • If I do this, I might just do data representables and/or a lower level interface of this, simply to allow support for more than just items. Might be useful, I think an opinion other than mine on this would be nice. I won't implement this yet though because I don't know any good use cases.
  • Better class generation
    • Don't assign local vars that are unused
    • Support void method calls by returning empty string (gen class differently)
  • Suggestions by people (not expecting many, if any at all, so this may be unchecked when I close this issue)
  • Test and deploy

Hopefully I can do most of this soon.

Source required to replace placeholder?

Hi!

I would like to integrate PAPI into the plugin Holograms. These holograms are just ArmorStand with custom names, no packet magic is done. Therefore the source for replacing placeholders can not be determined. Null is forbidden for the source. Is there any way I could integrate it?

Further expansion

This is more of a checklist/brainstorm than an issue, but I think some things could be added to allow more dynamic and powerful placeholders.

  • Configurable expansions (Configuration grabbed from PlaceholderAPI plugin)
  • Relational placeholders
  • Custom delimiters for regular expression
  • Javascript Placeholders
  • Text instead of String for better Sponge integration
  • bStats support
  • Online file explorer (GH Pages?) for scripts/expansions
    • JavaScript+HTML backend (Not sure how well I can do this since I don't know much JS or HTML)
    • GitHub Pages enabled
  • Internaltionalization
    Removed injection systems Not in the domain of the plugin.
    Multiple versions for Sponge builds is not valuable Might as well stay on latest, once api 8 rolls out this will move to 8 exclusivity anyways. Latest is greatest ;)
    ValueModifiers I've realized that this is not particularly helpful as you can execute fill methods now. Since retrieving real values for placeholders, like Integer, List, etc. instead of just Text is now possible and easy this has become significantly more niche, if not downright useless.

Feel free to leave a comment suggesting a feature. If you want to request a placeholder, see #12 instead.

Allow applying own TextTemplate params

There is Text replacePlaceholders(Player player, TextTemplate text) for TextTemplates. I would like to apply my own parameters additionally to the ones from PlayeholderAPI.
How about a method that allows additional params to be passed to the TextTemplate. Or the PlaceholderAPI returns a map of the filled in params and values that the plugin using PAPI applies itself on the TextTemplate?

An additional feature for replacement transformation

I want to add a feature for my plugin that server admins could write single-line scripts such as %economy_balance_dollar% > 20 or %player_perm_a.b.c% == 'true', while I noticed something that needed to be done: there could be some weird characters such as single quotes and double quotes which should be escaped (' => \', " => \", etc.) in order to avoid potential injection attacks.

So I request for a feature about transformation of the replacements, and the API might be like this:

Text replacePlaceholders(Player player, String text, Function<? super Text, ? extends Text> mappingFunction);
String replacePlaceholdersLegacy(Player player, String text, Function<? super Text, ? extends String> mappingFunction);

and then I could pass the escape function and everything works well.

Thanks for your attention!

Support for spongeforge-1.12.2-2555-7.1.0-BETA-2831

I'm looking for a PlaceholderAPI & DeluxeJoin that will work on a Sponge Forge Server with spongeforge-1.12.2-2555-7.1.0-BETA-2831 mod and forge-1.12.2-14.23.1.2587.

When I tried with PlaceholderAPI-4.4.jar and DeluxeJoin-5.0.0-1.0.jar the startup fails and server crashes. Without the PlaceholderAPI, it crashes b/c of the dependency. Adding it to the startup, I get to the end of startup and then the crash occurs. See full startup here. https://pastebin.com/ii9UJATa
My guess here is that either or both mods need to be updated to the latest SpongeAPI.

Plugin breaks when non default config/plugin folder are used

SpongeAPI version: 5/7
PlaceholderAPI version: PlaceholderAPI-4.3.jar
Plugins installed: doesn't matter, but tested with VirtualChest

Error log: https://gist.github.com/phit/3183779fc09b5fef9943abcdf6e1dd06

Plugin completely breaks down when you have non default config and plugin folder paths set in your Sponge global.conf
In this case I had it set to:

        config-dir="${CANONICAL_GAME_DIR}/plugins/config"
        plugins-dir="${CANONICAL_GAME_DIR}/plugins"

Workaround is manually putting configs generated on another server in the usual config/ folder. Then it loads fine..

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.