Fix notifications through Toast AndJam library

feat/data-edit-commands
William 2 years ago
parent 6fef9c4eae
commit d682e6e6c6

@ -4,7 +4,7 @@ dependencies {
implementation 'net.william278:mpdbdataconverter:1.0.1'
implementation 'net.william278:hsldataconverter:1.0'
implementation 'net.william278:MapDataAPI:1.0.2'
implementation 'net.william278:AndJam:1.0'
implementation 'net.william278:AndJam:1.0.2'
implementation 'me.lucko:commodore:2.2'
implementation 'net.kyori:adventure-platform-bukkit:4.1.2'
implementation 'dev.triumphteam:triumph-gui:3.1.3'
@ -13,10 +13,10 @@ dependencies {
compileOnly 'commons-io:commons-io:2.11.0'
compileOnly 'de.themoep:minedown-adventure:1.7.1-SNAPSHOT'
compileOnly 'dev.dejvokep:boosted-yaml:1.3'
compileOnly 'com.github.Roxeez:AdvancementAPI:9b959a88cc'
compileOnly 'com.zaxxer:HikariCP:5.0.1'
compileOnly 'net.william278:DesertWell:1.1'
compileOnly 'net.william278:Annotaml:2.0'
compileOnly 'net.william278:AdvancementAPI:97a9583413'
}
shadowJar {

@ -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

@ -123,17 +123,13 @@ public abstract class EventListener {
private void handleSynchronisationCompletion(@NotNull OnlineUser user, boolean succeeded) {
if (succeeded) {
switch (plugin.getSettings().notificationDisplaySlot) {
case CHAT -> plugin.getLocales().getLocale("synchronisation_complete")
case CHAT -> plugin.getLocales().getLocale("synchronisation_complete")
.ifPresent(user::sendMessage);
case ACTION_BAR -> plugin.getLocales().getLocale("synchronisation_complete")
.ifPresent(user::sendActionBar);
case ACTION_BAR -> plugin.getLocales().getLocale("synchronisation_complete")
.ifPresent(user::sendActionBar);
case TOAST -> {
// todo locale implementation
user.sendToast(new MineDown("Synchronization complete"),
new MineDown("Your data has been synchronized"),
"minecraft:structure_void",
"task");
}
case TOAST -> plugin.getLocales().getLocale("synchronisation_complete")
.ifPresent(locale -> user.sendToast(locale, new MineDown(""),
"minecraft:bell", "TASK"));
}
plugin.getDatabase().ensureUser(user).join();
lockedPlayers.remove(user.uuid);

@ -91,13 +91,9 @@ public class RedisManager {
.ifPresent(user::sendMessage);
case ACTION_BAR -> plugin.getLocales().getLocale("data_update_complete")
.ifPresent(user::sendActionBar);
case TOAST -> {
// todo locale implementation
user.sendToast(new MineDown("Data updated"),
new MineDown("Your data has been updated"),
"minecraft:structure_void",
"task");
}
case TOAST -> plugin.getLocales().getLocale("data_update_complete")
.ifPresent(locale -> user.sendToast(locale, new MineDown(""),
"minecraft:bell", "TASK"));
}
plugin.getEventCannon().fireSyncCompleteEvent(user);
} else {

Loading…
Cancel
Save