Skip to content

Commit

Permalink
Adds a permission to the twerking.
Browse files Browse the repository at this point in the history
Requires minimum of BentoBox 1.13.0

#18
  • Loading branch information
tastybento committed May 25, 2020
1 parent ad9de41 commit c941faa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/main/java/world/bentobox/twerk/listeners/TreeGrowListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,6 @@ protected void showSparkles(Block b) {
AROUND.stream().map(b::getRelative).map(Block::getLocation).forEach(x -> x.getWorld().playEffect(x, addon.getSettings().getEffectsTwerk(), 0));
}

/*
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onTreePlant(BlockPlaceEvent e) {
if (!e.getBlock().getWorld().getEnvironment().equals(Environment.NORMAL)
|| !addon.getPlugin().getIWM().inWorld(Util.getWorld(e.getBlock().getWorld()))
|| !Tag.SAPLINGS.isTagged(e.getBlock().getType())) {
return;
}
// Add Sapling
addon.getIslands().getIslandAt(e.getBlock().getLocation()).ifPresent(i -> plantedTrees.put(e.getBlock(), i));
}
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onTreeBreak(BlockBreakEvent e) {
plantedTrees.keySet().removeIf(e.getBlock()::equals);
Expand All @@ -181,7 +169,8 @@ public void onTreeGrow(StructureGrowEvent e) {
public void onTwerk(PlayerToggleSneakEvent e) {
if (!e.getPlayer().getWorld().getEnvironment().equals(Environment.NORMAL)
|| !addon.getPlugin().getIWM().inWorld(Util.getWorld(e.getPlayer().getWorld()))
|| e.getPlayer().isFlying()) {
|| e.getPlayer().isFlying()
|| !e.getPlayer().hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(e.getPlayer().getWorld()) + "twerkingfortrees")) {
return;
}
// Get the island
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ name: TwerkingForTrees
main: world.bentobox.twerk.TwerkingForTrees
version: ${version}${build.number}
icon: OAK_SAPLING
api: 1.13

prefix: TwerkingForTrees

authors: [tastybento]

permissions:
'[gamemode].twerkingfortrees':
description: Player can twerk for trees.
default: true

0 comments on commit c941faa

Please sign in to comment.