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:
2021-11-05 23:39:18 +01:00
parent 4566c15350
commit 8c4cf16375
10 changed files with 71 additions and 19 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}
}