Skip to content

Commit

Permalink
Update 1.18.2
Browse files Browse the repository at this point in the history
Signed-off-by: Blaumeise03 <[email protected]>
  • Loading branch information
Blaumeise03 committed May 5, 2022
1 parent 0be596f commit 74fe095
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2020 Blaumeise03
~ Copyright (c) 2022 Blaumeise03
-->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down Expand Up @@ -31,7 +31,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand All @@ -48,12 +48,12 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.18.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>19.0.0</version>
<version>23.0.0</version>
<scope>compile</scope>
</dependency>
<!--dependency>
Expand All @@ -74,14 +74,14 @@
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.15-SNAPSHOT</version>
<version>1.16-R0.3</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.15-SNAPSHOT</version>
<version>1.16-R0.3</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>
Expand All @@ -95,7 +95,7 @@

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<defaultGoal>clean source:jar javadoc:jar install</defaultGoal>
<defaultGoal>clean source:jar install</defaultGoal> <!--javadoc:jar-->
<resources>
<resource>
<directory>src/main/resources</directory>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/blaumeise03/blueUtils/Head.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Blaumeise03
* Copyright (c) 2022 Blaumeise03
*/

package de.blaumeise03.blueUtils;
Expand All @@ -12,14 +12,14 @@
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.craftbukkit.libs.org.apache.commons.codec.binary.Base64;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.Field;
import java.util.Base64;
import java.util.UUID;

public class Head {
Expand Down Expand Up @@ -53,7 +53,7 @@ public static ItemStack getSkullFromWeb(String url) {

SkullMeta headMeta = (SkullMeta) head.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url: \"%s\"}}}", url).getBytes());
byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url: \"%s\"}}}", url).getBytes());
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
Field profileField = null;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Blaumeise03
* Copyright (c) 2022 Blaumeise03
*/

package de.blaumeise03.blueUtils.crossServer;
Expand All @@ -15,6 +15,7 @@

public class ServerBuffer {
private static final String serverTableName = "serverStates";
private boolean isDatabaseIsActive = true;
private final String url;
private final String host;
private final String port;
Expand Down Expand Up @@ -44,8 +45,10 @@ public ServerBuffer(String host, String port, String user, String password, Stri
this.password = password;
if (host == null || port == null || user == null || password == null || database == null || user.equalsIgnoreCase("INSERT USER NAME") || password.equalsIgnoreCase("INSERT PASSWORD")) {
Plugin.getPlugin().getLogger().severe("Failed loading sql-config! At least on information is missing!");
isDatabaseIsActive = false;
//Plugin.getPlugin().getLogger().warning("Host: " + host + " Port: " + port + " User: " + user + " No, I won't print the password...");
}
if (!isDatabaseIsActive) return;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(url, user, password);
Expand Down Expand Up @@ -74,6 +77,7 @@ public synchronized void tryCreateTable() throws SQLException {
public synchronized void refreshBuffer() {
//if(timer.isRunning()) timer.reset();
//timer.start();
if (!isDatabaseIsActive) return;
try {
if (connection == null || selectStm == null || connection.isClosed() || selectStm.isClosed()) {
refreshConnection();
Expand Down Expand Up @@ -125,6 +129,7 @@ public synchronized void refreshBuffer() {
}

private synchronized void refreshConnection() {
if (!isDatabaseIsActive) return;
Plugin.getPlugin().getLogger().info("Refreshing SQL-Connection...");
try {
if (connection == null || connection.isClosed() || !connection.isValid(2))
Expand Down Expand Up @@ -155,6 +160,7 @@ public synchronized void setState(String server, String state, String extra) {
}

public synchronized void setState(String server, String state, String extra, boolean retry) {
if (!isDatabaseIsActive) return;
try {
if (connection == null || insertStm == null || selectStm == null || connection.isClosed() || insertStm.isClosed() || selectStm.isClosed()) {
refreshConnection();
Expand Down Expand Up @@ -195,6 +201,7 @@ public synchronized void setState(String server, String state, String extra, boo
}

public synchronized void close() {
if (!isDatabaseIsActive) return;
Plugin.getPlugin().getLogger().info("Closing SQL...");
try {
if (insertStm != null)
Expand Down

0 comments on commit 74fe095

Please sign in to comment.