2018-07-23 05:44:20 +02:00
|
|
|
package net.ME1312.SubServers.Client.Sponge.Event;
|
|
|
|
|
2019-05-12 03:22:18 +02:00
|
|
|
import net.ME1312.Galaxi.Library.Util;
|
2020-11-16 21:34:59 +01:00
|
|
|
import net.ME1312.SubServers.Client.Sponge.Library.SubEvent;
|
|
|
|
|
2018-07-23 05:44:20 +02:00
|
|
|
import org.spongepowered.api.event.cause.Cause;
|
|
|
|
import org.spongepowered.api.event.impl.AbstractEvent;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send Command Event
|
|
|
|
*/
|
|
|
|
public class SubSendCommandEvent extends AbstractEvent implements SubEvent {
|
|
|
|
private UUID player;
|
|
|
|
private String server;
|
|
|
|
private String command;
|
2021-12-01 10:50:25 +01:00
|
|
|
private UUID target;
|
2018-07-23 05:44:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Server Command Event
|
|
|
|
*
|
2021-12-01 10:50:25 +01:00
|
|
|
* @param player Player Commanding
|
|
|
|
* @param server Target Server
|
|
|
|
* @param command Command to Send
|
|
|
|
* @param target Player that will send
|
2018-07-23 05:44:20 +02:00
|
|
|
*/
|
2021-12-01 10:50:25 +01:00
|
|
|
public SubSendCommandEvent(UUID player, String server, String command, UUID target) {
|
2021-10-24 06:14:07 +02:00
|
|
|
Util.nullpo(server, command);
|
2018-07-23 05:44:20 +02:00
|
|
|
this.player = player;
|
|
|
|
this.server = server;
|
|
|
|
this.command = command;
|
2021-12-01 10:50:25 +01:00
|
|
|
this.target = target;
|
2018-07-23 05:44:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Server Effected
|
|
|
|
*
|
|
|
|
* @return The Server Effected
|
|
|
|
*/
|
|
|
|
public String getServer() { return server; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the player that triggered the Event
|
|
|
|
*
|
|
|
|
* @return The Player that triggered this Event or null if Console
|
|
|
|
*/
|
|
|
|
public UUID getPlayer() { return player; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Command to Send
|
|
|
|
*
|
|
|
|
* @return Command to Send
|
|
|
|
*/
|
|
|
|
public String getCommand() {
|
|
|
|
return command;
|
|
|
|
}
|
|
|
|
|
2021-12-01 10:50:25 +01:00
|
|
|
/**
|
|
|
|
* Gets the Player that will be forced to send the Command
|
|
|
|
*
|
|
|
|
* @return Target Player or null if Console
|
|
|
|
*/
|
|
|
|
public UUID getTarget() {
|
|
|
|
return target;
|
|
|
|
}
|
|
|
|
|
2018-07-23 05:44:20 +02:00
|
|
|
/**
|
|
|
|
* Gets the cause of this Event
|
|
|
|
*
|
2018-07-30 18:29:36 +02:00
|
|
|
* @deprecated Use simplified methods where available
|
2018-08-30 03:55:59 +02:00
|
|
|
* @return The player UUID who triggered this event
|
2018-07-23 05:44:20 +02:00
|
|
|
*/
|
|
|
|
@Override
|
2018-07-30 18:29:36 +02:00
|
|
|
@Deprecated
|
2018-07-23 05:44:20 +02:00
|
|
|
public Cause getCause() {
|
2018-08-30 03:55:59 +02:00
|
|
|
return Cause.builder().append(player).build(getContext());
|
2018-07-23 05:44:20 +02:00
|
|
|
}
|
|
|
|
}
|