Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e.setSignLine on PreShopCreationEvent not working somehow #82

Closed
DrOreo002 opened this issue Nov 18, 2017 · 5 comments
Closed

e.setSignLine on PreShopCreationEvent not working somehow #82

DrOreo002 opened this issue Nov 18, 2017 · 5 comments

Comments

@DrOreo002
Copy link

I think the problem is that you didn't update the sign using sign.update :/. I want to try to edit the file but well I don't want to messed things up and I cannot use Github btw xD

@Phoenix616
Copy link
Member

What exactly are you trying to do and at which point is the sign text not changed? When it's applied to the world or in a plugin function somewhere?

Because the signs are changed by using the setSignLine method in the SignChangeEvent so Bukkit is responsible for actually setting the changed lines on the sign in the end.

@DrOreo002
Copy link
Author

I'm trying this code on PreShopCrationEvent..

for (int i = 0; i < 4; i++) {
e.setSignLine((byte) i, "");
}

and it should change the sign's text right?. Btw I'm making a shop limiter addon where it will cancel the event and I want to clear the sign's line when player reached the max limit..

But the problem is.., that code is not working and its not changing the sign's text.

Also I'm not on my pc rn, I'm using my phone to reply, I'll continue this tommorow, thanks

@DrOreo002
Copy link
Author

Btw, I hope I've explained it correctly. I'm not really good at english. Thanks..

@Phoenix616
Copy link
Member

Yeah I think I see what the issue is. When cancelling the event it will not reach the line setting part. Maybe we should move the sign setting before the return when it's cancelled or cancel the SignChangeEvent too when the PreShopCreationEvent is cancelled. Not sure which the better solution is but the way it's now it's not really practical.

@DrOreo002
Copy link
Author

DrOreo002 commented Nov 19, 2017

Okay I can use my pc now. Here's my code (not working tho), I've tried to cancel the event after I changed the sign.

        if (currShop >= limit) {
            player.sendMessage(Main.getPrefix() + "You have reached the max limit of shops creation. Please contact server admin if you need some help.");
            for (int i = 0; i < 4; i++) {
                e.setSignLine((byte) i, "");
            }
            e.setSignLine((byte) 0, "[ Error ]");
            e.setOutcome(PreShopCreationEvent.CreationOutcome.OTHER);
            return;
        }

Can you help me?, If you can't well its okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants