Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #5

Merged
merged 4 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ bin/
.vscode/

### Mac OS ###
.DS_Store
.DS_Store
/.gradle/
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
4 changes: 2 additions & 2 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Sun Jul 02 14:20:27 CEST 2023
gradle.version=8.2
#Thu Apr 04 18:48:28 CEST 2024
gradle.version=8.7
Binary file removed API/json.jar
Binary file not shown.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ repositories {
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
implementation 'org.jetbrains:annotations:23.0.0'
implementation files('API/json.jar')
}

java {
Expand All @@ -29,7 +28,6 @@ java {

jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(zipTree("API/json.jar"))
from {
subprojects.collect { it.sourceSets.main.output }
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 3 additions & 26 deletions src/main/java/org/scorpion/api/HoneyAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
import org.scorpion.user.HoneyUser;
import org.scorpion.util.Time;
import org.scorpion.util.file.FileManager;
import org.scorpion.util.user.User;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
Expand All @@ -27,7 +21,7 @@
*/
public class HoneyAPI {

public final static String VERSION = "1.8.0-SNAPSHOT";
public final static String VERSION = "2.0.0-SNAPSHOT";
protected static final LinkedList<String> warps = new LinkedList<>();
protected static final HashMap<Player, Player> tpa = new HashMap<>();
protected static final HashMap<Player, Player> tpaHere = new HashMap<>();
Expand Down Expand Up @@ -116,15 +110,13 @@ public static void manageLang() {
addSetting("message.kick-syntax", "%prefix% §c/kick <Player> <Reason>!");
addSetting("message.glow", "%prefix% §7Glow: §e%state%");
addSetting("message.glow-target", "%prefix% §7Glow: §e%state% §8| §6%target%");
addSetting("message.rtp-deny", "%prefix% §cYou can't teleport because the cooldown hasn't worn off! (500 seconds total)");
addSetting("message.seen-target-offline", "%prefix% §7The player §c%target% §7is offline since §e%time%");
addSetting("message.seen-target-online", "%prefix% §7The player §c%target% §7is online since §e%time%");
addSetting("message.ban-player", "§c§lYou was banned!\n§7Reason: §e%reason%\n§7End: §e%time%");
addSetting("message.ban-syntax", "%prefix% §c/ban <Player> <Reason>");
addSetting("message.ban-player-message", "%prefix% §e%target% §7wurde gebannt.");
addSetting("message.kill", "%prefix% §7You was killed!");
addSetting("message.kill-target", "%prefix% §7The player §e%target% §7was killed!");
;
addSetting("message.broadcast", "%prefix% §8» §a%bc%");
addSetting("message.broadcast-syntax", "%prefix% §c/Broadcast (Text)");
addSetting("message.sudo-syntax", "%prefix% §c/Sudo (Player) (Message)");
Expand Down Expand Up @@ -216,27 +208,12 @@ public static void sendTPA(Player sender, Player target) {
target.sendMessage(getPrefix() + "§7You have received a teleport request from §c" + sender.getName() + "§7!");
}

private static Object getWebData(String u, String data) {
try {
URL url = new URL(u);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));

String line = reader.readLine();
JSONObject json = new JSONObject(line);
return json.getString(data);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}

public static String getPluginVersion() {
return getWebData("https://sunlightscorpion.de/honey.json", "plugin").toString();
return null;
}

public static boolean needUpdate(String version) {
String current = getWebData("https://sunlightscorpion.de/honey.json", "plugin").toString();
return !current.equalsIgnoreCase(version);
return true;
}

public static boolean isSnapshot(String version) {
Expand Down
Loading