Skip to content

Commit

Permalink
1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
BenceX100 committed May 22, 2024
1 parent 08a9e08 commit a33b4d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.artillexstudios</groupId>
<artifactId>AxSellwands</artifactId>
<version>1.3.0</version>
<version>1.3.1</version>
<packaging>jar</packaging>

<name>AxSellwands</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void help(@NotNull CommandSender sender) {
}
}

@Subcommand("give")
@Subcommand("give") // todo: add optional overrides for uses, multiplier
public void give(@NotNull CommandSender sender, Player player, @Sellwands @NotNull Sellwand sellwand, @Optional @Range(min = 1, max = 64) Integer amount) {

float multiplier = sellwand.getMultiplier();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Iterator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
Expand All @@ -15,20 +17,18 @@ public class FileUtils {
public static final Path PLUGIN_DIRECTORY = AxSellwands.getInstance().getDataFolder().toPath();

public static void copyFromResource(@NotNull String path) {
try (ZipFile zip = new ZipFile(AxSellwands.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().getPath())) {
try (ZipFile zip = new ZipFile(Paths.get(AxSellwands.getInstance().getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).toFile())) {
for (Iterator<? extends ZipEntry> it = zip.entries().asIterator(); it.hasNext(); ) {
ZipEntry entry = it.next();
if (entry.getName().startsWith(path + "/")) {
if (!entry.getName().endsWith(".yml")) continue;
if (!entry.getName().endsWith(".yaml") && !entry.getName().endsWith(".yml")) continue;
InputStream resource = AxSellwands.getInstance().getResource(entry.getName());
if (resource == null) {
continue;
}
if (resource == null) continue;

Files.copy(resource, PLUGIN_DIRECTORY.resolve(entry.getName()));
}
}
} catch (IOException ex) {
} catch (IOException | URISyntaxException ex) {
ex.printStackTrace();
}
}
Expand Down

0 comments on commit a33b4d0

Please sign in to comment.