-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BuildTools
committed
Jun 4, 2019
1 parent
df33eab
commit cc2ae8e
Showing
18 changed files
with
1,629 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: skript-nms | ||
author: FurkannM | ||
description: A Skript addon for NMS stuff | ||
version: 0.1.2 | ||
version: 0.1.4 | ||
main: com.furkannm.skriptnms.SkriptNMS | ||
depend: [Skript] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/com/furkannm/skriptnms/nms/versions/reflection/NBTClassInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.furkannm.skriptnms.nms.versions.reflection; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import com.furkannm.skriptnms.SkriptNMS; | ||
import com.furkannm.skriptnms.nms.NMSClasses; | ||
|
||
import ch.njol.skript.classes.ClassInfo; | ||
import ch.njol.skript.classes.Parser; | ||
import ch.njol.skript.lang.ParseContext; | ||
|
||
public class NBTClassInfo<N extends NMSClasses> { | ||
|
||
private Class<N> c; | ||
private String codeName; | ||
private String[] users; | ||
|
||
public NBTClassInfo(Class<N> c, String codeName, String... users) { | ||
this.c = c; | ||
this.codeName = codeName; | ||
this.users = users; | ||
} | ||
|
||
public ClassInfo<N> getClassInfo() { | ||
return new ClassInfo<>(c, codeName) | ||
.user(users) | ||
.name("NBT Compound") | ||
.since("0.1.3") | ||
.parser(getParser()); | ||
} | ||
|
||
public Parser<N> getParser() { | ||
return new Parser<N>() { | ||
|
||
@Override | ||
public String getVariableNamePattern() { | ||
return ".+"; | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
@Nullable | ||
public N parse(String s, ParseContext context) { | ||
if (s.startsWith("nbt:{") && s.endsWith("}")) { | ||
N nbt = (N) SkriptNMS.getNMS().parseRawNBT(s.substring(4)); | ||
return nbt; | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public String toString(N n, int arg1) { | ||
return n.toString(); | ||
} | ||
|
||
@Override | ||
public String toVariableNameString(N n) { | ||
return n.toString(); | ||
} | ||
|
||
}; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.