mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35:44 +01:00
Added check against duplicate Island UUIDs
May relate to https://github.com/BentoBoxWorld/BentoBox/issues/447
This commit is contained in:
parent
acb6cd5650
commit
dc8b672286
@ -223,6 +223,12 @@ public class IslandsManager {
|
|||||||
*/
|
*/
|
||||||
public Island createIsland(Location location, UUID owner){
|
public Island createIsland(Location location, UUID owner){
|
||||||
Island island = new Island(location, owner, plugin.getIWM().getIslandProtectionRange(location.getWorld()));
|
Island island = new Island(location, owner, plugin.getIWM().getIslandProtectionRange(location.getWorld()));
|
||||||
|
while (handler.objectExists(island.getUniqueId())) {
|
||||||
|
// This should never happen, so although this is a potential infinite loop I'm going to leave it here because
|
||||||
|
// it will be bad if this does occur and the server should crash.
|
||||||
|
plugin.logWarning("Duplicate island UUID occurred");
|
||||||
|
island.setUniqueId(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
if (islandCache.addIsland(island)) {
|
if (islandCache.addIsland(island)) {
|
||||||
return island;
|
return island;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user