Commit Graph

58 Commits

Author SHA1 Message Date
Wesley Wolfe
859aab1fa3 Add a tab completion API for chat messages. Adds BUKKIT-2607
This implementation provides access to a (mutable) list and the base
message. Also provided is a convenience method for getting the last
'token' in the provided string.
2012-10-17 04:56:11 -05:00
Score_Under
ede3fd278d Add tab-completion API. Fixes BUKKIT-2181. Adds BUKKIT-2602
CommandMap contains a method that will auto-complete commands
appropriately. Before the first space, it searches for commands of which
the sender has permission. After the first space, it delegates to the
individual command.

Vanilla commands contain implementations to mimic vanilla
implementation. Exception would be give, that allows for name matching;
a feature we already allowed as part of the command is now supported for
auto-complete as well.

Plugin commands can get a tab completer set to delegate the completion
for. If no tab completer is set, it can check the executor to see if it
implements the tab completion interface. It will also attempt to chain
calls if null gets returned from these interfaces. Plugins also
implement the new TabCompleter interface, to add ease-of-use for plugin
developers, similar to the onCommand() method.

The default command implementation simply searches for player names.

To help facilitate command completion, a utility class was added with
two functions. One checks two strings, to see if the specified string
starts with (ignoring case) the second. The other method uses the first
to selectively copy elements from one collection to another.
2012-10-16 00:05:40 -05:00
Wesley Wolfe
7a6a3d9558 Change Player usage in unit tests to proxies 2012-08-10 00:03:21 -05:00
feildmaster
ec51c24641 Add API to get a players experience to level (getExpToLevel). Implements BUKKIT-1906
This is the total experience one needs to gain a level.
2012-07-11 17:12:26 -05:00
TomyLobo
945ff9eebb Add an isValid() method to Entity. Addresses BUKKIT-810 2012-06-28 19:33:33 -05:00
TomyLobo
6525a30e74 Add LivingEntity.hasLineOfSight. Addresses BUKKIT-1255 2012-06-23 10:58:01 -05:00
Wesley Wolfe
4ebefa5b3a Support asynchronous events; Addresses BUKKIT-1212 2012-06-13 23:01:03 -05:00
Travis Watkins
7bbda1b7ab Optimize ChatColor.getLastColors.
ChatColor searches from the start to the end of a string for chat format
characters but this always has to search the entire string. By starting
from the end of the string and working backwards we can stop searching once
we find a color code or a reset code as any previous formatting is wiped
out by these.
2012-05-16 18:42:39 -05:00
feildmaster
3c1ba91f77 Fix createSection getting sections from itself. Fixes BUKKIT-1513 2012-04-14 00:59:22 -05:00
rmichela
6b8d346e4f [Bleeding] Removing the last metadata item for a key now sets hasMetadata(key) to false. Addresses BUKKIT-1380 2012-03-28 19:21:57 -04:00
rmichela
a8f0910a82 [Bleeding] MetadataBase now properly takes the metadata key into account when computing hasMetadata(). Addresses BUKKIT-1211 2012-03-28 19:21:25 -04:00
EvilSeph
a3581f1416 Added missing tests to TestPlayer. 2012-03-22 18:17:38 -04:00
Celtic Minstrel
42e694c696 [Bleeding] Fixed some issues with no-effect potions, and added more potion tests. Fixes BUKKIT-1251 2012-03-21 12:31:21 -04:00
rmichela
c4c5237232 [Bleeding] Added ChatColor.translateAlternateColorCodes(). Addresses BUKKIT-1191 2012-03-16 02:48:54 -04:00
EvilSeph
627aa62119 Updated tests with isBlocking(). 2012-03-14 01:35:43 -04:00
Celtic Minstrel
e8f00c8fd8 Added Enchantment.conflictsWith() and EnchantmentTarget.includes(). Addresses BUKKIT-1159 and addresses BUKKIT-1160 2012-03-13 22:20:02 -04:00
rmichela
6fc7d4ae40 [Bleeding] ChatPaginator now preserves the color of a line after wrapping the line of text. Fixes BUKKIT-1048 2012-03-08 02:02:28 -05:00
rmichela
52fcb63c8e [Bleeding] Added ConversationAbandonedEvent and supporting infrastructure. Whenever a conversation exits, the ConversationAbandonedEvent is triggered with details about how the conversation ended and what, if anything caused it to end. Fixes BUKKIT-986 2012-03-08 01:29:30 -05:00
rmichela
bba2e1cd2f [Bleeding] Added Help API. Addresses BUKKIT-863 2012-03-01 04:28:21 -05:00
rmichela
49c34510e3 [Bleeding] Added Conversations API. Addresses BUKKIT-864 2012-03-01 03:52:18 -05:00
Celtic Minstrel
08a68cff82 [Bleeding] Added sharp() and natural() factory functions to mirror the flat() one, sharped() and flattened() functions to get a note from an existing note, a toString(), and more tests. Addresses BUKKIT-861 2012-02-29 22:43:35 -05:00
Feildmaster
a628d2faff Revert Plugin to Interface, added PluginBase
Fixed Tests, moved TestPlugin out of messaging
2012-02-29 20:59:56 -05:00
Celtic Minstrel
0b77483c2f [Bleeding] Inventory framework and events. Addresses BUKKIT-856
New events:
- InventoryOpenEvent
- InventoryClickEvent - detects any clicks on a slot or outside the window
  - In the creative inventory view, only clicks on the quickbar are detected
