mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-08-21 11:54:32 +00:00
base js expansion
This commit is contained in:
parent
75b652b86a
commit
3f63d4ed6e
7
build.gradle
Normal file
7
build.gradle
Normal file
@ -0,0 +1,7 @@
|
||||
dependencies {
|
||||
compileOnly project(":api")
|
||||
|
||||
implementation 'com.eclipsesource.j2v8:j2v8_linux_x86_64:4.6.0'
|
||||
implementation 'com.eclipsesource.j2v8:j2v8_win32_x86_64:4.6.0'
|
||||
implementation 'com.eclipsesource.j2v8:j2v8_macosx_x86_64:4.6.0'
|
||||
}
|
66
pom.xml
66
pom.xml
@ -1,66 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.extendedclip.papi.expansion.javascript</groupId>
|
||||
<artifactId>javascript-expansion</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<name>PAPI-Expansion-Javascript</name>
|
||||
<description>PlaceholderAPI expansion for javascript placeholders</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.10.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<finalName>${name}</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<target>1.8</target>
|
||||
<source>1.8</source>
|
||||
<encoding>UTF-8</encoding>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,30 @@
|
||||
package at.helpch.placeholderapi.expansion.javascript;
|
||||
|
||||
import at.helpch.placeholderapi.api.expansion.Expansion;
|
||||
import at.helpch.placeholderapi.api.expansion.ExpansionDescription;
|
||||
import at.helpch.placeholderapi.api.expansion.Platform;
|
||||
import at.helpch.placeholderapi.api.expansion.placeholder.Placeholder;
|
||||
import com.eclipsesource.v8.V8;
|
||||
|
||||
// ------------------------------
|
||||
// Copyright (c) PiggyPiglet 2021
|
||||
// https://www.piggypiglet.me
|
||||
// ------------------------------
|
||||
@ExpansionDescription(
|
||||
name = "Javascript",
|
||||
version = "1.0.0",
|
||||
identifier = "javascript",
|
||||
authors = "HelpChat",
|
||||
platforms = {Platform.BUKKIT, Platform.SPONGE, Platform.NUKKIT}
|
||||
)
|
||||
public final class JavascriptExpansion extends Expansion {
|
||||
private static final String JAVASCRIPT = "5+5";
|
||||
|
||||
@Placeholder("")
|
||||
public Object parse() {
|
||||
final V8 runtime = V8.createV8Runtime();
|
||||
final Object value = runtime.executeScript(JAVASCRIPT);
|
||||
runtime.release();
|
||||
return value;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user