Skip to content

Commit e811a1f

Browse files
committed
Fix logic for bed respawn
1 parent 95aed8e commit e811a1f

6 files changed

Lines changed: 17 additions & 3 deletions

File tree

pom.xml

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

66
<groupId>fr.fluffevent.fluffyteams</groupId>
77
<artifactId>FluffyTeams</artifactId>
8-
<version>0.1.0-SNAPSHOT</version>
8+
<version>0.1.1-SNAPSHOT</version>
99

1010
<repositories>
1111
<repository>

src/main/java/fr/fluffevent/fluffyteams/Config.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ public class Config {
4040
*/
4141
public static boolean overrideBedRespawnLocation = false;
4242

43+
/**
44+
* Whether to override the player's anchor respawn location with team spawn.
45+
* If true, players will always respawn at their team spawn instead of their
46+
* anchors.
47+
*/
48+
public static boolean overrideAnchorRespawnLocation = false;
49+
4350
/**
4451
* Loads configuration values from config.yml.
4552
* Creates the default configuration file if it doesn't exist.
@@ -56,5 +63,6 @@ public static void readConfig(JavaPlugin plugin) {
5663
databasePassword = config.getString("database-password");
5764
serverName = config.getString("server-name");
5865
overrideBedRespawnLocation = config.getBoolean("override-bed-respawn-location", false);
66+
overrideAnchorRespawnLocation = config.getBoolean("override-anchor-respawn-location", false);
5967
}
6068
}

src/main/java/fr/fluffevent/fluffyteams/controllers/TeamController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public boolean removeOfflineMember(String username) {
352352
// If couldn't get UUID from Mojang, try with Bukkit's offline player (for
353353
// players who have connected before)
354354
if (playerUUID == null) {
355+
@SuppressWarnings("deprecation")
355356
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username);
356357
if (offlinePlayer.hasPlayedBefore()) {
357358
playerUUID = offlinePlayer.getUniqueId();

src/main/java/fr/fluffevent/fluffyteams/listeners/PlayerRespawnListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public PlayerRespawnListener() {
2323
public void onPlayerRespawn(PlayerRespawnEvent event) {
2424
Player player = event.getPlayer();
2525

26-
if (player.getBedLocation() != null && !Config.overrideBedRespawnLocation) {
26+
if (event.isBedSpawn() && !Config.overrideBedRespawnLocation) {
27+
return;
28+
}
29+
30+
if (event.isAnchorSpawn() && !Config.overrideAnchorRespawnLocation) {
2731
return;
2832
}
2933

src/main/resources/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ database-password: "password"
55

66
server-name: "default"
77
override-bed-respawn-location: false
8+
override-anchor-respawn-location: false

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: FluffyTeams
22
main: fr.fluffevent.fluffyteams.FluffyTeams
3-
version: 0.1.0-SNAPSHOT
3+
version: 0.1.1-SNAPSHOT
44
api-version: 1.21
55
author: FluffEvent
66
authors: [lululombard]

0 commit comments

Comments
 (0)