Skip to content

Commit 47acb92

Browse files
add config option to prevent frames from playing when the server starts
1 parent 35047a1 commit 47acb92

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/main/java/org/inventivetalent/animatedframes/AnimatedFramesPlugin.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ public class AnimatedFramesPlugin extends JavaPlugin {
5252
SpigetUpdate spigetUpdate;
5353
public boolean updateAvailable;
5454

55-
@ConfigValue(path = "fixImageTypes") boolean fixImageTypes = false;
56-
@ConfigValue(path = "synchronizedStart") static boolean synchronizedStart = false;
57-
@ConfigValue(path = "maxAnimateDistance") int maxAnimateDistance = 32;
58-
@ConfigValue(path = "defaultDelay") int defaultDelay = 50;
59-
static long synchronizedTime = 0;
55+
@ConfigValue(path = "fixImageTypes") boolean fixImageTypes = false;
56+
@ConfigValue(path = "synchronizedStart") static boolean synchronizedStart = false;
57+
@ConfigValue(path = "doNotStartAutomatically") boolean doNotStartAutomatically = false;
58+
@ConfigValue(path = "maxAnimateDistance") int maxAnimateDistance = 32;
59+
@ConfigValue(path = "defaultDelay") int defaultDelay = 50;
60+
static long synchronizedTime = 0;
6061

6162
int maxAnimateDistanceSquared = 1024;
6263

src/main/java/org/inventivetalent/animatedframes/FrameManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,10 @@ public void call(Void aVoid) {
362362
}
363363
};
364364
loadedFrame.refresh();
365-
startFrame(loadedFrame);
366-
loadedFrame.setPlaying(true);
365+
if (!plugin.doNotStartAutomatically) {
366+
startFrame(loadedFrame);
367+
loadedFrame.setPlaying(true);
368+
}
367369
}
368370

369371
// TimingsHelper.stopTiming("AnimatedFrames - readFromFile");

src/main/resources/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Make sure all animations are started at the same time on startup (useful if you usethe same image on multiple frames)
22
synchronizedStart: false
33

4+
# Enable this to not start any frames automatically on server start & if you'd like to start them manually instead
5+
doNotStartAutomatically: false
6+
47
# This is a (slightly hacky) fix for images which Java interpretes as the wrong image type
58
# You should enable this if you get this error when creating a image: "java.lang.IllegalArgumentException: Unknown image type 0"
69
fixImageTypes: false

0 commit comments

Comments
 (0)