mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-28 20:17:49 +01:00
Merge branch 'master' of github.com:essentials/Essentials into essmaster
This commit is contained in:
commit
dfd283d998
@ -193,7 +193,12 @@ public class EssentialsSign
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockPush(Block block, IEssentials ess)
|
public boolean onBlockIgnite(final Block block, final IEssentials ess)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onBlockPush(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,24 @@ public class SignBlockListener extends BlockListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protectSignsAndBlocks(event.getBlock(), event.getPlayer()))
|
final Block block = event.getBlock();
|
||||||
|
if (((block.getType() == Material.WALL_SIGN
|
||||||
|
|| block.getType() == Material.SIGN_POST)
|
||||||
|
&& EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block)))
|
||||||
|
|| EssentialsSign.checkIfBlockBreaksSigns(block))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Signs signs : Signs.values())
|
||||||
|
{
|
||||||
|
final EssentialsSign sign = signs.getSign();
|
||||||
|
if (sign.getBlocks().contains(block.getType())
|
||||||
|
&& !sign.onBlockIgnite(block, ess))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,6 +314,14 @@ public class SignProtection extends EssentialsSign
|
|||||||
return state == SignProtectionState.NOSIGN;
|
return state == SignProtectionState.NOSIGN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockIgnite(final Block block, final IEssentials ess)
|
||||||
|
{
|
||||||
|
final SignProtectionState state = isBlockProtected(block, null, null, false);
|
||||||
|
|
||||||
|
return state == SignProtectionState.NOSIGN;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockPush(final Block block, final IEssentials ess)
|
public boolean onBlockPush(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.earth2me.essentials.protect;
|
package com.earth2me.essentials.protect;
|
||||||
|
|
||||||
import com.earth2me.essentials.EssentialsBlockListener;
|
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -21,11 +20,11 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Fireball;
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
@ -47,7 +46,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityDamage(EntityDamageEvent event)
|
public void onEntityDamage(final EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
{
|
{
|
||||||
@ -139,18 +138,21 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (event instanceof EntityDamageByProjectileEvent
|
if (edEvent.getDamager() instanceof Projectile
|
||||||
&& target instanceof Player
|
&& target instanceof Player
|
||||||
&& prot.getSettingBool(ProtectConfig.disable_projectiles)
|
&& ((prot.getSettingBool(ProtectConfig.disable_projectiles)
|
||||||
&& !(user.isAuthorized("essentials.protect.damage.projectiles")
|
&& !(user.isAuthorized("essentials.protect.damage.projectiles")
|
||||||
&& !user.isAuthorized("essentials.protect.damage.disable")))
|
&& !user.isAuthorized("essentials.protect.damage.disable")))
|
||||||
|
|| (((Projectile)edEvent.getDamager()).getShooter() instanceof Player
|
||||||
|
&& prot.getSettingBool(ProtectConfig.disable_pvp)
|
||||||
|
&& (!user.isAuthorized("essentials.protect.pvp")
|
||||||
|
|| !ess.getUser(((Projectile)edEvent.getDamager()).getShooter()).isAuthorized("essentials.protect.pvp")))))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
((EntityDamageByProjectileEvent)event).setBounce(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final DamageCause cause = event.getCause();
|
final DamageCause cause = event.getCause();
|
||||||
if (target instanceof Player)
|
if (target instanceof Player)
|
||||||
@ -201,7 +203,7 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityExplode(EntityExplodeEvent event)
|
public void onEntityExplode(final EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
{
|
{
|
||||||
@ -279,12 +281,6 @@ public class EssentialsProtectEntityListener extends EntityListener
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*if (EssentialsBlockListener.protectedBlocks.contains(block.getType())
|
|
||||||
&& EssentialsBlockListener.isBlockProtected(block))
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user