Войти или зарегистрироваться
  • Вы находитесь в сообществе Rubukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на различные языки плагины наших коллег из других стран.

PlayerJoinEvent - При входе давали эффекты

Статус
Закрыто для дальнейших ответов.

SinBan

Активный участник
Пользователь
Баллы
88
Имя в Minecraft
FSka
Всем привет)
У меня вопрос я ещё не понимаю просто в Bukkit API
Можете помочь
Как сделать чтобы когда игрок заходил на сервер.
Ему давались опр.эффекты.

Меня интересует. Скорость (на бесконечность) и прыжки (на бесконечность)
 
Код:
@EventHandler
public void onJoin(PlayerJoinEvent var1) {
Player var2 = var1.getPlayer();
var2.addPotionEffect(new PotionEffect(PotionEffectType.Зелье, Уровень, Время));
}
 
Java:
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 9999999)); // выдача скорости, лвл 1, бесконечно
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 9999999)); // выдача прыжка, лвл 1, бесконечно
}

Возможно есть ошибки, я писал без IDE.
 
Java:
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 9999999)); // выдача скорости, лвл 1, бесконечно
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 9999999)); // выдача прыжка, лвл 1, бесконечно
}

Возможно есть ошибки, я писал без IDE.
Проблема...
Когда заходишь он даёт. И забирает.
Java:
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 9999999)); // выдача скорости, лвл 1, бесконечно
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 9999999)); // выдача прыжка, лвл 1, бесконечно
}

Возможно есть ошибки, я писал без IDE.
public class mainClass extends JavaPlugin implements Listener
{
private FileConfiguration config;
public void onEnable()
{
getLogger().info("Plugin enable ForsPlus");
Bukkit.getPluginManager().registerEvents(this, this);
config = getConfig();
}

@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 999999));
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 999999));
}

public void onDisable()
{
getLogger().info("Plugin disable ForsPlus");
saveConfig();
}
 
Проблема...
Когда заходишь он даёт. И забирает.

public class mainClass extends JavaPlugin implements Listener
{
private FileConfiguration config;
public void onEnable()
{
getLogger().info("Plugin enable ForsPlus");
Bukkit.getPluginManager().registerEvents(this, this);
config = getConfig();
}

@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 999999));
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 999999));
}

public void onDisable()
{
getLogger().info("Plugin disable ForsPlus");
saveConfig();
}

О боже, зачем ты подключаешь конфиг, если ты его даже не используешь?

Попробуй так:


Java:
public class mainClass extends JavaPlugin
{
    Logger log = getLogger();

     public void onEnable() {
        log.info("Plugin enable ForsPlus");
     }

    public void onDisable() {
        log.info("Plugin disable ForsPlus");
     }

    @EventHandler
    public void onJoin(PlayerJoinEvent e) {
    Player p = e.getPlayer();
    p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 999999));
    p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 999999));
    }
 
О боже, зачем ты подключаешь конфиг, если ты его даже не используешь?

Попробуй так:


6 09:41:37 [Server] SEVERE Error occurred while enabling ForsPlus v0.1 (Is it up to date?)
05.06 09:41:37 [Server] INFO Enabling ForsPlus v0.1
05.06 09:41:37 [Server] INFO ForsPlus has been unloaded and disabled!
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:404)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:472)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:228)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.DedicatedServer.an(DedicatedServer.java:263)
05.06 09:41:37 [Server] INFO at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchServerCommand(CraftServer.java:535)
05.06 09:41:37 [Server] INFO at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:546)
05.06 09:41:37 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
05.06 09:41:37 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.PlugManCommands.onCommand(PlugManCommands.java:82)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.utilities.Utilities.reloadCommand(Utilities.java:422)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.utilities.Utilities.unloadPlugin(Utilities.java:366)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:401)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:481)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:219)
05.06 09:41:37 [Server] INFO at ForsPlus.mainClass.onDisable(mainClass.java:28)
05.06 09:41:37 [Server] INFO java.lang.NullPointerException
05.06 09:41:37 [Server] SEVERE Error occurred while disabling ForsPlus v0.1 (Is it up to date?)
05.06 09:41:37 [Server] INFO Disabling ForsPlus v0.1

Сейчас вот такой бред
6 09:41:37 [Server] SEVERE Error occurred while enabling ForsPlus v0.1 (Is it up to date?)
05.06 09:41:37 [Server] INFO Enabling ForsPlus v0.1
05.06 09:41:37 [Server] INFO ForsPlus has been unloaded and disabled!
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:404)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:472)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:228)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.DedicatedServer.an(DedicatedServer.java:263)
05.06 09:41:37 [Server] INFO at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchServerCommand(CraftServer.java:535)
05.06 09:41:37 [Server] INFO at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:546)
05.06 09:41:37 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
05.06 09:41:37 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.PlugManCommands.onCommand(PlugManCommands.java:82)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.utilities.Utilities.reloadCommand(Utilities.java:422)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.utilities.Utilities.unloadPlugin(Utilities.java:366)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:401)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:481)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:219)
05.06 09:41:37 [Server] INFO at ForsPlus.mainClass.onDisable(mainClass.java:28)
05.06 09:41:37 [Server] INFO java.lang.NullPointerException
05.06 09:41:37 [Server] SEVERE Error occurred while disabling ForsPlus v0.1 (Is it up to date?)
05.06 09:41:37 [Server] INFO Disabling ForsPlus v0.1
6 09:41:37 [Server] SEVERE Error occurred while enabling ForsPlus v0.1 (Is it up to date?)
05.06 09:41:37 [Server] INFO Enabling ForsPlus v0.1
05.06 09:41:37 [Server] INFO ForsPlus has been unloaded and disabled!
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:404)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:472)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:228)
05.06 09:41:37 [Server] INFO at net.minecraft.server.v1_5_R3.DedicatedServer.an(DedicatedServer.java:263)
05.06 09:41:37 [Server] INFO at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchServerCommand(CraftServer.java:535)
05.06 09:41:37 [Server] INFO at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:546)
05.06 09:41:37 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
05.06 09:41:37 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.PlugManCommands.onCommand(PlugManCommands.java:82)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.utilities.Utilities.reloadCommand(Utilities.java:422)
05.06 09:41:37 [Server] INFO at com.ryanclancy000.plugman.utilities.Utilities.unloadPlugin(Utilities.java:366)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:401)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:481)
05.06 09:41:37 [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:219)
05.06 09:41:37 [Server] INFO at ForsPlus.mainClass.onDisable(mainClass.java:28)
05.06 09:41:37 [Server] INFO java.lang.NullPointerException
05.06 09:41:37 [Server] SEVERE Error occurred while disabling ForsPlus v0.1 (Is it up to date?)
05.06 09:41:37 [Server] INFO Disabling ForsPlus v0.1
Сам код
package ForsPlus;
import java.util.logging.Logger;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public class mainClass extends JavaPlugin
{
Logger log = getLogger();

public void onEnable() {
log.info("Plugin enable ForsPlus");
}

public void onDisable()
{
log.info("Plugin disable ForsPlus");
}

@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1, 999999));
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1, 999999));
}

}
Проблема решена. Дописал.
 
Статус
Закрыто для дальнейших ответов.

Поделиться этой страницей

Назад
Верх