mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
Merge pull request #162 from Craftinators/remapped
Cleanup previous PR changes
This commit is contained in:
@@ -9,10 +9,8 @@ import com.hibiscusmc.hmccosmetics.gui.Menus;
|
|||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUserProvider;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUserProvider;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import lombok.Getter;
|
|
||||||
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -149,21 +147,21 @@ public final class HMCCosmeticsAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a new cosmetic user provider to use to construct {@link CosmeticUser}s.
|
* Registers a new cosmetic user provider to use for constructing {@link CosmeticUser} instances.
|
||||||
*
|
*
|
||||||
* @param provider the provider to register
|
* @param provider the provider to register
|
||||||
* @throws IllegalArgumentException if another plugin has already registered a provider
|
* @throws IllegalArgumentException if another plugin has already registered a provider
|
||||||
*/
|
*/
|
||||||
public static void registerCosmeticUserProvider(final CosmeticUserProvider provider) {
|
public static void registerCosmeticUserProvider(@NotNull CosmeticUserProvider provider) {
|
||||||
CosmeticUsers.registerProvider(provider);
|
CosmeticUsers.registerProvider(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the current {@link CosmeticUserProvider} that is in use.
|
* Retrieves the current {@link CosmeticUserProvider} that is in use.
|
||||||
*
|
*
|
||||||
* @return the {@link CosmeticUserProvider}
|
* @return the current {@link CosmeticUserProvider}
|
||||||
*/
|
*/
|
||||||
public static CosmeticUserProvider getCosmeticUserProvider() {
|
public static @NotNull CosmeticUserProvider getCosmeticUserProvider() {
|
||||||
return CosmeticUsers.getProvider();
|
return CosmeticUsers.getProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
package com.hibiscusmc.hmccosmetics.listener;
|
package com.hibiscusmc.hmccosmetics.listener;
|
||||||
|
|
||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.api.HMCCosmeticsAPI;
|
|
||||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerLoadEvent;
|
import com.hibiscusmc.hmccosmetics.api.events.PlayerLoadEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerPreLoadEvent;
|
import com.hibiscusmc.hmccosmetics.api.events.PlayerPreLoadEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerUnloadEvent;
|
import com.hibiscusmc.hmccosmetics.api.events.PlayerUnloadEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.config.DatabaseSettings;
|
import com.hibiscusmc.hmccosmetics.config.DatabaseSettings;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
|
||||||
import com.hibiscusmc.hmccosmetics.database.Database;
|
import com.hibiscusmc.hmccosmetics.database.Database;
|
||||||
import com.hibiscusmc.hmccosmetics.database.UserData;
|
|
||||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUserProvider;
|
|
||||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
import com.hibiscusmc.hmccosmetics.user.CosmeticUsers;
|
||||||
import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager;
|
import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager;
|
||||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@@ -26,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class PlayerConnectionListener implements Listener {
|
public class PlayerConnectionListener implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@@ -69,7 +63,7 @@ public class PlayerConnectionListener implements Listener {
|
|||||||
}, 4);
|
}, 4);
|
||||||
});
|
});
|
||||||
}).exceptionally(ex -> {
|
}).exceptionally(ex -> {
|
||||||
log.error("Unable to load Cosmetic User {}", uuid, ex);
|
MessagesUtil.sendDebugMessages("Unable to load Cosmetic User " + uuid + ". Exception: " + ex.getMessage());
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
|||||||
import com.hibiscusmc.hmccosmetics.database.UserData;
|
import com.hibiscusmc.hmccosmetics.database.UserData;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ public interface CosmeticUserProvider {
|
|||||||
* @return the {@link CosmeticUser}
|
* @return the {@link CosmeticUser}
|
||||||
* @apiNote This method is called during the {@link PlayerJoinEvent}.
|
* @apiNote This method is called during the {@link PlayerJoinEvent}.
|
||||||
*/
|
*/
|
||||||
CosmeticUser createCosmeticUser(UUID playerId, UserData userData);
|
@NotNull CosmeticUser createCosmeticUser(@NotNull UUID playerId, @NotNull UserData userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the custom {@link CosmeticUser}.
|
* Construct the custom {@link CosmeticUser}.
|
||||||
@@ -28,7 +29,7 @@ public interface CosmeticUserProvider {
|
|||||||
* @return the {@link CosmeticUser}
|
* @return the {@link CosmeticUser}
|
||||||
* @apiNote This method is called during the {@link PlayerJoinEvent}.
|
* @apiNote This method is called during the {@link PlayerJoinEvent}.
|
||||||
*/
|
*/
|
||||||
CosmeticUser createCosmeticUserWithoutData(UUID playerId);
|
@NotNull CosmeticUser createCosmeticUserWithoutData(@NotNull UUID playerId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the plugin that is providing this {@link CosmeticUserProvider}
|
* Represents the plugin that is providing this {@link CosmeticUserProvider}
|
||||||
@@ -41,12 +42,12 @@ public interface CosmeticUserProvider {
|
|||||||
*/
|
*/
|
||||||
class Default implements CosmeticUserProvider {
|
class Default implements CosmeticUserProvider {
|
||||||
@Override
|
@Override
|
||||||
public CosmeticUser createCosmeticUser(UUID playerId, UserData userData) {
|
public @NotNull CosmeticUser createCosmeticUser(@NotNull UUID playerId, @NotNull UserData userData) {
|
||||||
return new CosmeticUser(playerId, userData);
|
return new CosmeticUser(playerId, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CosmeticUser createCosmeticUserWithoutData(UUID playerId) {
|
public @NotNull CosmeticUser createCosmeticUserWithoutData(@NotNull UUID playerId) {
|
||||||
return new CosmeticUser(playerId);
|
return new CosmeticUser(playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.hibiscusmc.hmccosmetics.user;
|
|||||||
|
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils;
|
import com.hibiscusmc.hmccosmetics.util.HMCCServerUtils;
|
||||||
import lombok.Getter;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -54,7 +53,7 @@ public class CosmeticUsers {
|
|||||||
/**
|
/**
|
||||||
* This method allows you to get a CosmeticUser from just using the player class. This just allows you to have a bit less boilerplate.
|
* This method allows you to get a CosmeticUser from just using the player class. This just allows you to have a bit less boilerplate.
|
||||||
* @param player The player to lookup (will take their UUID from the class)
|
* @param player The player to lookup (will take their UUID from the class)
|
||||||
* @return Returns the user if there is a vlaid user, returns null if not.
|
* @return Returns the user if there is a valid user, returns null if not.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public static CosmeticUser getUser(@NotNull Player player) {
|
public static CosmeticUser getUser(@NotNull Player player) {
|
||||||
|
|||||||
Reference in New Issue
Block a user