You are not logged in.

  • Login

[Bukkit-Plugin] </command> Rückgabe

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

sombig

User / Kunde

  • "sombig" is male
  • "sombig" started this thread

Posts: 230

Location: Sachsen

Occupation: Schüler

  • Send private message

1

Tuesday, March 31st 2015, 10:09pm

</command> Rückgabe

Moin, ich will mein Befehl ausführen und das einzige was kommt ist </command> von usage XD

Main:

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package me.rolegaming.plugin;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin implements Listener {
	
	  public class Events extends JavaPlugin implements Listener {
	   
	   private Inventory inv = null;
	   
	   public void onEnable() {
	    this.getServer().getPluginManager().registerEvents(this, this);
	    System.out.println("Aktiviert");
	    
	   }
	   public void onDisable() {
	    System.out.println("Deaktiviert.");
	    
	   }
	   @Override
	   public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	    
	    Player p = (Player) sender;
	    
	    
	    
	    //Kommando -> Effekte
	    
	    if(cmd.getName().equalsIgnoreCase("effekte")) {
	     if(!p.hasPermission("server.effekte")) {
	      p.sendMessage("§2Server §8>> §4Dazu hast du keine Rechte!");
	      
	     } else {
	    	 
	      this.inv = p.getPlayer().getServer().createInventory(null, 9);
	      ItemStack is = new ItemStack(Material.BLAZE_POWDER);
	      ItemMeta im = is.getItemMeta();
	      im.setDisplayName("§6Feuer");
	      is.setItemMeta(im);
	      
	      ItemStack is2 = new ItemStack(Material.REDSTONE_BLOCK);
	      ItemMeta im2 = is2.getItemMeta();
	      im2.setDisplayName("§6Feuer");
	      is2.setItemMeta(im2);
	      
	      this.inv.setItem(0, is);
	      
	      p.openInventory(this.inv);
	      
	      
	     }
	    }
		return false;
	}
	   @SuppressWarnings("deprecation")
	   @EventHandler
	   public void Inv1(InventoryClickEvent e) {
	    Player p = (Player) e.getWhoClicked();
	    if(e.getCurrentItem().getType() == Material.BLAZE_POWDER) {
	     if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Feuer")) {
	    	 
	        for (Player ef : p.getWorld().getPlayers()) {
	        	this.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {

	        		public void run() {
	        		ef.playEffect(p.getPlayer().getLocation(), org.bukkit.Effect.ENDER_SIGNAL, 10);
	        		}
	        		}, 1L, 1L);
	        p.sendMessage("§2Server §8>> §2Du hast nun den Effekt §6Feuer §2ausgewählt.");
	        e.setCancelled(true);
	        ef.closeInventory();
	        
	       }
	     }
	    }
	   }
	  }
}



Plugin.yml:

Source code

1
2
3
4
5
6
7
8
name: Partikel
main: me.rolegaming.plugin.Main
author: RoleGaming
version: 1.0
commands:
  effekte:
    usage: </command>
    description: Partikel Plugin


wie im TItel steht, wenn ich /effekte mache kommt anstatt das Inventar </command> raus. bitte helfen, danke D:

This post has been edited 1 times, last edit by "sombig" (Mar 31st 2015, 10:16pm)


masterofgamingde

User / Kunde

  • "masterofgamingde" is male

Posts: 38

  • Send private message

2

Tuesday, March 31st 2015, 10:29pm

Änder das return zu return true;

Gebauer_01

User / Kunde

Posts: 2,304

  • Send private message

3

Tuesday, March 31st 2015, 10:37pm

Änder das return zu return true;


Das

Java source code

1
return false;
zu

Java source code

1
return true;


MfG Gebauer_01

sombig

User / Kunde

  • "sombig" is male
  • "sombig" started this thread

Posts: 230

Location: Sachsen

Occupation: Schüler

  • Send private message

4

Wednesday, April 1st 2015, 12:38pm

geht nicht...

StackBasher

User / Kunde

  • "StackBasher" is male

Posts: 109

  • Send private message

5

Wednesday, April 1st 2015, 12:48pm

ich weiss nicht, ob es daran liegt. Aber versuche mal in der plugin.yml das "usage: </command>" auf "usage: /<command>" zu ändern...

sombig

User / Kunde

  • "sombig" is male
  • "sombig" started this thread

Posts: 230

Location: Sachsen

Occupation: Schüler

  • Send private message

6

Wednesday, April 1st 2015, 12:52pm

geht immernoch nicht.. sollte auch nich funktionieren

StackBasher

User / Kunde

  • "StackBasher" is male

Posts: 109

  • Send private message

7

Wednesday, April 1st 2015, 1:05pm

Also bei mir funktioniert der Code. Kriegst du irgendwelche Fehlermeldungen?

sombig

User / Kunde

  • "sombig" is male
  • "sombig" started this thread

Posts: 230

Location: Sachsen

Occupation: Schüler

  • Send private message

8

Wednesday, April 1st 2015, 1:14pm

nein krieg ich nicht.

mache mal neues projekt;
benutze spigot 1.7.2


EDIT:
geht immer noch nicht.. was soll ich tun? :(

This post has been edited 1 times, last edit by "sombig" (Apr 1st 2015, 1:20pm)


lee0xp

User / Kunde

Posts: 24

  • Send private message

9

Wednesday, April 1st 2015, 1:45pm

du hast oben einmal public class Main und einmal public class Events gemacht

sombig

User / Kunde

  • "sombig" is male
  • "sombig" started this thread

Posts: 230

Location: Sachsen

Occupation: Schüler

  • Send private message

10

Wednesday, April 1st 2015, 2:20pm

danke

//CLOSED


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

Similar threads