Adds better default permissions
- Adds three new permission groups for easier setup - Sets better default permissions - Updates and prettifies some documentation - Renames the silent portal option to quiet
This commit is contained in:
		@@ -161,7 +161,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
            //Just teleport the player like normal
 | 
			
		||||
            new PlayerTeleporter(destination, player).teleportPlayer(entrancePortal, event);
 | 
			
		||||
        }
 | 
			
		||||
        if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
        if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
            Stargate.getMessageSender().sendSuccessMessage(player, Stargate.getString(Message.TELEPORTED));
 | 
			
		||||
        }
 | 
			
		||||
        entrancePortal.getPortalOpener().closePortal(false);
 | 
			
		||||
@@ -203,7 +203,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
 | 
			
		||||
        //Decide if the user should be teleported to another bungee server
 | 
			
		||||
        if (entrancePortal.getOptions().isBungee()) {
 | 
			
		||||
            if (BungeeHelper.bungeeTeleport(player, entrancePortal, event) && !entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
            if (BungeeHelper.bungeeTeleport(player, entrancePortal, event) && !entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendSuccessMessage(player, Stargate.getString(Message.TELEPORTED));
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
@@ -404,7 +404,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        boolean deny = PermissionHelper.cannotAccessNetwork(player, portal.getCleanNetwork());
 | 
			
		||||
 | 
			
		||||
        if (PermissionHelper.portalAccessDenied(player, portal, deny)) {
 | 
			
		||||
            if (!portal.getOptions().isSilent()) {
 | 
			
		||||
            if (!portal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ACCESS_DENIED));
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -463,7 +463,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
    /**
 | 
			
		||||
     * Displays information about a clicked portal
 | 
			
		||||
     *
 | 
			
		||||
     * <p>This will only display portal info if the portal has no sign and is not silent.</p>
 | 
			
		||||
     * <p>This will only display portal info if the portal has no sign and is not quiet.</p>
 | 
			
		||||
     *
 | 
			
		||||
     * @param block  <p>The clicked block</p>
 | 
			
		||||
     * @param player <p>The player that clicked the block</p>
 | 
			
		||||
@@ -475,7 +475,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Display portal information as a portal without a sign does not display any
 | 
			
		||||
        if (portal.getOptions().hasNoSign() && (!portal.getOptions().isSilent() || player.isSneaking())) {
 | 
			
		||||
        if (portal.getOptions().hasNoSign() && (!portal.getOptions().isQuiet() || player.isSneaking())) {
 | 
			
		||||
            MessageSender sender = Stargate.getMessageSender();
 | 
			
		||||
            sender.sendSuccessMessage(player, ChatColor.GOLD + Stargate.getString(Message.PORTAL_INFO_TITLE));
 | 
			
		||||
            sender.sendSuccessMessage(player, Stargate.replacePlaceholders(Stargate.getString(Message.PORTAL_INFO_NAME),
 | 
			
		||||
 
 | 
			
		||||
@@ -100,7 +100,7 @@ public class VehicleEventListener implements Listener {
 | 
			
		||||
        for (Player player : players) {
 | 
			
		||||
            if (destinationPortal == null) {
 | 
			
		||||
                cancelTeleportation = true;
 | 
			
		||||
                if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
                if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                    Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.INVALID_DESTINATION));
 | 
			
		||||
                }
 | 
			
		||||
            } else if (!TeleportHelper.playerCanTeleport(player, entrancePortal, destinationPortal)) {
 | 
			
		||||
@@ -136,7 +136,7 @@ public class VehicleEventListener implements Listener {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
        if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
            for (Player player : players) {
 | 
			
		||||
                Stargate.getMessageSender().sendSuccessMessage(player, Stargate.getString(Message.TELEPORTED));
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -258,7 +258,7 @@ public class PortalActivator {
 | 
			
		||||
 | 
			
		||||
        //If no destinations are available, just tell the player and quit
 | 
			
		||||
        if (destinations.isEmpty()) {
 | 
			
		||||
            if (!portal.getOptions().isSilent()) {
 | 
			
		||||
            if (!portal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.NO_DESTINATION));
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ public enum PortalOption {
 | 
			
		||||
    /**
 | 
			
		||||
     * This option allows a portal which does not display a teleportation message, for better immersion
 | 
			
		||||
     */
 | 
			
		||||
    SILENT('q', "silent", 21),
 | 
			
		||||
    QUIET('q', "quiet", 21),
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This option causes a fixed portal's sign to be removed after creation
 | 
			
		||||
 
 | 
			
		||||
@@ -172,15 +172,15 @@ public class PortalOptions {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets whether this portal is silent
 | 
			
		||||
     * Gets whether this portal is QUIET
 | 
			
		||||
     *
 | 
			
		||||
     * <p>A silent portal does not output anything to the chat when teleporting. This option is mainly useful to keep
 | 
			
		||||
     * <p>A quiet 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>
 | 
			
		||||
     * @return <p>Whether this portal is quiet</p>
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isSilent() {
 | 
			
		||||
        return this.options.get(PortalOption.SILENT);
 | 
			
		||||
    public boolean isQuiet() {
 | 
			
		||||
        return this.options.get(PortalOption.QUIET);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -185,7 +185,7 @@ public final class BungeeHelper {
 | 
			
		||||
                                         @NotNull PlayerMoveEvent event) {
 | 
			
		||||
        //Check if bungee is actually enabled
 | 
			
		||||
        if (!Stargate.getGateConfig().enableBungee()) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.BUNGEE_DISABLED));
 | 
			
		||||
            }
 | 
			
		||||
            entrancePortal.getPortalOpener().closePortal(false);
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ public final class PermissionHelper {
 | 
			
		||||
 | 
			
		||||
        //Destination is invalid or the same portal. Send an error message
 | 
			
		||||
        if (destination == null || destination == portal) {
 | 
			
		||||
            if (!portal.getOptions().isSilent()) {
 | 
			
		||||
            if (!portal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.INVALID_DESTINATION));
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
@@ -74,7 +74,7 @@ public final class PermissionHelper {
 | 
			
		||||
        //Deny access if another player has activated the portal, and it's still in use
 | 
			
		||||
        if (!portal.getOptions().isFixed() && portal.getPortalActivator().isActive() &&
 | 
			
		||||
                portal.getActivePlayer() != player) {
 | 
			
		||||
            if (!portal.getOptions().isSilent()) {
 | 
			
		||||
            if (!portal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ACCESS_DENIED));
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -82,7 +82,7 @@ public final class PermissionHelper {
 | 
			
		||||
 | 
			
		||||
        //Check if the player can use the private gate
 | 
			
		||||
        if (portal.getOptions().isPrivate() && !PermissionHelper.canUsePrivatePortal(player, portal)) {
 | 
			
		||||
            if (!portal.getOptions().isSilent()) {
 | 
			
		||||
            if (!portal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ACCESS_DENIED));
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -90,7 +90,7 @@ public final class PermissionHelper {
 | 
			
		||||
 | 
			
		||||
        //Destination is currently in use by another player, blocking teleportation
 | 
			
		||||
        if (destination.isOpen() && !destination.getOptions().isAlwaysOn()) {
 | 
			
		||||
            if (!portal.getOptions().isSilent()) {
 | 
			
		||||
            if (!portal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.DESTINATION_BLOCKED));
 | 
			
		||||
            }
 | 
			
		||||
            return true;
 | 
			
		||||
@@ -414,7 +414,7 @@ public final class PermissionHelper {
 | 
			
		||||
 | 
			
		||||
        //Not open for this player
 | 
			
		||||
        if (!entrancePortal.getPortalOpener().isOpenFor(player)) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ACCESS_DENIED));
 | 
			
		||||
            }
 | 
			
		||||
            new PlayerTeleporter(entrancePortal, player).teleportPlayer(entrancePortal, event);
 | 
			
		||||
@@ -429,7 +429,7 @@ public final class PermissionHelper {
 | 
			
		||||
 | 
			
		||||
        //Player cannot access portal
 | 
			
		||||
        if (PermissionHelper.cannotAccessPortal(player, entrancePortal, destination)) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ACCESS_DENIED));
 | 
			
		||||
            }
 | 
			
		||||
            new PlayerTeleporter(entrancePortal, player).teleportPlayer(entrancePortal, event);
 | 
			
		||||
 
 | 
			
		||||
@@ -138,7 +138,7 @@ public final class PortalFileHelper {
 | 
			
		||||
        builder.append(options.isNoNetwork()).append(':');
 | 
			
		||||
        builder.append(options.isRandom()).append(':');
 | 
			
		||||
        builder.append(options.isBungee()).append(':');
 | 
			
		||||
        builder.append(options.isSilent()).append(':');
 | 
			
		||||
        builder.append(options.isQuiet()).append(':');
 | 
			
		||||
        builder.append(options.hasNoSign());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -229,7 +229,7 @@ public final class TeleportHelper {
 | 
			
		||||
                                            @NotNull Portal destinationPortal) {
 | 
			
		||||
        //Make sure the user can access the portal
 | 
			
		||||
        if (PermissionHelper.cannotAccessPortal(player, entrancePortal, destinationPortal)) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ACCESS_DENIED));
 | 
			
		||||
            }
 | 
			
		||||
            entrancePortal.getPortalOpener().closePortal(false);
 | 
			
		||||
@@ -240,7 +240,7 @@ public final class TeleportHelper {
 | 
			
		||||
        int cost = EconomyHelper.getUseCost(player, entrancePortal, destinationPortal);
 | 
			
		||||
        boolean canAffordFee = cost <= 0 || Stargate.getEconomyConfig().canAffordFee(player, cost);
 | 
			
		||||
        if (!canAffordFee) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isSilent()) {
 | 
			
		||||
            if (!entrancePortal.getOptions().isQuiet()) {
 | 
			
		||||
                Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString(Message.ECONOMY_INSUFFICIENT));
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
@@ -40,16 +40,28 @@ dynmap:
 | 
			
		||||
  # Should StarGate icons be hidden by default? (must users manually enable their checkbox?)
 | 
			
		||||
  dynmapIconsHiddenByDefault: true
 | 
			
		||||
 | 
			
		||||
# +----------------------------------------------------------------------------------------------+ #
 | 
			
		||||
# |                                        Gate Behaviour                                        | #
 | 
			
		||||
# +----------------------------------------------------------------------------------------------+ #
 | 
			
		||||
gates:
 | 
			
		||||
  # What is the maximum number of gates a single network may contain? (0 for unlimited)
 | 
			
		||||
  maxGatesEachNetwork: 0
 | 
			
		||||
 | 
			
		||||
  # What network will be used when none has been specified? (Max length 12 characters)
 | 
			
		||||
  # 
 | 
			
		||||
  # Note that this primarily applies to users with the stargate.create.network node.
 | 
			
		||||
  # Generally, that node is given to staff (we recommend stargate.create.personal for users).
 | 
			
		||||
  defaultGateNetwork: central
 | 
			
		||||
 | 
			
		||||
  # At what speed should players be sent out of portals?
 | 
			
		||||
  # When exiting a gate, players retain their original movement velocity, multiplied by this value.
 | 
			
		||||
  exitVelocity: 0.1
 | 
			
		||||
  
 | 
			
		||||
  functionality:
 | 
			
		||||
    # Should an alternative (and less effective) teleportation script be used to teleport vehicles?
 | 
			
		||||
    # This will fix an incompatibility with CraftBook, but will cause vehicles' data to be wiped on teleportation.
 | 
			
		||||
    enableCraftBookRemoveOnEjectFix: false
 | 
			
		||||
    
 | 
			
		||||
    # +----------------------------------------------------------------------------------------------+ #
 | 
			
		||||
    # |                                        Gate Behaviour                                        | #
 | 
			
		||||
    # +----------------------------------------------------------------------------------------------+ #
 | 
			
		||||
    
 | 
			
		||||
    # Are you connected to a BungeeCord-compatible proxy?
 | 
			
		||||
    # Set this value to true if you intend on building gates with the bUngee flag.
 | 
			
		||||
    enableBungee: false
 | 
			
		||||
@@ -72,19 +84,6 @@ gates:
 | 
			
		||||
    # Should StarGate also handle creatures attached to a player via a lead?
 | 
			
		||||
    handleLeashedCreatures: true
 | 
			
		||||
  
 | 
			
		||||
  # What is the maximum number of gates a single network may contain? (0 for unlimited)
 | 
			
		||||
  maxGatesEachNetwork: 0
 | 
			
		||||
  
 | 
			
		||||
  # What network will be used when none has been specified? (Max length 12 characters)
 | 
			
		||||
  # 
 | 
			
		||||
  # Note that this primarily applies to users with the stargate.create.network node.
 | 
			
		||||
  # Generally, that node is given to staff (we recommend stargate.create.personal for users).
 | 
			
		||||
  defaultGateNetwork: central
 | 
			
		||||
  
 | 
			
		||||
  # At what speed should players be sent out of portals?
 | 
			
		||||
  # When exiting a gate, players retain their original movement velocity, multiplied by this value.
 | 
			
		||||
  exitVelocity: 0.1
 | 
			
		||||
  
 | 
			
		||||
  integrity:
 | 
			
		||||
    
 | 
			
		||||
    # Can StarGates be broken via an explosion?
 | 
			
		||||
@@ -144,6 +143,8 @@ gates:
 | 
			
		||||
      - 'WARPED:inverted,inverted'
 | 
			
		||||
      - 'BAMBOO:default,default'
 | 
			
		||||
      - 'CHERRY:default,default'
 | 
			
		||||
      - 'PALE_OAK:default,default'
 | 
			
		||||
      - 'MANGROVE:default,default'
 | 
			
		||||
 | 
			
		||||
economy:
 | 
			
		||||
  # When scrolling through a networked portal's destination list, should SG color free gates?
 | 
			
		||||
@@ -151,7 +152,7 @@ economy:
 | 
			
		||||
  
 | 
			
		||||
  # If freeGatesColored is true, which color should SG use?
 | 
			
		||||
  #
 | 
			
		||||
  # All color names should follow this format:
 | 
			
		||||
  # All color names should be a hex RGB color (#ffffff) or follow this format:
 | 
			
		||||
  # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/ChatColor.html 
 | 
			
		||||
  freeGatesColor: DARK_GREEN
 | 
			
		||||
  
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ permissions:
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.use:
 | 
			
		||||
    description: Allow use of all stargates linking to any world in any network
 | 
			
		||||
    default: true
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.world: true
 | 
			
		||||
      stargate.network: true
 | 
			
		||||
@@ -43,7 +43,7 @@ permissions:
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.create:
 | 
			
		||||
    description: Allow creating stargates on any network using any gate type
 | 
			
		||||
    default: op
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.create.personal: true
 | 
			
		||||
      stargate.create.network: true
 | 
			
		||||
@@ -59,7 +59,7 @@ permissions:
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.destroy:
 | 
			
		||||
    description: Allows the destruction of all stargates
 | 
			
		||||
    default: op
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.destroy.network: true
 | 
			
		||||
      stargate.destroy.personal: true
 | 
			
		||||
@@ -71,7 +71,7 @@ permissions:
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.free:
 | 
			
		||||
    description: Allow free use/creation/destruction of stargates
 | 
			
		||||
    default: op
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.free.use: true
 | 
			
		||||
      stargate.free.create: true
 | 
			
		||||
@@ -87,7 +87,7 @@ permissions:
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.option:
 | 
			
		||||
    description: Allows use of all options
 | 
			
		||||
    default: op
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.option.hidden: true
 | 
			
		||||
      stargate.option.alwayson: true
 | 
			
		||||
@@ -97,7 +97,7 @@ permissions:
 | 
			
		||||
      stargate.option.show: true
 | 
			
		||||
      stargate.option.nonetwork: true
 | 
			
		||||
      stargate.option.random: true
 | 
			
		||||
      stargate.option.silent: true
 | 
			
		||||
      stargate.option.quiet: true
 | 
			
		||||
      stargate.option.nosign: true
 | 
			
		||||
  stargate.option.hidden:
 | 
			
		||||
    description: Allows the creation of a hidden stargate
 | 
			
		||||
@@ -123,7 +123,7 @@ permissions:
 | 
			
		||||
  stargate.option.random:
 | 
			
		||||
    description: Allows the creation of a stargate with a random destination
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.option.silent:
 | 
			
		||||
  stargate.option.quiet:
 | 
			
		||||
    description: Allows the creation of a stargate which does not output anything to the chat
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.option.nosign:
 | 
			
		||||
@@ -149,11 +149,35 @@ permissions:
 | 
			
		||||
    default: false
 | 
			
		||||
  stargate.admin:
 | 
			
		||||
    description: Allow all admin features and commands (Hidden/Private bypass, BungeeCord, Reload, Config)
 | 
			
		||||
    default: op
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.admin.reload: true
 | 
			
		||||
      stargate.admin.hidden: true
 | 
			
		||||
      stargate.admin.private: true
 | 
			
		||||
      stargate.admin.bungee: true
 | 
			
		||||
      stargate.admin.config: true
 | 
			
		||||
      stargate.admin.dye: true
 | 
			
		||||
      stargate.admin.dye: true
 | 
			
		||||
  stargate.group.admin:
 | 
			
		||||
    description: Allow everything except stargate.free
 | 
			
		||||
    default: op
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.admin: true
 | 
			
		||||
      stargate.server: true
 | 
			
		||||
      stargate.group.builder: true
 | 
			
		||||
  stargate.group.builder:
 | 
			
		||||
    description: Allows unrestricted building and destruction of Stargates with any option
 | 
			
		||||
    default: false
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.group.player: true
 | 
			
		||||
      stargate.option: true
 | 
			
		||||
      stargate.network: true
 | 
			
		||||
      stargate.create: true
 | 
			
		||||
      stargate.destroy: true
 | 
			
		||||
  stargate.group.player:
 | 
			
		||||
    description: Gives normal players limited use of Stargates
 | 
			
		||||
    default: true
 | 
			
		||||
    children:
 | 
			
		||||
      stargate.use: true
 | 
			
		||||
      stargate.create.gate.nethergate: true
 | 
			
		||||
      stargate.create.personal: true
 | 
			
		||||
      stargate.destroy.personal: true
 | 
			
		||||
		Reference in New Issue
	
	Block a user