Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLimeGlass committed Jan 28, 2020
1 parent 8394d32 commit 1cfa1d1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lang/english.lang
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version: @version@
#@an makes the pattern allow for `an`.
types:
fadetype: fade type, fading type
soundcategory: sound category, sound categories
songplayer: song player, song players
funkysoundcategory: sound category, sound categories
funkysongplayer: song player, song players
positionsongplayer: position player, position players, position song player, position song players
noteblocksongplayer: note block song player, note block song players, note block player, note block players, noteblock song player, noteblock song players, noteblock player, noteblock players
layer: song layer, note layer, layer
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/me/limeglass/funky/elements/Register.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,26 @@ public class Register {

public Set<Class<?>> classes = new HashSet<>();
public Set<Class<?>> oldclasses = new HashSet<>();
private JarFile Stocksaddon;
private JarFile addon;

@SuppressWarnings({ "unchecked", "rawtypes" })
public Register() {
try {
Method method = JavaPlugin.class.getDeclaredMethod("getFile");
method.setAccessible(true);
File file = (File) method.invoke(FunkySk.getInstance());
Stocksaddon = new JarFile(file);
for (Enumeration<JarEntry> jarEntry = Stocksaddon.entries(); jarEntry.hasMoreElements();) {
addon = new JarFile(file);
for (Enumeration<JarEntry> jarEntry = addon.entries(); jarEntry.hasMoreElements();) {
String name = jarEntry.nextElement().getName().replace("/", ".");
if (!name.endsWith(".class"))
continue;
String className = name.substring(0, name.length() - 6);
className = className.replace('/', '.');
if (name.startsWith(FunkySk.getPackageName()) && name.endsWith(".class")) {
classes.add(Class.forName(className));
}
}
Stocksaddon.close();
addon.close();
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | IOException | ClassNotFoundException e1) {
e1.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
@Description("Returns the song currently playing in the song player(s).")
@Properties({"funkysongplayers", "(song|track|music)[s]", "{1}[(all [[of] the]|the)]"})
@PropertiesAddition("song[ ]player[s]")
@RegisterEnum("soundcategory")
@User("soundcategor(y|ies)")
@RegisterEnum("funkysoundcategory")
@User("funkysoundcategor(y|ies)")
@Changers(ChangeMode.SET)
public class ExprSongPlayerCategory extends FunkyPropertyExpression<SongPlayer, SoundCategory> {

Expand Down
14 changes: 11 additions & 3 deletions src/main/java/me/limeglass/funky/utils/TypeClassInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public T parse(String s, ParseContext parseContext){

public void register(){
if (Classes.getExactClassInfo(clazz) == null) {
Classes.registerClass(classInfo.user(codeName + "s?").defaultExpression(new EventValueExpression<>(clazz)).parser(new Parser<T>(){

classInfo.user(codeName + "s?").defaultExpression(new EventValueExpression<>(clazz)).parser(new Parser<T>(){
@Override
public String getVariableNamePattern() {
return codeName + ":.+";
Expand All @@ -48,6 +48,11 @@ public String getVariableNamePattern() {
public T parse(String s, ParseContext parseContext) {
return null;
}

@Override
public boolean canParse(ParseContext context) {
return false;
}

@Override
public String toString(T t, int i) {
Expand All @@ -57,7 +62,10 @@ public String toString(T t, int i) {
@Override
public String toVariableNameString(T t) {
return codeName + ':' + t.toString();
}}).serializeAs(clazz));
}}).serializeAs(clazz);
if (classInfo.getSerializer() == null)
classInfo.serializeAs(null);
Classes.registerClass(classInfo);
FunkySk.debugMessage("&5Registered Type '" + codeName + "' with return class " + clazz.getName());
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: FunkySk
author: LimeGlass
description: A Skript addon to get funky with NoteBlockAPI.
version: 1.0.1c
main: me.limeglass.funky.Funky
version: @version@
api-version: 1.13
main: me.limeglass.funky.FunkySk
depend: [Skript, NoteBlockAPI]

0 comments on commit 1cfa1d1

Please sign in to comment.