Adds an option for silent stargates which don't print teleportation messages or errors to the player's chat #7
This commit is contained in:
@ -248,7 +248,9 @@ public class PortalActivator {
|
||||
|
||||
//If no destinations are available, just tell the player and quit
|
||||
if (destinations.size() == 0) {
|
||||
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("destEmpty"));
|
||||
if (!portal.getOptions().isSilent()) {
|
||||
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("destEmpty"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,12 @@ public enum PortalOption {
|
||||
/**
|
||||
* This option allows a portal to teleport to another server connected through BungeeCord
|
||||
*/
|
||||
BUNGEE('u', "stargate.admin.bungee", 20);
|
||||
BUNGEE('u', "stargate.admin.bungee", 20),
|
||||
|
||||
/**
|
||||
* This option allows a portal which does not display a teleportation message, for better immersion
|
||||
*/
|
||||
SILENT('i', "stargate.option.silent", 21);
|
||||
|
||||
private final char characterRepresentation;
|
||||
private final String permissionString;
|
||||
|
@ -165,4 +165,16 @@ public class PortalOptions {
|
||||
return this.options.get(PortalOption.BUNGEE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether this portal is silent
|
||||
*
|
||||
* <p>A silent portal does not output anything to the chat when teleporting. This option is mainly useful to keep
|
||||
* the immersion during teleportation (for role-playing servers or similar).</p>
|
||||
*
|
||||
* @return <p>Whether this portal is silent</p>
|
||||
*/
|
||||
public boolean isSilent() {
|
||||
return this.options.get(PortalOption.SILENT);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user