Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
- Added a TaskTimer for re-reading the homes file into the HashMap every 5 minutes
- Fixed a slight saving issue
  • Loading branch information
TobiasDeBruijn committed Jun 29, 2020
1 parent e65d0b8 commit fb5f4b8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java'
}

version = '1.16_1.0.0'
version = '1.16_1.0.2'

repositories {
jcenter()
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/nl/thedutchmc/dutchyhome/Home.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public void run() {
}.runTaskLater(this, 5);

getCommand("home").setExecutor(new CommandHandler());
getCommand("sethome").setExecutor(new CommandHandler());
getCommand("sethome").setExecutor(new CommandHandler());


new BukkitRunnable() {

@Override
public void run() {

StorageHandler.readStorage();

}
}.runTaskTimerAsynchronously(plugin, 20, 50*60*20);

}
}
4 changes: 3 additions & 1 deletion src/main/java/nl/thedutchmc/dutchyhome/StorageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ public void loadStorage() {
}
}

public void readStorage() {
public static void readStorage() {
List<String> homes = storage.getStringList("homes");

for(String str : homes) {
String[] strParts = str.split(":");

Home.homes.clear();

Home.homes.put(UUID.fromString(strParts[0]), new Location(Bukkit.getWorld(strParts[4]), Double.valueOf(strParts[1]), Double.valueOf(strParts[2]), Double.valueOf(strParts[3])));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: DutchyHome
main: nl.thedutchmc.dutchyhome.Home
version: 1.0.1
version: 1.0.2
api-version: 1.16
author: TheDutchMC
description: Homes!
Expand Down

0 comments on commit fb5f4b8

Please sign in to comment.