Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Asleeepp committed Mar 31, 2024
0 parents commit 6291076
Show file tree
Hide file tree
Showing 28 changed files with 1,616 additions and 0 deletions.
118 changes: 118 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

.gradle
build/

# Ignore Gradle GUI config
gradle-app.setting

# Cache of project
.gradletasknamecache

**/build/

# Common working directory
run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
95 changes: 95 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import org.apache.tools.ant.filters.ReplaceTokens

plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'eclipse'
id 'java'
}

compileJava.options.encoding = 'Cp1252'
compileTestJava.options.encoding = 'Cp1252'

compileJava {
sourceCompatibility = '1.17'
targetCompatibility = '1.17'
}

group = 'me.Asleepp'
version = '1.0'

repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}

// Skript
maven {
name = "Skript"
url = 'https://repo.skriptlang.org/releases'
}
// Oraxen
maven {
name = "Oraxen"
url = "https://repo.oraxen.com/releases"

}
}

dependencies {
compileOnly "io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT"
compileOnly (group: 'com.github.SkriptLang', name: 'Skript', version: '2.7.1') {
transitive = false
}
compileOnly 'io.th0rgal:oraxen:1.170.0'

}

def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'

if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}

build {
dependsOn(shadowJar)
tasks.withType(JavaCompile).tap {
configureEach {
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-Xlint:deprecation")
}
}
}

processResources {
filter ReplaceTokens, tokens: ["version": project.version]
}


shadowJar {
dependencies {
include(dependency('org.bstats:bstats-bukkit'))
include(dependency('org.bstats:bstats-base'))
}
relocate 'org.bstats', 'me.asleepp.skriptoraxen.bstats'
configurations = [project.configurations.shadow]
archiveVersion = project.property("version")
minimize()
}
Empty file added gradle.properties
Empty file.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'skript-oraxen'
70 changes: 70 additions & 0 deletions src/main/java/me/asleepp/skriptoraxen/SkriptOraxen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package me.asleepp.skriptoraxen;

import java.io.IOException;


import ch.njol.skript.bstats.bukkit.Metrics;
import ch.njol.skript.util.Version;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import ch.njol.skript.Skript;
import ch.njol.skript.SkriptAddon;

import javax.annotation.Nullable;

@SuppressWarnings("ALL")
public class SkriptOraxen extends JavaPlugin {

private static SkriptAddon addon;

private static SkriptOraxen instance;

@Nullable
public static SkriptOraxen getInstance() {
return instance;
}
@Nullable
public static SkriptAddon getAddonInstance() {
return addon;
}


public void onEnable() {
// Let's get this show on the road.
final PluginManager manager = this.getServer().getPluginManager();
final Plugin skript = manager.getPlugin("Skript");
if (skript == null || !skript.isEnabled()) {
getLogger().severe("Could not find Skript! Disabling...");
manager.disablePlugin(this);
return;
} else if (Skript.getVersion().compareTo(new Version(2, 7, 0)) < 0) {
getLogger().warning("You are running an unsupported version of Skript. Disabling...");
manager.disablePlugin(this);
return;
}
final Plugin oraxen = manager.getPlugin("Oraxen");
if (oraxen == null || !oraxen.isEnabled()) {
getLogger().severe("Could not find Oraxen! Disabling...");
manager.disablePlugin(this);
return;
}
int pluginId = 21274;
Metrics metrics = new Metrics(this, pluginId);
instance = this;
addon = Skript.registerAddon(this);
addon.setLanguageFileDirectory("lang");
try {
addon.loadClasses("me.asleepp.skriptoraxen");
} catch (IOException error) {
error.printStackTrace();
manager.disablePlugin(this);
return;
}


}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package me.asleepp.skriptoraxen.elements.conditions;

import ch.njol.skript.Skript;
import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Examples;
import ch.njol.skript.doc.Name;
import ch.njol.skript.lang.Condition;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.util.Kleenean;
import io.th0rgal.oraxen.api.OraxenBlocks;
import org.bukkit.block.Block;
import org.bukkit.event.Event;

import javax.annotation.Nullable;
@Name("Is Oraxen Block")
@Description({"Checks if the block is an Oraxen block."})
@Examples({
"on break:",
"\tif event-block is a custom block",
"\t\tsend \"you killed my pet block :(\" to player"})
public class CondIsCustomBlock extends Condition {
private Expression<Block> block;

static {
Skript.registerCondition(CondIsCustomBlock.class,"%blocks% (is [a[n]]|are) (custom|oraxen) block[s]");
}

@Override
public boolean check(Event e) {
Block[] blocks = block.getArray(e);
if (blocks == null) {
return false;
}

for (Block b : blocks) {
if (OraxenBlocks.isOraxenBlock(b)) {
return true;
}
}
return false;
}
@Override
public String toString(@Nullable Event e, boolean debug) {
return block.toString(e, debug) + " is an Oraxen block";
}

@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
block = (Expression<Block>) exprs[0];
return true;
}
}
Loading

0 comments on commit 6291076

Please sign in to comment.