Skip to content

Commit

Permalink
Revert "Update to 1.0-beta-3d"
Browse files Browse the repository at this point in the history
  • Loading branch information
Picono435 authored Aug 21, 2021
1 parent 618fc99 commit b0c4350
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 83 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/unofficial-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

name: Unofficial Builds

on: workflow_dispatch
on: pull_request

jobs:
build-java16:
Expand All @@ -23,6 +23,8 @@ jobs:
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: build/test-results/**/*.xml
Expand All @@ -44,6 +46,8 @@ jobs:
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: build/test-results/**/*.xml
Expand All @@ -65,6 +69,8 @@ jobs:
run: ./gradlew test
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: build/test-results/**/*.xml
Expand Down
86 changes: 26 additions & 60 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ buildscript {

plugins {
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'io.github.slimjar' version '1.3.0'
id 'io.github.slimjar' version '1.2.1'
id 'java'
id 'maven-publish'
id 'net.nemerosa.versioning' version '2.14.0'
}

Expand All @@ -23,7 +22,7 @@ targetCompatibility = '1.8'
versioning {
releaseMode = { nextTag, lastTag, currentTag, extension ->
"1.0-beta-3c"
} as Object
}
}

if (System.getenv("STABLE_BUILD") != null) {
Expand All @@ -39,6 +38,10 @@ if (System.getenv("STABLE_BUILD") != null) {
repositories {
mavenCentral()

maven {
url = 'https://jcenter.bintray.com'
}

maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
Expand All @@ -58,53 +61,42 @@ repositories {
maven {
url = 'https://repo.codemc.org/repository/maven-public'
}

maven {
url = 'https://repo.rosewooddev.io/repository/public/'
}

maven {
url = 'https://repo.vshnv.tech/'
}

mavenLocal()
}

dependencies {
// Spigot
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
// Storage Methods
slim 'org.mongodb:mongodb-driver-sync:4.3.1'
slim 'org.mongodb:mongodb-driver-sync:4.2.3'
slim 'com.zaxxer:HikariCP:4.0.3'
slim 'com.h2database:h2:1.4.200'
slim 'org.xerial:sqlite-jdbc:3.36.0.1'
slim 'org.mariadb.jdbc:mariadb-java-client:2.7.4'
slim 'mysql:mysql-connector-java:8.0.26'
implementation 'org.spongepowered:configurate-core:4.1.2'
implementation 'org.spongepowered:configurate-gson:4.1.2'
implementation 'org.spongepowered:configurate-yaml:4.1.2'
implementation 'org.spongepowered:configurate-hocon:4.1.2'
slim 'org.mariadb.jdbc:mariadb-java-client:2.7.3'
slim 'mysql:mysql-connector-java:8.0.25'
implementation 'org.spongepowered:configurate-core:4.1.1'
implementation 'org.spongepowered:configurate-gson:4.1.1'
implementation 'org.spongepowered:configurate-yaml:4.1.1'
implementation 'org.spongepowered:configurate-hocon:4.1.1'
// Plugins API
compileOnly('me.clip:placeholderapi:2.10.10') { transitive = false }
compileOnly('com.github.MilkBowl:VaultAPI:1.7.1') { transitive = false }
compileOnly('org.black_ixx:playerpoints:3.0.3') { transitive = false }
compileOnly('me.clip:placeholderapi:2.10.9') { transitive = false }
compileOnly('com.github.MilkBowl:VaultAPI:1.7') { transitive = false }
compileOnly('com.github.Mitsugaru:PlayerPoints:master-SNAPSHOT') { transitive = false }
compileOnly('com.github.Realizedd:TokenManager:3.2.4') { transitive = false }
// Other libraries
implementation 'com.github.mkremins:fanciful:18dc039f5b'
slim 'com.fasterxml.jackson.core:jackson-databind:2.12.4'
slim 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.4'
implementation 'org.apache.maven:maven-artifact:3.8.2'
slim 'com.fasterxml.jackson.core:jackson-databind:2.12.3'
slim 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.3'
implementation 'org.apache.maven:maven-artifact:3.8.1'
implementation 'org.bstats:bstats-bukkit:2.2.1'
slim 'org.slf4j:slf4j-simple:1.7.32'
slim 'org.slf4j:slf4j-api:1.7.32'
testImplementation 'com.github.seeseemelk:MockBukkit-v1.16:1.5.0'
slim 'org.slf4j:slf4j-simple:1.7.31'
slim 'org.slf4j:slf4j-api:1.7.31'
testImplementation 'com.github.seeseemelk:MockBukkit-v1.16:1.3.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
testCompileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
testCompileOnly('me.clip:placeholderapi:2.10.10') { transitive = false }
testCompileOnly 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
testCompileOnly('me.clip:placeholderapi:2.10.9') { transitive = false }
testCompileOnly('com.github.MilkBowl:VaultAPI:1.7') { transitive = false }
testCompileOnly('org.black_ixx:playerpoints:3.0.3') { transitive = false }
testCompileOnly('com.github.Mitsugaru:PlayerPoints:master-SNAPSHOT') { transitive = false }
testCompileOnly('com.github.Realizedd:TokenManager:3.2.4') { transitive = false }
implementation slimjar("1.2.5")
}

test {
Expand All @@ -127,29 +119,3 @@ processResources {
rootProject.tasks.named("processResources") {
duplicatesStrategy = 'include'
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
repositories {
mavenLocal()
}
}
8 changes: 1 addition & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
slimjar.version = 1.2.3
systemProp.http.proxyHost=
systemProp.http.proxyPort=
systemProp.http.nonProxyHosts=
systemProp.https.proxyHost=
systemProp.https.proxyPort=
systemProp.https.nonProxyHosts=
slimjar.version = 1.2.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MSYS* | MINGW* )
MINGW* )
msys=true
;;
NONSTOP* )
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/com/gmail/picono435/picojobs/PicoJobsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ public void onEnable() {

// SETTING UP AND REQUIRED AND OPTIONAL DEPENDENCIES
PicoJobsAPI.registerEconomy(new ExpImplementation());
VaultHook.setupVault();
PlayerPointsHook.setupPlayerPoints();
PicoJobsAPI.registerEconomy(new TokenManagerImplementation());
PlaceholderAPIHook.setupPlaceholderAPI();
new BukkitRunnable() {
public void run() {
VaultHook.setupVault();
Bukkit.getConsoleSender().sendMessage("[PicoJobs] " + economies.size() + " " + ChatColor.GREEN + "economy implementations successfully registered!");
}
}.runTaskLater(this, 1L);
Expand Down Expand Up @@ -208,13 +208,21 @@ public void sendConsoleMessage(Level level, String message) {
public boolean isNewerThan(String version) {
DefaultArtifactVersion legacyVersion = new DefaultArtifactVersion(version);
DefaultArtifactVersion serverVersionArt = new DefaultArtifactVersion(serverVersion);
return serverVersionArt.compareTo(legacyVersion) >= 0;
if(legacyVersion.compareTo(serverVersionArt) >= 0) {
return true;
} else {
return false;
}
}

public boolean isOlderThan(String version) {
DefaultArtifactVersion legacyVersion = new DefaultArtifactVersion(version);
DefaultArtifactVersion serverVersionArt = new DefaultArtifactVersion(serverVersion);
return serverVersionArt.compareTo(legacyVersion) <= 0;
if(legacyVersion.compareTo(serverVersionArt) <= 0) {
return true;
} else {
return false;
}
}

public boolean isOldVersion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.black_ixx.playerpoints.PlayerPoints;
import org.black_ixx.playerpoints.PlayerPointsAPI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

import com.gmail.picono435.picojobs.api.PicoJobsAPI;
import com.gmail.picono435.picojobs.hooks.economy.PointsImplementation;
Expand All @@ -25,8 +26,10 @@ public static boolean isEnabled() {
return isEnabled;
}

private static void hookPlayerPoints() {
playerPoints = PlayerPoints.getInstance();
private static boolean hookPlayerPoints() {
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("PlayerPoints");
playerPoints = PlayerPoints.class.cast(plugin);
return playerPoints != null;
}

public static PlayerPointsAPI getPlayerPointsAPI() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public double getBalance(Player player) {

@Override
public void deposit(Player player, double amount) {
PlayerPointsHook.getPlayerPointsAPI().giveAsync(player.getUniqueId(), (int)amount);
PlayerPointsHook.getPlayerPointsAPI().give(player.getUniqueId(), (int)amount);
}

@Override
public void withdraw(Player player, double amount) {
PlayerPointsHook.getPlayerPointsAPI().takeAsync(player.getUniqueId(), (int)amount);
PlayerPointsHook.getPlayerPointsAPI().take(player.getUniqueId(), (int)amount);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public void onBasicClick(InventoryClickEvent e) {
if(System.currentTimeMillis() >= a1) {
JobsCommand.salaryCooldown.remove(p.getUniqueId());
} else {
p.sendMessage(LanguageManager.getMessage("salary-cooldown", p)
.replace("%cooldown_mtime%", TimeFormatter.formatTimeInMinecraft(a1 - System.currentTimeMillis()))
.replace("%cooldown_time%", TimeFormatter.formatTimeInRealLife(a1 - System.currentTimeMillis())));
p.sendMessage(LanguageManager.getMessage("salary-cooldown", p).replace("%cooldown_mtime%", TimeFormatter.formatTimeInMinecraft(a1 - System.currentTimeMillis()).replace("%cooldown_time%", TimeFormatter.formatTimeInRealLife(a1 - System.currentTimeMillis()))));
p.closeInventory();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ public class FillListener implements Listener {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFillBucket(PlayerBucketFillEvent e) {
if(e.getPlayer() == null) return;
Block b = e.getBlockClicked();
if(PicoJobsPlugin.getInstance().isNewerThan("1.17")) {
if(!b.isLiquid() && b.getType() == Material.POWDER_SNOW) return;
if(!PicoJobsPlugin.getInstance().isNewerThan("1.17")) {
if(b == null || (!b.isLiquid())) return;
} else {
if(!b.isLiquid()) return;
if(b == null || (!b.isLiquid() && b.getType() == Material.POWDER_SNOW)) return;
}
Player p = e.getPlayer();
JobPlayer jp = PicoJobsAPI.getPlayersManager().getJobPlayer(p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MilkListener implements Listener {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTakeMilk(PlayerBucketFillEvent e) {
if(e.getPlayer() == null) return;
Block b = e.getBlockClicked();
if(b.isLiquid()) return;
Player p = e.getPlayer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ public class SmeltListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCraftItem(InventoryClickEvent e) {
if(e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR) return;
if(PicoJobsPlugin.getInstance().isNewerThan("1.14")) {
if(!PicoJobsPlugin.getInstance().isNewerThan("1.14")) {
if(e.getInventory().getType() != InventoryType.FURNACE && e.getInventory().getType() != InventoryType.valueOf("BLAST_FURNACE") && e.getInventory().getType() != InventoryType.valueOf("SMOKER")) return;
} else {
if(e.getInventory().getType() != InventoryType.FURNACE) return;
}
if(e.getSlotType() != SlotType.RESULT) return;
if(e.getWhoClicked() == null) return;
Player p = (Player) e.getWhoClicked();
JobPlayer jp = PicoJobsAPI.getPlayersManager().getJobPlayer(p);
if(!jp.hasJob()) return;
Expand Down

0 comments on commit b0c4350

Please sign in to comment.