Skip to content

Commit b20eaff

Browse files
committed
Bug fixes for Netherrack Items and Double Axes
1 parent c7eac63 commit b20eaff

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

dependency-reduced-pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.chrismin13</groupId>
55
<artifactId>VanillaAdditions</artifactId>
6-
<version>1.3.2-SNAPSHOT</version>
6+
<version>1.3.3-SNAPSHOT</version>
77
<build>
88
<plugins>
99
<plugin>
@@ -58,13 +58,13 @@
5858
</goals>
5959
<configuration>
6060
<executable>C:\Users\chris\eclipse-workspace\vanilla-additions/scripts/dev.bat</executable>
61-
<arguments>C:\Users\chris\eclipse-workspace\vanilla-additions\target\VanillaAdditions-1.3.2-SNAPSHOT.jar</arguments>
61+
<arguments>C:\Users\chris\eclipse-workspace\vanilla-additions\target\VanillaAdditions-1.3.3-SNAPSHOT.jar</arguments>
6262
</configuration>
6363
</execution>
6464
</executions>
6565
<configuration>
6666
<executable>C:\Users\chris\eclipse-workspace\vanilla-additions/scripts/dev.bat</executable>
67-
<arguments>C:\Users\chris\eclipse-workspace\vanilla-additions\target\VanillaAdditions-1.3.2-SNAPSHOT.jar</arguments>
67+
<arguments>C:\Users\chris\eclipse-workspace\vanilla-additions\target\VanillaAdditions-1.3.3-SNAPSHOT.jar</arguments>
6868
</configuration>
6969
</plugin>
7070
</plugins>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.chrismin13</groupId>
88
<artifactId>VanillaAdditions</artifactId>
9-
<version>1.3.2-SNAPSHOT</version>
9+
<version>1.3.3-SNAPSHOT</version>
1010
<build>
1111
<plugins>
1212

src/main/java/com/chrismin13/vanillaadditions/listeners/NetherrackItemsListener.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ public void onRightClickBlock(PlayerInteractEvent event) {
6464
}
6565
}
6666

67-
CustomItemBlockIgniteEvent cEvent = new CustomItemBlockIgniteEvent(
68-
new BlockIgniteEvent(blockClicked, IgniteCause.FLINT_AND_STEEL, blockAir), cStack);
67+
BlockIgniteEvent bEvent = new BlockIgniteEvent(blockClicked, IgniteCause.FLINT_AND_STEEL, player, blockAir);
68+
CustomItemBlockIgniteEvent cEvent = new CustomItemBlockIgniteEvent(bEvent, cStack);
69+
Bukkit.getPluginManager().callEvent(bEvent);
6970
Bukkit.getPluginManager().callEvent(cEvent);
70-
if (!cEvent.isCancelled()) {
71+
if (!bEvent.isCancelled() && !cEvent.isCancelled()) {
7172
blockAir.setType(Material.FIRE);
7273
blockAir.setData((byte) 0);
7374
player.playSound(blockAir.getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1F, 1F);

src/main/java/com/chrismin13/vanillaadditions/utils/BlockUtils.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ public static boolean isBlockIgnored(Block block) {
5757
}
5858

5959
public static boolean breakBlock(Block block, CustomItemStack cStack, Player player) {
60+
return breakBlock(block, cStack, player, false);
61+
}
62+
63+
public static boolean breakBlock(Block block, CustomItemStack cStack, Player player, boolean cancelDurability) {
64+
final Integer currentDurability;
65+
if (cancelDurability && cStack.getCustomItem().hasFakeDurability())
66+
currentDurability = cStack.getFakeDurability();
67+
else
68+
currentDurability = null;
69+
6070
addIgnoreBlocks(block);
6171
BlockBreakEvent event = new BlockBreakEvent(block, player);
6272

@@ -88,6 +98,10 @@ public static boolean breakBlock(Block block, CustomItemStack cStack, Player pla
8898
else
8999
block.breakNaturally();
90100
removeIgnoreBlocks(block);
101+
102+
if (currentDurability != null)
103+
cStack.setFakeDurability(currentDurability);
104+
91105
return !event.isCancelled();
92106
}
93107
}

src/main/java/com/chrismin13/vanillaadditions/utils/TreeFeller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public static void popLogs(List<Block> blocks, final World world, Player player,
296296
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
297297
@Override
298298
public void run() {
299-
if (!BlockUtils.breakBlock(currentBlock, cStack, player)) {
299+
if (BlockUtils.breakBlock(currentBlock, cStack, player)) {
300300
TreeFeller.popLeaves(currentBlock, cStack, player);
301301
}
302302
// if (useParticleLIB)
@@ -324,7 +324,7 @@ public static void popLeaves(Block block, final CustomItemStack cStack, Player p
324324
// @SuppressWarnings("deprecation")
325325
@Override
326326
public void run() {
327-
BlockUtils.breakBlock(target, cStack, player);
327+
BlockUtils.breakBlock(target, cStack, player, true);
328328
// if (useParticleLIB)
329329
// ParticleEffect.BLOCK_CRACK.sendData(players,
330330
// (double) target.getX(),

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: VanillaAdditions
2-
version: 1.3.2
2+
version: 1.3.3
33
main: com.chrismin13.vanillaadditions.VanillaAdditions
44
author: chrismin13
55
depend: [ AdditionsAPI ]

0 commit comments

Comments
 (0)