Some updates

- Added Reddit flair sync
- Removed magical saddle because the stacking potato does the same thing
- Some internal improvements
- Fixed bug where if a service throws an error while starting or stopping it breaks the entire plugin
This commit is contained in:
Seth
2020-08-04 15:16:11 -07:00
parent b73d1df350
commit 81df3103b6
20 changed files with 466 additions and 94 deletions

View File

@ -107,29 +107,14 @@ public class ItemFun extends FreedomService
if (player.getInventory().getItemInMainHand().getType().equals(Material.POTATO) || entity.getType().equals(EntityType.PLAYER))
{
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory().getItemInMainHand(), plugin.sh.getStackingPotato()))
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory(), plugin.sh.getStackingPotato()))
{
player.addPassenger(entity);
player.sendMessage("Stacked " + entity.getName());
}
}
if (onCooldown(player, ShopItem.MAGICAL_SADDLE))
{
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 15 seconds.");
return;
}
if (player.getInventory().getItemInMainHand().getType().equals(Material.SADDLE) || player.getInventory().getItemInOffHand().getType().equals(Material.SADDLE) || entity.getType().equals(EntityType.PLAYER))
{
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.MAGICAL_SADDLE, player.getInventory().getItemInMainHand(), plugin.sh.getMagicalSaddle()) || plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.MAGICAL_SADDLE, player.getInventory().getItemInOffHand(), plugin.sh.getMagicalSaddle()))
{
entity.addPassenger(player);
cooldown(player, ShopItem.MAGICAL_SADDLE, 15);
if (entity instanceof Player)
{
entity.sendMessage(ChatColor.GRAY + player.getName() + " is now riding you, run /eject to eject them.");
return;
}
player.addPassenger(entity);
player.sendMessage("Stacked " + entity.getName());
}
}
}
@ -152,7 +137,7 @@ public class ItemFun extends FreedomService
return;
}
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory().getItemInMainHand(), plugin.sh.getStackingPotato()))
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory(), plugin.sh.getStackingPotato()))
{
return;
}
@ -215,7 +200,7 @@ public class ItemFun extends FreedomService
case BLAZE_ROD:
{
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.LIGHTNING_ROD, player.getInventory().getItemInMainHand(), plugin.sh.getLightningRod()))
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.LIGHTNING_ROD, player.getInventory(), plugin.sh.getLightningRod()))
{
break;
}
@ -239,7 +224,7 @@ public class ItemFun extends FreedomService
case FIRE_CHARGE:
{
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.FIRE_BALL, player.getInventory().getItemInMainHand(), plugin.sh.getFireBall()))
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.FIRE_BALL, player.getInventory(), plugin.sh.getFireBall()))
{
break;
}
@ -263,7 +248,7 @@ public class ItemFun extends FreedomService
final int RADIUS_HIT = 5;
final int STRENGTH = 4;
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.CLOWN_FISH, player.getInventory().getItemInMainHand(), plugin.sh.getClownFish()))
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.CLOWN_FISH, player.getInventory(), plugin.sh.getClownFish()))
{
break;
}
@ -329,7 +314,7 @@ public class ItemFun extends FreedomService
if (entity instanceof EnderPearl && entity.getShooter() instanceof Player)
{
Player player = (Player)entity.getShooter();
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.RIDEABLE_PEARL, player.getInventory().getItemInMainHand(), plugin.sh.getRideablePearl()))
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.RIDEABLE_PEARL, player.getInventory(), plugin.sh.getRideablePearl()))
{
entity.addPassenger(player);
}
@ -390,7 +375,7 @@ public class ItemFun extends FreedomService
PlayerData data = plugin.pl.getData(player);
PlayerInventory inv = event.getPlayer().getInventory();
ItemStack rod = inv.getItemInMainHand();
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.GRAPPLING_HOOK, player.getInventory().getItemInMainHand(), plugin.sh.getGrapplingHook()))
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.GRAPPLING_HOOK, player.getInventory(), plugin.sh.getGrapplingHook()))
{
if (event.getState() == PlayerFishEvent.State.REEL_IN || event.getState() == PlayerFishEvent.State.IN_GROUND)
{