ItemJoin

ItemJoin

157k Downloads

[Request] API - Check if an item is ItemJoin's item and get it's name.

momoservertw opened this issue · 7 comments

commented

I am developing a trading plugin and an event control plugin.
Can you add an API to check if the item is ItemJoin's item and get it's name.

commented

The name to be displayed on the item or the node name?

Thank you SO MUCH for the dono btw :3

commented

The node name. To distinguish which ItemJoin item is.
For example,
boolean: ItemJoinAPI.isItemJoin(itemStack);
String: ItemJoinAPI.getItemNode(itemStack);

The following APIs are also quite useful.
List<String>: getItemFlags(itemNode);
List<String>: getItemCommands(itemNode);
List<String>: getItemTriggers(itemNode);
int: getItemSlot(itemNode);
Event: ItemJoinExecuteEvent - when execute command.
Event: ItemJoinGetEvent - when trigger and get command.
setItemJoin(itemStack) - replace this item to ItemJoin's item.

Your welcome~~ :)

commented

Can you explain a little more on the setItemJoin(itemstack)?
I don't quite get what you are asking. Are you wanting ItemJoin to overwrite the itemStack with the closest custom item it can find of the same material?

Also for the slot method, custom slots such as Crafting, Armor, and Offhand do not have integer values when being set so instead I will tell the slot method to return as a String and you can check if it is an integer value or is a custom slot.

EDIT: In the meantime I have added the requested features excluding the setItemJoin(itemStack) until I hear back from you.

You can test it here; http://ci.craftationgaming.com/job/ItemJoin/354/
Methods; https://github.com/RockinChaos/ItemJoin/blob/master/src/me/RockinChaos/itemjoin/api/ItemJoinAPI.java

commented

Happy new year!
ItemJoin has the API I want, thank you~~

I think "replace this item to ItemJoin's item." may not very good.
New a custom item will be better because we can add in another event or drop it on the grown.
For example,
image

commented

Wow, sorry for the late update to this I am getting really bad at my job lol.
Happy b-lated New Year!

I have added what you requested but I had to make some amendments to it as it didn't fit the scope of how ItemJoin handles items. Items are always specific for each player since some have player skins and specific placeholder values for that player so ItemJoin uses a system to search for the player and give that specific ItemStack for the player.

In the method it takes the input of the player you are searching for and the itemNode then returns the ItemStack.

The Method added;

	/**
	* Fetches the ItemStack defined for the provided itemNode.
	* 
	* @param itemNode that is the custom items config node.
	*/
	public ItemStack getItemStack(Player player, String itemNode) {
		return this.apiUtils.getItemStack(player, itemNode);
	}

Snapshot; http://ci.craftationgaming.com/job/ItemJoin/359/

commented

Awesome!
Happy new year ~~ Haha
Thank you very much for taking the time to add an API!

I'm busy with school and server updates recently, sorry for replying to your message late.

commented

This feature request has been officially added in the release of ItemJoin v5.0.6.
You can grab it here; https://www.spigotmc.org/resources/itemjoin.12661/download?version=320427

Please read the changelog as the documentation has not been updated yet;
https://github.com/RockinChaos/ItemJoin/wiki/Recent-Changes