From 31884ea59d9907d3552a41dd4658042dadbc94d2 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 10 Sep 2016 14:31:42 +0100 Subject: [PATCH] Maybe fix race condition with messages not sending --- .../src/main/java/me/lucko/luckperms/BukkitSenderFactory.java | 4 ++-- .../src/main/java/me/lucko/luckperms/BungeeSenderFactory.java | 4 ++-- .../src/main/java/me/lucko/luckperms/SpongeSenderFactory.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/BukkitSenderFactory.java b/bukkit/src/main/java/me/lucko/luckperms/BukkitSenderFactory.java index 219f1ed4..a5c8a678 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/BukkitSenderFactory.java +++ b/bukkit/src/main/java/me/lucko/luckperms/BukkitSenderFactory.java @@ -34,8 +34,8 @@ import java.util.UUID; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class BukkitSenderFactory extends SenderFactory { private static BukkitSenderFactory instance = null; - public static BukkitSenderFactory get() { - if (instance == null){ + public static synchronized BukkitSenderFactory get() { + if (instance == null) { instance = new BukkitSenderFactory(); } return instance; diff --git a/bungee/src/main/java/me/lucko/luckperms/BungeeSenderFactory.java b/bungee/src/main/java/me/lucko/luckperms/BungeeSenderFactory.java index 8c04aba8..10a86560 100644 --- a/bungee/src/main/java/me/lucko/luckperms/BungeeSenderFactory.java +++ b/bungee/src/main/java/me/lucko/luckperms/BungeeSenderFactory.java @@ -35,8 +35,8 @@ import java.util.UUID; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class BungeeSenderFactory extends SenderFactory { private static BungeeSenderFactory instance = null; - public static BungeeSenderFactory get() { - if (instance == null){ + public static synchronized BungeeSenderFactory get() { + if (instance == null) { instance = new BungeeSenderFactory(); } return instance; diff --git a/sponge/src/main/java/me/lucko/luckperms/SpongeSenderFactory.java b/sponge/src/main/java/me/lucko/luckperms/SpongeSenderFactory.java index 2bf7dccd..d02ed84c 100644 --- a/sponge/src/main/java/me/lucko/luckperms/SpongeSenderFactory.java +++ b/sponge/src/main/java/me/lucko/luckperms/SpongeSenderFactory.java @@ -35,8 +35,8 @@ import java.util.UUID; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class SpongeSenderFactory extends SenderFactory { private static SpongeSenderFactory instance = null; - public static SpongeSenderFactory get() { - if (instance == null){ + public static synchronized SpongeSenderFactory get() { + if (instance == null) { instance = new SpongeSenderFactory(); } return instance;