Skip to content

Plugin API

4drian3d edited this page Oct 5, 2021 · 10 revisions

Currently the plugin has 2 events and methods to handle InfractionPlayers.

Events

ChatViolationEvent

@Subscribe
public void onPlayerMessageInfraction(ChatViolationEvent event){
    // --------------------- Getters ---------------------
    // Get the Infractionplayer that was detected in the detection
    InfractionPlayer infractionPlayer = event.getInfractionPlayer();

    // Get the type of infraction of the event
    InfractionType infractionType = event.getType();

    // Get the message that was detected
    String message = event.getMessage();

    // Get the result of the event
    GenericResult result = event.getResult();

    // Get the result of the event
    GenericResult result = event.getResult();
    
    // --------------------- Setters ---------------------
    // Sets the status of the event. Here you can cancel the event
    event.setResult(GenericResult result);
}

CommandViolationEvent

@Subscribe
public void onPlayerCommandInfraction(CommandViolationEvent event){
    // --------------------- Getters ---------------------
    // Get the Infractionplayer that was detected in the detection
    InfractionPlayer infractionPlayer = event.getInfractionPlayer();

    // Get the type of infraction of the event
    InfractionType infractionType = event.getType();

    // Get the command that was detected
    String command = event.getCommand();

    // Get the result of the event
    GenericResult result = event.getResult();

    // Get the result of the event
    GenericResult result = event.getResult();
    
    // --------------------- Setters ---------------------
    // Sets the status of the event. Here you can cancel the event
    event.setResult(GenericResult result);
}

Objects

InfractionPlayer

An InfractionPlayer is an object that stores a player's infringement variables.

Get a InfractionPlayer

// Based on a Player
InfractionPlayer infractionPlayer = InfractionPlayer.get(Player player);

//Based on an UUID
InfractionPlayer infractionPlayer = InfractionPlayer.get(UUID uuid, ProxyServer server);

InfractionPlayer Methods

// -------------------- Getters --------------------
// Get the player's name
String name = infractionPlayer.username();

// Obtain the player's online status
// An InfractionPlayer can be online or offline so that you can use its methods at any time.
boolean online = infractionplayer.isOnline()

// Get the message prior to the player's last message
String preLastMessage = infractionPlayer.preLastMessage();

// Get the last message sent by the player
String lastMessage = infractionPlayer.lastMessage();

// -------------------- Setters --------------------
// Set the player's online status
infractionPlayer.isOnline(true);
Clone this wiki locally