@EventHandler(priority = EventPriority.HIGHEST) public void onPlayerJoin(final PlayerJoinEvent event) { final User user = ess.getUser(event.getPlayer()); if (!user.isJailed() || user.getJail() == null || user.getJail().isEmpty()) { return; } try { sendToJail(user, user.getJail()); } catch (Exception ex) { if (ess.getSettings().isDebug()) { LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex); } else { LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage())); } } user.sendMessage(_("jailMessage")); }
public void onPlayerRespawn(final PlayerRespawnEvent event) { final User user = ess.getUser(event.getPlayer()); if (user.isJailed() && user.getJail() != null && !user.getJail().isEmpty()) { return; } if (ess.getSettings().getRespawnAtHome()) { Location home; final Location bed = user.getBedSpawnLocation(); if (bed != null && bed.getBlock().getType() == Material.BED_BLOCK) { home = bed; } else { home = user.getHome(user.getLocation()); } if (home != null) { event.setRespawnLocation(home); return; } } final Location spawn = spawns.getSpawn(user.getGroup()); if (spawn != null) { event.setRespawnLocation(spawn); } }
public void reply(Player target, CommandSender commandSender) { UserStatus userStatus = new UserStatus(); User essUser = plugin.essentials.getUser(target); // Nick userStatus.addRow(new UserStatusRow("Ник: ", target.getName())); // HP userStatus.addRow( new UserStatusRow( "Здоровье: ", target.getHealth() + "/" + target.getMaxHealth() + " ( +" + target.getFoodLevel() + " насыщение )")); // XP userStatus.addRow( new UserStatusRow("Уровень: ", target.getExp() + "(уровень " + target.getLevel() + " )")); // location // TODO: Make output readable userStatus.addRow(new UserStatusRow("Местоположение: ", target.getLocation().toString())); // balance userStatus.addRow(new UserStatusRow("Баланс: ", essUser.getMoney().toString())); // IP userStatus.addRow(new UserStatusRow("IP: ", target.getAddress().toString())); // GameMode userStatus.addRow(new UserStatusRow("Игровой режим: ", target.getGameMode().name())); // GodMode userStatus.addRow(new UserStatusRow("В режиме бога: ", essUser.isGodModeEnabled())); // OP userStatus.addRow(new UserStatusRow("OP: ", target.isOp())); // Fly userStatus.addRow(new UserStatusRow("Летает: ", target.isFlying())); // AFK userStatus.addRow(new UserStatusRow("AFK: ", essUser.isAfk())); // InJail userStatus.addRow(new UserStatusRow("В тюрьме: ", essUser.isJailed())); // InMute userStatus.addRow(new UserStatusRow("В муте: ", essUser.isMuted())); // InSasVanish userStatus.addRow( new UserStatusRow( "В сас ванише: ", ((SasVanish) plugin.sasCommandExecuter.commands.get("sasvanish")).inVanish(target))); // PEX userStatus.addRow( new UserStatusRow( "Группы: ", StringUtils.join(PermissionsEx.getUser(target).getGroupsNames(), ", "))); // TODO: Display only permissions added customly (not inherited from groups) // This commented line displays ALL the permissions of a player // userStatus.addRow(new UserStatusRow("Пермишены: ", // StringUtils.join(PermissionsEx.getUser(target).getPermissions(target.getWorld().getName()), // ", "))); userStatus.send(commandSender); }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerInteract(final PlayerInteractEvent event) { final User user = ess.getUser(event.getPlayer()); if (user.isJailed()) { event.setCancelled(true); } }