Compare commits

...

5 Commits

Author SHA1 Message Date
Christian Koop e438efa4d0
Merge pull request #2 from xartuu/master
Fixed interactions with kit blocks
2023-08-25 14:53:56 +02:00
craftaro-plugins-overview[bot] 87598f6a3a
Updates contents of README.md 2023-08-25 12:31:27 +00:00
craftaro-plugins-overview[bot] 288bed7fd0
Updates contents of README.md (#3)
Co-authored-by: craftaro-plugins-overview[bot] <111250264+craftaro-plugins-overview[bot]@users.noreply.github.com>
2023-08-25 12:25:32 +02:00
Artur Kociszewski a74b801576
feat: Added message about the need for a key 2023-04-30 19:46:04 +02:00
Artur Kociszewski 20effd37cb
fix: Fixed interactions with kit blocks 2023-04-30 19:45:09 +02:00
3 changed files with 88 additions and 30 deletions

View File

@ -1,4 +1,46 @@
# UltimateKits
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<img src="https://craftaro.com/images/products/493/icons/2hG0tPkGtUknkEKG7X13mwesVyeie8k3g3xpoU9v.png" width="128px">
UltimateKits introduces a powerful, yet intuitive system to your server that allows players and administrators to preview and purchase your delicately crafted in-game kits. Kits can be easily assigned to any block and configured to sell for either kit keys or economy balance. That, along with it's unique, one-of-a kind kit editor makes it a must have for server owners looking to add something to their server in order to boost profit and keep players motivated! Have questions? Check out our support page [here](http://songoda.com/support.php?a=product&id=UltimateKits.2 "http://songoda.com/support.php?a=product&id=UltimateKits.2").
![N|Solid](https://i.imgur.com/jKtE7ZM.png)
# UltimateKits
**Creating and displaying your server&#39;s kits has never been easier.**
**Use a GUI to drag kit items in then players can browse through them and even use crate keys on them.**
[![Discord][Discord shield]][Discord invite]
[![Patreon][Patreon shield]][Patreon page]
<br>
[![Latest version][Latest version shield]][Marketplace page]
[![bStats Servers][bStats shield]][bStats page]
</div>
## Download (Marketplace)
You can visit [our marketplace][Marketplace page] to download UltimateKits as well as take a
look at many other fantastic plugins which are sure to catch your eye.
## Documentation
You can find all the information about UltimateKits, including dependencies, commands, permissions and incompatible
plugins on [our wiki][Plugin wiki].
Feel free to also contribute to the wiki as a way to help others in the community with using the plugin.
## Support
If you encounter any issues while using the plugin, feel free to contact us on
[our Discord server][Discord invite].
## Suggestions
For suggestions about features you think should be added to the plugin to increase its functionality, feel free to
create a thread over on [our Discord server][Discord invite].
[Marketplace page]: https://craftaro.com/marketplace/product/14
[Plugin wiki]: https://wiki.craftaro.com/index.php/Ultimate_Kits
[Patreon page]: https://www.patreon.com/join/songoda
[Discord invite]: https://discord.gg/craftaro
[bStats page]: https://bstats.org/plugin/bukkit/UltimateKits/4198
[Patreon shield]: https://img.shields.io/badge/-Support_us_on_Patreon-F96854.svg?logo=patreon&style=flat&logoColor=white
[Discord shield]: https://img.shields.io/discord/293212540723396608?color=5865F2&label=Discord&logo=discord&logoColor=5865F2
[bStats shield]: https://img.shields.io/bstats/servers/4198?label=Servers
[Latest version shield]: https://img.shields.io/badge/dynamic/xml?style=flat&color=blue&logo=github&logoColor=white&label=Latest&url=https%3A%2F%2Fraw.githubusercontent.com%2Fcraftaro%2FUltimateKits%2Fmaster%2Fpom.xml&query=%2F*%5Blocal-name()%3D'project'%5D%2F*%5Blocal-name()%3D'version'%5D

View File

@ -21,6 +21,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import com.songoda.ultimatekits.settings.Settings;
public class InteractListeners implements Listener {
@ -48,50 +49,64 @@ public class InteractListeners implements Listener {
Kit kit = kitBlockData.getKit();
Player player = event.getPlayer();
Material itemInHand = player.getItemInHand().getType();
Material keyMaterial = Settings.KEY_MATERIAL.getMaterial().getItem().getType();
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
if (player.isSneaking()) return;
event.setCancelled(true);
if (player.getItemInHand().getType() == Material.TRIPWIRE_HOOK) {
event.setCancelled(true);
kit.processKeyUse(player);
if (player.isSneaking()) {
return;
}
if (kitBlockData.getType() != KitType.PREVIEW) {
event.setCancelled(true);
if (kitBlockData.getType() == KitType.PREVIEW) {
kit.display(player, guiManager, null);
} else if(kitBlockData.getType() == KitType.CRATE) {
if (itemInHand == keyMaterial) {
kit.processKeyUse(player);
} else {
plugin.getLocale().getMessage("event.crate.needkey").sendPrefixedMessage(player);
return;
}
} else if (kitBlockData.getType() == KitType.CLAIM) {
if (!kit.hasPermissionToClaim(player)) {
plugin.getLocale().getMessage("command.general.noperms").sendPrefixedMessage(player);
return;
}
if (kit.getNextUse(player) <= 0) {
kit.processGenericUse(player, false);
kit.updateDelay(player);
} else {
if (kit.getNextUse(player) > 0) {
long time = kit.getNextUse(player);
plugin.getLocale().getMessage("event.crate.notyet").processPlaceholder("time",
Methods.makeReadable(time)).sendPrefixedMessage(player);
plugin.getLocale().getMessage("event.crate.notyet").processPlaceholder("time", Methods.makeReadable(time)).sendPrefixedMessage(player);
return;
}
} else if (kit.getLink() != null || kit.getPrice() != 0) {
kit.buy(player, guiManager);
} else {
kit.display(player, guiManager, null);
}
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (block.getState() instanceof InventoryHolder || block.getType() == Material.ENDER_CHEST) {
event.setCancelled(true);
if (kit.getLink() != null || kit.getPrice() != 0) {
kit.buy(player, guiManager);
} else {
kit.processGenericUse(player, false);
}
kit.updateDelay(player);
}
}
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
event.setCancelled(true);
if (player.isSneaking() && player.hasPermission("ultimatekits.admin")) {
guiManager.showGUI(player, new BlockEditorGui(plugin, kitBlockData));
return;
}
if (player.getItemInHand().getType() == Material.TRIPWIRE_HOOK) {
event.setCancelled(true);
kit.processKeyUse(player);
return;
}
kit.display(player, guiManager, null);
kit.display(player, guiManager, null);
}
}

View File

@ -187,6 +187,7 @@ event:
wrongkey: '&cThis key doesn''t belong to this kit..'
success: '&9Successfully opened a crate.'
given: '&9You have received a %crate% %kit% crate.'
needkey: '&cYou need the right key to get this kit'
claim:
cannotafford: '&9You cannot afford to buy kit &7%kit%&9.'
nottwice: '&9You can only receive this kit once.'