37 Commits

Author SHA1 Message Date
Feildmaster
0a106995d2 Revert Plugin to Interface, added PluginBase
Fixed Tests, moved TestPlugin out of messaging
2012-02-29 20:59:56 -05:00
Celtic Minstrel
8a458ca273 [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
0db822f609 Implementation of richer playEffect methods. Addresses BUKKIT-857 2012-02-29 15:02:59 -05:00
rmichela
cd732ee3f7 [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
ca7aab6f4f [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
2ba3ab3fb8 [Bleeding] Fixed potion tests. 2012-02-25 18:06:20 -05:00
Celtic Minstrel
1c9d419c27 [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
697e67f3e6 [Bleeding] Added launchProjectile.
Use launchProjectile in place of individual throwSnowball, throwEgg, and shootArrow methods
2012-02-23 05:54:16 -05:00
Celtic Minstrel
ce4a390b00 [Bleeding] Added EntityType to replace CreatureType. 2012-02-22 22:06:19 -05:00
Wesley Wolfe
2b49045614 [Bleeding] Added Enchantment and misc tests to ItemStack (de)serialization 2012-02-19 01:24:42 -05:00
Erik Broes
049a7cc1d0 Deprecation cleanup. 2012-02-18 13:05:58 -05:00
fullwall
d99c95f6d1 [Bleeding] Added Potions API. Fixes BUKKIT-389 2012-02-10 17:26:38 -05:00
Travis Watkins
5e6125e01b [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
839d00f9d6 Add some testing 2012-01-29 11:17:44 +01:00
Erik Broes
95e3f07b69 Add Player.setBedSpawnLocation(Location). Thanks md_5 2012-01-17 22:43:16 +01:00
Nathan Adams
86f33b82c9 [Bleeding] Changed event system into a new, much faster design. Huge thanks to @zml2008 & @lahwran. 2012-01-17 19:46:22 +01:00
rmichela
5ca940b907 [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
ed34f17ddf 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
88c17a7f86 Generic cleaning 2012-01-15 14:37:43 +01:00
Nathan Adams
ea3e91b416 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
96b3a075af Added Player set/getAllowFlight methods. Thanks to Qala for the PR. 2012-01-15 10:55:33 +00:00
Erik Broes
428a73da65 Fix unambiguous import 2012-01-15 10:20:07 +01:00
Nathan Adams
2d1e365c43 Added entity.playEffect, thanks to main-- in an (unfortunately old) PR. 2012-01-14 17:35:52 +00:00
Nathan Adams
ce4f4af087 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
7f37ce3dc1 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
b9fca3c04d Generic cleanup of warnings, whitespace and style. 2011-12-25 16:02:30 +01:00
Nathan Adams
03fa22001b 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
58f30039c8 Removed redundant TestEnum file 2011-11-13 10:00:50 +00:00
Feildmaster
c00f47e0e2 Added createSection(String path, Map<String, object> map) 2011-11-05 20:33:28 +00:00
Nathan Adams
e33fce94b5 Added helper methods such as getStringList to ConfigurationSection 2011-10-26 09:47:51 +01:00
Nathan Adams
bfa45985c5 Fixed issues with loading YamlConfigurations with typed keys 2011-10-26 06:56:36 +01:00
Nathan Adams
5993f1cc16 Added new FileConfigurationOptions.copyHeader, defaulting to true. Copies the header from default config, if there is one. 2011-10-12 13:24:57 +01:00
Nathan Adams
db7bdbbd58 Loading a FileConfiguration (Yaml/) should remember the previously saved header 2011-10-12 05:03:47 +01:00
Nathan Adams
5703334ac8 YamlConfiguration now correctly writes extra blank lines at the end if requested 2011-10-12 04:39:22 +01:00
Nathan Adams
252fc76816 Fixed removing entries in the new Configuration (via set(x, null)) 2011-10-11 12:16:43 +01:00
Nathan Adams
4485364e17 Small javadoc cleanup 2011-10-10 21:58:44 +01:00
Dinnerbone
ee27cc07f0 Added new Configuration classes 2011-10-10 21:06:34 +01:00