Hello, I present to your attention the recode
of the GreatKits plugin from Kizeko_
I express my sincere gratitude for using his resources.
GreatKitsReloaded - allows you to easily create and edit kits. In addition, it saves inventory by slots, which allows you to load a kit with the arrangement of items as you have installed. In addition, the code was rewritten and some bugs were fixed.
Made support for versions 1.12.2 - 1.19.x
Supports multiple languages, the plugin already contains translations of English, Russian, Spanish, German, Chinese
The plugin was rewritten and improved by coder 6ex9one
Saving items by slot has been improved, support for translations and different languages has been improved, bugs have been fixed, and support for the next versions has been added. It is also planned to be updated further.
Supported plugins :
This plugin supports
PlaceholderAPI
https://www.spigotmc.org/resources/placeholderapi.6245/
Admin-Commands:
➤ /gk create <kit> - Allows you to create a whale with the specified ID
➤
/gk setname <kit> <Name> - Allows you to assign a name to the whale, supports all colors including RGB
➤
/gk remove <kit> - Allows you to remove the whale
➤
/gk setonetimeuse <kit> <true/false> - Allows you to specify whether the set will be disposable.
➤
/gk setfirstjoin <kit> <true/false> - Specifies whether the whale will be issued automatically upon login.
➤
/gk setinv <kit> - Install inventory for the whale (the one you have now)
➤
/gk setcooldown <kit> <seconds> - Allows you to set the cooldown for recruitment in seconds
Note! Attention with the new update you will be able to specify any command that should be executed when entering our command!
Player-Commands:
➤ /kit <kit> - Get the specified set
➤
/kit list - Get a list of available sets
➤
/kit - Shows help on the command, but!
Note! Attention with the new update you will be able to specify any command that should be executed when entering our command!
Permissions:
➤ greatkits.* - Allows the player to access all kits without any restrictions. ( Default: false )
➤
greatkits.admin - Allows the player to bypass cooldowns and one-time-use limitations.
( Default: op )
➤
greatkits.<kitId> - Allows the player to access a specific kit with the given ID.
( Default: false )
➤
greatkits.list - Allows the player to see the list of available kits.
( Default: true )
Developer API
➤ The
API is fully
asynchronous-friendly and ready to use right after the plugin is loaded.
Getting Started
➤ You can access the API using:
Code (Java):
KitsAPI api
= GKReloaded.
getAPI
(
)
;
Note! Make sure that
GreatKitsReloaded is loaded before you call this method.
If it’s not present on the server, `GKReloaded.getAPI()` will return `null`.
Example Usage
➤ Give a kit to a player
Code (Java):
KitsAPI api
= GKReloaded.
getAPI
(
)
;
if
(api.
canClaim
(player,
"starter"
)
)
{
api.
giveKit
(player,
"starter",
true,
true
)
;
player.
sendMessage
(
"§aYou received your start kit!"
)
;
}
else
{
player.
sendMessage
(
"§cYou cannot claim this kit yet!"
)
;
}
Check cooldown
Code (Java):
long remain
= GKReloaded.
getAPI
(
).
getRemainingCooldown
(player.
getUniqueId
(
),
"starter"
)
;
if
(remain
>
0
)
{
player.
sendMessage
(
"§eYou can use this kit again in "
+
(remain
/
1000
)
+
" seconds."
)
;
}
List all kits
Code (Java):
for
(Kit kit
: GKReloaded.
getAPI
(
).
getKits
(
)
)
{
Bukkit.
getLogger
(
).
info
(
"Loaded kit: "
+ kit.
getName
(
)
)
;
}
API Structure
Interface: KitsAPI
Code (Java):
public
interface KitsAPI
{
Kit getKit
(
String id
)
;
Collection
<Kit
> getKits
(
)
;
boolean giveKit
(Player player,
String id,
boolean checkCooldown,
boolean checkOneTimeUse
)
;
boolean canClaim
(Player player,
String id
)
;
long getRemainingCooldown
(UUID uuid,
String id
)
;
void saveKit
(
String id
)
;
void deleteKit
(
String id
)
;
}
Interface: Kit
Code (Java):
public
interface Kit
{
String getName
(
)
;
int getCooldown
(
)
;
boolean isOneTimeUse
(
)
;
boolean isFirstTimeJoinKit
(
)
;
Map
<
Integer, ItemStack
> getItems
(
)
;
void give
(Player player,
boolean dropFullInventory
)
;
}
Example Integration
Code (Java):
public
class ExamplePlugin
extends JavaPlugin
{
private KitsAPI kits
;
@Override
public
void onEnable
(
)
{
if
(Bukkit.
getPluginManager
(
).
getPlugin
(
"GreatKitsReloaded"
)
!=
null
)
{
kits
= GKReloaded.
getAPI
(
)
;
getLogger
(
).
info
(
"GreatKitsReloaded API successfully hooked!"
)
;
}
else
{
getLogger
(
).
warning
(
"GreatKitsReloaded not found. API disabled."
)
;
}
}
public
void giveStartKit
(Player player
)
{
if
(kits
!=
null
&& kits.
canClaim
(player,
"start"
)
)
{
kits.
giveKit
(player,
"start",
true,
true
)
;
}
}
}