Separate plugin types #10

Merged
owlsys merged 14 commits from ecorous/plugin-types into main 2024-06-16 17:13:54 -04:00
4 changed files with 37 additions and 20 deletions
Showing only changes of commit b6d904595a - Show all commits

View file

@ -1,9 +1,11 @@
package dev.frogmc.frogloader.impl.gui.component; package dev.frogmc.frogloader.impl.gui.component;
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.basic.BasicBorders; import javax.swing.plaf.basic.BasicBorders;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL; import java.net.URL;
import dev.frogmc.frogloader.impl.mod.ModDependencyResolver; import dev.frogmc.frogloader.impl.mod.ModDependencyResolver;
@ -28,17 +30,29 @@ public class DependencyErrorEntry extends JPanel {
desc.setText("<html>" + description.replace("<", "&lt;").replace("\n", "<br>") + "</html>"); desc.setText("<html>" + description.replace("<", "&lt;").replace("\n", "<br>") + "</html>");
text.add(desc); text.add(desc);
add(text, BorderLayout.NORTH); Box top = Box.createHorizontalBox();
add(top, BorderLayout.NORTH);
if (icon != null) {
URL location = getClass().getResource("/"+icon);
if (location != null) {
try {
int size = 100;
Image image = ImageIO.read(location).getScaledInstance(size, size, Image.SCALE_SMOOTH);
Box container = Box.createVerticalBox();
container.add(new JLabel(new ImageIcon(image)));
container.add(Box.createVerticalGlue());
top.add(container);
} catch (IOException ignored) {
}
}
}
top.add(text);
this.actions = new JPanel(new FlowLayout(FlowLayout.LEFT)); this.actions = new JPanel(new FlowLayout(FlowLayout.LEFT));
add(this.actions, BorderLayout.SOUTH); add(this.actions, BorderLayout.SOUTH);
if (icon != null) {
URL location = getClass().getResource(icon);
if (location != null)
add(new JLabel(new ImageIcon(location)), BorderLayout.WEST);
}
} }
public void addAction(String label, ActionListener listener) { public void addAction(String label, ActionListener listener) {

View file

@ -87,19 +87,21 @@ public class FrogModProvider implements ModProvider {
Runtime.getRuntime().addShutdownHook(new Thread(() -> { Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try { try {
Files.walkFileTree(dir, new SimpleFileVisitor<>(){ if (Files.exists(dir)) {
@Override Files.walkFileTree(dir, new SimpleFileVisitor<>() {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { @Override
Files.delete(file); public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
return super.visitFile(file, attrs); Files.delete(file);
} return super.visitFile(file, attrs);
}
@Override @Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir); Files.delete(dir);
return super.postVisitDirectory(dir, exc); return super.postVisitDirectory(dir, exc);
} }
}); });
}
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Failed to clear extracted jij mods!", e); LOGGER.error("Failed to clear extracted jij mods!", e);
} }

View file

@ -9,4 +9,5 @@ license = "Apache-2.0"
credits = [ credits = [
{ name = "FrogMC Team", roles = ["author"] } { name = "FrogMC Team", roles = ["author"] }
] ]
icon = "icon.png"

BIN
src/main/resources/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB