Dig Speed

Discussion in 'Plugin Development' started by Ultimate_n00b, Apr 18, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Ultimate_n00b

    Is it possible to change dig speed at all?
    I know worldedit can make it instant and such, but how would I do this?
    I am trying to make all blocks that take more than 1 second to break by diamond pickaxe take .5 seconds. Any ideas?
     
  2. Slow digging and fast digging potion effects are as good as it gets.

    Or enchantments.
     
  3. Offline

    chasechocolate

    Haste and Mining Fatigue.

    EDIT: Ninja'd again :(
     
  4. Offline

    Ultimate_n00b

    xD
    Anyway, I suppose they're the way to go. FAST MINING 400 FTW
     
  5. Offline

    Technius

    It's possible to do it without the potion effects... but it's extremely difficult to get right.
     
  6. Offline

    Ultimate_n00b

    Impossible you say? What about this?:

    Code:java
    1.  
    2. @EventHandler
    3. public void addSlowDigging(PlayerInteractEvent event) {
    4. Player p = event.getPlayer();
    5. if (event.getClickedBlock().getType() == Material.DIAMOND.ORE) {
    6. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 300, 1));
    7. }
    8. }
    9. @EventHandler
    10. public void onBlockBreak(BlockBreakEvent event) {
    11. Player player = event.getPlayer();
    12. if (event.getBlock().getType() == Material.DIAMOND_ORE) {
    13. if (player.hasPotionEffect(PotionEffectType.SLOW_DIGGING)) {
    14. player.removePotionEffect(PotionEffectType.SLOW_DIGGING);
    15.  
    16. }
    17. }
    18. }
     
  7. Offline

    Technius

     
    devilquak likes this.
  8. Offline

    Ultimate_n00b

    Lol, I was talking about how you said extremely difficult.
     
  9. Ultimate_n00b
    I belive you don't understand the word "without", it means "not with", therefore he was talking about doing it in any other way would be difficult and potion efects are the easy way.
     
  10. Offline

    Ultimate_n00b

    He was saying it was hard to get right, so I showed him the code I wrote that made it easy.
     
  11. Offline

    unrealdesign

    I think you're beating a dead horse haha
     
    microgeek likes this.
  12. Offline

    nitrousspark

    use the block damage event, i was bored and was looking through the bukkit source code, found that and it said something like event.setInstantBreak()
     
Thread Status:
Not open for further replies.

Share This Page