Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Minecraft
You last visited: Today at 04:25

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Link in Json-String verpacken

Discussion on Link in Json-String verpacken within the Minecraft forum part of the Other Online Games category.

Closed Thread
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2014
Posts: 48
Received Thanks: 0
Question Link in Json-String verpacken

Hi,

wollte nur mal schnell fragen, wie ich einen Json-String erzeuge, in dem eine bestimmte Stelle anklickbar ist und einen Link öffnet, bzw. auch wie man damit einen Command ausführt...

Google liefert mir leider keine Antwort mit der ich etwas anfangen könnte...

Könnte mir das vlt. schnell jemand erklären? :P
MFG
LuisKillergurke
LuisKillergurke is offline  
Old 01/30/2015, 22:06   #2
Moderator


 
elite*gold: 558
Join Date: Feb 2010
Posts: 6,544
Received Thanks: 1,424
ComputerBaer is offline  
Old 01/30/2015, 23:58   #3

 
KleinesGumi's Avatar
 
elite*gold: 12
Join Date: Jun 2011
Posts: 2,016
Received Thanks: 284
z.b
'{text:"Hover over me!",hoverEvent:{action:show_text,value:[{text:"Woah, you
just hovered over me!",color:blue}]}}'

'{text:"Click me to run a command!",clickEvent:{action:run_command,value:"/say
Clicked."}}'

{text:"Click me to open Google!",clickEvent:{actionpen_url,value:"http://google.com"}}'
KleinesGumi is offline  
Thanks
1 User
Old 01/31/2015, 09:36   #4
 
elite*gold: 0
Join Date: Feb 2014
Posts: 48
Received Thanks: 0
Vielen Dank!

Nun nur noch eine Frage:
Wie kann ich die Nachrichten denn senden? Bekomme das grade nicht hin :/
LuisKillergurke is offline  
Old 01/31/2015, 12:07   #5
Moderator


 
elite*gold: 558
Join Date: Feb 2010
Posts: 6,544
Received Thanks: 1,424
Ich nehme an über die Bukkit-API, oder?
player.sendRawMessage(jsonString);

Edit:
Es könnte sein, dass die Methode nicht das tut was sie soll. Ich habe hier mal zwei Lösungswege:
Code:
// ComputerBaer
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + player.getName() + " " + jsonString);

// Floppy012
public static void sendRawToPlayer(Player p, String message) {
  IChatBaseComponent comp = ChatSerializer.a(message);
  PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
  ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
}
ComputerBaer is offline  
Thanks
1 User
Old 01/31/2015, 18:22   #6
 
elite*gold: 0
Join Date: Feb 2014
Posts: 48
Received Thanks: 0
Ok, die 1. Methode ging wirklich nicht.
Vielen Dank, ich nutze jetzt die /tellraw-Methode

Kann dann geclosed werden
LuisKillergurke is offline  
Closed Thread

Tags
jsonstring, link, minecraftchat link


Similar Threads Similar Threads
.json files!
10/28/2013 - Facebook - 5 Replies
Is it Possible to Change some data in .json files I was gonna edit Dragons of atlantis .json files ! Just Like BYm gonna map it then everything is like WTF!!
[Visual Basic] [Problem] String auslesen/String zufällig wählen
05/06/2012 - General Coding - 4 Replies
Code: #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Name Generator", 236, 299, 815, 246) $Input1 = GUICtrlCreateInput("Username", 24, 72, 185, 21) $Input2 = GUICtrlCreateInput("Username", 24, 104, 185, 21) $Input3 = GUICtrlCreateInput("Username", 24, 136, 185, 21) $Input4 = GUICtrlCreateInput("Username", 24, 168, 185, 21) $Input5 = GUICtrlCreateInput("Username", 24, 200, 185, 21)
[VB08]String in String mit mehreren Funden
08/08/2011 - .NET Languages - 6 Replies
Hey, bin gerade auf ein Problem gestoßen, an dem ich mir seit 3 Stunden die Zähne ausbeiße. Ich will eine Funktion schreiben, die der _StringBetween Funktion von AutoIt gleich ist. _StringBetween gibt in einem Array alle Strings zwischen zwei SubStrings und dem ganzen String aus. Die Ausgabe bei _StringBetween("<h1>test1</h1>&l t;h1>test2</h1>", "<h1>", "</h1>") wäre also idealer Weiße ein Array (x = "test1", x = "test2")... da man in VB08 kein Array returnen kann, komme ich aber einfach...
Komplexer JSON String
12/09/2010 - General Coding - 6 Replies
Huhu Kleine Herausforderung für euch: Ich habe einen JSON String. Jetzt will ich den JSON String in eine geeignete Datenstruktur in Java impementieren. Ein Objekt (mit ner Klasse als Vorlage), dynamische Arrays, oder ne Hashmap. Der Json String ist ziemlich komplex: var game_data =...



All times are GMT +2. The time now is 04:25.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.