Skip to content

Commit

Permalink
add option for default delay
Browse files Browse the repository at this point in the history
  • Loading branch information
InventivetalentDev committed Nov 12, 2018
1 parent 02c0600 commit 13f5c4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ public void run() {

BufferedImage image = scaleImage(decoder.getFrame(i));
int delay = decoder.getDelay(i);
if (delay == 0) {
plugin.getLogger().warning("Frame has no delay information, falling back to default (" + plugin.defaultDelay + ")");
delay = plugin.defaultDelay;
}
this.frameDelays[i] = delay;
MapWrapper wrapper = mapManager.wrapMultiImage(image, this.height, this.width);
this.mapWrappers[i] = wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class AnimatedFramesPlugin extends JavaPlugin {
@ConfigValue(path = "fixImageTypes") boolean fixImageTypes = false;
@ConfigValue(path = "synchronizedStart") static boolean synchronizedStart = false;
@ConfigValue(path = "maxAnimateDistance") int maxAnimateDistance = 32;
@ConfigValue(path = "defaultDelay") int defaultDelay = 50;
static long synchronizedTime = 0;

int maxAnimateDistanceSquared = 1024;
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ fixImageTypes: false
# Note: Increasing this only has an effect if your server's rendering distance for entities is also increased (i.e. spigot.yml entity-tracking-range)
maxAnimateDistance: 32

# (ms) Default delay for GIFs with missing delay information (Time for each frame to be displayed)
defaultDelay: 50

message:
command:
create:
Expand Down

0 comments on commit 13f5c4b

Please sign in to comment.