[Problema] Creazione Plugin Basic

Salve A Tutti,Ho Iniziato Da Poco A Creare Plugin...Uso Eclipse..(Vi Chiedo Scusa Se C'è Disordine Nella Discussione)..Il Primo Plugin Che Ho Creato è Stato Solo Quello Della Lettura Nella Console,Dove Il Plugin Veniva Eseguito Ed In Console Apparivano Dei Messaggi Che Avevo Inserito

esempio:

[Ilario42] Plugin Enabled


Poi Ho Cominciato A Passare Ai Comandi,Ho Creato Un Plugin Che facendo /help Basic Dava I Comandi Che Sono /Basic1 /Basic2 /Basic3


Qualcuno Sa Come Aiutarmi??? Dirmi Che Errore Ho Fatto Grazie Mille Big Grin

Ma Quando Eseguo Uno Di Questi Comandi Appaiono Errori Nella Console.....Vi Lascio Gli Errori:


[12:23:22 INFO]: [Ilario42] Enabling Ilario42 v1.2
[12:23:22 INFO]: [Ilario42] Plugin Enabled
[12:23:22 WARN]: [Ilario42] Plugin Error
[12:23:22 ERROR]: [Ilario42] Plugin Disable
[12:23:22 INFO]: Server permissions file permissions.yml is empty, ignoring it
[12:23:22 INFO]: Done (5,300s)! For help, type "help" or "?"
>pl
[12:23:30 INFO]: Plugins (1): Ilario42
>help Ilario42
[12:23:35 INFO]: --------- Help: Ilario42 ------------------------
[12:23:35 INFO]: Below is a list of all Ilario42 commands:
[12:23:35 INFO]: /basic: Plugin Per Provare Il Test
[12:23:35 INFO]: /basic2: Plugin Per Provare Il Test
[12:23:35 INFO]: /basic3: Plugin Per Provare Il Test
>basic
[12:23:38 WARN]: Unexpected exception while parsing console command "basic"
org.bukkit.command.CommandException: Unhandled exception executing command 'basic' in plugin Ilario42 v1.2
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchServerCommand(CraftServer.java:631) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.aL(DedicatedServer.java:437) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:401) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:655) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:554) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Caused by: java.lang.Error: Unresolved compilation problems:
Player cannot be resolved to a type
The method sendMessagge(String) is undefined for the type CommandSender

at Ilario422.Ilario422.onCommand(Ilario422.java:36) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
... 8 more
>basic2
[12:23:46 WARN]: Unexpected exception while parsing console command "basic2"
org.bukkit.command.CommandException: Unhandled exception executing command 'basic2' in plugin Ilario42 v1.2
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchServerCommand(CraftServer.java:631) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.aL(DedicatedServer.java:437) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:401) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:655) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:554) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Caused by: java.lang.Error: Unresolved compilation problems:
cmd cannot be resolved
sender cannot be resolved

at Ilario422.MyCommandExecutor.onCommand(MyCommandExecutor.java:13) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
... 8 more
>basic3
[12:23:47 WARN]: Unexpected exception while parsing console command "basic3"
org.bukkit.command.CommandException: Unhandled exception executing command 'basic3' in plugin Ilario42 v1.2
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchServerCommand(CraftServer.java:631) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.aL(DedicatedServer.java:437) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:401) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:655) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:554) [spigot_server.jar:git-Spigot-7d15d07-c194444]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Caused by: java.lang.Error: Unresolved compilation problems:
cmd cannot be resolved
sender cannot be resolved

at Ilario422.MyCommandExecutor.onCommand(MyCommandExecutor.java:13) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot_server.jar:git-Spigot-7d15d07-c194444]
... 8 more
>







Questi Sono I File Su Eclipse:

File Principale:

package Ilario422;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public class Ilario422 extends JavaPlugin
{
private static Ilario422 instance;
public void onEnable()
{
instance = this;

registerCommands();

getLogger().info("Plugin Enabled");
getLogger().warning("Plugin Error");
getLogger().severe("Plugin Disable");

}

private void registerCommands()
{
MyCommandExecutor exec = new MyCommandExecutor();
getCommand("basic2").setExecutor(exec);
getCommand("basic3").setExecutor(exec);
}

public static Ilario422 getInstance()
{
return instance;
}

public boolean onCommand(CommandSender sender, Command cmd, String label, String []args)
{
boolean isPlayer = sender instanceof Player;

if(!isPlayer && cmd.getName().equalsIgnoreCase("basic"))
{
if(args.length > 0 && args[0].equals("Funziona"))
{
sender.sendMessagge("Il Plugin Funziona Bravo Ilario42");

return true;
}

sender.sendMessage("Ciao Il Plugin Funziona Correttamente");
return true;
}


return false;

}
}




File MyCommandExecutor:


package Ilario422;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class MyCommandExecutor implements CommandExecutor
{

@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3)
{
if(cmd.getName().equalsIgnoreCase("basic2"))
{
sender.sendMessage("Hai Eseguito Il Comando basic2!");
return true;
}

return false;
}

}



null
Non si capisce nulla.
Utilizza pastebin.com o usa
Codice:
[.code]Testo (Senza punti)[./code]
(Modificato 26/03/2016, 16:10 da Niketion.)
[Immagine: bZvpSjW.png]  

Scusami in anticipo perché non so risponderti...
Una domanda: perché???
Perché ad ogni parola hai messo la maiuscola????? D:
Semplicemente metti che sender debba ricevere il messaggio, ma nel tuo onCommand metti come variabile che CommandSender = arg0
Banana.
Il codice è troppo disordinato ed ho notato un "sendMessa*gg*e".
_____________________________________________________________________________________________________________
GitHub: https://github.com/EduProArd/
Come contattarmi: Skype("EduProArd") oppure per MP("Messaggio privato sul forum")
Hosting: https://www.easyware-hosting.ch/
EasyWay: https://www.minecraft-italia.it/forum/t-easyway-servizi-di-sviluppo-plugin-ed-amministrazione-di-sistema
_____________________________________________________________________________________________________________
Infatti, e ti do un consiglio, non fare copia-incolla, non impari nulla ;D
Poi per risolvere il primo errore "Player cannot be resolved as a type" usa CTRL+SHIFT+O (o CMD+SHIFT+O) per importare.
[Immagine: sercoprogamer.png] [Immagine: Start%20a%20Server%21.png][Immagine: Build%20a%20Plugin!.png]
Discussioni simili
Ultima risposta: Lucatro
19/11/2017, 19:45
Ultima risposta: TheCrazyGamer73
12/11/2017, 21:45
 
[Problema] Aiuto con un plugin
4 177
Ultima risposta: TheCrazyGamer73
27/10/2017, 15:26
Ultima risposta: TheCrazyGamer73
23/10/2017, 15:41
Ultima risposta: _Pitz_
01/09/2017, 18:43

Utente(i) che stanno guardando questa discussione: 1 Ospite(i)