mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-26 05:42:37 +02:00
Removed sum deaths setting.
This setting was originally for the ASkyBlock level calculation and so should go into the Level addon, not BentoBox.
This commit is contained in:
parent
c79df4c813
commit
88a3ebbf2a
@ -293,10 +293,4 @@ public interface WorldSettings extends ConfigObject {
|
||||
*/
|
||||
boolean isKickedKeepInventory();
|
||||
|
||||
/**
|
||||
* @return whether the death value reported by {@link world.bentobox.bentobox.database.objects.Players#getDeaths()}
|
||||
* should include a sum of all players on the island or not
|
||||
* @since 1.5.0
|
||||
*/
|
||||
boolean isDeathsSumTeam();
|
||||
}
|
||||
|
@ -266,22 +266,12 @@ public class Players implements DataObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of deaths in this world. If {@link world.bentobox.bentobox.api.configuration.WorldSettings#isDeathsSumTeam()}
|
||||
* is true, then this value will be the sum of the team deaths.
|
||||
* Get the number of deaths in this world.
|
||||
* @param world - world
|
||||
* @return number of deaths
|
||||
*/
|
||||
public int getDeaths(World world) {
|
||||
BentoBox plugin = BentoBox.getInstance();
|
||||
int d = deaths.getOrDefault(world.getName(), 0);
|
||||
if (plugin.getIWM().isDeathsSumTeam(world) && plugin.getIslands().hasIsland(world, getPlayerUUID())) {
|
||||
// Sum team deaths
|
||||
d += plugin.getIslands().getIsland(world, getPlayerUUID()).getMemberSet().stream()
|
||||
.filter(playerUUID -> !getPlayerUUID().equals(playerUUID))
|
||||
.map(playerUUID -> plugin.getPlayers().getDeaths(world, playerUUID))
|
||||
.collect(Collectors.summingInt(Integer::intValue));
|
||||
}
|
||||
return d;
|
||||
return deaths.getOrDefault(world.getName(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -715,11 +715,4 @@ public class IslandWorldManager {
|
||||
return gameModes.get(world).getWorldSettings().isKickedKeepInventory();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the death value reported by {@link world.bentobox.bentobox.database.objects.Players#getDeaths()}
|
||||
* should include a sum of all players on the island or not
|
||||
*/
|
||||
public boolean isDeathsSumTeam(@NonNull World world) {
|
||||
return gameModes.get(world).getWorldSettings().isDeathsSumTeam();
|
||||
}
|
||||
}
|
||||
|
@ -129,33 +129,10 @@ public class PlayersTest {
|
||||
* Test for {@link world.bentobox.bentobox.database.objects.Players#getDeaths(World)}
|
||||
*/
|
||||
@Test
|
||||
public void testGetDeathsNoSumTeam() {
|
||||
public void testGetDeaths() {
|
||||
p.addDeath(world);
|
||||
p.addDeath(world);
|
||||
assertEquals(2, p.getDeaths(world));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for {@link world.bentobox.bentobox.database.objects.Players#getDeaths(World)}
|
||||
*/
|
||||
@Test
|
||||
public void testGetDeathsSumTeamNoIsland() {
|
||||
when(im.hasIsland(any(), any(UUID.class))).thenReturn(false);
|
||||
p.addDeath(world);
|
||||
p.addDeath(world);
|
||||
when(iwm.isDeathsSumTeam(any())).thenReturn(true);
|
||||
assertEquals(2, p.getDeaths(world));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for {@link world.bentobox.bentobox.database.objects.Players#getDeaths(World)}
|
||||
*/
|
||||
@Test
|
||||
public void testGetDeathsSumTeamHasIsland() {
|
||||
p.addDeath(world);
|
||||
p.addDeath(world);
|
||||
when(iwm.isDeathsSumTeam(any())).thenReturn(true);
|
||||
assertEquals(52, p.getDeaths(world));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user