tidy up variable names
This commit is contained in:
parent
03220a03e8
commit
db51bdc57e
1 changed files with 18 additions and 24 deletions
|
@ -1,4 +1,3 @@
|
||||||
var global = this;
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
events Module
|
events Module
|
||||||
=============
|
=============
|
||||||
|
@ -88,35 +87,35 @@ 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)
|
||||||
|
@ -125,15 +124,10 @@ var events = events || {
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
__plugin
|
listener.reg = new bkRegListener( __plugin, eventExecutor, priority, __plugin, true);
|
||||||
,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));
|
||||||
|
|
Reference in a new issue