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

@ -633,6 +633,7 @@ public class BukkitPlayer extends OnlineUser {
@Override @Override
public void sendToast(@NotNull MineDown title, @NotNull MineDown description, public void sendToast(@NotNull MineDown title, @NotNull MineDown description,
@NotNull String iconMaterial, @NotNull String backgroundType) { @NotNull String iconMaterial, @NotNull String backgroundType) {
try {
final Material material = Material.matchMaterial(iconMaterial); final Material material = Material.matchMaterial(iconMaterial);
Toast.builder(BukkitHuskSync.getInstance()) Toast.builder(BukkitHuskSync.getInstance())
.setTitle(title.toComponent()) .setTitle(title.toComponent())
@ -641,6 +642,9 @@ public class BukkitPlayer extends OnlineUser {
.setFrameType(FrameType.valueOf(backgroundType)) .setFrameType(FrameType.valueOf(backgroundType))
.build() .build()
.show(player); .show(player);
} catch (Exception e) {
e.printStackTrace();
}
} }
@Override @Override

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

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

Loading…
Cancel
Save