mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-18 14:11:40 +01:00
Split build and use protection
This commit is contained in:
parent
1556801834
commit
e3a470e264
@ -414,6 +414,10 @@ protect:
|
||||
# Set true to disable building for those people
|
||||
build: true
|
||||
|
||||
# Should people with build: false in permissions be allowed to use items
|
||||
# Set true to disable useing for those people
|
||||
use: true
|
||||
|
||||
#Should we tell people they are not allowed to build
|
||||
warn-on-build-disallow: false
|
||||
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.block.Action;
|
||||
|
||||
|
||||
@ -30,7 +31,20 @@ public class EssentialsProtectPlayerListener extends PlayerListener
|
||||
}
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
|
||||
if (prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
|
||||
if (event.hasItem()
|
||||
&& (event.getItem().getType() == Material.WATER_BUCKET
|
||||
|| event.getItem().getType() == Material.LAVA_BUCKET)
|
||||
&& prot.getSettingBool(ProtectConfig.disable_build) && !user.canBuild())
|
||||
{
|
||||
if (ess.getSettings().warnOnBuildDisallow())
|
||||
{
|
||||
user.sendMessage(Util.i18n("buildAlert"));
|
||||
}
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (prot.getSettingBool(ProtectConfig.disable_use) && !user.canBuild())
|
||||
{
|
||||
if (ess.getSettings().warnOnBuildDisallow())
|
||||
{
|
||||
|
@ -10,7 +10,8 @@ public enum ProtectConfig
|
||||
memstore("protect.memstore", false),
|
||||
disable_contactdmg("protect.disable.contactdmg", false),
|
||||
disable_lavadmg("protect.disable.lavadmg", false),
|
||||
disable_build("protect.disable.build", false),
|
||||
disable_build("protect.disable.build", true),
|
||||
disable_use("protect.disable.use", true),
|
||||
disable_pvp("protect.disable.pvp", false),
|
||||
disable_projectiles("protect.disable.projectiles", false),
|
||||
disable_fall("protect.disable.fall", false),
|
||||
|
Loading…
Reference in New Issue
Block a user