Commit Graph

246 Commits

Author SHA1 Message Date
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
3313210590 Clarify some of the verbose in SimplePluginManager.
When an exception occurs, the version of the plugin is not included.
Having this information would be beneficial to plugin authors performing
debug.

The list of authors for NagAuthorException verbose (although unused)
would be more appropriate to simply include all authors, as opposed to
the first appearing.
2012-09-30 03:35:06 -05:00
Wesley Wolfe
98d257daab Allow inherited methods to be event handlers. Addresses BUKKIT-2299
This change lets JavaPluginLoader use a temporary HashSet to store
methods that could possibly have the EventHandler annotation. Duplicates
are prevented by the nature of a Set.

Registering parent listeners is a breaking change for any listener
extending another listener and expecting parent listeners to not be
called. Changing this is justified by the ease-of-use and proper object
inheritance design. If this is undesired behavior, the method may be
overridden without reapplying the method with the EventHandler notation.
2012-08-26 21:14:28 -05:00
Wesley Wolfe
3ea3884cc5 Provide better verbose for registering listeners. Addresses BUKKIT-2391 2012-08-25 17:48:53 -05:00
Wesley Wolfe
75e9cfb7a7 Fully restrict the org.bukkit and net.minecraft namespace 2012-08-19 07:42:20 -04:00
Wesley Wolfe
dc3fc6a702 Add Warning API and settings for Deprecated events 2012-08-07 00:16:57 -05:00
Wesley Wolfe
0b2870a6fd Warn server owners of plugins using deprecated events. Fixes BUKKIT-2027 2012-08-02 23:21:02 -05:00
Wesley Wolfe
2b3eaee7d9 Add check for existing config file. Addresses BUKKIT-1851 2012-06-28 16:39:19 -05:00
Wesley Wolfe
ae4f1c05d8 Revert "Shift plugin initialization; Addresses BUKKIT-1788"
This reverts commit 27cb5e7c9c. Issues
were discovered with shared class loaders.
2012-06-16 00:48:47 -05:00
Wesley Wolfe
27cb5e7c9c Shift plugin initialization; Addresses BUKKIT-1788 2012-06-15 23:48:09 -05:00
Wesley Wolfe
4ebefa5b3a Support asynchronous events; Addresses BUKKIT-1212 2012-06-13 23:01:03 -05:00
feildmaster
537138e9b2 Javadoc updates
Fixes BUKKIT-1653, Fixes BUKKIT-1383 and Fixes BUKKIT-1644
2012-06-03 05:40:54 -05:00
Wesley Wolfe
fbdceefaa7 Change logger references to explicitly use plugin logger 2012-05-26 14:33:27 -05:00
Wesley Wolfe
6807c05321 Reverse disable order; Addresses BUKKIT-1389 2012-05-26 01:28:51 -05:00
Wesley Wolfe
30545e1a50 Make class loader preference predictable; Fixes BUKKIT-1591 2012-05-25 15:47:39 -05:00
Wesley Wolfe
adbf20a289 [Bleeding] Fixed soft-dependencies broken by previous commit. 2012-03-22 03:12:00 -04:00
Wesley Wolfe
ad78b17c6e [Bleeding] Added loadbefore property; Addresses BUKKIT-843 2012-03-21 15:44:43 -04:00
Wesley Wolfe
eef1fd0ca4 [Bleeding] Lazily calculate permissions. Addresses BUKKIT-1122 2012-03-15 06:46:02 -04:00
Wesley Wolfe
1ae1f72235 [Bleeding] More lenient command creation from plugin.yml. Fixes BUKKIT-1093 2012-03-15 06:45:44 -04:00
Wesley Wolfe
31876058a4 [Bleeding] Fixed naughty plugins crashing server. 2012-03-01 10:36:07 -05:00
Celtic Minstrel
17403d617a Fix javadoc errors/warnings 2012-02-29 21:31:28 -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
Aidan Matzko
ba3da3ac97 Add optional prefix value to plugin.yml. Addresses BUKKIT-838 2012-02-29 19:58:05 -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
Wesley Wolfe
a60a7b6bf7 [Bleeding] Fixes deadlock issue and generic usage. Fixes BUKKIT-844 and fixes BUKKIT-854 2012-02-29 09:50:03 -05:00
TomyLobo
6c7fb871c5 Event system optimizations. Addresses BUKKIT-813
- Made the handlers field a simple array instead of an array of arrays.
- Got rid of the "baked" field.
2012-02-28 21:57:16 -05:00
EdGruberman
cf2b0b5247 Adjust plugin enable/disable logging 2012-02-26 15:45:17 -05:00
zml2008
e891176aa7 Added service register and unregister events. Addresses BUKKIT-816 2012-02-26 12:15:36 -05:00
Wesley Wolfe
a294e9c246 [Bleeding] Exception cleanup. Addresses BUKKIT-774 2012-02-18 23:55:35 -05:00
Wesley Wolfe
f8804423bf [Bleeding] Skip InvocationTargetException. Addresses BUKKIT-774 2012-02-18 23:54:57 -05:00
Erik Broes
7a06777e19 Deprecation cleanup. 2012-02-18 13:05:58 -05:00
Wesley Wolfe
5cdc3b3600 [Bleeding] Update serialVersionUID. 2012-02-13 02:42:05 -05:00
Feildmaster
c098ea4b56 [Bleeding] Added ability to register and listen to SubEvents. Addresses
BUKKIT-585
2012-02-13 01:08:15 -05:00
Zeerix
622399fa17 [Bleeding] Cleanup of exceptions org.bukkit.plugin.Invalid*
Removed throwable and message, because the superclass already stores them
Added message of inner exception to the outer exception to make the first line of the stacktrace more verbose
2012-02-13 01:05:18 -05:00
md_5
4c8cd25d91 [Bleeding] Add the ability for plugins to ignore cancelled events when
using the new event system.
2012-02-09 15:51:56 -05:00
Meaglin
c05887b956 Properly unregister plugin channels when a plugin gets disabled. 2012-02-09 03:49:51 -05:00
Nathan Adams
94e561ce50 onEnable and onDisable are no longer required implementations for JavaPlugins 2012-02-01 01:53:56 +00:00
EvilSeph
0a0fee8be2 Fixed plugin loader. Thanks Wolvereness! 2012-01-25 04:11:37 -05:00
Tahg
53261190cf Updated timing code for new event system 2012-01-19 18:41:04 -05:00
Nathan Adams
c82666738f Added new PlayerExpChangeEvent and PlayerLevelChangeEvent events. Thanks to feildmaster for the PR. 2012-01-19 16:07:03 +00:00
Erik Broes
792d2601e6 Use the type of the eventhandler method's parameter as type rather than specificing it. Thanks zml2008. 2012-01-19 08:13:49 +01:00
zml2008
a4ff34607b Added a default to EventHandler.priority()
Fixed HandlerList.unregisterAll()
Fixed incorrect isAssignableFrom check in SimplePluginManager.getRegistrationClass()
2012-01-18 14:46:15 +01:00
Erik Broes
0062c83d81 Minor cleanup 2012-01-17 19:51:27 +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
Erik Broes
eb9dc64493 Generic cleaning 2012-01-15 14:37:43 +01:00
Nathan Adams
78cc950c50 Added "class-loader-of" field to plugin.yml. Big thanks to CmdrDats for the PR. 2012-01-15 12:54:06 +00:00
Nathan Adams
b2364780cb Added an EntityCreatePortalEvent 2012-01-15 11:58:03 +00:00
Feildmaster
ec2ccae979 Don't send events to disabled plugins. 2012-01-15 08:18:44 +00:00