mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 13:45:14 +01:00
Fix bug with sethome not replacing previous homes.
This commit is contained in:
parent
8f469eb339
commit
d34ad5dce3
@ -165,6 +165,8 @@ public class Players implements DataObject {
|
||||
* @param number - a number
|
||||
*/
|
||||
public void setHomeLocation(Location location, int number) {
|
||||
// Remove any home locations in the same world with the same number
|
||||
homeLocations.entrySet().removeIf(e -> Util.sameWorld(location.getWorld(), e.getKey().getWorld()) && e.getValue().equals(number));
|
||||
homeLocations.put(location, number);
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.powermock.reflect.Whitebox;
|
||||
@ -33,9 +34,10 @@ import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.database.objects.Players;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest( { BSkyBlock.class })
|
||||
@PrepareForTest( { BSkyBlock.class, Util.class })
|
||||
public class MySQLDatabaseHandlerTest {
|
||||
|
||||
private static MySQLDatabaseHandler<Island> handler;
|
||||
@ -87,6 +89,9 @@ public class MySQLDatabaseHandlerTest {
|
||||
instance.setUniqueId(UNIQUE_ID);
|
||||
handler = new MySQLDatabaseHandler<>(plugin, Island.class, dbConn);
|
||||
|
||||
PowerMockito.mockStatic(Util.class);
|
||||
when(Util.sameWorld(Mockito.any(), Mockito.any())).thenReturn(true);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user