Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
- public void onBedBreak(final BlockBreakEvent e) {
- final Gamer gamer = this.main.getGamer(e.getPlayer());
- if(!gamer.isSpectator()) {
- final Block block = e.getBlock();
- if (block == null) {
- return;
- }
- final Material type = block.getType();
- if (type != Material.BED_BLOCK) {
- return;
- }
- e.setCancelled(true);
- for (final Team team : BedWars.getInstance().getTeams()) {
- if (!team.isBed(e.getBlock().getLocation())) {
- continue;
- }
- if (team.getPlayers().contains(e.getPlayer())) {
- e.getPlayer().sendMessage(BedWars.getInstance().getPrefix() + "§cВы не можете разрушить кровать своей команды");
- return;
- }
- ActionBar b = new ActionBar("§e§lРазрушение кровати §7- §a§l+ 10 монет");
- b.send(e.getPlayer());
- team.breakBed(e.getPlayer(), gamer);
- ++gamer.bedKills;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement