mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-11-04 02:57:32 +00:00
Allow other plugins to use the same first line on signs as essentials. Just make sure that the player, who creates the sign does not have essentials.signs.signname.create or essentials.signs.create.signname permission.
This commit is contained in:
parent
858e2a8b89
commit
327c15c5be
1 changed files with 6 additions and 3 deletions
|
@ -33,13 +33,15 @@ public class EssentialsSign
|
||||||
public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess)
|
public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final ISign sign = new EventSign(event);
|
final ISign sign = new EventSign(event);
|
||||||
sign.setLine(0, String.format(FORMAT_FAIL, this.signName));
|
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".create")
|
if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".create")
|
||||||
|| user.isAuthorized("essentials.signs.create." + signName.toLowerCase())))
|
|| user.isAuthorized("essentials.signs.create." + signName.toLowerCase())))
|
||||||
{
|
{
|
||||||
return false;
|
// Return true, so other plugins can use the same sign title, just hope
|
||||||
|
// they won't change it to §1[Signname]
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
sign.setLine(0, String.format(FORMAT_FAIL, this.signName));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final boolean ret = onSignCreate(sign, user, getUsername(user), ess);
|
final boolean ret = onSignCreate(sign, user, getUsername(user), ess);
|
||||||
|
@ -57,7 +59,8 @@ public class EssentialsSign
|
||||||
{
|
{
|
||||||
ess.showError(user, ex, signName);
|
ess.showError(user, ex, signName);
|
||||||
}
|
}
|
||||||
return false;
|
// Return true, so the player sees the wrong sign.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSuccessName()
|
public String getSuccessName()
|
||||||
|
|
Loading…
Reference in a new issue