diff --git a/bukkit/build.gradle b/bukkit/build.gradle index 02839409..093a67d2 100644 --- a/bukkit/build.gradle +++ b/bukkit/build.gradle @@ -5,7 +5,6 @@ dependencies { implementation 'net.william278:mpdbdataconverter:1.0.1' implementation 'net.william278:hsldataconverter:1.0' implementation 'net.william278:mapdataapi:1.0.3' - implementation 'net.william278:andjam:1.0.2' implementation 'org.bstats:bstats-bukkit:3.0.2' implementation 'net.kyori:adventure-platform-bukkit:4.3.3' implementation 'dev.triumphteam:triumph-gui:3.1.10' @@ -46,7 +45,6 @@ shadowJar { relocate 'net.william278.desertwell', 'net.william278.husksync.libraries.desertwell' relocate 'net.william278.paginedown', 'net.william278.husksync.libraries.paginedown' relocate 'net.william278.mapdataapi', 'net.william278.husksync.libraries.mapdataapi' - relocate 'net.william278.andjam', 'net.william278.husksync.libraries.andjam' relocate 'net.william278.mpdbconverter', 'net.william278.husksync.libraries.mpdbconverter' relocate 'net.william278.hslmigrator', 'net.william278.husksync.libraries.hslconverter' relocate 'org.json', 'net.william278.husksync.libraries.json' diff --git a/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java b/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java index 6b53cd31..695c70c5 100644 --- a/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java +++ b/bukkit/src/main/java/net/william278/husksync/data/BukkitData.java @@ -33,11 +33,7 @@ import net.william278.husksync.HuskSync; import net.william278.husksync.adapter.Adaptable; import net.william278.husksync.config.Settings.SynchronizationSettings.AttributeSettings; import net.william278.husksync.user.BukkitUser; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.Registry; -import org.bukkit.Statistic; -import org.bukkit.NamespacedKey; +import org.bukkit.*; import org.bukkit.advancement.AdvancementProgress; import org.bukkit.attribute.AttributeInstance; import org.bukkit.attribute.AttributeModifier; diff --git a/bukkit/src/main/java/net/william278/husksync/user/BukkitUser.java b/bukkit/src/main/java/net/william278/husksync/user/BukkitUser.java index 3be35d81..47130b07 100644 --- a/bukkit/src/main/java/net/william278/husksync/user/BukkitUser.java +++ b/bukkit/src/main/java/net/william278/husksync/user/BukkitUser.java @@ -23,14 +23,10 @@ import de.themoep.minedown.adventure.MineDown; import dev.triumphteam.gui.builder.gui.StorageBuilder; import dev.triumphteam.gui.guis.Gui; import dev.triumphteam.gui.guis.StorageGui; -import net.roxeez.advancement.display.FrameType; -import net.william278.andjam.Toast; -import net.william278.husksync.BukkitHuskSync; import net.william278.husksync.HuskSync; import net.william278.husksync.data.BukkitData; import net.william278.husksync.data.BukkitUserDataHolder; import net.william278.husksync.data.Data; -import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.ApiStatus; @@ -40,8 +36,6 @@ import java.util.Arrays; import java.util.function.Consumer; import java.util.logging.Level; -import static net.william278.husksync.util.BukkitKeyedAdapter.matchMaterial; - /** * Bukkit platform implementation of an {@link OnlineUser} */ @@ -68,20 +62,12 @@ public class BukkitUser extends OnlineUser implements BukkitUserDataHolder { } @Override + @Deprecated(since = "3.6.7") public void sendToast(@NotNull MineDown title, @NotNull MineDown description, @NotNull String iconMaterial, @NotNull String backgroundType) { - try { - final Material material = matchMaterial(iconMaterial); - Toast.builder((BukkitHuskSync) plugin) - .setTitle(title.toComponent()) - .setDescription(description.toComponent()) - .setIcon(material != null ? material : Material.BARRIER) - .setFrameType(FrameType.valueOf(backgroundType)) - .build() - .show(player); - } catch (Throwable e) { - plugin.log(Level.WARNING, "Failed to send toast to player " + player.getName(), e); - } + plugin.log(Level.WARNING, "Toast notifications are deprecated. " + + "Please change your notification display slot to CHAT, ACTION_BAR or NONE."); + this.sendActionBar(title); } @Override diff --git a/common/src/main/java/net/william278/husksync/config/Locales.java b/common/src/main/java/net/william278/husksync/config/Locales.java index 9babe821..6c7e5002 100644 --- a/common/src/main/java/net/william278/husksync/config/Locales.java +++ b/common/src/main/java/net/william278/husksync/config/Locales.java @@ -193,14 +193,20 @@ public class Locales { * Displays the notification in the action bar */ ACTION_BAR, + /** * Displays the notification in the chat */ CHAT, + /** * Displays the notification in an Advancement Toast + * + * @deprecated No longer supported */ + @Deprecated(since = "3.6.7") TOAST, + /** * Does not display the notification */ diff --git a/common/src/main/java/net/william278/husksync/config/Settings.java b/common/src/main/java/net/william278/husksync/config/Settings.java index fdecb893..e087ffd0 100644 --- a/common/src/main/java/net/william278/husksync/config/Settings.java +++ b/common/src/main/java/net/william278/husksync/config/Settings.java @@ -250,7 +250,7 @@ public class Settings { @Comment("Whether to use the snappy data compression algorithm. Keep on unless you know what you're doing") private boolean compressData = true; - @Comment("Where to display sync notifications (ACTION_BAR, CHAT, TOAST or NONE)") + @Comment("Where to display sync notifications (ACTION_BAR, CHAT or NONE)") private Locales.NotificationSlot notificationDisplaySlot = Locales.NotificationSlot.ACTION_BAR; @Comment("Persist maps locked in a Cartography Table to let them be viewed on any server") diff --git a/common/src/main/java/net/william278/husksync/user/OnlineUser.java b/common/src/main/java/net/william278/husksync/user/OnlineUser.java index 9b7b9d52..c64a4881 100644 --- a/common/src/main/java/net/william278/husksync/user/OnlineUser.java +++ b/common/src/main/java/net/william278/husksync/user/OnlineUser.java @@ -89,7 +89,9 @@ public abstract class OnlineUser extends User implements CommandUser, UserDataHo * @param description the description of the toast * @param iconMaterial the namespace-keyed material to use as an hasIcon of the toast * @param backgroundType the background ("ToastType") of the toast + * @deprecated No longer supported */ + @Deprecated(since = "3.6.7") public abstract void sendToast(@NotNull MineDown title, @NotNull MineDown description, @NotNull String iconMaterial, @NotNull String backgroundType); @@ -145,12 +147,6 @@ public abstract class OnlineUser extends User implements CommandUser, UserDataHo switch (plugin.getSettings().getSynchronization().getNotificationDisplaySlot()) { case CHAT -> cause.getCompletedLocale(plugin).ifPresent(this::sendMessage); case ACTION_BAR -> cause.getCompletedLocale(plugin).ifPresent(this::sendActionBar); - case TOAST -> cause.getCompletedLocale(plugin) - .ifPresent(locale -> this.sendToast( - locale, new MineDown(""), - "minecraft:bell", - "TASK" - )); } plugin.fireEvent( plugin.getSyncCompleteEvent(this), diff --git a/docs/Config-File.md b/docs/Config-File.md index 41f1d879..1b79a1d1 100644 --- a/docs/Config-File.md +++ b/docs/Config-File.md @@ -109,7 +109,7 @@ synchronization: sync_dead_players_changing_server: true # Whether to use the snappy data compression algorithm. Keep on unless you know what you're doing compress_data: true - # Where to display sync notifications (ACTION_BAR, CHAT, TOAST or NONE) + # Where to display sync notifications (ACTION_BAR, CHAT or NONE) notification_display_slot: ACTION_BAR # Persist maps locked in a Cartography Table to let them be viewed on any server persist_locked_maps: true diff --git a/fabric/src/main/java/net/william278/husksync/listener/FabricEventListener.java b/fabric/src/main/java/net/william278/husksync/listener/FabricEventListener.java index 95894e37..19bff5c5 100644 --- a/fabric/src/main/java/net/william278/husksync/listener/FabricEventListener.java +++ b/fabric/src/main/java/net/william278/husksync/listener/FabricEventListener.java @@ -54,8 +54,6 @@ import net.william278.husksync.user.OnlineUser; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.stream.Collectors; - public class FabricEventListener extends EventListener implements LockedHandler { public FabricEventListener(@NotNull HuskSync plugin) { diff --git a/fabric/src/main/java/net/william278/husksync/mixins/ServerPlayerEntityMixin.java b/fabric/src/main/java/net/william278/husksync/mixins/ServerPlayerEntityMixin.java index ed44b890..c7429f5d 100644 --- a/fabric/src/main/java/net/william278/husksync/mixins/ServerPlayerEntityMixin.java +++ b/fabric/src/main/java/net/william278/husksync/mixins/ServerPlayerEntityMixin.java @@ -21,7 +21,6 @@ package net.william278.husksync.mixins; import net.minecraft.entity.ItemEntity; import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.ActionResult; import net.william278.husksync.event.ItemDropCallback; diff --git a/fabric/src/main/java/net/william278/husksync/user/FabricUser.java b/fabric/src/main/java/net/william278/husksync/user/FabricUser.java index ecb644e6..348e2564 100644 --- a/fabric/src/main/java/net/william278/husksync/user/FabricUser.java +++ b/fabric/src/main/java/net/william278/husksync/user/FabricUser.java @@ -40,6 +40,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import java.util.function.Consumer; +import java.util.logging.Level; public class FabricUser extends OnlineUser implements FabricUserDataHolder { @@ -70,9 +71,12 @@ public class FabricUser extends OnlineUser implements FabricUserDataHolder { } @Override + @Deprecated(since = "3.6.7") public void sendToast(@NotNull MineDown title, @NotNull MineDown description, @NotNull String iconMaterial, @NotNull String backgroundType) { - getAudience().sendActionBar(title.toComponent()); // Toasts unimplemented for now + plugin.log(Level.WARNING, "Toast notifications are deprecated. " + + "Please change your notification display slot to CHAT, ACTION_BAR or NONE."); + this.sendActionBar(title); } @Override diff --git a/paper/build.gradle b/paper/build.gradle index 4aaf94fb..66495ed9 100644 --- a/paper/build.gradle +++ b/paper/build.gradle @@ -34,7 +34,6 @@ shadowJar { relocate 'net.william278.desertwell', 'net.william278.husksync.libraries.desertwell' relocate 'net.william278.paginedown', 'net.william278.husksync.libraries.paginedown' relocate 'net.william278.mapdataapi', 'net.william278.husksync.libraries.mapdataapi' - relocate 'net.william278.andjam', 'net.william278.husksync.libraries.andjam' relocate 'net.william278.mpdbconverter', 'net.william278.husksync.libraries.mpdbconverter' relocate 'net.william278.hslmigrator', 'net.william278.husksync.libraries.hslconverter' relocate 'org.json', 'net.william278.husksync.libraries.json'