[SPIGOT-4288] Item conversion in legacy plugins (sign vs sign post) Created: 17/Aug/18  Updated: 28/May/24  Resolved: 28/May/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: blablubbabc Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Version: git-Spigot-fe3ab0d-0611294 (MC: 1.13)
Guidelines Read: Yes

 Description   

There might be something wrong with the backwards compatibility regarding the item conversion in legacy plugins: A legacy plugin used the following code to check if the player is holding a sign item in hand.

 

Reproduction code:

@EventHandler(priority = EventPriority.HIGHEST)
void onPlayerInteract(PlayerInteractEvent event) {
	Player player = event.getPlayer();
	player.sendMessage("In hand: " + player.getItemInHand().getType());
	player.sendMessage("Sign: " + Material.SIGN);
	player.sendMessage("Same type?: " + (player.getItemInHand().getType() == Material.SIGN));
}

 

The item in hand will report as 'LEGACY_SIGN_POST', while 'LEGACY_SIGN' would be expected / required for the plugin to continue working.

 

Edit: Not sure how one would 'fix' this.. since SIGN represents both the sign post block and the item now.. One would probably have to differently handle the legacy conversion for ItemStack#getType and Block#getType (if this isn't the case already).



 Comments   
Comment by md_5 [ 17/Aug/18 ]

Yes blocks and items need to be converted separately both ways which is even more of an annoyance.

Generated at Tue Apr 08 01:20:55 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.