Fix deprecation warning (#11)

* Bump dependencies

* Fix deprecation warning

* Fix small issue
This commit is contained in:
Luna 2023-07-07 17:49:32 -03:00 committed by GitHub
parent b665cbd192
commit 8513443147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 27 deletions

View File

@ -15,7 +15,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -33,7 +33,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.3.0</version>
<executions>
<execution>
<id>checkstyle</id>

View File

@ -18,8 +18,6 @@ import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import com.destroystokyo.paper.event.entity.ProjectileCollideEvent;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextDecoration;
@ -72,37 +70,28 @@ public final class WeaponBlobinator implements Listener {
}
}
@EventHandler
private void onProjectileCollide(final ProjectileCollideEvent event) {
if (event.getEntityType() == EntityType.SNOWBALL) {
final Projectile projectile = event.getEntity();
if (Component.text("WeaponBlobinatorBall").equals(projectile.customName())) {
event.setCancelled(true);
}
}
}
@EventHandler
private void onProjectileHit(final ProjectileHitEvent event) {
if (event.getEntityType() == EntityType.SNOWBALL) {
final Block hitBlock = event.getHitBlock();
final Projectile projectile = event.getEntity();
if (hitBlock != null
&& Component.text("WeaponBlobinatorBall").equals(projectile.customName())) {
final int radius = 4;
final World world = projectile.getWorld();
final Material color = Main.getColors().get(
ThreadLocalRandom.current().nextInt(Main.getColors().size()));
if (Component.text("WeaponBlobinatorBall").equals(projectile.customName())) {
if (hitBlock != null) {
final int radius = 4;
final World world = projectile.getWorld();
final Material color = Main.getColors().get(
ThreadLocalRandom.current().nextInt(Main.getColors().size()));
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z++) {
createBlobSplash(world, x, y, z, radius, hitBlock, color);
for (int x = -radius; x < radius; x++) {
for (int y = -radius; y < radius; y++) {
for (int z = -radius; z < radius; z++) {
createBlobSplash(world, x, y, z, radius, hitBlock, color);
}
}
}
}
event.setCancelled(true);
}
}
}

View File

@ -1,12 +1,12 @@
name: Weapons
main: pw.kaboom.weapons.Main
description: Plugin that implements various kinds of weapons.
api-version: 1.13
api-version: '1.20'
version: master
folia-supported: true
commands:
weapons:
aliases: weapon
aliases: [ weapon ]
description: Gives you a weapon
permission: weapons.command