From 8c57217510f048a5802c3e0a98a4eed5a7008374 Mon Sep 17 00:00:00 2001
From: Soroush
Date: Sat, 9 Jul 2022 15:15:53 +0430
Subject: [PATCH 1/3] REMOVE(JNativeHook) Because of library's issue on running
as a service. https://github.com/kwhat/jnativehook/issues/162
---
pom.xml | 5 --
.../github/shuoros/pepeParty/PepeParty.java | 89 ++-----------------
2 files changed, 8 insertions(+), 86 deletions(-)
diff --git a/pom.xml b/pom.xml
index fb8cf7d..4bb06b3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,11 +47,6 @@
-
- com.1stleg
- jnativehook
- 2.0.3
-
io.github.shuoros
JTerminal
diff --git a/src/main/java/com/github/shuoros/pepeParty/PepeParty.java b/src/main/java/com/github/shuoros/pepeParty/PepeParty.java
index b618434..034a117 100644
--- a/src/main/java/com/github/shuoros/pepeParty/PepeParty.java
+++ b/src/main/java/com/github/shuoros/pepeParty/PepeParty.java
@@ -1,21 +1,13 @@
package com.github.shuoros.pepeParty;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
+import com.github.shuoros.pepeParty.model.Frame;
import com.github.shuoros.pepeParty.util.EntityLoader;
+import com.github.shuoros.pepeParty.util.FrameLoader;
import io.github.shuoros.jterminal.JTerminal;
import io.github.shuoros.jterminal.util.TextEntity;
-import org.jnativehook.GlobalScreen;
-import org.jnativehook.NativeHookException;
-import org.jnativehook.keyboard.NativeKeyEvent;
-import org.jnativehook.keyboard.NativeKeyListener;
-import com.github.shuoros.pepeParty.model.Frame;
-import com.github.shuoros.pepeParty.util.FrameLoader;
+import java.util.ArrayList;
+import java.util.List;
/**
* If you are tired of life, invite Pepe to throw a party in your terminal.
@@ -24,19 +16,17 @@
* @version 0.1.0
* @since 0.1.0
*/
-public class PepeParty implements NativeKeyListener {
+public class PepeParty {
private static List frames = new ArrayList<>();
private static List> entities = new ArrayList<>();
private static int frameIndex = 0;
private static String currentFrame;
private static List currentEntity;
- private static boolean shutdown = false;
/**
- * Application runner. First it load the frames by
- * {@link com.github.shuoros.pepeParty.util.FrameLoader} then register the
- * {@link org.jnativehook.keyboard.NativeKeyListener} and then call the
+ * Application runner. First it loads the frames by
+ * {@link com.github.shuoros.pepeParty.util.FrameLoader} and then call the
* {@code run()} to run the party.
*
* @param args Command line arguments.
@@ -45,8 +35,6 @@ public static void main(String[] args) {
frames = FrameLoader.load("frames.files");
entities = EntityLoader.load("entities.files");
- registerKeyListener();
-
run();
}
@@ -82,7 +70,7 @@ private static void create(int frameIndex) {
* Render the {@code currentFrame} on terminal.
*/
private static void render() {
- JTerminal.println(currentFrame, currentEntity);
+ JTerminal.println(currentFrame, currentEntity);
}
/**
@@ -94,12 +82,6 @@ private static void render() {
* @param wait Time duration between two frames.
*/
private static void dispose(int wait) {
- if (shutdown) {
- JTerminal.clear();
- unRegisterKeyListener();
- System.exit(0);
- }
-
frameIndex++;
if (frameIndex >= frames.size()) {
@@ -109,59 +91,4 @@ private static void dispose(int wait) {
JTerminal.clear(wait);
}
- /**
- * Register the {@link org.jnativehook.keyboard.NativeKeyListener} to screen and
- * turn off {@link org.jnativehook.keyboard.NativeKeyListener} logs.
- */
- private static void registerKeyListener() {
- LogManager.getLogManager().reset();
- Logger logger = Logger.getLogger(GlobalScreen.class.getPackage().getName());
- logger.setLevel(Level.OFF);
-
- try {
- GlobalScreen.registerNativeHook();
- } catch (NativeHookException ex) {
- System.err.println("There was a problem registering the native hook.");
- System.err.println(ex.getMessage());
- System.exit(1);
- }
-
- GlobalScreen.addNativeKeyListener(new PepeParty());
-
- }
-
- private static void unRegisterKeyListener(){
- try {
- GlobalScreen.unregisterNativeHook();
- }
- catch (NativeHookException ex) {
- ex.printStackTrace();
- }
- }
-
- /**
- * There is no need to KeyPressed event.
- */
- @Override
- public void nativeKeyPressed(NativeKeyEvent e) {
- }
-
- /**
- * If escape button pressed and released turn shut down to {@code true} and exit
- * the application.
- */
- @Override
- public void nativeKeyReleased(NativeKeyEvent e) {
- if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
- shutdown = true;
- }
- }
-
- /**
- * There is no need to KeyTyped event.
- */
- @Override
- public void nativeKeyTyped(NativeKeyEvent e) {
- }
-
}
From 5b6033926464ec3fe6aa7aa2354fe032993a7088 Mon Sep 17 00:00:00 2001
From: Soroush
Date: Sat, 9 Jul 2022 15:22:27 +0430
Subject: [PATCH 2/3] UPDATE(version to 1.1.0)
---
pom.xml | 2 +-
snap/snapcraft.yaml | 15 +++++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4bb06b3..2ad4ee5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.github.shuoros
pepe-party
- 1.0.0
+ 1.1.0
jar
pepe-party
If you are tired of coding, invite Pepe to throw a party in your terminal.
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index a132dfa..a4b8006 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,18 +1,17 @@
-name: pepe-party-party
-version: '1.0.0'
+name: pepe-party
+version: '1.1.0'
summary: Invite pepe-party to your terminal!
description: |
If you are tired of coding, invite Pepe to throw a party in your terminal.!
- To invite Pepe, run "pepe" command in your terminal!
+ To invite Pepe, run "pepe-party" command in your terminal!
To quit the party either hit "Esc" or "Ctrl+C"
Have fun:D!
Homepage: https://github.com/shuoros/pepe-party
title: Pepe Party
-website: https://github.com/shuoros/pepe-party-party
+website: https://github.com/shuoros/pepe-party
contact: shuoros@yahoo.com
-issues: https://github.com/shuoros/pepe-party-party/issues
-icon: ./icon.png
+issues: https://github.com/shuoros/pepe-party/issues
license: MIT
base: core18
@@ -21,12 +20,12 @@ confinement: strict
apps:
pepe-party:
- command: bin/java -jar $SNAP/jar/pepe-party-party-$SNAP_VERSION-jar-with-dependencies.jar
+ command: bin/java -jar $SNAP/jar/pepe-party-$SNAP_VERSION-jar-with-dependencies.jar
parts:
pepe-party:
plugin: maven
- source: https://github.com/shuoros/pepe-party-party.git
+ source: https://github.com/shuoros/pepe-party.git
source-tag: main
source-type: git
maven-options: [-DskipTests]
From f0292924865bef60e00949d0a684666a22260797 Mon Sep 17 00:00:00 2001
From: Soroush
Date: Sat, 9 Jul 2022 15:22:38 +0430
Subject: [PATCH 3/3] UPDATE(README.md)
---
README.md | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 935235c..a9389c9 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
If you are tired of coding, invite Pepe to throw a party in your terminal!
-
+
Powered by
@@ -13,11 +13,14 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -69,7 +72,7 @@ pepe-party
```
## Quit
-You can quit the party by either hitting `Esc` or `Ctrl+C`.
+You can quit the party by hitting `Ctrl+C`.
## Authors
The `Pepe Party` is developed by [Soroush Shemshadi](https://shuoros.github.io) and the [contributors](https://github.com/shuoros/pepe-party/blob/main/CONTRIBUTORS.md).