Code:java @EventHandler public void onZoom(PlayerInteractEvent e) { final Player p = e.getPlayer(); if (e.getAction() == Action.LEFT_CLICK_AIR && zoom.containsKey(p)) { zoom.remove(p); p.removePotionEffect(PotionEffectType.SLOW); p.playSound(p.getLocation(), Sound.CLICK, 3, 1); return; } if (p.getItemInHand().getType() == Material.DIAMOND_HOE) { p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 4)); zoom.put(p, p); p.playSound(p.getLocation(), Sound.CLICK, 4, 2); } } So I made a gun plugin and when I left click I can zoom in, and it partially works the zoom works but when I shoot it puts me back in zoom mode? can you help?? Gun code: Code:java public void onInteract(PlayerInteractEvent e) { final Player p = e.getPlayer(); if (e.getAction() == Action.RIGHT_CLICK_AIR) { if (p.getItemInHand().getType() == Material.DIAMOND_HOE) { p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 5, 2)); p.playSound(p.getEyeLocation(), Sound.EXPLODE, 0.6F, 2.0F); p.getWorld().playEffect(p.getEyeLocation().add(p.getLocation().getDirection()), Effect.SMOKE, 4); p.teleport(p.getLocation().add(new Vector(0, 1, -3)));
In your first class, you have the interact event and the zoom.contains event together, this means if the movement isn't equal to left click air, then you will get the slowme
XgXXSnipz Not sure about the error but why are you using a HashMap for the zoomed players ? You could just use a Set, like HashSet, and most importantly do not store the Player object, store their name or their UUID.
XgXXSnipz A cheap way of doing this is by giving them slowness because it the potion effect is high enough it cause rhe players screen to zoom in