tidy up variable names

This commit is contained in:
walterhiggins 2013-12-15 21:27:48 +00:00
parent 03220a03e8
commit db51bdc57e

View file

@ -1,4 +1,3 @@
var global = this;
/************************************************************************ /************************************************************************
events Module events Module
============= =============
@ -88,52 +87,47 @@ var events = events || {
// //
// private implementation from here on in... // private implementation from here on in...
// //
(function(){ (function(events){
if (events._eventsLoaded){ if (events._eventsLoaded){
return; return;
} }
var _event = org.bukkit.event; var bkEvent = org.bukkit.event;
var _plugin = org.bukkit.plugin; var bkEvtExecutor = org.bukkit.plugin.EventExecutor;
var bkRegListener = org.bukkit.plugin.RegisteredListener;
var _on = function(eventType, handler, priority) var _on = function(eventType, handler, priority)
{ {
if (typeof priority == "undefined"){ if (typeof priority == "undefined"){
priority = _event.EventPriority.HIGHEST; priority = bkEvent.EventPriority.HIGHEST;
}else{ }else{
priority = _event.EventPriority[priority]; priority = bkEvent.EventPriority[priority];
} }
if (typeof eventType == "string"){ if (typeof eventType == "string"){
var subPkgs = eventType.split('.'); var subPkgs = eventType.split('.');
eventType = _event[subPkgs[0]]; eventType = bkEvent[subPkgs[0]];
for (var i = 1;i < subPkgs.length; i++){ for (var i = 1;i < subPkgs.length; i++){
eventType = eventType[subPkgs[i]]; eventType = eventType[subPkgs[i]];
} }
} }
var handlerList = eventType.getHandlerList(); var handlerList = eventType.getHandlerList();
var listener = {}; var listener = {};
var eventExecutor = new _plugin.EventExecutor(){ var eventExecutor = new bkEvtExecutor(){
execute: function(l,e){ execute: function(l,e){
handler(listener.reg,e); handler(listener.reg,e);
} }
}; };
listener.reg = new _plugin.RegisteredListener( /*
/* wph 20130222 issue #64 bad interaction with Essentials plugin
wph 20130222 issue #64 bad interaction with Essentials plugin if another plugin tries to unregister a Listener (not a Plugin or a RegisteredListener)
if another plugin tries to unregister a Listener (not a Plugin or a RegisteredListener) then BOOM! the other plugin will throw an error because Rhino can't coerce an
then BOOM! the other plugin will throw an error because Rhino can't coerce an equals() method from an Interface.
equals() method from an Interface. The workaround is to make the ScriptCraftPlugin java class a Listener.
The workaround is to make the ScriptCraftPlugin java class a Listener. Should only unregister() registered plugins in ScriptCraft js code.
Should only unregister() registered plugins in ScriptCraft js code. */
*/ listener.reg = new bkRegListener( __plugin, eventExecutor, priority, __plugin, true);
__plugin
,eventExecutor
,priority
,__plugin
,true
)
handlerList.register(listener.reg); handlerList.register(listener.reg);
return listener.reg; return listener.reg;
}; };
events.on = _on; events.on = _on;
events._eventsLoaded = true; events._eventsLoaded = true;
}()); }(events));