Mirror von
https://github.com/TheSilentPro/HeadDB.git
synchronisiert 2024-12-27 11:20:05 +01:00
Commit
bb61114cc2
36
.github/workflows/publish.yml
vendored
Normale Datei
36
.github/workflows/publish.yml
vendored
Normale Datei
@ -0,0 +1,36 @@
|
|||||||
|
name: Publish build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Upload build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: contains(github.event.head_commit.message, '[ci skip]') == false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v3.13.0
|
||||||
|
with:
|
||||||
|
distribution: 'adopt'
|
||||||
|
java-version: '17'
|
||||||
|
java-package: jdk
|
||||||
|
architecture: x64
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package
|
||||||
|
|
||||||
|
- name: Upload to Blob Builds
|
||||||
|
uses: WalshyDev/blob-builds/gh-action@main
|
||||||
|
with:
|
||||||
|
project: Slimefun4
|
||||||
|
releaseChannel: ${{ github.ref == 'refs/heads/release' && 'Release' || 'Dev' }}
|
||||||
|
apiToken: ${{ secrets.BUILDS_API_TOKEN }}
|
||||||
|
file: './target/HeadDB.jar'
|
||||||
|
releaseNotes: ${{ github.event.head_commit.message }}
|
@ -19,7 +19,6 @@ import java.io.BufferedReader;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
@ -71,6 +70,7 @@ public class HeadDB extends NexusPlugin {
|
|||||||
File langFile = new File(getDataFolder(), "langs.data");
|
File langFile = new File(getDataFolder(), "langs.data");
|
||||||
if (!langFile.exists()) {
|
if (!langFile.exists()) {
|
||||||
try {
|
try {
|
||||||
|
//noinspection ResultOfMethodCallIgnored
|
||||||
langFile.createNewFile();
|
langFile.createNewFile();
|
||||||
localization.saveLanguages(langFile);
|
localization.saveLanguages(langFile);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import tsp.headdb.core.util.Utils;
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@ -107,7 +108,7 @@ class Metrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void appendServiceData(JsonObjectBuilder builder) {
|
private void appendServiceData(JsonObjectBuilder builder) {
|
||||||
builder.appendField("pluginVersion", plugin.getDescription().getVersion());
|
builder.appendField("pluginVersion", Utils.getVersion().orElse("Unknown"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getPlayerAmount() {
|
private int getPlayerAmount() {
|
||||||
|
@ -2,6 +2,7 @@ package tsp.headdb.core.command;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import tsp.headdb.HeadDB;
|
import tsp.headdb.HeadDB;
|
||||||
|
import tsp.headdb.core.util.Utils;
|
||||||
import tsp.nexuslib.player.PlayerUtils;
|
import tsp.nexuslib.player.PlayerUtils;
|
||||||
|
|
||||||
public class CommandInfo extends SubCommand {
|
public class CommandInfo extends SubCommand {
|
||||||
@ -13,7 +14,7 @@ public class CommandInfo extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(CommandSender sender, String[] args) {
|
public void handle(CommandSender sender, String[] args) {
|
||||||
if (HeadDB.getInstance().getConfig().getBoolean("showAdvancedPluginInfo")) {
|
if (HeadDB.getInstance().getConfig().getBoolean("showAdvancedPluginInfo")) {
|
||||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB - " + HeadDB.getInstance().getDescription().getVersion());
|
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB - " + Utils.getVersion().orElse(HeadDB.getInstance().getDescription().getVersion() + " &7(&4UNKNOWN SEMVER&7)"));
|
||||||
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
PlayerUtils.sendMessage(sender, "&7GitHub: &6https://github.com/TheSilentPro/HeadDB");
|
||||||
} else {
|
} else {
|
||||||
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB &7by &6TheSilentPro (Silent)");
|
PlayerUtils.sendMessage(sender, "&7Running &6HeadDB &7by &6TheSilentPro (Silent)");
|
||||||
|
@ -5,7 +5,6 @@ import tsp.helperlite.Schedulers;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
public class Storage {
|
public class Storage {
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ import tsp.nexuslib.util.Validate;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
@ -41,6 +43,26 @@ import java.util.*;
|
|||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
private static final HeadDB instance = HeadDB.getInstance();
|
private static final HeadDB instance = HeadDB.getInstance();
|
||||||
|
private static Properties properties = null;
|
||||||
|
|
||||||
|
public static Optional<String> getVersion() {
|
||||||
|
if (properties == null) {
|
||||||
|
InputStream is = instance.getResource("build.properties");
|
||||||
|
if (is == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
properties = new Properties();
|
||||||
|
properties.load(is);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
instance.getLog().debug("Failed to load build properties: " + ex.getMessage());
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Optional.ofNullable(properties.getProperty("version"));
|
||||||
|
}
|
||||||
|
|
||||||
public static String toString(Collection<String> set) {
|
public static String toString(Collection<String> set) {
|
||||||
String[] array = set.toArray(new String[0]);
|
String[] array = set.toArray(new String[0]);
|
||||||
|
@ -85,7 +85,7 @@ public class Requester {
|
|||||||
HttpURLConnection connection = (HttpURLConnection) new URL(provider.getFormattedUrl(category)).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(provider.getFormattedUrl(category)).openConnection();
|
||||||
connection.setConnectTimeout(5000);
|
connection.setConnectTimeout(5000);
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
connection.setRequestProperty("User-Agent", plugin.getName() + "/" + plugin.getDescription().getVersion());
|
connection.setRequestProperty("User-Agent", plugin.getName() + "/" + Utils.getVersion().orElse(plugin.getDescription().getVersion()));
|
||||||
connection.setRequestProperty("Accept", "application/json");
|
connection.setRequestProperty("Accept", "application/json");
|
||||||
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren