Skocz do zawartości
  • 0

jak zrobić klikalną wiadomość na chacie która po kliknięciu otwiera stronę


albertinio
 Udostępnij

Pytanie

Tak Jak W Tytule. I Chcę żeby po wejściu na serwer wysłało wiadomość np. Naciśnij Mnie! i po kliknięciu ma otwierać jakąś stronę np. skript.pl i jeszcze jak się na nią na jedzie myszką to ma być np. Na Co Czekasz Kliknij Mnie! jeśli tak da zrobić za pomoc daje + i najlepszą odpowiedz jeśli będzie pomocna i proszę nie pisać że jestem słaby itd. bo to wiem xD dopiero zaczynam przygodę z pluginami i się uczę pozdrawiam. + kod jaki już zrobiłem:

 

@EventHandler
	public void onJoin(final PlayerJoinEvent e){
		Bukkit.getScheduler().runTaskLater(Main.getInst(), new Runnable(){
			public void run(){

 

Odnośnik do komentarza
Udostępnij na innych stronach

15 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0

Proszę:

 

@EventHandler
	public void onJoin(final PlayerJoinEvent e){
		Bukkit.getScheduler().runTaskLater(Main.getInst(), new Runnable(){
			public void run(){
				TextComponent message = new TextComponent( "Click me" );
				message.setClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org" ) );
				message.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Visit the Spigot website!" ).create() ) );

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

@Ixidi tak?:

@EventHandler
	public void onJoin(final PlayerJoinEvent e){
		Bukkit.getScheduler().runTaskLater(Main.getInst(), new Runnable(){
			public void run(){
				e.getPlayer().spigot().sendMessage(message);
				message.setClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org" ) );
				message.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Visit the Spigot website!" ).create() ) );

 

Bo Tak mi coś nie działa. sory że taki głupi jestem xD

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

@Ixidi no ok mam ale nadal jest zle errory z konsoli:

org.bukkit.plugin.InvalidDescriptionException: null is not properly structured.
        at org.bukkit.plugin.PluginDescriptionFile.asMap(PluginDescriptionFile.java:1074) ~[silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:228) ~[silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:157) ~[silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.reload(CraftServer.java:750) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.Bukkit.reload(Bukkit.java:525) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchServerCommand(CraftServer.java:634) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.DedicatedServer.aP(DedicatedServer.java:444) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:407) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • 0

ze złego pluginu w ziołem ... ten jednak nie ma errorow ale gdy wchodzę nie działa a w eclipse są te takie lampki z krzyżykiem oznaczające error

 

a nie jednak ma:

Could not pass event PlayerJoinEvent to 8odcinek v0.1
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.PlayerList.onPlayerJoin(PlayerList.java:346) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.PlayerList.a(PlayerList.java:166) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.LoginListener.b(LoginListener.java:159) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.LoginListener.e(LoginListener.java:57) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.NetworkManager.a(NetworkManager.java:233) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.ServerConnection.c(ServerConnection.java:140) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:845) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [silnik.jar:git-Spigot-eb3d921-2b93d83]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Caused by: java.lang.Error: Unresolved compilation problems:
        The constructor TextComponent(String) is not visible
        The method setClickEvent(ClickEvent) is undefined for the type TextComponent
        The method setHoverEvent(HoverEvent) is undefined for the type TextComponent
        ComponentBuilder cannot be resolved to a type
        The method sendMessage(BaseComponent) in the type Player.Spigot is not applicable for the arguments (TextComponent)

        at pl.albertinio.osmyodcinek.Schedulery.onJoin(Schedulery.java:62) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[silnik.jar:git-Spigot-eb3d921-2b93d83]
        ... 14 more

pojawił się gdy wszedłem na serwer czyli event join nie działa

 

proszę: ps.nie chciało mi się usuwać automsg nie zwracaj na niego uwagi

package pl.albertinio.osmyodcinek;

import java.awt.TextComponent;
import java.util.ArrayList;
import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;

import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;

public class Main extends JavaPlugin{

	private static Main instance;
	private List<String> msgs = new ArrayList<String>();{
		msgs.add("§6§lAutoMsg 1");
		msgs.add("§c§lAutoMsg 2");
		msgs.add("§a§lAutoMsg 3");
		msgs.add("§b§lAutoMsg 4");
		msgs.add("§d§lAutoMsg 5");
		msgs.add("§5§lAutoMsg 6");
	}
	private int msgNum;
	
	public void onEnable(){
		instance = this;
		System.out.println("Uruchamianie...");
		getCommand("timer").setExecutor(new Schedulery());
		Bukkit.getPluginManager().registerEvents(new Schedulery(), this);
		msgNum = 0;
		autoMsg(msgs);
	}
	
	public void onDisable(){
		System.out.println("Wylaczanie...");
	}
	
	public static Main getInst(){
		return instance;
	}
	
	private void autoMsg(final List<String> msg){
		Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
			public void run(){
				Bukkit.broadcastMessage("§7§l[INFO] " + msg.get(msgNum));
				msgNum++;
				if(msgNum == 6){
					msgNum = 0;
				}
			}
		}, 0, 10*20);
	}
	@EventHandler
	public void onJoin(final PlayerJoinEvent e){
		TextComponent message = new TextComponent( "Click me" );
	    message.setClickEvent( new ClickEvent( ClickEvent.Action.OPEN_URL, "https://www.spigotmc.org" ) );
	    message.setHoverEvent( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( "Visit the Spigot website!" ).create() ) );
	    e.getPlayer().spigot().sendMessage(message);
	} 
}

 

Ixidi

łącze

Notatka dodana przez Ixidi

Nieaktywny

Łączę posty

Odnośnik do komentarza
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...