Repository navigation
[Sell] custom sign from custom plugin is taken over by EssentialsX #6643
|
I have built my own HeadSellSign plugin so that I can sell player_head customized items to the sign (EssentialsX does not recognize custom heads from HeadDatabase). Because I actively use EssentialsX's [Sell] signs elsewhere, I wanted my signs to look exactly the same as EssentialsX ones so that they are all unified. My signs are created in the way that I write [headsell] in the 1st line and quantity in the 2nd line so that the sign creates: [MyLabel] -> 1 ->player_head -> $500 (all 4 lines are utilized exactly as on the EssentialsX's sign). The problem shows up when I set (a configurable in config.yml) MyLabel to <dark_blue>[Sell]</dark_blue> - in such case the EssentialsX plugin takes over my sign and says: "Error: You do not have player_head". When I change MyLabel to e.g. <dark_blue>[SellHead]</dark_blue> the sign works as intended. I would like to know what can I do to force EssentialsX plugin to give up checking MyLabel on the first line of my sign so that <dark_blue>[Sell]</dark_blue> configured will not cause EssentialsX to take over that sign. I have added - sell to the list of unprotected-sign-names list, but this did not do the trick. Many thanks in advance for any help! |
Replies: 1 comment 1 reply
|
EssentialsX doesn't look for You can keep the identical look and tell EssentialsX to leave your signs alone through its API event import net.ess3.api.events.SignInteractEvent;
@EventHandler(ignoreCancelled = true)
public void onEssentialsSign(SignInteractEvent event) {
if (isHeadSellSign(event.getSign().getBlock())) {
event.setCancelled(true); // EssentialsX stops here, no "You do not have ..." error
}
}For One more thing to watch: EssentialsX's listener runs at |
EssentialsX doesn't look for
[Sell]as text you typed, it compares the whole first line with its own success label. InSignPlayerListener.onSignPlayerInteractit loops over the enabled signs and checkscsign.equalsIgnoreCase(sign.getSuccessName(ess)), and the success label for Sell issignFormatSuccess=<dark_blue>[{0}], i.e.§1[Sell]. Your<dark_blue>[Sell]</dark_blue>turns into exactly that string, so to EssentialsX your sign is a Sell sign.[SellHead]works because it no longer matches.You can keep the identical look and tell EssentialsX to leave your signs alone through its API event
net.ess3.api.events.SignInteractEvent, which is fired before the sign does anything and is cancellable: