Skip to content

Commit 2bcfa21

Browse files
committed
Update for BetonQuest version: 2.0.0-DEV-450
1 parent f08770c commit 2bcfa21

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>honny</groupId>
88
<artifactId>HonnyCompass</artifactId>
9-
<version>1.2</version>
9+
<version>1.3</version>
1010
<packaging>jar</packaging>
1111

1212
<name>HonnyCompass</name>

src/main/java/honny/HonnyCompass.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import honny.tasks.PlayerCompassLocationsUpdater;
1212
import lombok.Getter;
1313
import org.betonquest.betonquest.BetonQuest;
14+
import org.betonquest.betonquest.api.profiles.Profile;
1415
import org.bukkit.Bukkit;
1516
import org.bukkit.entity.Player;
1617
import org.bukkit.plugin.java.JavaPlugin;
@@ -92,9 +93,13 @@ public PlayerCompass createCompass(Player player) {
9293
return playerCompass;
9394
}
9495

96+
public Optional<PlayerCompass> getCompass(Profile profile) {
97+
if (!compasses.containsKey(profile.getPlayer().getUniqueId())) return Optional.empty();
98+
return Optional.of(compasses.get(profile.getPlayer().getUniqueId()));
99+
}
100+
95101
public Optional<PlayerCompass> getCompass(Player player) {
96102
if (!compasses.containsKey(player.getUniqueId())) return Optional.empty();
97-
98103
return Optional.of(compasses.get(player.getUniqueId()));
99104
}
100105

src/main/java/honny/dependings/betonquest/CompassLocations.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package honny.dependings.betonquest;
22

33
import honny.HonnyCompass;
4-
import org.betonquest.betonquest.Backpack;
54
import org.betonquest.betonquest.BetonQuest;
6-
import org.betonquest.betonquest.api.config.QuestPackage;
5+
import org.betonquest.betonquest.api.config.quest.QuestPackage;
6+
import org.betonquest.betonquest.api.profiles.Profile;
77
import org.betonquest.betonquest.config.Config;
88
import org.betonquest.betonquest.database.PlayerData;
99
import org.betonquest.betonquest.utils.PlayerConverter;
@@ -35,7 +35,7 @@ public void reload() {
3535
locations.clear();
3636

3737
for (final QuestPackage pack : Config.getPackages().values()) {
38-
final String packName = pack.getPackagePath();
38+
final String packName = pack.getQuestPath();
3939
// loop all compass locations
4040
final ConfigurationSection section = pack.getConfig().getConfigurationSection("compass");
4141
if (section != null) {
@@ -93,12 +93,11 @@ public List<CompassLocation> getLocations(Player player) {
9393
List<CompassLocation> compassLocations = new ArrayList<>();
9494
BetonQuest betonQuest = HonnyCompass.getInstance().getOptionalBetonQuest().get();
9595

96-
String playerID = PlayerConverter.getID(player.getName());
97-
PlayerData playerData = betonQuest.getPlayerData(playerID);
96+
Profile profile = PlayerConverter.getID(player);
97+
PlayerData playerData = betonQuest.getPlayerData(profile);
9898

9999
for (Map.Entry<String, CompassLocation> entry : this.locations.entrySet()) {
100100
if (playerData.hasTag(entry.getKey())) {
101-
102101
compassLocations.add(entry.getValue());
103102
}
104103
}

src/main/java/honny/handlers/QuestCompassTargetChangeHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import honny.HonnyCompass;
44
import honny.controllers.PlayerCompass;
55
import org.betonquest.betonquest.api.QuestCompassTargetChangeEvent;
6+
import org.betonquest.betonquest.api.profiles.Profile;
7+
import org.betonquest.betonquest.database.PlayerData;
8+
import org.betonquest.betonquest.utils.PlayerConverter;
69
import org.bukkit.event.EventHandler;
710
import org.bukkit.event.Listener;
811

@@ -12,7 +15,8 @@ public class QuestCompassTargetChangeHandler implements Listener {
1215
@EventHandler
1316
public void QuestCompassTargetChangeEvent(QuestCompassTargetChangeEvent event) {
1417
HonnyCompass honnyCompass = HonnyCompass.getInstance();
15-
Optional<PlayerCompass> optionalPlayerCompass = honnyCompass.getCompass(event.getPlayer());
18+
19+
Optional<PlayerCompass> optionalPlayerCompass = honnyCompass.getCompass(event.getProfile());
1620
optionalPlayerCompass.ifPresent(playerCompass -> playerCompass.setTargetLocation(event.getLocation()));
1721
}
1822
}

0 commit comments

Comments
 (0)