Download Quill Notifications — Minecraft Mods — MetaMods

Quill Notifications

Active

Downloads

0

Last update

3 months ago

Versions

1.16.5 — 1.21.5
Server
Fabric
Quilt
Libraries
Social
Technological

Quill Notifications

Quill Notifications is a compact Minecraft library that provides a stylish and efficient notification system for players. The mod allows sending messages to both active and inactive users, ensuring delivery even during their temporary absence from the game.

Installation and Requirements

For proper mod operation, you need to install Fabric API and SQLib. Although using Adventure API is not mandatory, it is strongly recommended for developers to extend functionality.

After installing the mod on the server, a configuration file is automatically created upon first launch. You will need to configure it by specifying the file path or MySQL database connection parameters.

For Developers

Getting Started

To connect the library to your project, add the following dependencies:

repositories {
    maven { url "https://api.modrinth.com/maven" }
    // Adventure API is not mandatory but allows using component messages
    maven {
        name = "sonatype-oss-snapshots1"
        url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
        mavenContent { snapshotsOnly() }
    }
}

dependencies {
    modImplementation("maven.modrinth:quill:1.2.3")
    // Adventure API is not mandatory but useful and allows using component messages
    modImplementation include("net.kyori:adventure-platform-fabric:6.4.0")
}

Basic Usage

Notification notification = NotificationBuilder.Notification(receiverUUID) // Initialize a new notification
    .setMessage(message) // setMessage() accepts String, MutableText, or Component variables (only the last set message is saved)
    .setStyle(Scribe.INFO) // setStyle() works only for string messages
    .setMetadata(jsonData) // adding JSON data for use with the event system
    .setSound(SoundEvents.BLOCK_BELL_USE) // setting a sound event when notification is received
    .setCommands(commandString, commandString2) // setting commands to execute when notification is received
    .setCommandDelay(10, TimeUnit.SECONDS) // setting command delay (can also pass a number in milliseconds)
    .setExpiry(15, TimeUnit.MINUTES) // setting notification expiration time (can also pass a number in milliseconds)
    .build();
Pigeon.send(notification); // sending notification to player

for (Notification message: QuillNotifications.getNotifications(receiverUUID)) { // getting all pending notifications for a player (from oldest to newest)
    if (notification.getMessage().toString().equals("Test message plz delete")) message.cancel() // canceling notification before sending to player
}

Event System

// The event system provides a notification object to modify data before sending
QuillEvents.PRE_SEND_NOTIFICATION.register((notification) -> {
  System.out.println(notification.getPlayerEntity().getName().getString());
  // returning true allows message sending, returning false stops
  // returning false stops message display
  return true;
  // Do cool things with metadata or other variables, the event system is your tool.
});
Project members
electrobrine

electrobrine

Developer

Created: 10 Oct 2023

ID: 13161