Skip to content

Commit

Permalink
skulls ready event
Browse files Browse the repository at this point in the history
Took 2 hours 33 minutes
  • Loading branch information
kiranhart committed Mar 22, 2022
1 parent c83d543 commit 84f5986
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
13 changes: 2 additions & 11 deletions pom.xml
Expand Up @@ -7,15 +7,15 @@
<artifactId>skulls</artifactId>

<name>Skulls</name>
<version>2.9.1</version>
<version>2.11.0</version>
<packaging>jar</packaging>

<properties>
<author>Kiran Hart</author>
<jarName>Skulls</jarName>
<main.class>${project.groupId}.${project.artifactId}.${project.name}</main.class>
<java.version>1.8</java.version>
<tweety.version>1.10.0</tweety.version>
<tweety.version>1.16.0</tweety.version>
<tweety.path>com.github.kiranhart</tweety.path>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand All @@ -26,15 +26,6 @@
<url>https://jitpack.io</url>
</repository>
</repositories>

<!-- UNCOMMENT ONLY IF YOUR java.version IS SET TO JAVA 16 OR HIGHER. -->
<!-- <pluginRepositories>-->
<!-- <pluginRepository>-->
<!-- <id>maven-snapshots</id>-->
<!-- <url>https://repository.apache.org/content/repositories/snapshots/</url>-->
<!-- </pluginRepository>-->
<!-- </pluginRepositories>-->

<dependencies>
<dependency>
<groupId>${tweety.path}</groupId>
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/ca/tweetzy/skulls/api/event/SkullsReadyEvent.java
@@ -0,0 +1,28 @@
package ca.tweetzy.skulls.api.event;

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
* Date Created: March 22 2022
* Time Created: 1:05 p.m.
*
* @author Kiran Hart
*/
public final class SkullsReadyEvent extends Event {

private static final HandlerList HANDLERS = new HandlerList();

public SkullsReadyEvent() {
super(true);
}

public static HandlerList getHandlerList() {
return HANDLERS;
}

@Override
public HandlerList getHandlers() {
return HANDLERS;
}
}
5 changes: 4 additions & 1 deletion src/main/java/ca/tweetzy/skulls/model/SkullManager.java
Expand Up @@ -2,6 +2,7 @@

import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.enums.SkullsDefaultCategory;
import ca.tweetzy.skulls.api.event.SkullsReadyEvent;
import ca.tweetzy.skulls.impl.Skull;
import ca.tweetzy.skulls.impl.SkullCategory;
import ca.tweetzy.tweety.Common;
Expand Down Expand Up @@ -180,7 +181,7 @@ public void downloadHeadCategory(@NonNull final SkullsDefaultCategory category)
* For internal use only
*/
public void downloadHeads(final boolean redownload) {
if (redownload || FileUtil.getFile("config.yml").exists()) {
if (redownload) {
final File directory = FileUtil.getFile("/heads");
if (directory.exists()) {
for (File file : FileUtil.getFiles("heads", "json")) {
Expand Down Expand Up @@ -229,6 +230,8 @@ private void loadHeads() {
}

this.loading = false;
Common.callEvent(new SkullsReadyEvent());

// load blocked heads
try {
final ConfigurationSection section = Skulls.getInstance().getDataFile().getConfigField("Blocked");
Expand Down

0 comments on commit 84f5986

Please sign in to comment.