Skip to content

Commit

Permalink
Merge pull request #3 from sarhatabaot/dev/1.14
Browse files Browse the repository at this point in the history
* Version 1.5.4
* Added Shop reload message.
* Now properly shading bStats.
* Added a show per item feature - will only show available enchantments for an item.
* Added @NotNull annotations.
* Added customizable shop.yml file - You can also customize the back item.
  • Loading branch information
sarhatabaot authored Jun 6, 2019
2 parents 4556993 + 15cb51a commit 1373661
Show file tree
Hide file tree
Showing 17 changed files with 358 additions and 796 deletions.
39 changes: 33 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
group 'Tychsen.me'
version '1.5.2'
plugins {
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'java'
}

group = 'me.tychsen'
version = '1.5.4'

apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
Expand All @@ -17,13 +23,34 @@ repositories {
name = "bungeecord-chat"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
name = "codemc-repo"
url = "https://repo.codemc.org/repository/maven-public"
}
}

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.13.1-R0.1-SNAPSHOT'
compile "net.milkbowl.vault:VaultAPI:1.7"
implementation "org.spigotmc:spigot-api:1.14.2-R0.1-SNAPSHOT"
implementation "net.milkbowl.vault:VaultAPI:1.7"
compile "org.bstats:bstats-bukkit:1.5"
compile group: 'org.jetbrains', name: 'annotations', version: '16.0.1'

}

import org.apache.tools.ant.filters.ReplaceTokens

processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}

shadowJar {
classifier = ""
configurations = [project.configurations.compile]
relocate 'org.bstats', 'me.tychsen.enchantgui.util'
}

wrapper {
gradleVersion = "5.1.1"
gradleVersion = "5.4.1"
}
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Jan 12 12:18:44 IST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
25 changes: 14 additions & 11 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
Expand Down Expand Up @@ -28,16 +28,16 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -154,16 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
34 changes: 30 additions & 4 deletions src/main/java/me/tychsen/enchantgui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@
import me.tychsen.enchantgui.config.EshopConfig;
import me.tychsen.enchantgui.event.EventManager;
import me.tychsen.enchantgui.menu.DefaultMenuSystem;
import org.bukkit.Bukkit;
import net.milkbowl.vault.economy.Economy;
import org.bstats.bukkit.Metrics;
import org.bukkit.event.Listener;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {
private static Main instance;
private static Economy econ = null;

@Override
public void onEnable() {
instance = this;
if (!setupEconomy()) {
getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
getLogger().info("Loading configs and stuff...");

// Generate config.yml if there is none
Expand All @@ -27,12 +35,30 @@ public void onEnable() {

// Enable Metrics
Metrics metrics = new Metrics(this);
getLogger().info(getName() + " " + getDescription().getVersion() + "enabled!");
}

public static void debug(String msg) {
if (EshopConfig.getInstance().getDebug())
Main.getInstance().getLogger().warning(String.format("\u001B[33m" + "DEBUG %s \u001B[0m", msg));
}

private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
getLogger().severe("could not find vault");
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
getLogger().severe("could not find Economy.class");
return false;
}
econ = rsp.getProvider();
return econ != null;
}

public static void debug(String msg){
if(EshopConfig.getInstance().getDebug())
Bukkit.getPluginManager().getPlugin("EnchantGUI").getLogger().warning("\u001B[33m"+"[DEBUG] "+msg+"\u001B[0m");
public static Economy getEconomy() {
return econ;
}

public static Main getInstance() {
Expand Down
Loading

0 comments on commit 1373661

Please sign in to comment.