Alias

Due to recent issues, I currently have no time to continue development for this plugin. The source code will be sent to anyone who asks, anyone who wants to continue development is free to do so - if you want access to this page, too, please message me.

alias.logo

Current Version: 1.1.0
Recommended Build: 1.2.5-R1
Thanks to Unscrewed for one awesome logo!

About

Have you ever found yourself typing the same command over and over? Do you want to simplify vanilla Bukkit commands without installing a great bunch of plugins? This plugin allows you to do so. With Alias, you can add aliases to existing commands, shortening the text you have to type.

Examples

Simplify the Bukkit "tp" command: /a set tp tp {name} {1}

Breakdown of the command:

  • /a - All aliases and alias commands must be prefixed by /alias, or the shorter /a, to prevent conflicts with existing commands
  • set - Sets a new alias. If you had another alias registered with that name, it will be overwritten and the old command will be displayed to you
  • tp - The name of the alias. In the future, you can invoke it by typing /a tp [your parameters]
  • tp - Here, the command that should be invoked begins. In our case, it is the teleport command
  • {name} - Every time you invoke this command, it will be replaced by your name. In other words, you save yourself typing your name every time.
  • {1} - This will be replaced by the first argument you pass to the alias, in our case the target player.

Now, instead of typing /tp <yourname> <other name>, you shortened it to /a tp <other name>. Shorter, isn't it?

Simplify Worldedit commands: /a set farm /pos1;/pos2;/expand {1} N;/expand {1} E;/expand {1} S;/expand {1}W;/set 60;/shift 1 D;/set 9;/shift 2 U;/set 59

Breakdown:

  • /a set farm - As seen above
  • /pos1 - Since worldedit takes two forward slashed, you need to add one here.
  • ;/pos2; - Chain multiple commands
  • /expand {1} N;/expand {1} E;[...] - Expand the area the same amount in all directions, with your feet now being at the center

Usage: /a farm <radius> - Creates an area (2*radius)+1 long and wide, makes it farmland, places water under it, places seeds on top of it.

The explanation of the rest of the commands can be looked up here. Please note that I do not have much experience with WorldEdit, so some of the used commands may be outdated or wrong. This is only supposed to be a proof-of-concept.

Commands

All commands start with either /a or /alias (Both are equivalent):

  • /a - Displays help
  • /a list <player> - List your (or <player>'s) aliases
  • /a remove [alias] - Removes alias with name [alias]
  • /a set [alias] [commands] - Registers a new alias with name [alias]
  • /a [alias] - Executes the command associated with [alias]
  • /a help <command> - Displays the general help or the help for <command>

Permissions

There is only one permission:

  • alias.list.others - Allows to see other people's aliases

Variables

Alias allows you to replace words with place holders, which will be filled in when you issue the command.

  • {name} - Will be replaced by your name
  • {health} - Will be replaced by your health in half hearts
  • {1}, {2}, ..., {n} - Will be replaced by the first/second/nth word after the alias. If you pass less arguments than there are placeholders, the place holders will be printed literally. If you pass more arguments, superfluous arguments are discarded. For example, if you have an alias s = say {1} {2}:
    • "/a s foo" will output "foo {2}"
    • "/a s foo bar" will output "foo bar"
    • "/a s foo bar asd" will output "foo bar"
  • {} - Will be replaced with the first argument
  • {n:} - Will be replaced with all arguments from n to the end (inclusive), separated by spaces
  • {:m} - Will be replaced with all arguments from the beginning to m (inclusive), separated by spaces
  • {n:m} - Will be replaced with all arguments from n to m (inclusive), separated by spaces

Questions and Answers

Q: Does Alias support command <X>?
A: As long as X is a vanilla bukkit command or you have a plugin the uses command X, yes. Otherwise, no.

Q: What is with permissions?
A: If a user attempts to use a command he has no permissions for, he will be denied.

Q: Do all users have the same aliases?
A: No. Every user has his own set of aliases, as does the console.

Q: Can I edit other users aliases?
A: No. As mentioned above, there is no reason to do so permission-wise, and people should be able to trust their aliases as much as standard commands. No one wants to risk getting lava dumped over their had by a moderator who messed with their alias.

Q: I tried to open "aliases.data", but it seems to be corrupted!
A: The aliases are not saved in plain text, but in a format that the JVM can easily load and save. This is both for speed and security reasons.

Files

There is one file: /plugins/Alias/aliases.data. This stores all players aliases in a non-editable, non-readable format. Please, don't try to edit it. You will only corrupt the file. Right now, there is no configuration file, as there is not much configure.

Planned Features

  • None right now - open to suggestions

Changelog

v1.1.0

  • Added range variables:
    • {} matches the first argument
    • {n:} matches everything from n to the end (inclusive)
    • {:m} matches everything from the beginning to m (inclusive)
    • {n:m} matches everything from n to m (inclusive)

Example usage: /a set b broadcast {1:} /a b <your text> is now equivalent to /broadcast <yourtext>

v1.0.0

  • First release

Contact

Ticket here or contact me on IRC: irc://irc.esper.net:6667/arcticraft (I'm not always active, but if you just talk to me, my bouncer will tell me when I come back)


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files

Bukkit