Witam, robie plugin na wiadomosci o dolaczeniu z configiem. Zrobilem prosty plugin ale wyswietla mi sie na czerwono setQuitMessage..
package me.hotangel2k17.sidebar;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener{
boolean title = false;
@Override
public void onEnable(){
saveDefaultConfig();
this.getConfig().getBoolean("title", title);
System.out.println("wlaczanie...");
}
@Override
public void onDisable(){
System.out.println("wylaczanie...");
}
@EventHandler
public void onJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
if(title == false){
for (String s : Main.getPlugin(Main.class).getConfig().getStringList("message.sendJoin")) {
s = s.replace("&", "§");
s = s.replace("{NICK}", p.getName());
e.setJoinMessage(s);
}
for (String f : Main.getPlugin(Main.class).getConfig().getStringList("message.sendQuit")) {
f = f.replace("&", "§");
f = f.replace("{NICK}", p.getName());
e.setQuitMessage(f);
}
}
}
}
Pytanie
Ever 20
Witam, robie plugin na wiadomosci o dolaczeniu z configiem. Zrobilem prosty plugin ale wyswietla mi sie na czerwono setQuitMessage..
package me.hotangel2k17.sidebar; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener{ boolean title = false; @Override public void onEnable(){ saveDefaultConfig(); this.getConfig().getBoolean("title", title); System.out.println("wlaczanie..."); } @Override public void onDisable(){ System.out.println("wylaczanie..."); } @EventHandler public void onJoin(PlayerJoinEvent e){ Player p = e.getPlayer(); if(title == false){ for (String s : Main.getPlugin(Main.class).getConfig().getStringList("message.sendJoin")) { s = s.replace("&", "§"); s = s.replace("{NICK}", p.getName()); e.setJoinMessage(s); } for (String f : Main.getPlugin(Main.class).getConfig().getStringList("message.sendQuit")) { f = f.replace("&", "§"); f = f.replace("{NICK}", p.getName()); e.setQuitMessage(f); } } } }Odnośnik do komentarza
https://skript.pl/temat/25226-czemu-to-nie-dziala-v2/Udostępnij na innych stronach
9 odpowiedzi na to pytanie
Rekomendowane odpowiedzi