Skip to content
Open
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
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
plugins {
id 'java'
id("com.gradleup.shadow") version "9.2.2"
id("com.gradleup.shadow") version "9.3.1"
}

group 'net.mackenziemolloy.shopguiplus.sellgui'
version '1.1.8'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(8)
}

sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = sourceCompatibility
}

repositories {
mavenLocal()
mavenLocal()
mavenCentral()

maven { url = 'https://repo.papermc.io/repository/maven-public/' }
maven { url = "https://repo.mattstudios.me/artifactory/public/" }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url = 'https://repo.codemc.org/repository/maven-public/' }
maven { url = 'https://jitpack.io/' }
maven { url = "https://repo.tcoded.com/releases"}
maven { url = "https://repo.tcoded.com/releases" }
}

dependencies {
compileOnly "org.spigotmc:spigot-api:1.21.8-R0.1-SNAPSHOT"
compileOnly 'com.github.brcdev-minecraft:shopgui-api:3.0.0'
compileOnly "org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT"
compileOnly "com.github.brcdev-minecraft:shopgui-api:3.2.0"
implementation "dev.triumphteam:triumph-gui:3.1.13"
implementation 'org.bstats:bstats-bukkit:3.1.0'
implementation "org.bstats:bstats-bukkit:3.1.0"
implementation "com.tcoded:FoliaLib:0.5.1"
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,16 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
}

String sub = args[0].toLowerCase(Locale.US);
return switch (sub) {
case "rl", "reload" -> commandReload(sender);
case "debug", "dump" -> commandDebug(sender);
default -> false;
};
switch (sub) {
case "rl":
case "reload":
return commandReload(sender);
case "debug":
case "dump":
return commandDebug(sender);
default:
return false;
}
}

private boolean commandReload(CommandSender sender) {
Expand All @@ -129,7 +134,8 @@ private boolean commandReload(CommandSender sender) {
else if (this.plugin.fileLogger == null) this.plugin.initLogger();

sendMessage(sender, "reloaded_config");
if (sender instanceof Player player) {
if (sender instanceof Player) {
Player player = (Player) sender;
PlayerHandler.playSound(player, "success");
}
});
Expand Down Expand Up @@ -174,9 +180,12 @@ private boolean commandDebug(CommandSender sender) {

String message = String.format(Locale.US, pastedDumpMsg, pasteUrl);
Bukkit.getConsoleSender().sendMessage(message);
if (sender instanceof Player) sender.sendMessage(message);
if (sender instanceof Player) {
sender.sendMessage(message);
}

if (sender instanceof Player player) {
if (sender instanceof Player) {
Player player = (Player) sender;
PlayerHandler.playSound(player, "success");
}
} catch (IOException ex) {
Expand All @@ -188,11 +197,13 @@ private boolean commandDebug(CommandSender sender) {
}

private boolean commandBase(CommandSender sender) {
if (!(sender instanceof Player player)) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "Only players can execute this command.");
return true;
}

Player player = (Player) sender;

if (!player.hasPermission("sellgui.use")) {
sendMessage(player, "no_permission");
return true;
Expand Down Expand Up @@ -576,7 +587,8 @@ private void sendMessage(CommandSender sender, String path, @Nullable Function<S
return;
}

if (sender instanceof Player player) {
if (sender instanceof Player) {
Player player = (Player) sender;
BaseComponent[] components = TextComponent.fromLegacyText(message);
player.spigot().sendMessage(components);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public CommentedConfiguration() {
* config, they will be synced with the resource's config.
*/
public void syncWithConfig(File file, InputStream resource, String... ignoredSections) throws IOException{
if(creationFailure) return;
if (creationFailure) {
return;
}

CommentedConfiguration cfg = loadConfiguration(resource);
if (syncConfigurationSection(cfg, cfg.getConfigurationSection(""), Arrays.asList(ignoredSections)) && file != null) {
Expand Down Expand Up @@ -213,7 +215,7 @@ public String saveToString() {
contents.append("\n").append(line);
}

return contents.isEmpty() ? "" : contents.substring(1);
return contents.length() == 0 ? "" : contents.substring(1);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public static void playSound(Player player, String event) {

Location location = player.getLocation();
Sound sound = getSound(event);
if (sound == null) return;
if (sound == null) {
return;
}

player.playSound(location, sound, volume, pitch);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public final class HexColorUtility {
Pattern pattern = getReplaceAllRgbPattern(colorChar);
Matcher matcher = pattern.matcher(string);

StringBuilder buffer = new StringBuilder();
StringBuffer buffer = new StringBuffer();
while (matcher.find()) {
if (matcher.group(1) != null) {
matcher.appendReplacement(buffer, colorChar + "#$2");
Expand All @@ -43,7 +43,7 @@ public final class HexColorUtility {
matcher.appendTail(buffer);

// Normalize Adventure legacy serializers so that colors reset styles (bold/italic/etc.)
Component component = LegacyComponentSerializer.legacyAmpersand().deserialize(buffer.toString());
Component component = LegacyComponentSerializer.legacySection().deserialize(buffer.toString());
return LegacyComponentSerializer.legacySection().serialize(component);
}

Expand Down