mirror of
https://github.com/kaboomserver/extras.git
synced 2025-07-23 05:53:45 +00:00
refactor: fix most deprecation warnings
This commit is contained in:
parent
1e706a44eb
commit
c915594d7e
6 changed files with 15 additions and 9 deletions
|
@ -33,10 +33,10 @@ public final class CommandBroadcastVanilla implements CommandExecutor {
|
|||
final Component senderName = sender.name();
|
||||
final String input = String.join(" ", args);
|
||||
final Component component = LEGACY_COMPONENT_SERIALIZER.deserialize(input);
|
||||
final Component broadcastComponent = Component.translatable("chat.type.admin")
|
||||
final Component broadcastComponent =
|
||||
Component.translatable("chat.type.admin", senderName, component)
|
||||
.decorate(TextDecoration.ITALIC)
|
||||
.color(NamedTextColor.GRAY)
|
||||
.args(senderName, component);
|
||||
.color(NamedTextColor.GRAY);
|
||||
|
||||
sender.sendMessage(component);
|
||||
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package pw.kaboom.extras.commands;
|
||||
|
||||
import io.papermc.paper.registry.RegistryAccess;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
@ -30,7 +34,9 @@ public final class CommandEnchantAll implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
final Registry<@NotNull Enchantment> registry = RegistryAccess.registryAccess()
|
||||
.getRegistry(RegistryKey.ENCHANTMENT);
|
||||
for (Enchantment enchantment : registry) {
|
||||
item.addUnsafeEnchantment(enchantment, Short.MAX_VALUE);
|
||||
}
|
||||
player.sendMessage(Component
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class CommandPing implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
final int ping = target.spigot().getPing();
|
||||
final int ping = target.getPing();
|
||||
final int d = (int) Math.floor((float) ping / 100);
|
||||
NamedTextColor highlighting = NamedTextColor.WHITE;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public final class PlayerConnection implements Listener {
|
|||
@EventHandler
|
||||
void onPlayerSpawn(final PlayerSpawnLocationEvent event) {
|
||||
if (RANDOMIZE_SPAWN
|
||||
&& event.getPlayer().getBedSpawnLocation() != event.getSpawnLocation()) {
|
||||
&& event.getPlayer().getRespawnLocation() != event.getSpawnLocation()) {
|
||||
final World world = event.getPlayer().getWorld();
|
||||
final ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ public final class PlayerDamage implements Listener {
|
|||
|
||||
player.setHealth(20);
|
||||
|
||||
if (player.getBedSpawnLocation() != null) {
|
||||
player.teleportAsync(player.getBedSpawnLocation());
|
||||
if (player.getRespawnLocation() != null) {
|
||||
player.teleportAsync(player.getRespawnLocation());
|
||||
} else {
|
||||
final World world = Bukkit.getWorld("world");
|
||||
player.teleportAsync(world.getSpawnLocation());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
name: Extras
|
||||
main: pw.kaboom.extras.Main
|
||||
description: Plugin that adds extra functionality to the server.
|
||||
api-version: '1.19'
|
||||
api-version: '1.21'
|
||||
version: master
|
||||
|
||||
commands:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue