Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.iml
/.project
out/
.classpath
.settings
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: java
jdk:
- oraclejdk8
- oraclejdk11
notifications:
email: false

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>net.lankylord</groupId>
<artifactId>SimpleHomes</artifactId>
<version>2.0.4</version>
<version>2.0.5</version>
<packaging>jar</packaging>

<name>SimpleHomes</name>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/lankylord/simplehomes/SimpleHomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ private void loadUpdater() {
//No update found
getLogger().log(Level.INFO, "No update found.");
break;
default:
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*/
package net.lankylord.simplehomes.commands;

import net.lankylord.simplehomes.SimpleHomes;
import net.lankylord.simplehomes.configuration.languages.LanguageManager;
import net.lankylord.simplehomes.homes.HomeManager;
import net.lankylord.simplehomes.util.UUIDManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ public boolean onCommand(CommandSender sender, Command command, String s, String
homeName = "default";
}
final String targetName = strings[0].toLowerCase();
simpleHomes.getServer().getScheduler().runTaskAsynchronously(simpleHomes, new BukkitRunnable() {
new BukkitRunnable() {
UUID targetUUID;

@Override
public void run() {
targetUUID = UUIDManager.getUUIDFromPlayer(targetName);
if (targetUUID != null) {
simpleHomes.getServer().getScheduler().runTask(simpleHomes, new BukkitRunnable() {
new BukkitRunnable() {
@Override
public void run() {
Location location = homeManager.getPlayerHome(targetUUID, homeName);
Expand All @@ -86,12 +86,12 @@ public void run() {
player.sendMessage(LanguageManager.HOME_NOT_FOUND);
}
}
});
}.runTask(simpleHomes);
} else {
player.sendMessage(LanguageManager.PLAYER_NOT_EXIST);
}
}
});
}.runTaskAsynchronously(simpleHomes);
} else {
sender.sendMessage(LanguageManager.PLAYER_COMMAND_ONLY);
}
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/net/lankylord/simplehomes/homes/HomeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class HomeManager {

public HomeManager(HomeFileManager fileManager) {
this.fileManager = fileManager;
this.loadedHomes = new HashMap<>();
this.loadedHomes = new HashMap<UUID, Map<String, Location>>();
}

/**
Expand Down Expand Up @@ -93,7 +93,6 @@ private void saveHomeToFile(UUID uuid, Location location, String homeName) {
* @param player The player
* @param homeName Name of the home
*/
@SuppressWarnings("unchecked")
public void saveHome(Player player, String homeName) {
UUID uuid = player.getUniqueId();
Location location = player.getLocation();
Expand All @@ -108,9 +107,8 @@ public void saveHome(Player player, String homeName) {
saveHomeToFile(uuid, location, homeName);
}

@SuppressWarnings("unchecked")
public void deleteHome(UUID uuid, String homeName) {
Map homeLocations = loadedHomes.get(uuid);
Map<String, Location> homeLocations = loadedHomes.get(uuid);
if (homeLocations != null) {
homeLocations.remove(homeName.toLowerCase());
loadedHomes.put(uuid, homeLocations);
Expand Down Expand Up @@ -166,7 +164,6 @@ public void unloadPlayerHomes(UUID uuid) {
* @param homeName Name of the home
* @return Location of home
*/
@SuppressWarnings("unchecked")
public Location getPlayerHome(UUID uuid, String homeName) {
Map<String, Location> homeLocations = loadedHomes.get(uuid);
if (homeLocations != null) {
Expand All @@ -193,13 +190,12 @@ public Location getPlayerHomeFromFile(UUID uuid, String homeName) {
return homeLocation.get(homeName.toLowerCase());
}

@SuppressWarnings("unchecked")
public Map<String, Location> getPlayerHomes(UUID uuid) {
if (loadedHomes.containsKey(uuid)) {
return loadedHomes.get(uuid);
} else {
loadPlayerHomes(uuid);
HashMap playerHomes = (HashMap) loadedHomes.get(uuid);
HashMap<String, Location> playerHomes = (HashMap<String, Location>) loadedHomes.get(uuid);
unloadPlayerHomes(uuid);
return playerHomes;
}
Expand Down