mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge pull request #241 from speedxx/development
add magical saddle to shop
This commit is contained in:
commit
95e67f84ef
@ -0,0 +1,29 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
|
@CommandParameters(description = "Obtain a magical saddle.", usage = "/<command>")
|
||||||
|
public class Command_magicalsaddle extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
if (plugin.pl.getData(playerSender).hasItem(ShopItem.MAGICAL_SADDLE))
|
||||||
|
{
|
||||||
|
playerSender.getInventory().addItem(plugin.sh.getMagicalSaddle());
|
||||||
|
msg("You have been given a Magical Saddle", ChatColor.GREEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg("You do not own a Magical Saddle! Purchase one from the shop.", ChatColor.RED);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -28,7 +28,7 @@ public class Command_smite extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
String reason = null;
|
String reason = null;
|
||||||
Boolean silent = false;
|
boolean silent = false;
|
||||||
if (args.length >= 2)
|
if (args.length >= 2)
|
||||||
{
|
{
|
||||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||||
@ -76,18 +76,21 @@ public class Command_smite extends FreedomCommand
|
|||||||
|
|
||||||
public static void smite(CommandSender sender, Player player, String reason, Boolean silent)
|
public static void smite(CommandSender sender, Player player, String reason, Boolean silent)
|
||||||
{
|
{
|
||||||
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
|
||||||
player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||||
|
|
||||||
if (reason != null)
|
|
||||||
{
|
|
||||||
FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
{
|
{
|
||||||
|
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||||
|
if (reason != null)
|
||||||
|
{
|
||||||
|
FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED);
|
||||||
|
}
|
||||||
FUtil.bcastMsg(" Smitten by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
FUtil.bcastMsg(" Smitten by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Smitten " + player.getName() + " quietly.");
|
||||||
|
}
|
||||||
|
|
||||||
// Deop
|
// Deop
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
@ -119,4 +122,4 @@ public class Command_smite extends FreedomCommand
|
|||||||
player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Reason: " + reason, 20, 100, 60);
|
player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Reason: " + reason, 20, 100, 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -103,6 +103,7 @@ public enum ConfigEntry
|
|||||||
SHOP_PRICES_RIDEABLE_PEARL(Integer.class, "shop.prices.rideable_pearl"),
|
SHOP_PRICES_RIDEABLE_PEARL(Integer.class, "shop.prices.rideable_pearl"),
|
||||||
SHOP_PRICES_STACKING_POTATO(Integer.class, "shop.prices.stacking_potato"),
|
SHOP_PRICES_STACKING_POTATO(Integer.class, "shop.prices.stacking_potato"),
|
||||||
SHOP_PRICES_CLOWN_FISH(Integer.class, "shop.prices.clown_fish"),
|
SHOP_PRICES_CLOWN_FISH(Integer.class, "shop.prices.clown_fish"),
|
||||||
|
SHOP_PRICES_MAGICAL_SADDLE(Integer.class, "shop.prices.magical_saddle"),
|
||||||
//
|
//
|
||||||
ADMINLIST_CLEAN_THESHOLD_HOURS(Integer.class, "adminlist.clean_threshold_hours"),
|
ADMINLIST_CLEAN_THESHOLD_HOURS(Integer.class, "adminlist.clean_threshold_hours"),
|
||||||
ADMINLIST_CONSOLE_IS_SENIOR(Boolean.class, "adminlist.console_is_senior"),
|
ADMINLIST_CONSOLE_IS_SENIOR(Boolean.class, "adminlist.console_is_senior"),
|
||||||
|
@ -11,7 +11,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@ -43,13 +42,12 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.inventory.meta.FireworkMeta;
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class ItemFun extends FreedomService
|
public class ItemFun extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public List<Player> explosivePlayers = new ArrayList<Player>();
|
public List<Player> explosivePlayers = new ArrayList<>();
|
||||||
|
|
||||||
private final Random random = new Random();
|
private final Random random = new Random();
|
||||||
|
|
||||||
@ -71,7 +69,7 @@ public class ItemFun extends FreedomService
|
|||||||
{
|
{
|
||||||
cooldownTracker.get(player.getName()).add(item.getDataName());
|
cooldownTracker.get(player.getName()).add(item.getDataName());
|
||||||
}
|
}
|
||||||
BukkitTask thing = new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
@ -105,21 +103,35 @@ public class ItemFun extends FreedomService
|
|||||||
{
|
{
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
Entity entity = event.getRightClicked();
|
Entity entity = event.getRightClicked();
|
||||||
|
|
||||||
if (!player.getInventory().getItemInMainHand().getType().equals(Material.POTATO) || entity.getType().equals(EntityType.PLAYER))
|
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()))
|
||||||
|
{
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory().getItemInMainHand(), plugin.sh.getStackingPotato()))
|
if (player.getInventory().getItemInMainHand().getType().equals(Material.SADDLE) || player.getInventory().getItemInOffHand().getType().equals(Material.SADDLE) || entity.getType().equals(EntityType.PLAYER))
|
||||||
{
|
{
|
||||||
return;
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.addPassenger(entity);
|
|
||||||
player.sendMessage("Stacked " + entity.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@ -210,7 +222,7 @@ public class ItemFun extends FreedomService
|
|||||||
|
|
||||||
if (onCooldown(player, ShopItem.LIGHTNING_ROD))
|
if (onCooldown(player, ShopItem.LIGHTNING_ROD))
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.RED + "You're are currently on a cooldown for 10 seconds.");
|
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 10 seconds.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +246,7 @@ public class ItemFun extends FreedomService
|
|||||||
|
|
||||||
if (onCooldown(player, ShopItem.FIRE_BALL))
|
if (onCooldown(player, ShopItem.FIRE_BALL))
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.RED + "You're are currently on a cool-down for 5 seconds.");
|
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 5 seconds.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,6 +257,7 @@ public class ItemFun extends FreedomService
|
|||||||
cooldown(player, ShopItem.FIRE_BALL, 5);
|
cooldown(player, ShopItem.FIRE_BALL, 5);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TROPICAL_FISH:
|
case TROPICAL_FISH:
|
||||||
{
|
{
|
||||||
final int RADIUS_HIT = 5;
|
final int RADIUS_HIT = 5;
|
||||||
@ -257,7 +270,7 @@ public class ItemFun extends FreedomService
|
|||||||
|
|
||||||
if (onCooldown(player, ShopItem.CLOWN_FISH))
|
if (onCooldown(player, ShopItem.CLOWN_FISH))
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.RED + "You're are currently on a cool-down for 30 seconds.");
|
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 30 seconds.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,5 +464,4 @@ public class ItemFun extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
package me.totalfreedom.totalfreedommod.shop;
|
package me.totalfreedom.totalfreedommod.shop;
|
||||||
|
|
||||||
import com.vexsoftware.votifier.model.Vote;
|
|
||||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -21,6 +19,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
@ -28,6 +27,7 @@ import org.bukkit.scheduler.BukkitTask;
|
|||||||
|
|
||||||
public class Shop extends FreedomService
|
public class Shop extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
private BukkitTask reactions;
|
private BukkitTask reactions;
|
||||||
public String reactionString = "";
|
public String reactionString = "";
|
||||||
public Date reactionStartTime;
|
public Date reactionStartTime;
|
||||||
@ -248,6 +248,18 @@ public class Shop extends FreedomService
|
|||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getMagicalSaddle()
|
||||||
|
{
|
||||||
|
ItemStack itemStack = new ItemStack(Material.SADDLE);
|
||||||
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
itemMeta.setDisplayName(ChatColor.DARK_GREEN + "Magical Saddle");
|
||||||
|
itemMeta.setLore(Arrays.asList(ChatColor.GREEN + "Ride anything you want..."));
|
||||||
|
itemMeta.addEnchant(Enchantment.DURABILITY, 1, true);
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canAfford(int price, int coins)
|
public boolean canAfford(int price, int coins)
|
||||||
{
|
{
|
||||||
if (coins >= price)
|
if (coins >= price)
|
||||||
|
@ -12,17 +12,18 @@ public enum ShopItem
|
|||||||
FIRE_BALL("Fire Ball", Material.FIRE_CHARGE, 14, ConfigEntry.SHOP_PRICES_FIRE_BALL, ChatColor.RED, "fireBall", "/fireball"),
|
FIRE_BALL("Fire Ball", Material.FIRE_CHARGE, 14, ConfigEntry.SHOP_PRICES_FIRE_BALL, ChatColor.RED, "fireBall", "/fireball"),
|
||||||
RIDEABLE_PEARL("Rideable Ender Pearl", Material.ENDER_PEARL, 16, ConfigEntry.SHOP_PRICES_RIDEABLE_PEARL, ChatColor.DARK_PURPLE, "rideablePearl", "/rideablepearl"),
|
RIDEABLE_PEARL("Rideable Ender Pearl", Material.ENDER_PEARL, 16, ConfigEntry.SHOP_PRICES_RIDEABLE_PEARL, ChatColor.DARK_PURPLE, "rideablePearl", "/rideablepearl"),
|
||||||
STACKING_POTATO("Stacking Potato", Material.POTATO, 20, ConfigEntry.SHOP_PRICES_STACKING_POTATO, ChatColor.YELLOW, "stackingPotato", "/stackingpotato"),
|
STACKING_POTATO("Stacking Potato", Material.POTATO, 20, ConfigEntry.SHOP_PRICES_STACKING_POTATO, ChatColor.YELLOW, "stackingPotato", "/stackingpotato"),
|
||||||
|
MAGICAL_SADDLE("Magical Saddle", Material.SADDLE, 22, ConfigEntry.SHOP_PRICES_MAGICAL_SADDLE, ChatColor.DARK_GREEN, "magicalSaddle", "/magicalsaddle"),
|
||||||
CLOWN_FISH("Clown Fish", Material.TROPICAL_FISH, 24, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish");
|
CLOWN_FISH("Clown Fish", Material.TROPICAL_FISH, 24, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Shop GUI Layout:
|
Shop GUI Layout:
|
||||||
|
|
||||||
Dimensions: 9x4 = 36
|
Dimensions: 9x4 = 36
|
||||||
Key: g = Grappling Hook, l = Lightning Rod, f = Fire Ball, r = Rideable Ender Pearl, s = Stacking Potato, c = Clown Fish, $ = Coins}
|
Key: g = Grappling Hook, l = Lightning Rod, f = Fire Ball, r = Rideable Ender Pearl, s = Stacking Potato, c = Clown Fish, m = Magical Saddle $ = Coins}
|
||||||
|
|
||||||
---------
|
---------
|
||||||
-g-l-f-r-
|
-g-l-f-r-
|
||||||
--s---c--
|
--s-m-c--
|
||||||
--------$
|
--------$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -124,6 +124,7 @@ shop:
|
|||||||
rideable_pearl: 700
|
rideable_pearl: 700
|
||||||
stacking_potato: 300
|
stacking_potato: 300
|
||||||
clown_fish: 1500
|
clown_fish: 1500
|
||||||
|
magical_saddle: 250
|
||||||
|
|
||||||
# Admin list
|
# Admin list
|
||||||
adminlist:
|
adminlist:
|
||||||
|
Loading…
Reference in New Issue
Block a user