#Helping GoldenEdit
1 messages · Page 1 of 1 (latest)
Alright
If you replace that effect.getType == with effect.getType().equals(PotionEffectType.HEAL) I bet it'll work
Ill give it a go
@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");
}
}
}
}
}```
nope ):
Its no that?
No to this
Ahh allright
I recommend uuid instead of player Object
yeah
Works for me
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
I know it does
just reloading the server breaks it
yep
sorry for being a dumbass
and thank you!!
happy to help