mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
remove function test in evalCondition : a condition is now never a function
This commit is contained in:
parent
a1ec6138b7
commit
ffa11996c4
1 changed files with 6 additions and 15 deletions
|
@ -119,23 +119,14 @@ for (var n in entityMetadataTypes) {
|
|||
entityMetadataTypeBytes[entityMetadataTypes[n].type] = n;
|
||||
}
|
||||
|
||||
function isFunction(functionToCheck) {
|
||||
var getType = {};
|
||||
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
||||
}
|
||||
|
||||
function evalCondition(condition,field_values)
|
||||
{
|
||||
if(!isFunction(condition))
|
||||
{
|
||||
var field_value_to_test="this" in condition && condition["this"] ? field_values["this"][condition.field] : field_values[condition.field];
|
||||
var b=condition.values.some(function(value) {return field_value_to_test===value;});
|
||||
if("different" in condition && condition["different"])
|
||||
return !b;
|
||||
else
|
||||
return b;
|
||||
}
|
||||
return condition(field_values);
|
||||
var field_value_to_test="this" in condition && condition["this"] ? field_values["this"][condition.field] : field_values[condition.field];
|
||||
var b=condition.values.some(function(value) {return field_value_to_test===value;});
|
||||
if("different" in condition && condition["different"])
|
||||
return !b;
|
||||
else
|
||||
return b;
|
||||
}
|
||||
|
||||
function sizeOfEntityMetadata(value) {
|
||||
|
|
Loading…
Reference in a new issue