Skip to content

Commit

Permalink
change java version
Browse files Browse the repository at this point in the history
  • Loading branch information
WiktorDev committed Nov 6, 2024
1 parent 91fa93c commit d553bbb
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publishing {
create<MavenPublication>("maven") {
groupId = "pl.yshop.plugin"
artifactId = "api"
version = "4.0.2"
version = "4.0.4"
from(components["java"])
}
}
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/pl/yshop/plugin/api/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ public interface Platform {
Configuration getConfiguration();
Requester getRequester();

Object plugin();

PlatformLogger logger();
}
10 changes: 10 additions & 0 deletions api/src/main/java/pl/yshop/plugin/api/utils/Base64Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package pl.yshop.plugin.api.utils;

import java.util.Base64;

public class Base64Utils {
public static String decode(String input) {
byte[] decodedBytes = Base64.getDecoder().decode(input);
return new String(decodedBytes);
}
}
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ allprojects {
group = "pl.yshop.plugin"
version = "4.0.0"

java.sourceCompatibility = JavaVersion.VERSION_16
java.targetCompatibility = JavaVersion.VERSION_16

repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://repo.panda-lang.org/releases")
maven("https://repo.xenondevs.xyz/releases")
}

tasks {
Expand All @@ -38,4 +42,5 @@ dependencies {
implementation(project(":bukkit"))
implementation(project(":bungee"))
implementation(project(":velocity"))
implementation("xyz.xenondevs.invui:invui:1.39")
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ public PlatformLogger logger() {
public Requester getRequester() {
return new YShopRequest(this);
}

@Override
public Object plugin() {
return this.plugin;
}
}
17 changes: 16 additions & 1 deletion bungee/src/main/java/pl/yshop/plugin/bungee/BungeePlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@

import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Plugin;
import pl.yshop.plugin.api.Configuration;
import pl.yshop.plugin.api.Platform;
import pl.yshop.plugin.api.PlatformLogger;
import pl.yshop.plugin.api.commands.PlatformCommand;
import pl.yshop.plugin.api.request.Requester;
import pl.yshop.plugin.bungee.configuration.BungeeConfigurationManager;
import pl.yshop.plugin.bungee.configuration.BungeeConfiguration;
import pl.yshop.plugin.shared.PlatformCommandManager;
import pl.yshop.plugin.shared.configuration.ConfigProperties;
import pl.yshop.plugin.shared.request.YShopRequest;

public class BungeePlatform implements Platform {
private final Plugin plugin;
private final BungeeAudiences audiences;
private final PlatformCommandManager<CommandSender> commandManager;

public BungeePlatform(Plugin plugin) {
public BungeePlatform(Plugin plugin, PlatformCommandManager<CommandSender> commandManager) {
this.plugin = plugin;
this.audiences = BungeeAudiences.create(plugin);
this.commandManager = commandManager;
}

@Override
Expand Down Expand Up @@ -53,6 +58,11 @@ public void announce(String message) {
});
}

@Override
public void registerCommand(PlatformCommand command) {
this.commandManager.register(command);
}

@Override
public Configuration getConfiguration() {
BungeeConfigurationManager configManager = new BungeeConfigurationManager(this.plugin);
Expand All @@ -72,6 +82,11 @@ public Requester getRequester() {
return new YShopRequest(this);
}

@Override
public Object plugin() {
return this.plugin;
}

@Override
public PlatformLogger logger() {
return new BungeeLogger(this.plugin.getLogger());
Expand Down
7 changes: 5 additions & 2 deletions bungee/src/main/java/pl/yshop/plugin/bungee/BungeePlugin.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package pl.yshop.plugin.bungee;

import net.kyori.adventure.platform.bungeecord.BungeeAudiences;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.plugin.Plugin;
import pl.yshop.plugin.api.Platform;
import pl.yshop.plugin.bungee.commands.BungeeCommandManager;
import pl.yshop.plugin.shared.Bootstrap;
import pl.yshop.plugin.shared.PlatformCommandManager;
import pl.yshop.plugin.shared.tasks.ExecuteCommandsTask;

import java.util.concurrent.TimeUnit;
Expand All @@ -16,9 +18,10 @@ public class BungeePlugin extends Plugin {
@Override
public void onEnable() {
audiences = BungeeAudiences.create(this);
Platform platform = new BungeePlatform(this);
PlatformCommandManager<CommandSender> commandManager = new BungeeCommandManager(this);
Platform platform = new BungeePlatform(this, commandManager);
this.bootstrap = new Bootstrap(platform)
.withCommandManager(new BungeeCommandManager(this))
.withCommandManager(commandManager)
.enableExtensions(this.getDataFolder())
.start();

Expand Down
4 changes: 0 additions & 4 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ dependencies {
api("com.squareup.okhttp3:okhttp:4.10.0")
compileOnly("com.google.code.gson:gson:2.8.6")
}

tasks.test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pl.yshop.plugin.api.Configuration;
import pl.yshop.plugin.api.Platform;
import pl.yshop.plugin.api.PlatformLogger;
import pl.yshop.plugin.api.commands.PlatformCommand;
import pl.yshop.plugin.api.request.Requester;
import pl.yshop.plugin.shared.configuration.ConfigProperties;
import pl.yshop.plugin.shared.request.YShopRequest;
Expand All @@ -24,12 +25,12 @@ public VelocityPlatform(final ProxyServer server, Logger logger, ConfigurationNo

@Override
public String version() {
return "";
return "1.2";
}

@Override
public String engine() {
return "";
return "Velocity";
}

@Override
Expand All @@ -54,6 +55,11 @@ public void announce(String message) {
});
}

@Override
public void registerCommand(PlatformCommand command) {

}

@Override
public Configuration getConfiguration() {
ConfigProperties properties = new VelocityConfiguration(this.configurationNode);
Expand All @@ -71,6 +77,11 @@ public Requester getRequester() {
return new YShopRequest(this);
}

@Override
public Object plugin() {
return null;
}

@Override
public PlatformLogger logger() {
return new VelocityLogger(this.logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public class VelocityPlugin {
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
ConfigurationNode node = this.getConfiguration();
this.logger.error("=================");
this.logger.error(node.getNode("apiKey").getString());
this.logger.error("=================");
Platform platform = new VelocityPlatform(this.proxy, this.logger, node);

this.bootstrap = new Bootstrap(platform)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public VelocityConfiguration(ConfigurationNode root) {

@Override
public String getString(String key) {
return this.root.getString(key);
return this.root.getNode(key).getString();
}

@Override
public boolean getBoolean(String key) {
return Boolean.getBoolean(this.root.getString(key));
return this.root.getNode(key).getBoolean();
}
}

0 comments on commit d553bbb

Please sign in to comment.