Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
Update 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
efekurbann committed Apr 17, 2021
1 parent ee446cc commit 39565bb
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
36 changes: 36 additions & 0 deletions src/main/java/xyz/efekurbann/topbalance/UpdateChecker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package xyz.efekurbann.topbalance;

import org.bukkit.Bukkit;
import org.bukkit.util.Consumer;

import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;

public class UpdateChecker {

private final TopBalancePlugin plugin;
private String latestVersion;

public UpdateChecker(TopBalancePlugin plugin) {
this.plugin = plugin;
}

public void isUpToDate(final Consumer<Boolean> consumer) {
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
try {
HttpsURLConnection con = (HttpsURLConnection) (new URL("https://api.spigotmc.org/legacy/update.php?resource=91372")).openConnection();
con.setRequestMethod("GET");
InputStreamReader reader = new InputStreamReader(con.getInputStream());
this.latestVersion = (new BufferedReader(reader)).readLine();
String version = plugin.getDescription().getVersion();

consumer.accept(latestVersion.equals(version));
} catch (IOException exception) {
this.plugin.getLogger().info("Cannot look for updates: " + exception.getMessage());
}
});
}
}
6 changes: 5 additions & 1 deletion src/main/resources/turkish_config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Gui:
custom-item: false
custom-item: true # En iyi performans için true olarak bırakın!!!
enabled: true # Sohbette göstermesini istiyorsanız false yapın.
title: "&5Top 10"
size: 27
#
# Mevcut değişkenler
# - {name} (lore-name), {rank} (lore-name), {balance} - formatted (lore), {balance_raw} (lore)
#
items:
player-item:
name: "&a{name} &d#{rank}"
Expand Down

0 comments on commit 39565bb

Please sign in to comment.