- InventoryCloseEvent
- BrewEvent - when a potion finishes brewing
- CraftItemEvent (a subevent of InventoryClickEvent) - fired when taking the crafted item
- PrepareItemCraftEvent - fired just before updating the result slot
Changes to existing events:
- EnchantItemEvent extends InventoryEvent and also has a new whichButton() method
- PrepareItemEnchantEvent also extends InventoryEvent
- FurnaceBurnEvent and FurnaceSmeltEvent now extend BlockEvent (as does BrewEvent)
- PlayerInventoryEvent is deprecated (though it never did anything anyway)
New subclasses of Inventory:
- BrewerInventory
- CraftingInventory
- DoubleChestInventory
- EnchantingInventory
- FurnaceInventory
New methods in Inventory:
- getViewers()
- getTitle()
- getType()
- getHolder()
- iterator() - Yes, inventories are now iterable!
  - The iterator is a ListIterator that does not support add or remove
New methods in Player:
- getOpenInventory()
- openInventory()
- openWorkbench()
- openEnchanting()
- closeInventory()
- setWindowProperty()
- getItemOnCursor()
- setItemOnCursor()
Other changes:
- createInventory() methods in Server to make inventories not linked to an object
- ContainerBlock is deprecated in favour of InventoryHolder
- New InventoryView class gives direct access to an inventory window!
- Removed the Slot class which did nothing and was used nowhere

Some small credit goes to Afforess (initial conception of openInventory() methods) and Drakia (initial conception of InventoryOpenEvent and InventoryCloseEvent).
2012-02-29 15:18:56 -05:00
Celtic Minstrel
aaea53c517 Implementation of richer playEffect methods. Addresses BUKKIT-857 2012-02-29 15:02:59 -05:00
rmichela
a2c69f9f51 [Bleeding] Added a Metadata framework for Entities, Blocks, and Worlds
This metadata implementation has the following features:

- All metadata is lazy. Metadata values are not actually computed until another plugin requests them. Memory and CPU are conserved by not computing and storing unnecessary metadata values.

- All metadata is cached. Once a metadata value is computed its value is cached in the metadata store to prevent further unnecessary computation. An invalidation mechanism is provided to flush the cache and force recompilation of metadata values.

- All metadata is stored in basic data types. Convenience methods in the MetadataValue class allow for the conversion of metadata data types when possible. Restricting metadata to basic data types prevents the accidental linking of large object graphs into metadata. Metadata is persistent across the lifetime of the application and adding large object graphs would damage garbage collector performance.

- Metadata access is thread safe. Care has been taken to protect the internal data structures and access them in a thread safe manner.

- Metadata is exposed for all objects that descend from Entity, Block, and World. All Entity and World metadata is stored at the Server  level and all Block metadata is stored at the World level.

- Metadata is NOT keyed on references to original objects - instead metadata is keyed off of unique fields within those objects. Doing this allows metadata to exist for blocks that are in chunks not currently in memory. Additionally, Player objects are keyed off of player name so that Player metadata remains consistent between logins.

- Metadata convenience methods have been added to all Entities, Players, Blocks, BlockStates, and World allowing direct access to an individual instance's metadata.

- Players and OfflinePlayers share a single metadata store, allowing player metadata to be manipulated regardless of the player's current online status.
2012-02-29 19:16:04 +01:00
Wesley Wolfe
7db0e50da7 [Bleeding] Cleaned up unsafe casts. Addresses BUKKIT-844
Removed internal collection leaks from PluginDescriptionFile
BREAKING: PluginDescriptionFile.getAuthors() now returns List instead of
ArrayList

Various places with unsafe generics, notably List<Object> getList() in
Configurations are now referenced as <?>. This is nonbreaking, but
sourcecode will need to be revised when compiled.
2012-02-29 10:23:16 -05:00
Celtic Minstrel
c69d99f0fa [Bleeding] Fixed potion tests. 2012-02-25 18:06:20 -05:00
Celtic Minstrel
9b5feab9c8 [Bleeding] Add missing methods to Bukkit class, fix non-static methods, and add a junit test to ensure both these problems will be caught in future. 2012-02-25 16:59:27 -05:00
aPunch
c0e2ade335 [Bleeding] Added launchProjectile.
Use launchProjectile in place of individual throwSnowball, throwEgg, and shootArrow methods
2012-02-23 05:54:16 -05:00
Celtic Minstrel
cbb9bc0fa3 [Bleeding] Added EntityType to replace CreatureType. 2012-02-22 22:06:19 -05:00
Wesley Wolfe
fa31bf889c [Bleeding] Added Enchantment and misc tests to ItemStack (de)serialization 2012-02-19 01:24:42 -05:00
Erik Broes
7a06777e19 Deprecation cleanup. 2012-02-18 13:05:58 -05:00
fullwall
f229d6fe83 [Bleeding] Added Potions API. Fixes BUKKIT-389 2012-02-10 17:26:38 -05:00
Travis Watkins
103ead4346 [Bleeding] Added Vanish API for hiding players from each other.
Adds Player.hidePlayer, Player.showPlayer, and Player.canSee for managing
what players are hidden from a player. When someone is hidden from a player
the player cannot see them in the user list or /list and they cannot /tell
them so they appear to be completely gone from the server.
2012-02-03 03:32:21 -05:00
Erik Broes
9c0f2f6d38 Add some testing 2012-01-29 11:17:44 +01:00
Erik Broes
a210df5d52 Add Player.setBedSpawnLocation(Location). Thanks md_5 2012-01-17 22:43:16 +01:00
Nathan Adams
e35037ab50 [Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran. 2012-01-17 19:46:22 +01:00
rmichela
05173f2200 [Bleeding] Added Plugin.getLogger() which returns a java.util.Logger that prefixes messages with the plugin name.
Note: the server when enabling or disabling a plugin will now by default log this.
2012-01-17 19:45:36 +01:00
Nathan Adams
c72c570d77 Added ChatColor.MAGIC, changed to char based values and deprecated old methods. Added unit tests for ChatColor 2012-01-16 19:38:08 +00:00
Erik Broes
eb9dc64493 Generic cleaning 2012-01-15 14:37:43 +01:00
Nathan Adams
0023c705eb Configurations now properly support lists of serializable objects, and ItemStack is properly serializable. Big thanks to GICodeWarrior for the PR. This fixes BUKKIT-425 2012-01-15 11:15:58 +00:00
Nathan Adams
c84c5a2132 Added Player set/getAllowFlight methods. Thanks to Qala for the PR. 2012-01-15 10:55:33 +00:00
Erik Broes
23f9390fce Fix unambiguous import 2012-01-15 10:20:07 +01:00
Nathan Adams
e03e2cc1c2 Added entity.playEffect, thanks to main-- in an (unfortunately old) PR. 2012-01-14 17:35:52 +00:00
Nathan Adams
55cc8722c8 Implemented new Plugin Message API - see http://dinnerbone.com/blog/2012/01/13/minecraft-plugin-channels-messaging/ 2012-01-13 08:53:14 +00:00
Nathan Adams
b9d901a305 Fixed YamlConfiguration creating empty lines when reading a file with no contents, and made it trim the initial newlines of any existing config header 2012-01-08 23:32:36 +00:00
Erik Broes
dce83b6ce4 Generic cleanup of warnings, whitespace and style. 2011-12-25 16:02:30 +01:00
Nathan Adams
1927e22e33 Configuration methods .getX (int/double/etc) now try to cast existing values where possible. This fixes BUKKIT-290 2011-12-12 18:34:26 +00:00
Nathan Adams
8322850aae Removed redundant TestEnum file 2011-11-13 10:00:50 +00:00
Feildmaster
95b487d274 Added createSection(String path, Map<String, object> map) 2011-11-05 20:33:28 +00:00