-
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
Furkan Mercimek
committed
Sep 18, 2018
1 parent
04f1ede
commit f845bd6
Showing
27 changed files
with
399 additions
and
232 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.0.1 | ||
version: 0.1.0 | ||
main: com.furkannm.skriptnms.Core | ||
softdepend: [Skript] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,80 @@ | ||
package com.furkannm.skriptnms; | ||
|
||
import java.io.IOException; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.ExpressionType; | ||
import com.furkannm.skriptnms.util.nms.NMSClasses; | ||
import com.furkannm.skriptnms.util.nms.types.*; | ||
|
||
import com.furkannm.skriptnms.effects.EffLoadDat; | ||
import com.furkannm.skriptnms.expressions.ExprFileNbt; | ||
import com.furkannm.skriptnms.expressions.ExprNBTOf; | ||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.SkriptAddon; | ||
|
||
public class Core extends JavaPlugin{ | ||
static String ver; | ||
private static String ver; | ||
private static Core instance; | ||
private static SkriptAddon addonInstance; | ||
|
||
public Core() { | ||
if(instance == null) { | ||
instance = this; | ||
}else{ | ||
throw new IllegalStateException(); | ||
} | ||
} | ||
|
||
@Override | ||
public void onEnable() { | ||
if (Bukkit.getPluginManager().getPlugin("Skript") != null && Skript.isAcceptRegistrations()) { | ||
Skript.registerExpression(ExprNBTOf.class, Object.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %~object%", "%~object%'s nbt[[ ]tag[s]]"); | ||
Skript.registerExpression(ExprFileNbt.class, Object.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] from [file] %string%", "nbt[[ ]tag[s]] from last loaded [dat ]file", "last loaded [dat ]file's nbt[[ ]tag[s]]"); | ||
Skript.registerEffect(EffLoadDat.class, "load nbt[[ ]tag[s]] from [file] %string%","load %string%'s nbt[[ ]tag[s]]"); | ||
getLogger().info("Skript-NMS is started!"); | ||
ver = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; | ||
}else { | ||
getLogger().info("Unable to find Skript or Skript isn't accepting registrations, disabling skript-nms..."); | ||
Bukkit.getPluginManager().disablePlugin(this); | ||
getLogger().info("Skript-NMS is started!"); | ||
ver = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; | ||
try { | ||
getAddonInstance().loadClasses("com.furkannm.skriptnms", "effects", "expressions"); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
loadClass(); | ||
NMSClasses.loadClasses(); | ||
} | ||
|
||
public static SkriptAddon getAddonInstance() { | ||
if(addonInstance == null) { | ||
addonInstance = Skript.registerAddon(getInstance()); | ||
} | ||
return addonInstance; | ||
} | ||
|
||
public static Core getInstance() { | ||
if(instance == null) { | ||
throw new IllegalStateException(); | ||
} | ||
return instance; | ||
} | ||
|
||
public static String getVer() { | ||
return ver; | ||
} | ||
|
||
public static void loadClass() { | ||
new BlockPosition(); | ||
new CraftEntity(); | ||
new CraftItemStack(); | ||
new CraftWorld(); | ||
new Entity(); | ||
new IBlockData(); | ||
new ItemStack(); | ||
new MojangsonParser(); | ||
new NBTBase(); | ||
new NBTCompressedStreamTools(); | ||
new NBTTagByte(); | ||
new NBTTagCompound(); | ||
new NBTTagDouble(); | ||
new NBTTagFloat(); | ||
new NBTTagInt(); | ||
new NBTTagLong(); | ||
new NBTTagShort(); | ||
new NBTTagString(); | ||
new TileEntity(); | ||
new World(); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.