Skip to content

Commit

Permalink
dst
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Oct 4, 2024
1 parent edc8740 commit e88516b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import me.qscbm.slimefun4.utils.VersionEventsUtils;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
Expand Down Expand Up @@ -40,6 +39,7 @@ public StomperBoots(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci
* @param fallDamageEvent
* The {@link EntityDamageEvent} in which the {@link Player} has taken fall damage
*/
@SuppressWarnings("removal")
public void stomp(EntityDamageEvent fallDamageEvent) {
Player player = (Player) fallDamageEvent.getEntity();
SoundEffect.STOMPER_BOOTS_STOMP_SOUND.playFor(player);
Expand All @@ -56,8 +56,8 @@ public void stomp(EntityDamageEvent fallDamageEvent) {
|| (player.getWorld().getPVP()
&& Slimefun.getProtectionManager()
.hasPermission(player, entity.getLocation(), Interaction.ATTACK_PLAYER))) {
EntityDamageByEntityEvent event = VersionEventsUtils.newEntityDamageByEntityEvent(
player, entity, DamageCause.ENTITY_ATTACK,"PLAYER_ATTACK",fallDamageEvent.getDamage() / 2);
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(
player, entity, DamageCause.ENTITY_ATTACK,fallDamageEvent.getDamage() / 2);
Bukkit.getPluginManager().callEvent(event);

if (!event.isCancelled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import java.util.Collection;

import me.qscbm.slimefun4.utils.VersionEventsUtils;
import org.bukkit.Bukkit;
import org.bukkit.SoundCategory;
import org.bukkit.entity.ArmorStand;
Expand Down Expand Up @@ -39,6 +38,7 @@ public ExplosiveBow(ItemGroup itemGroup, SlimefunItemStack item, ItemStack[] rec
addItemSetting(range);
}

@SuppressWarnings("removal")
@Override
public BowShootHandler onShoot() {
return (e, target) -> {
Expand All @@ -60,8 +60,8 @@ public BowShootHandler onShoot() {
double damage = e.getDamage() * (1 - (distanceSquared / (2 * range.getValue() * range.getValue())));

if (!entity.getUniqueId().equals(target.getUniqueId())) {
EntityDamageByEntityEvent event = VersionEventsUtils.newEntityDamageByEntityEvent(
e.getDamager(), entity, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, "EXPLOSION", damage);
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(
e.getDamager(), entity, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damage);
Bukkit.getPluginManager().callEvent(event);

if (!event.isCancelled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.Set;
import java.util.UUID;

import me.qscbm.slimefun4.utils.VersionEventsUtils;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
Expand Down Expand Up @@ -110,11 +109,12 @@ private boolean canReach(Location playerLocation, Location entityLocation, Locat

}

@SuppressWarnings("removal")
private void pushEntity(Player p, Entity entity) {
// Only damage players when PVP is enabled, other entities are fine.
if (entity.getType() != EntityType.PLAYER || p.getWorld().getPVP()) {
EntityDamageByEntityEvent event = VersionEventsUtils.newEntityDamageByEntityEvent(
p, entity, DamageCause.ENTITY_ATTACK, "PLAYER_ATTACK", DAMAGE);
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(
p, entity, DamageCause.ENTITY_ATTACK, DAMAGE);
Bukkit.getPluginManager().callEvent(event);

// Fixes #2207 - Only apply Vector if the Player is able to damage the entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private DamageType getDamageType(String key) {
}
}

@SuppressWarnings("deprecation")
@Override
public EntityDamageByEntityEvent newEntityDamageByEntityEvent(Entity damager, Entity damagee, EntityDamageEvent.DamageCause cause, String damageType, double damage) {
return new EntityDamageByEntityEvent(damager, damagee, cause, newDamageSource(damageType, damager), damage);
Expand Down

0 comments on commit e88516b

Please sign in to comment.