Skip to content

Commit

Permalink
Add get_bars()
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Feb 12, 2018
1 parent eb5f684 commit d249200
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/main/java/com/laytonsmith/core/functions/BossBar.java
Expand Up @@ -56,6 +56,40 @@ public Version since() {
}
}

@api
public static class get_bars extends BossBarFunction {

@Override
public String getName() {
return "get_bars";
}

@Override
public String docs() {
return "array {} Gets an array of boss bar ids currently in use.";
}

@Override
public Integer[] numArgs() {
return new Integer[]{0};
}

@Override
public Construct exec(Target t, Environment env, Construct... args) throws ConfigRuntimeException {
CArray ca = new CArray(t);
for(String id : bars.keySet()) {
ca.push(new CString(id, t), t);
}
return ca;
}

@Override
public Class<? extends CREThrowable>[] thrown() {
return new Class[]{};
}

}

@api
public static class create_bar extends BossBarFunction {

Expand Down

0 comments on commit d249200

Please sign in to comment.