mirror of
https://github.com/songoda/UltimateTimber.git
synced 2024-11-29 05:16:29 +01:00
Update src/main/java/com/songoda/ultimatetimber/configurations/DefaultConfig.java, src/main/java/com/songoda/ultimatetimber/treefall/EventFilter.java files
This commit is contained in:
parent
bca27ee82e
commit
dcd9b46a5c
@ -20,6 +20,7 @@ public class DefaultConfig {
|
||||
Also they are easier to refer to using an IDE.
|
||||
*/
|
||||
public static final String AXES_ONLY = "Only topple down trees cut down using axes";
|
||||
public static final String SNEAK_ONLY = "Only topple down trees cut down while sneaking";
|
||||
public static final String ACCURATE_AXE_DURABILITY = "Lower durability proportionately to the amount of blocks toppled down";
|
||||
public static final String CREATIVE_DISALLOWED = "Players in creative mode can't topple down trees";
|
||||
public static final String PERMISSIONS_ONLY = "Only allow players with the permission node to topple down trees";
|
||||
@ -38,6 +39,7 @@ public class DefaultConfig {
|
||||
Configuration configuration = plugin.getConfig();
|
||||
|
||||
configuration.addDefault(AXES_ONLY, true);
|
||||
configuration.addDefault(SNEAK_ONLY, true);
|
||||
configuration.addDefault(ACCURATE_AXE_DURABILITY, true);
|
||||
configuration.addDefault(CREATIVE_DISALLOWED, true);
|
||||
configuration.addDefault(PERMISSIONS_ONLY, true);
|
||||
|
@ -42,6 +42,10 @@ public class EventFilter {
|
||||
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.WOODEN_AXE)))
|
||||
return false;
|
||||
|
||||
if (fileConfiguration.getBoolean(DefaultConfig.SNEAK_ONLY) &&
|
||||
!event.getPlayer().isSneaking())
|
||||
return false;
|
||||
|
||||
return !fileConfiguration.getBoolean(DefaultConfig.PERMISSIONS_ONLY) ||
|
||||
event.getPlayer().hasPermission("ultimatetimber.chop");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user