Simple toast notification system for minecraft bukkit
{
"id": "minecraft:stone",
"tag": { "CustomModelData": 1 }
}{
"id": "minecraft:stone",
"components": { "minecraft:custom_model_data": 1 }
}{
"id": "minecraft:stone",
"components": { "minecraft:custom_model_data": { "floats":[1] }
}{
"id": "minecraft:stone",
"components": { "minecraft:custom_model_data": { "strings":["anemys"] }
}// new obj ToastManager
ToastManager toastManager = new ToastManager(yourPlugin);
// to any player
toastManager.showToast(player, "DIAMOND", "FIND THE DIAMONDS!", ToastType.GOAL, 0, true);
// to multiple players
toastManager.showToast(Arrays.asList(player1, player2), "GOLD_INGOT", "HE,! ANY MESSAGE!", ToastType.TASK, 0, false);
// to all players
toastManager.showToastToAll("NETHERITE_BLOCK", "HEY!", ToastType.CHALLENGE, 0, false);
// with builder
toastManager.createToast()
.withIcon("EMERALD")
.withMessage("First line!|Seconds line")
.withStyle(ToastType.GOAL)
.withModelData(1)
.setGlowing(true)
.to(player)
.show();
1.20.4+ Component (Custom model data) support
toastManager.showToastToAll("NETHERITE_BLOCK", "HEY!", ToastType.CHALLENGE, "my_model_name", false);
toastManager.createToast()
.withIcon("PAPER")
.withMessage("&#FF0000t&#E72000e&#D04000x&#B86000t ͹F00wGBF00i;DF00t)FF00h ECD49rB46DgC9A92b ψDB:FFFO")
.withStyle(ToastType.GOAL)
.withModelData("my_model_name")
.setGlowing(false)
.to(player)
.show();
//valueOf types
toastManager.createToast()
.withIcon("PAPER")
.withMessage("&#FF0000t&#E72000e&#D04000x&#B86000t ͹F00wGBF00i;DF00t)FF00h ECD49rB46DgC9A92b ψDB:FFFO")
.withStyle(ToastType.GOAL)
.withModelData(1000, "float") //("string", "float", or ("integer [<1.20.4]"))
.withModelData("my_model_name") //Auto-detect model data type
.setGlowing(false)
.to(player)
.show();
Annotations (Maven)
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>24.1.0</version>
</dependency>

