mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-15 11:04:29 +02:00
Missing onBlockPlace event for Protection sign
This commit is contained in:
@@ -10,6 +10,7 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
|
|
||||||
|
|
||||||
@@ -82,9 +83,36 @@ public class SignBlockListener extends BlockListener
|
|||||||
for (Signs signs : Signs.values())
|
for (Signs signs : Signs.values())
|
||||||
{
|
{
|
||||||
final EssentialsSign sign = signs.getSign();
|
final EssentialsSign sign = signs.getSign();
|
||||||
if (event.getLine(0).equalsIgnoreCase(sign.getTemplateName()))
|
if (event.getLine(0).equalsIgnoreCase(sign.getTemplateName())
|
||||||
|
&& !sign.onSignCreate(event, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(!sign.onSignCreate(event, ess));
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
|
{
|
||||||
|
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Block block = event.getBlock();
|
||||||
|
if (block.getType() == Material.WALL_SIGN
|
||||||
|
|| block.getType() == Material.SIGN_POST)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Signs signs : Signs.values())
|
||||||
|
{
|
||||||
|
final EssentialsSign sign = signs.getSign();
|
||||||
|
if (sign.getBlocks().contains(block.getType())
|
||||||
|
&& !sign.onBlockPlace(block, event.getPlayer(), ess))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,7 +126,7 @@ public class SignBlockListener extends BlockListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
if ((block.getType() == Material.WALL_SIGN
|
if ((block.getType() == Material.WALL_SIGN
|
||||||
|| block.getType() == Material.SIGN_POST
|
|| block.getType() == Material.SIGN_POST
|
||||||
|| EssentialsSign.checkIfBlockBreaksSigns(block)))
|
|| EssentialsSign.checkIfBlockBreaksSigns(block)))
|
||||||
@@ -109,9 +137,10 @@ public class SignBlockListener extends BlockListener
|
|||||||
for (Signs signs : Signs.values())
|
for (Signs signs : Signs.values())
|
||||||
{
|
{
|
||||||
final EssentialsSign sign = signs.getSign();
|
final EssentialsSign sign = signs.getSign();
|
||||||
if (sign.getBlocks().contains(block.getType()))
|
if (sign.getBlocks().contains(block.getType())
|
||||||
|
&& !sign.onBlockBurn(block, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(!sign.onBlockBurn(block, ess));
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -232,6 +232,48 @@ public class SignProtection extends EssentialsSign
|
|||||||
return protectedBlocks;
|
return protectedBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException
|
||||||
|
{
|
||||||
|
final SignProtectionState state = isBlockProtected(block, player, username);
|
||||||
|
|
||||||
|
if (state == SignProtectionState.OWNER || state == SignProtectionState.NOSIGN)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((state == SignProtectionState.ALLOWED || state == SignProtectionState.NOT_ALLOWED)
|
||||||
|
&& player.isAuthorized("essentials.signs.protection.override"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
player.sendMessage(Util.format("noPlacePermission", block.getType().toString().toLowerCase()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onBlockInteract(final Block block, final User player, final String username, final IEssentials ess) throws SignException
|
||||||
|
{
|
||||||
|
final SignProtectionState state = isBlockProtected(block, player, username);
|
||||||
|
|
||||||
|
if (state == SignProtectionState.OWNER || state == SignProtectionState.NOSIGN || state == SignProtectionState.ALLOWED)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == SignProtectionState.NOT_ALLOWED
|
||||||
|
&& player.isAuthorized("essentials.signs.protection.override"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
player.sendMessage(Util.format("noAccessPermission", block.getType().toString().toLowerCase()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBlockBreak(final Block block, final User player, final String username, final IEssentials ess) throws SignException
|
protected boolean onBlockBreak(final Block block, final User player, final String username, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
|
@@ -74,8 +74,8 @@ foreverAlone = \u00a7cYou have nobody to whom you can reply.
|
|||||||
freedMemory = Freed {0} MB.
|
freedMemory = Freed {0} MB.
|
||||||
gcchunks = chunks,
|
gcchunks = chunks,
|
||||||
gcentities = entities
|
gcentities = entities
|
||||||
gcmax = Maximum memory: {0} MB
|
|
||||||
gcfree = Free memory: {0} MB
|
gcfree = Free memory: {0} MB
|
||||||
|
gcmax = Maximum memory: {0} MB
|
||||||
gctotal = Allocated memory: {0} MB
|
gctotal = Allocated memory: {0} MB
|
||||||
generatingPortal = \u00a77Generating an exit portal.
|
generatingPortal = \u00a77Generating an exit portal.
|
||||||
geoIpUrlEmpty = GeoIP download url is empty.
|
geoIpUrlEmpty = GeoIP download url is empty.
|
||||||
@@ -186,6 +186,7 @@ noMailSendPerm = \u00a7cYou do not have the \u00a7fessentials.mail.send\u00a7c p
|
|||||||
noMotd = \u00a7cThere is no message of the day."
|
noMotd = \u00a7cThere is no message of the day."
|
||||||
noNewMail = \u00a77You have no new mail.
|
noNewMail = \u00a77You have no new mail.
|
||||||
noPendingRequest = You do not have a pending request.
|
noPendingRequest = You do not have a pending request.
|
||||||
|
noPlacePermission = \u00a7cYou do not have permission to place a block near that sign.
|
||||||
noRules = \u00a7cThere are no rules specified yet.
|
noRules = \u00a7cThere are no rules specified yet.
|
||||||
noWarpsDefined = No warps defined
|
noWarpsDefined = No warps defined
|
||||||
none = none
|
none = none
|
||||||
|
@@ -76,8 +76,8 @@ foreverAlone = \u00a7cDu har ingen du kan svare.
|
|||||||
freedMemory = Befriede {0} MB.
|
freedMemory = Befriede {0} MB.
|
||||||
gcchunks = stykker,
|
gcchunks = stykker,
|
||||||
gcentities = enheder
|
gcentities = enheder
|
||||||
gcmax = Maximum memory: {0} MB
|
|
||||||
gcfree = Free memory: {0} MB
|
gcfree = Free memory: {0} MB
|
||||||
|
gcmax = Maximum memory: {0} MB
|
||||||
gctotal = Allocated memory: {0} MB
|
gctotal = Allocated memory: {0} MB
|
||||||
generatingPortal = \u00a77Genererer en udgangs portal.
|
generatingPortal = \u00a77Genererer en udgangs portal.
|
||||||
geoIpUrlEmpty = GeoIP download url er tom.
|
geoIpUrlEmpty = GeoIP download url er tom.
|
||||||
@@ -188,6 +188,7 @@ noMailSendPerm = \u00a7cDu har ikke \u00a7fessentials.mail.send\u00a7c tilladels
|
|||||||
noMotd = \u00a7cDer er ikke nogen besked for dagen."
|
noMotd = \u00a7cDer er ikke nogen besked for dagen."
|
||||||
noNewMail = \u00a77Du har ingen ny post.
|
noNewMail = \u00a77Du har ingen ny post.
|
||||||
noPendingRequest = Du har ikke en ventende anmodning.
|
noPendingRequest = Du har ikke en ventende anmodning.
|
||||||
|
noPlacePermission = \u00a7cYou do not have permission to place a block near that sign.
|
||||||
noRules = \u00a7cDer er ingen regler fastsat endnu.
|
noRules = \u00a7cDer er ingen regler fastsat endnu.
|
||||||
noWarpsDefined = Ingen warps defineret
|
noWarpsDefined = Ingen warps defineret
|
||||||
none = ingen
|
none = ingen
|
||||||
|
@@ -74,8 +74,8 @@ foreverAlone = \u00a7cDu hast niemanden, dem du antworten kannst.
|
|||||||
freedMemory = {0} MB frei gemacht.
|
freedMemory = {0} MB frei gemacht.
|
||||||
gcchunks = Chunks,
|
gcchunks = Chunks,
|
||||||
gcentities = Einheiten
|
gcentities = Einheiten
|
||||||
gcmax = Maximaler Speicher: {0} MB
|
|
||||||
gcfree = Freier Speicher: {0} MB
|
gcfree = Freier Speicher: {0} MB
|
||||||
|
gcmax = Maximaler Speicher: {0} MB
|
||||||
gctotal = Reservierter Speicher: {0} MB
|
gctotal = Reservierter Speicher: {0} MB
|
||||||
generatingPortal = \u00a77Erstelle ein Ausgangsportal.
|
generatingPortal = \u00a77Erstelle ein Ausgangsportal.
|
||||||
geoIpUrlEmpty = GeoIP Download-URL ist leer.
|
geoIpUrlEmpty = GeoIP Download-URL ist leer.
|
||||||
@@ -186,6 +186,7 @@ noMailSendPerm = \u00a7cDu hast die Rechte \u00a7fessentials.mail.send\u00a7c ni
|
|||||||
noMotd = \u00a7cEs existiert keine Willkommensnachricht."
|
noMotd = \u00a7cEs existiert keine Willkommensnachricht."
|
||||||
noNewMail = \u00a77Du hast keine Nachrichten.
|
noNewMail = \u00a77Du hast keine Nachrichten.
|
||||||
noPendingRequest = Du hast keine Teleportierungsanfragen.
|
noPendingRequest = Du hast keine Teleportierungsanfragen.
|
||||||
|
noPlacePermission = \u00a7cDu hast keine Rechte, einen Block in der N\u00e4he des Schildes zu platzieren.
|
||||||
noRules = \u00a7cEs wurden keine Regeln definiert.
|
noRules = \u00a7cEs wurden keine Regeln definiert.
|
||||||
noWarpsDefined = Keine Warp-Punkte erstellt.
|
noWarpsDefined = Keine Warp-Punkte erstellt.
|
||||||
none = keine
|
none = keine
|
||||||
|
@@ -74,8 +74,8 @@ foreverAlone = \u00a7cYou have nobody to whom you can reply.
|
|||||||
freedMemory = Freed {0} MB.
|
freedMemory = Freed {0} MB.
|
||||||
gcchunks = chunks,
|
gcchunks = chunks,
|
||||||
gcentities = entities
|
gcentities = entities
|
||||||
gcmax = Maximum memory: {0} MB
|
|
||||||
gcfree = Free memory: {0} MB
|
gcfree = Free memory: {0} MB
|
||||||
|
gcmax = Maximum memory: {0} MB
|
||||||
gctotal = Allocated memory: {0} MB
|
gctotal = Allocated memory: {0} MB
|
||||||
generatingPortal = \u00a77Generating an exit portal.
|
generatingPortal = \u00a77Generating an exit portal.
|
||||||
geoIpUrlEmpty = GeoIP download url is empty.
|
geoIpUrlEmpty = GeoIP download url is empty.
|
||||||
@@ -186,6 +186,7 @@ noMailSendPerm = \u00a7cYou do not have the \u00a7fessentials.mail.send\u00a7c p
|
|||||||
noMotd = \u00a7cThere is no message of the day."
|
noMotd = \u00a7cThere is no message of the day."
|
||||||
noNewMail = \u00a77You have no new mail.
|
noNewMail = \u00a77You have no new mail.
|
||||||
noPendingRequest = You do not have a pending request.
|
noPendingRequest = You do not have a pending request.
|
||||||
|
noPlacePermission = \u00a7cYou do not have permission to place a block near that sign.
|
||||||
noRules = \u00a7cThere are no rules specified yet.
|
noRules = \u00a7cThere are no rules specified yet.
|
||||||
noWarpsDefined = No warps defined
|
noWarpsDefined = No warps defined
|
||||||
none = none
|
none = none
|
||||||
|
@@ -74,8 +74,8 @@ foreverAlone = \u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre.
|
|||||||
freedMemory = A lib\u00e9r\u00e9 {0} Mo.
|
freedMemory = A lib\u00e9r\u00e9 {0} Mo.
|
||||||
gcchunks = chunks,
|
gcchunks = chunks,
|
||||||
gcentities = entit\u00e9s
|
gcentities = entit\u00e9s
|
||||||
gcmax = M\u00e9moire maximale: {0} Mo
|
|
||||||
gcfree = Free memory: {0} Mo
|
gcfree = Free memory: {0} Mo
|
||||||
|
gcmax = M\u00e9moire maximale: {0} Mo
|
||||||
gctotal = Allocated memory: {0} Mo
|
gctotal = Allocated memory: {0} Mo
|
||||||
generatingPortal = \u00a77G\u00e9n\u00e9ration d''un portail de sortie.
|
generatingPortal = \u00a77G\u00e9n\u00e9ration d''un portail de sortie.
|
||||||
geoIpUrlEmpty = L''url de t\u00e9l\u00e9chargement de GeoIP est vide.
|
geoIpUrlEmpty = L''url de t\u00e9l\u00e9chargement de GeoIP est vide.
|
||||||
@@ -186,6 +186,7 @@ noMailSendPerm = \u00a7cVous n''avez pas la permission \u00a7fessentials.mail.se
|
|||||||
noMotd = \u00a7cIl n''y a pas de message su jour.
|
noMotd = \u00a7cIl n''y a pas de message su jour.
|
||||||
noNewMail = \u00a77Vous n''avez pas de courrier.
|
noNewMail = \u00a77Vous n''avez pas de courrier.
|
||||||
noPendingRequest = Vous n''avez pas de requ\u00eate non lue.
|
noPendingRequest = Vous n''avez pas de requ\u00eate non lue.
|
||||||
|
noPlacePermission = \u00a7cYou do not have permission to place a block near that sign.
|
||||||
noRules = \u00a7cIl n''y a pas encore de r\u00e8gles d\u00e9finies.
|
noRules = \u00a7cIl n''y a pas encore de r\u00e8gles d\u00e9finies.
|
||||||
noWarpsDefined = Aucun warps d\u00e9finis.
|
noWarpsDefined = Aucun warps d\u00e9finis.
|
||||||
none = aucun
|
none = aucun
|
||||||
|
@@ -75,8 +75,8 @@ foreverAlone = \u00a7cJe hebt niemand waarnaar je kan reageren.
|
|||||||
freedMemory = {0} MB gelost.
|
freedMemory = {0} MB gelost.
|
||||||
gcchunks = chunks,
|
gcchunks = chunks,
|
||||||
gcentities = entities
|
gcentities = entities
|
||||||
gcmax = Maximaal geheugen: {0} MB
|
|
||||||
gcfree = Free memory: {0} MB
|
gcfree = Free memory: {0} MB
|
||||||
|
gcmax = Maximaal geheugen: {0} MB
|
||||||
gctotal = Allocated memory: {0} MB
|
gctotal = Allocated memory: {0} MB
|
||||||
generatingPortal = \u00a77Uitgangs portal aan het cre\u00ebren.
|
generatingPortal = \u00a77Uitgangs portal aan het cre\u00ebren.
|
||||||
geoIpUrlEmpty = GeoIP download url is leeg.
|
geoIpUrlEmpty = GeoIP download url is leeg.
|
||||||
@@ -187,6 +187,7 @@ noMailSendPerm = \u00a7cJe hebt de \u00a7fessentials.mail.send\u00a7c toestemmin
|
|||||||
noMotd = \u00a7cEr is geen bericht van de dag."
|
noMotd = \u00a7cEr is geen bericht van de dag."
|
||||||
noNewMail = \u00a77Je hebt geen nieuwe berichten.
|
noNewMail = \u00a77Je hebt geen nieuwe berichten.
|
||||||
noPendingRequest = Je hebt geen aanvragen.
|
noPendingRequest = Je hebt geen aanvragen.
|
||||||
|
noPlacePermission = \u00a7cYou do not have permission to place a block near that sign.
|
||||||
noRules = \u00a7cEr zijn nog geen regels gegeven.
|
noRules = \u00a7cEr zijn nog geen regels gegeven.
|
||||||
noWarpsDefined = Geen warps gedefinieerd
|
noWarpsDefined = Geen warps gedefinieerd
|
||||||
none = geen
|
none = geen
|
||||||
|
Reference in New Issue
Block a user