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;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.plaf.basic.BasicBorders;
import java.awt.*;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.net.URL;
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>");
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));
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) {

View file

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

View file

@ -9,4 +9,5 @@ license = "Apache-2.0"
credits = [
{ 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