

zMathi
-
Total de itens
545 -
Registro em
-
Última visita
Respostas na Comunidade
-
zMathi's postagem in Ajuda para bloquear was marked as the answer
//Bloquear clique no inventário
@EventHandler
public void onInventoryClick(InventoryClickEvent event){
event.setCancelled(true);
}
//Cancelar interação, logo nenhum item da hotbar funciona
@EventHandler
public void onInteract(PlayerInteractEvent event){
event.setCancelled(true);
}
//Cancelar pulo
@EventHandler
public void onMove(PlayerMoveEvent event){
if (event.getPlayer().getVelocity().getY() > 0 && !event.getPlayer().isOnGround()){
event.setCancelled(true);
}
}
-
zMathi's postagem in Impedir Inventario de Fechar was marked as the answer
Não é possível cancelar o jogador de fechar o inventário, porém podemos ficar abrindo novamente o inventário que o jogador fechar.
@EventHandler public void onInventoryClose(InventoryCloseEvent event) { Inventory inventory = event.getInventory(); if (inventory.getTitle().equals("Name of This Shit")){ event.getPlayer().openInventory(inventory); } } -
zMathi's postagem in Dúvida - Pegar nome de item was marked as the answer
Se você quiser verificar quando ele COMER terá que usar outro evento.
@EventHandler public void onConsume(PlayerItemConsumeEvent event) { Player player = event.getPlayer(); ItemStack item = event.getItem(); if (item.getType() == Material.APPLE && item.getItemMeta().getDisplayName().equalsIgnoreCase("Nome da maçã")){ //O que irá fazer } } -
zMathi's postagem in Utilizar Wait was marked as the answer
Isso vai parar a Thread-Main, ou seja, TUDO, o SERVIDOR INTEIRO vai parar...
@EDIT:
Nossa cara, esse teu último exemplo vai matar a máquina... vai criar 3 runnables pra cada jogador, no final do loop vai ter (jogadores * 3) runnables rodando '-'
Melhor forma seria:
public void count() { new BukkitRunnable() { int i = 0; @Override public void run() { i++; if (i <= 3) { for (Player p : Bukkit.getOnlinePlayers()) { p.sendMessage("CONTAGEM: " + i); } } else { cancel(); } } }.runTaskTimer(plugin, 0L, 20L); } -
zMathi's postagem in Evento ou permissão. was marked as the answer
Só trocar
if(p.getWorld().getName().equals("spawn")) { //Se o mundo do jogador for 'spawn' por
if(!p.getWorld().getName().equals("spawn")) { //Se o mundo do jogador não for 'spawn' -
zMathi's postagem in DEV - Como eu arrumo esse erro no MySQL? was marked as the answer
Você pode baixar por aqui: http://www.mysql.com/downloads/connector/j/
Depois de baixar, adicione o arquivo mysql-connector-java-5.1.15-bin no projeto. Se tiver com problemas, tem vários lugares que ensinam detalhadamente como instalar.
-
zMathi's postagem in Problemas com try e catch - [DUVIDA] was marked as the answer
Isso que tu fez não tem sentido cara...
Exemplo correto aqui:
Integer i = null; try { i = Integer.valueOf(args[0]); } catch (Exception e){ //Precisa ser um número return; } -
zMathi's postagem in [Resolvido] Como eu pego o antigo MITO? (Ou como eu salvo ele, e pego depois) was marked as the answer
Coloca na config duas String:
MitoAtual:
MitoAntigo:
E seta o mito antigo quando um jogador perder.
-
zMathi's postagem in [Resolvido] Ajuda, mais pra um pedido (pegar primeiro que entrou) was marked as the answer
Usa o Player first, creio que tenha os codes da API do LegendChat.
-
zMathi's postagem in [Resolvido] [Dúvida] - Como identificar que o bloco é uma lã azul? was marked as the answer
@EventHandler
plublic void onBreak(BlockBreakEvent e) {
if(e.getBlock().getType() == Material.WOOL && e.getBlock().getData() == <DATA DA LÃ AZUL>) {
}
}
-
zMathi's postagem in [Resolvido] [Dúvida] - Como remover o valor de uma INT? was marked as the answer
int = int - 1;
-
zMathi's postagem in [Resolvido] [Dúvida] - Cancelar Task! was marked as the answer
Bukkit.getScheduler().cancelTask(<INT>);
-
zMathi's postagem in [Entregue] [PEDIDO] Excluir ITEM was marked as the answer
Quando o jogador tiver com o item na mão, o item virará uma terra, e aparecerá aquela mensagem para ele.
-
zMathi's postagem in [Resolvido] [Help] Scoreboard GetOnlinePlayers was marked as the answer
Use:
Bukkit.getOnlinePlayers().lenght
-
zMathi's postagem in [Resolvido] ShoutBox não aparece photos profile was marked as the answer
AdminCP -> Others Apps -> ShoutBox -> Settings -> Shouts -> Em Show User Photos marca YES.
-
zMathi's postagem in [Resolvido] [Dúvida] Vault was marked as the answer
Desnecessário tudo isso '-'
int custo = 5000; if (economy.getBalance(p.getName()) >+ custo){ p.sendMessage("Você precisa ter 5000 coins ou mais para fazer isso."); } -
zMathi's postagem in [Entregue] Não poder mecher no inventario was marked as the answer
Ele não move o item, ás vezes se clica muito rápido o item vai ficar "fantasma" no slot que clicou, até o inventário dar update, aí voltará ao normal.
Download: http://www.mediafire.com/download/90db1j34u7ewowx/zBlockClick.jar
-
zMathi's postagem in [Resolvido] [Como?] ©omo $efaz um cont4dor was marked as the answer
HashMap<String, Integer> peixes = new HashMap();
ao pescar:
peixes.put(p.getName(), peixes.get(p.getName()).intValue() + 1);
p.sendMessage("Voce pegou "+ peixes.get(p.getName());
-
zMathi's postagem in [Entregue] Inventário full '-' was marked as the answer
public boolean inventarioVazio(Player p){ if ((p.getInventory().getContents() == null) && (p.getInventory().getArmorContents() == null)){ return true; }else{ return false; } } Como usar:
if (inventarioVazio(p) == true){ p.sendMessage("Você está com o inventário vazio!"); }else{ p.sendMessage("Você tem itens no inventário!"); } Vai checar se não tem itens no inventário, e se não tem armadura.
-
zMathi's postagem in [Resolvido] Múltiplos comandos.. was marked as the answer
Isso é argumentos!
Um exemplo simples:
if (command.getName().equalsIgnoreCase("regras"){ if (args.lenght == 0){ /* Checando se o comando for apenas "/regras" p.sendMessage("§aUse /Regras equipe"); / Caso for, irá dar um send return true; / E retornar } /* if (args.lenght >= 1){ //Checando se os argumentos for maior que um, ou checando se for "/regras <Alguma coisa>" if (args[0].equalsIgnoreCase("equipe"){ /* / Checando se o argumento 0 (No caso o segundo) for igual "equipe" } / } /* -
zMathi's postagem in [Resolvido] ScoreBoard ? was marked as the answer
https://bukkit.org/threads/tutorial-scoreboards-teams-with-the-bukkit-api.139655/