Adding Gem signs.
This commit is contained in:
parent
a46cb2c274
commit
7ca6f58108
@ -7,6 +7,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
@ -58,6 +59,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
import org.bukkit.event.block.SignChangeEvent;
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
@ -68,6 +70,7 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
|||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -1221,6 +1224,51 @@ public class EventGame extends Game
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void gemSign(final PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if(event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!(event.getClickedBlock() instanceof Sign))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Sign sign = (Sign) event.getClickedBlock().getState();
|
||||||
|
if(!sign.getLine(0).contentEquals("[GEM]"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
final Material mat = Material.getMaterial(Integer.parseInt(sign.getLine(1)));
|
||||||
|
Integer price = Integer.parseInt(sign.getLine(2));
|
||||||
|
if(price > 500)
|
||||||
|
price = 500;
|
||||||
|
|
||||||
|
if(price <= 0)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Event", "You got an item for free."));
|
||||||
|
event.getPlayer().getInventory().addItem(new ItemStack(mat));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Manager.GetDonation().Get(event.getPlayer()).GetGems() < price)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Event", "You dont have enough Gems."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int gems = price;
|
||||||
|
Manager.GetDonation().RewardGems(new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
public void run(Boolean completed)
|
||||||
|
{
|
||||||
|
if (completed)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Event", "You bought an item for " + gems + " Gems."));
|
||||||
|
event.getPlayer().getInventory().addItem(new ItemStack(mat));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, "Gem Sign", event.getPlayer().getName(), event.getPlayer().getUniqueId(), -price);
|
||||||
|
}
|
||||||
|
|
||||||
public class EventArea
|
public class EventArea
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -159,6 +159,12 @@ public class EventModule extends MiniPlugin
|
|||||||
UtilPlayer.message(player, F.value("/e give <player> <item> <amount> [e:#,e:#...]", "Give Item"));
|
UtilPlayer.message(player, F.value("/e give <player> <item> <amount> [e:#,e:#...]", "Give Item"));
|
||||||
|
|
||||||
UtilPlayer.message(player, F.value("/e doublejump", "Toggles Double Jump"));
|
UtilPlayer.message(player, F.value("/e doublejump", "Toggles Double Jump"));
|
||||||
|
UtilPlayer.message(player, F.value("/e bc", "Broadcast a message with colorcodes"));
|
||||||
|
UtilPlayer.message(player, F.value("/e tempgadget", "Activates gadget for all player"));
|
||||||
|
UtilPlayer.message(player, F.value("/e playerdamage", "Toggles damage fpr player"));
|
||||||
|
UtilPlayer.message(player, F.value("/e stacker [Player]", "toggles stacker global or for Players"));
|
||||||
|
UtilPlayer.message(player, F.value("/e kick", "Remove a player from the event"));
|
||||||
|
UtilPlayer.message(player, F.value("/e area PVP|ALL|PVE|EVP|Gadget|Effect / add", "Create and edit areas"));
|
||||||
|
|
||||||
UtilPlayer.message(player, F.value("/e scoreboard <Line #> [Text]", "Sets Scoreboard Text"));
|
UtilPlayer.message(player, F.value("/e scoreboard <Line #> [Text]", "Sets Scoreboard Text"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user