You are not logged in.

  • Login
Bitte besucht unser neues Forum unter https://forum.nitrado.net | Please visit our new Forum at https://forum.nitrado.net

Dear visitor, welcome to Nitrado.net Prepaid Gameserver Community-Support - Archiv. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Renel2202

User / Kunde

  • "Renel2202" is male
  • "Renel2202" started this thread

Posts: 40

Occupation: Auszubildender Fachinformatiker in der Anwendungsentwicklung

  • Send private message

1

Monday, August 17th 2015, 2:04pm

Brauche hilfe bei meinem TeamChat plugin

Hey,
Ich programmiere ein TeamChat plugin aber da hab ich folgendes Problem :
Wenn ich "/tc Hey was geht" kommt es dann so raus:
"Hey"
"Hey was"
"Hey was geht"


Java source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package de.xshadowplayerx.teamchat;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class main extends JavaPlugin implements Listener {
	public void onEnable(){
		getServer().getPluginManager().registerEvents( this, this);
	}
	public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args){
		Player p = (Player)sender;

		if(cmd.getName().equalsIgnoreCase("tc")){
			if(p.hasPermission("TeamChat.teamsend")){
			for(Player players : Bukkit.getServer().getOnlinePlayers()) {
			      if(players.hasPermission("TeamChat.teamview")){
			    	  if (args.length != 0){
			    	        String message = "";
			    	        for (int i = 0; i < args.length; i++) {
			    	        
			    	          message = message + " " + args[i];
			    	          
			    		    players.sendMessage("§4§lTeamChat §7 | " + ChatColor.GOLD + p.getName() + ChatColor.GRAY + " » " + ChatColor.RESET + message);
			    	          }
			    	  }
			      }
			      
			}
		}else{
			p.sendMessage(ChatColor.DARK_RED + "Du hast keine Berechtigung dazu");}
		}
		
		return false;
	}
}

Battlecraftman

User / Kunde

  • "Battlecraftman" is male

Posts: 508

Location: NRW

Occupation: Schüler

  • Send private message

2

Monday, August 17th 2015, 2:08pm

Das sendMessage muss aus der Schleife!

Gebauer_01

User / Kunde

Posts: 2,304

  • Send private message

3

Monday, August 17th 2015, 2:08pm

Schreib das

players.sendMessage( ..... );

unter die geschweifte Klammer der For-Schleife.

Dann sollte alles funktionieren

Renel2202

User / Kunde

  • "Renel2202" is male
  • "Renel2202" started this thread

Posts: 40

Occupation: Auszubildender Fachinformatiker in der Anwendungsentwicklung

  • Send private message

4

Monday, August 17th 2015, 2:12pm

Danke für die schnelle hilfe :)

Bitte besucht unser neues Forum unter https://forum.nitrado.net| Please visit our new Forum at https://forum.nitrado.net