This repository has been archived by the owner on Dec 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remake how the timer actually counts (instead of using ticks, an an ActionListener and Timer is used) The command now shows a GUI where you can edit the HUD and a button where you can access the Vigilance Config Update credits for VersionChecker Remove Lombok Set HUD Shadow to true as a default Remove Reset When World Exit and One Color Chroma Make Vigilance GUI look nicer
- Loading branch information
Wyvest
committed
May 6, 2021
1 parent
bdc313d
commit d72d1f1
Showing
12 changed files
with
146 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package net.wyvest.timer; | ||
|
||
import club.sk1er.mods.core.universal.UMinecraft; | ||
import net.wyvest.lib.util.Multithreading; | ||
|
||
import java.awt.event.ActionListener; | ||
|
||
/** | ||
* @author Wyvest | ||
*/ | ||
|
||
public class Timer { | ||
int delay = 1000; //milliseconds | ||
public int secondsPassed; | ||
public boolean running; | ||
public static Timer instance = new Timer(); | ||
ActionListener timerTask = evt -> secondsPassed += 1; | ||
javax.swing.Timer timer = new javax.swing.Timer(delay, timerTask); | ||
|
||
public void toggleTimer() { | ||
Multithreading.runAsync(()-> { | ||
if (!running) { | ||
if (UMinecraft.getWorld() == null) return; | ||
timer.start(); | ||
running = true; | ||
} else { | ||
timer.stop(); | ||
secondsPassed = 0; | ||
running = false; | ||
} | ||
}); | ||
} | ||
|
||
public void setTimer(boolean status) { | ||
Multithreading.runAsync(()-> { | ||
if (status) { | ||
timer.start(); | ||
running = true; | ||
} else { | ||
timer.stop(); | ||
secondsPassed = 0; | ||
running = false; | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.