Prevent Runed Pickaxe passive from remaining too long
This commit is contained in:
parent
222dd64bd0
commit
cf38af5de6
@ -9,6 +9,8 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
@ -46,7 +48,8 @@ public class RunedPickaxe extends RareItem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilServer.getPlayersCollection().forEach(player -> {
|
UtilServer.getPlayersCollection().forEach(player ->
|
||||||
|
{
|
||||||
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player);
|
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player);
|
||||||
|
|
||||||
if (!(gear.getWeapon() instanceof RunedPickaxe))
|
if (!(gear.getWeapon() instanceof RunedPickaxe))
|
||||||
@ -61,8 +64,7 @@ public class RunedPickaxe extends RareItem
|
|||||||
UtilTextBottom.displayProgress("Instant mine", (((double) (((double) System.currentTimeMillis()) - ((double) pick._instamineEnabled))) / 12000D), null, true, player);
|
UtilTextBottom.displayProgress("Instant mine", (((double) (((double) System.currentTimeMillis()) - ((double) pick._instamineEnabled))) / 12000D), null, true, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pick._enabled
|
if (pick._enabled && (System.currentTimeMillis() - pick._instamineEnabled) >= 12000)
|
||||||
&& (System.currentTimeMillis() - pick._instamineEnabled) >= 12000)
|
|
||||||
{
|
{
|
||||||
Recharge.Instance.use(player, "Instant Mine", 15 * 1000, true, true);
|
Recharge.Instance.use(player, "Instant Mine", 15 * 1000, true, true);
|
||||||
|
|
||||||
@ -76,6 +78,19 @@ public class RunedPickaxe extends RareItem
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSwap(PlayerItemHeldEvent event)
|
||||||
|
{
|
||||||
|
if (event.getPlayer().hasPotionEffect(PotionEffectType.FAST_DIGGING))
|
||||||
|
{
|
||||||
|
ItemStack previous = event.getPlayer().getInventory().getItem(event.getPreviousSlot());
|
||||||
|
if (previous != null && previous.getType() == Material.RECORD_7)
|
||||||
|
{
|
||||||
|
event.getPlayer().removePotionEffect(PotionEffectType.FAST_DIGGING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void blockDamage(BlockDamageEvent event)
|
public void blockDamage(BlockDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -149,7 +164,8 @@ public class RunedPickaxe extends RareItem
|
|||||||
|
|
||||||
public RunedPickaxe()
|
public RunedPickaxe()
|
||||||
{
|
{
|
||||||
super("Runed Pickaxe", UtilText.splitLinesToArray(new String[] {
|
super("Runed Pickaxe", UtilText.splitLinesToArray(new String[]
|
||||||
|
{
|
||||||
"What an interesting design this pickaxe seems to have!",
|
"What an interesting design this pickaxe seems to have!",
|
||||||
C.cYellow + "Right-Click" + C.cWhite + " to use " + F.elem("Instant mine") + "."
|
C.cYellow + "Right-Click" + C.cWhite + " to use " + F.elem("Instant mine") + "."
|
||||||
}, LineFormat.LORE), Material.RECORD_7);
|
}, LineFormat.LORE), Material.RECORD_7);
|
||||||
|
Loading…
Reference in New Issue
Block a user