Rename extended API interfaces

This commit is contained in:
GeorgH93 2021-06-21 22:15:20 +02:00
parent 3d1c40b9b4
commit 7ccf3edaf6
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
10 changed files with 32 additions and 41 deletions

View File

@ -18,16 +18,15 @@
package at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI;
import at.pcgamingfreaks.Bukkit.Message.Message;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface BackpackExtended extends Backpack
public interface Backpack extends at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack
{
@Override
@NotNull MinepacksPlayerExtended getOwner();
@NotNull MinepacksPlayer getOwner();
/**
* Let a given player open this backpack.

View File

@ -37,7 +37,7 @@
*/
public abstract class MinepacksCommand extends SubCommand
{
private static MinepacksPluginExtended minepacksPlugin = null;
private static MinepacksPlugin minepacksPlugin = null;
private static Method showHelp = null;
private static Message messageNoPermission = new Message(ChatColor.RED + "You don't have the permission to do that.");
private static Message messageNotFromConsole = new Message(ChatColor.RED + "This command can't be used from console!");
@ -95,7 +95,7 @@ public MinepacksCommand(@NotNull JavaPlugin plugin, @NotNull String name, @NotNu
*
* @return The instance of the marriage master plugin.
*/
protected @NotNull MinepacksPluginExtended getMinepacksPlugin()
protected @NotNull MinepacksPlugin getMinepacksPlugin()
{
return minepacksPlugin;
}

View File

@ -18,15 +18,14 @@
package at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI;
import at.pcgamingfreaks.Bukkit.Message.IMessage;
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface MinepacksPlayerExtended extends MinepacksPlayer
public interface MinepacksPlayer extends at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer
{
@Override
BackpackExtended getBackpack();
Backpack getBackpack();
void send(@NotNull IMessage message, @Nullable Object... args);

View File

@ -17,16 +17,13 @@
package at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin;
import at.pcgamingfreaks.Version;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface MinepacksPluginExtended extends MinepacksPlugin
public interface MinepacksPlugin extends at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlugin
{
/**
* Gets the command manager of the Minepacks plugin.
@ -43,7 +40,7 @@ public interface MinepacksPluginExtended extends MinepacksPlugin
* @return The backpack of the given player. null if the backpack is not loaded.
*/
@Override
@Nullable BackpackExtended getBackpackLoadedOnly(final @NotNull OfflinePlayer owner);
@Nullable Backpack getBackpackLoadedOnly(final @NotNull OfflinePlayer owner);
@NotNull Version getVersion();
}

View File

@ -23,7 +23,6 @@
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Enums.ShrinkApproach;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.InventoryCompressor;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.MinepacksPlayerData;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.BackpackExtended;
import at.pcgamingfreaks.StringUtils;
import org.bukkit.Bukkit;
@ -43,7 +42,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class Backpack implements BackpackExtended
public class Backpack implements at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.Backpack
{
@Setter(AccessLevel.PACKAGE) private static ShrinkApproach shrinkApproach = ShrinkApproach.COMPRESS;
private static Object titleOwn;

View File

@ -20,9 +20,9 @@
import at.pcgamingfreaks.Bukkit.Message.Message;
import at.pcgamingfreaks.Bukkit.Util.Utils;
import at.pcgamingfreaks.Command.HelpData;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.BackpackExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
@ -72,7 +72,7 @@ public void execute(final @NotNull CommandSender commandSender, final @NotNull S
{
if(backpack.getOwner().isOnline())
{
MinepacksPlayerExtended owner = ((BackpackExtended)backpack).getOwner();
MinepacksPlayer owner = ((Backpack)backpack).getOwner();
messageClearedOther.send(commandSender, backpack.getOwner().getName(), owner.getDisplayName());
owner.sendMessage(messageClearedBy, commandSender.getName(), (commandSender instanceof Player) ? ((Player) commandSender).getDisplayName() : ChatColor.GRAY + commandSender.getName());
}

View File

@ -23,7 +23,7 @@
import at.pcgamingfreaks.Command.HelpData;
import at.pcgamingfreaks.Message.MessageClickEvent;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
@ -73,7 +73,7 @@ public void execute(final @NotNull CommandSender sender, final @NotNull String m
{
if(getMinepacksPlugin().isPlayerGameModeAllowed((Player) sender))
{
MinepacksPlayerExtended minepacksPlayer = plugin.getMinepacksPlayer((Player) sender);
MinepacksPlayer minepacksPlayer = plugin.getMinepacksPlayer((Player) sender);
if(plugin.getCooldownManager() != null && !player.hasPermission(Permissions.NO_COOLDOWN))
{
long cd = plugin.getCooldownManager().getRemainingCooldown(minepacksPlayer);

View File

@ -28,7 +28,7 @@
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Backend.MySQL;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Backend.SQLite;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Enums.DatabaseType;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import org.bukkit.Bukkit;
@ -182,7 +182,7 @@ public void onPlayerLoginEvent(final @NotNull PlayerJoinEvent event)
return player;
}
public @Nullable MinepacksPlayerExtended getPlayerCached(final @NotNull OfflinePlayer offlinePlayer)
public @Nullable MinepacksPlayer getPlayerCached(final @NotNull OfflinePlayer offlinePlayer)
{
return cache.getCachedPlayer(offlinePlayer.getUniqueId());
}

View File

@ -20,9 +20,8 @@
import at.pcgamingfreaks.Bukkit.Message.IMessage;
import at.pcgamingfreaks.Database.Cache.ICacheablePlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.Item.ItemConfig;
import at.pcgamingfreaks.Minepacks.Bukkit.MagicValues;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
@ -43,7 +42,7 @@
import java.util.UUID;
import java.util.concurrent.ConcurrentLinkedQueue;
public class MinepacksPlayerData implements MinepacksPlayerExtended, ICacheablePlayer
public class MinepacksPlayerData implements MinepacksPlayer, ICacheablePlayer
{
@Getter @Setter private @NotNull String name;
private final @NotNull UUID uuid;
@ -58,7 +57,7 @@ public class MinepacksPlayerData implements MinepacksPlayerExtended, ICacheableP
@Getter @Setter private Object databaseKey = null;
private final Queue<Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack>> backpackLoadedQueue = new ConcurrentLinkedQueue<>();
private final Queue<Callback<MinepacksPlayer>> playerLoadedQueue = new ConcurrentLinkedQueue<>();
private final Queue<Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer>> playerLoadedQueue = new ConcurrentLinkedQueue<>();
public MinepacksPlayerData(final @Nullable UUID uuid, final @NotNull String name)
{
@ -202,7 +201,7 @@ public boolean isLoaded()
}
@Override
public void notifyOnLoad(final @NotNull Callback<MinepacksPlayer> callback)
public void notifyOnLoad(final @NotNull Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer> callback)
{
if(isLoaded()) callback.onResult(this);
else playerLoadedQueue.add(callback);

View File

@ -22,18 +22,16 @@
import at.pcgamingfreaks.Bukkit.Message.Message;
import at.pcgamingfreaks.Bukkit.Util.Utils;
import at.pcgamingfreaks.ConsoleColor;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.API.Callback;
import at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.API.WorldBlacklistMode;
import at.pcgamingfreaks.Minepacks.Bukkit.Command.CommandManager;
import at.pcgamingfreaks.Minepacks.Bukkit.Command.InventoryClearCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.Command.ShortcutCommand;
import at.pcgamingfreaks.Minepacks.Bukkit.Database.*;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.BackpackExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.Backpack;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksCommandManager;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayerExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPluginExtended;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlayer;
import at.pcgamingfreaks.Minepacks.Bukkit.ExtendedAPI.MinepacksPlugin;
import at.pcgamingfreaks.Minepacks.Bukkit.Item.ItemConfig;
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*;
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
@ -61,7 +59,7 @@
import java.util.Locale;
import java.util.Set;
public class Minepacks extends JavaPlugin implements MinepacksPluginExtended
public class Minepacks extends JavaPlugin implements MinepacksPlugin
{
@Getter private static Minepacks instance = null;
@ -269,13 +267,13 @@ public void reload()
}
@Override
public void openBackpack(final @NotNull Player opener, final @NotNull MinepacksPlayer owner, final boolean editable, final @Nullable String title)
public void openBackpack(final @NotNull Player opener, final @NotNull at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer owner, final boolean editable, final @Nullable String title)
{
owner.getBackpack(backpack -> openBackpack(opener, backpack, editable, title));
}
@Override
public void openBackpack(final @NotNull Player opener, final @NotNull Backpack backpack, final boolean editable, final @Nullable String title)
public void openBackpack(final @NotNull Player opener, final @NotNull at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack backpack, final boolean editable, final @Nullable String title)
{
WorldBlacklistMode disabled = isDisabled(opener);
if(disabled != WorldBlacklistMode.None)
@ -297,14 +295,14 @@ public void openBackpack(final @NotNull Player opener, final @NotNull Backpack b
}
@Override
public @Nullable BackpackExtended getBackpackLoadedOnly(@NotNull OfflinePlayer owner)
public @Nullable Backpack getBackpackLoadedOnly(@NotNull OfflinePlayer owner)
{
MinepacksPlayerExtended minepacksPlayer = getMinepacksPlayerLoadedOnly(owner);
MinepacksPlayer minepacksPlayer = getMinepacksPlayerLoadedOnly(owner);
return (minepacksPlayer != null) ? minepacksPlayer.getBackpack() : null;
}
@Override
public void getBackpack(final @NotNull OfflinePlayer owner, final @NotNull Callback<Backpack> callback)
public void getBackpack(final @NotNull OfflinePlayer owner, final @NotNull Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack> callback)
{
getMinepacksPlayer(owner).getBackpack(callback);
}
@ -316,15 +314,15 @@ public void getBackpack(final @NotNull OfflinePlayer owner, final @NotNull Callb
}
@Override
public void getMinepacksPlayer(final @NotNull OfflinePlayer player, final @NotNull Callback<MinepacksPlayer> callback)
public void getMinepacksPlayer(final @NotNull OfflinePlayer player, final @NotNull Callback<at.pcgamingfreaks.Minepacks.Bukkit.API.MinepacksPlayer> callback)
{
getMinepacksPlayer(player).notifyOnLoad(callback);
}
@Override
public @Nullable MinepacksPlayerExtended getMinepacksPlayerLoadedOnly(@NotNull OfflinePlayer player)
public @Nullable MinepacksPlayer getMinepacksPlayerLoadedOnly(@NotNull OfflinePlayer player)
{
MinepacksPlayerExtended mpPlayer = database.getPlayerCached(player);
MinepacksPlayer mpPlayer = database.getPlayerCached(player);
if(mpPlayer != null && mpPlayer.isLoaded()) return mpPlayer;
return null;
}