mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Fixed duplication bug with sticky pistons
This commit is contained in:
parent
87f59cd3eb
commit
f18a9bdcc7
@ -13,6 +13,7 @@ Version 1.3.10-dev
|
|||||||
+ Added Ability API functions
|
+ Added Ability API functions
|
||||||
+ Added 50% & 150% XP boost perks
|
+ Added 50% & 150% XP boost perks
|
||||||
+ Added "lucky" perk for donors
|
+ Added "lucky" perk for donors
|
||||||
|
= Fixed duplication bug with sticky pistons
|
||||||
= Fixed "GenericLabel belonging to mcMMO..." message
|
= Fixed "GenericLabel belonging to mcMMO..." message
|
||||||
= Fixed menu exit button not working
|
= Fixed menu exit button not working
|
||||||
= Fixed Repair enchant downgrade not working
|
= Fixed Repair enchant downgrade not working
|
||||||
|
@ -28,6 +28,7 @@ import com.gmail.nossr50.datatypes.ToolType;
|
|||||||
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||||
|
import com.gmail.nossr50.runnables.StickyPistonTracker;
|
||||||
import com.gmail.nossr50.skills.gathering.Excavation;
|
import com.gmail.nossr50.skills.gathering.Excavation;
|
||||||
import com.gmail.nossr50.skills.gathering.Herbalism;
|
import com.gmail.nossr50.skills.gathering.Herbalism;
|
||||||
import com.gmail.nossr50.skills.gathering.Mining;
|
import com.gmail.nossr50.skills.gathering.Mining;
|
||||||
@ -99,11 +100,9 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
Block block = event.getRetractLocation().getBlock();
|
if (event.isSticky()) {
|
||||||
|
//Needed only because under some circumstances Minecraft doesn't move the block
|
||||||
if (event.isSticky() && mcMMO.placeStore.isTrue(block)) {
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StickyPistonTracker(event), 0);
|
||||||
mcMMO.placeStore.setFalse(block);
|
|
||||||
mcMMO.placeStore.setTrue(event.getBlock().getRelative(event.getDirection()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.gmail.nossr50.runnables;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
|
public class StickyPistonTracker implements Runnable {
|
||||||
|
BlockPistonRetractEvent event;
|
||||||
|
|
||||||
|
public StickyPistonTracker(BlockPistonRetractEvent event) {
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Block originalBlock = event.getRetractLocation().getBlock();
|
||||||
|
|
||||||
|
if (originalBlock.getType() == Material.AIR && mcMMO.placeStore.isTrue(originalBlock)) {
|
||||||
|
Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace());
|
||||||
|
|
||||||
|
mcMMO.placeStore.setFalse(originalBlock);
|
||||||
|
mcMMO.placeStore.setTrue(newBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user