9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-28 11:09:11 +00:00

Fix notifications through Toast AndJam library

This commit is contained in:
William
2022-11-17 02:34:52 +00:00
parent 6fef9c4eae
commit d682e6e6c6
4 changed files with 24 additions and 28 deletions

View File

@@ -536,7 +536,7 @@ public class BukkitPlayer extends OnlineUser {
}
}, () -> BukkitHuskSync.getInstance().getLoggingAdapter().log(Level.WARNING,
"Could not set " + player.getName() + "'s persistent data key " + keyString +
" as it has an invalid type. Skipping!"));
" as it has an invalid type. Skipping!"));
}
});
}).exceptionally(throwable -> {
@@ -633,14 +633,18 @@ public class BukkitPlayer extends OnlineUser {
@Override
public void sendToast(@NotNull MineDown title, @NotNull MineDown description,
@NotNull String iconMaterial, @NotNull String backgroundType) {
final Material material = Material.matchMaterial(iconMaterial);
Toast.builder(BukkitHuskSync.getInstance())
.setTitle(title.toComponent())
.setDescription(description.toComponent())
.setIcon(material != null ? material : Material.BARRIER)
.setFrameType(FrameType.valueOf(backgroundType))
.build()
.show(player);
try {
final Material material = Material.matchMaterial(iconMaterial);
Toast.builder(BukkitHuskSync.getInstance())
.setTitle(title.toComponent())
.setDescription(description.toComponent())
.setIcon(material != null ? material : Material.BARRIER)
.setFrameType(FrameType.valueOf(backgroundType))
.build()
.show(player);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override