mirror of
https://github.com/plexusorg/Module-TFMExtras.git
synced 2026-06-04 07:36:54 +00:00
Update dependencies and Gradle, along with small cleanup
This commit is contained in:
@@ -153,7 +153,7 @@ public class TFMExtras extends PlexModule
|
||||
|
||||
private Set<Class<?>> getClassesFrom(String packageName)
|
||||
{
|
||||
Set<Class<?>> classes = new HashSet();
|
||||
Set<Class<?>> classes = new HashSet<>();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -70,12 +70,9 @@ public class CartSitCommand extends PlexCommand
|
||||
{
|
||||
return CompletableFuture.supplyAsync(() ->
|
||||
{
|
||||
Entity nearest = entities.get(0);
|
||||
for (int i = 0; i < entities.size(); i++)
|
||||
{
|
||||
Entity e = entities.get(i);
|
||||
if (player.getLocation().distance(e.getLocation()) < player.getLocation().distance(nearest.getLocation()))
|
||||
{
|
||||
Entity nearest = entities.getFirst();
|
||||
for (Entity e : entities) {
|
||||
if (player.getLocation().distance(e.getLocation()) < player.getLocation().distance(nearest.getLocation())) {
|
||||
nearest = e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import dev.plex.command.annotation.CommandParameters;
|
||||
import dev.plex.command.annotation.CommandPermissions;
|
||||
import dev.plex.command.source.RequiredCommandSource;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -79,7 +81,7 @@ public class EnchantCommand extends PlexCommand
|
||||
return messageComponent("enchantSpecify");
|
||||
}
|
||||
|
||||
Enchantment enchantmentToRemove = Registry.ENCHANTMENT.get(NamespacedKey.minecraft(args[1].toLowerCase()));
|
||||
Enchantment enchantmentToRemove = RegistryAccess.registryAccess().getRegistry(RegistryKey.ENCHANTMENT).get(NamespacedKey.minecraft(args[1].toLowerCase()));
|
||||
if (enchantmentToRemove == null || !item.containsEnchantment(enchantmentToRemove))
|
||||
{
|
||||
return messageComponent("enchantInvalid");
|
||||
@@ -108,7 +110,7 @@ public class EnchantCommand extends PlexCommand
|
||||
private List<Enchantment> getEnchantments(ItemStack item)
|
||||
{
|
||||
List<Enchantment> enchants = Lists.newArrayList();
|
||||
Arrays.stream(Enchantment.values()).filter(enchantment -> enchantment.canEnchantItem(item)).forEach(enchants::add);
|
||||
RegistryAccess.registryAccess().getRegistry(RegistryKey.ENCHANTMENT).stream().filter(enchantment -> enchantment.canEnchantItem(item)).forEach(enchants::add);
|
||||
return enchants;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package dev.plex.extras.listener;
|
||||
|
||||
import dev.plex.extras.TFMExtras;
|
||||
import dev.plex.listener.PlexListener;
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
@@ -74,7 +76,7 @@ public class ClownfishListener extends PlexListener
|
||||
{
|
||||
target.setFlying(false);
|
||||
|
||||
for (Sound sound : Sound.values())
|
||||
for (Sound sound : RegistryAccess.registryAccess().getRegistry(RegistryKey.SOUND_EVENT))
|
||||
{
|
||||
if (sound.toString().contains("HIT"))
|
||||
{
|
||||
@@ -91,7 +93,7 @@ public class ClownfishListener extends PlexListener
|
||||
|
||||
if (!pushedPlayers.isEmpty())
|
||||
{
|
||||
for (Sound sound : Sound.values())
|
||||
for (Sound sound : RegistryAccess.registryAccess().getRegistry(RegistryKey.SOUND_EVENT))
|
||||
{
|
||||
if (sound.toString().contains("HIT"))
|
||||
{
|
||||
|
||||
@@ -6,7 +6,6 @@ import dev.plex.extras.island.info.IslandPermissions;
|
||||
import dev.plex.listener.PlexListener;
|
||||
import dev.plex.util.PlexUtils;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
@@ -103,7 +102,6 @@ public class WorldListener extends PlexListener
|
||||
{
|
||||
event.getPlayer().sendMessage(PlexUtils.messageComponent("cantVisitIsland"));
|
||||
event.getPlayer().teleportAsync(event.getFrom().getSpawnLocation());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user