#Helping GoldenEdit

1 messages · Page 1 of 1 (latest)

iron iron
#

Golden ask here

coarse sky
#

Alright

iron iron
#

Ask here

#

I will look your code

#

Send full code if you can

vernal sparrow
#

If you replace that effect.getType == with effect.getType().equals(PotionEffectType.HEAL) I bet it'll work

coarse sky
#

Ill give it a go

iron iron
#
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
    public void PotionSplashEvent(PotionSplashEvent e) {
        ThrownPotion potion = (ThrownPotion) e.getEntity();
        Player p = (Player) e.getPotion().getShooter();
        if (p.hasPermission("mcba.playing")) {
            if (potion.getItem().getType() == Material.SPLASH_POTION){
                Collection<PotionEffect> effects = potion.getEffects();
                for (PotionEffect effect : effects) {
                    Bukkit.broadcastMessage(String.valueOf(effect));
                    PotionEffectType potionType = effect.getType();
                    if (potionType == PotionEffectType.HEAL) {
                        int value = (Integer) this.score.get(p);
                        this.score.replace(p, value + 1);
                        Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "MCBA > " + ChatColor.RESET + "" + ChatColor.YELLOW + p.getName() + "'s" + ChatColor.RED + " splashed health pot" + ChatColor.YELLOW + " (" + ChatColor.BOLD + "" + this.score.get(p) + " Points" + ChatColor.RESET + "" + ChatColor.YELLOW + ")");
                    } else{
                        Bukkit.broadcastMessage("bruh");
                    }
                }
            }
        }
    }```
coarse sky
#

nope ):

iron iron
#

Its no that?

iron iron
#

ah ok

#

where this.score comes from?

coarse sky
#

public HashMap<Player, Integer> score = new HashMap();

#

Bad practice, I know

iron iron
#

Ahh allright

iron iron
coarse sky
#

yeah

vernal sparrow
#

Works for me

coarse sky
#

thats so odd

#
public void PotionSplashEvent(PotionSplashEvent e) {
        ThrownPotion potion = (ThrownPotion) e.getEntity();
        Player p = (Player) e.getPotion().getShooter();
        if (p.hasPermission("mcba.playing")) {
            if (potion.getItem().getType() == Material.SPLASH_POTION) {
                Collection<PotionEffect> effects = potion.getEffects();
                for (PotionEffect effect : effects) {
                    Bukkit.broadcastMessage(String.valueOf(effect));
                    PotionEffectType potionType = effect.getType();
                    if (effect.getType().equals(PotionEffectType.HEAL)) {
                        int value = (Integer) this.score.get(p);
                        this.score.replace(p, value + 1);
                        Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "MCBA > " + ChatColor.RESET + "" + ChatColor.YELLOW + p.getName() + "'s" + ChatColor.RED + " splashed health pot" + ChatColor.YELLOW + " (" + ChatColor.BOLD + "" + this.score.get(p) + " Points" + ChatColor.RESET + "" + ChatColor.YELLOW + ")");
                    }else{
                        Bukkit.broadcastMessage("Effect Type: " + potionType);
                    }
                }
            }
        }
    }
#

this is my code currently

#

🤦‍♂️ it works

vernal sparrow
#

I know it does

coarse sky
#

just reloading the server breaks it

#

yep

#

sorry for being a dumbass

#

and thank you!!

vernal sparrow
#

happy to help

iron iron
#

Allright

#

#dump