Problème sur une Commande



  • Bonjour, j'ai essayé de faire une commande qui dans mon Overlay va changer un String mais côté Solo ça marche mais quand je suis sur mon serveur de test Internal Server Error

    Je veux que quand j’exécute la commande ça va faire : OverlayMain.text = "test";

    AH ! Et le text je veux qu'il soit unique pour le joueur qui a exécuté la commande si non le text reste vide


  • Moddeurs confirmés Rédacteurs Administrateurs

    Tu mets le code qui change l'ovelay dans la fonction onMessage de l'handler.



  • Cela serait peut-être plus pratique de le faire depuis un plugin avec l'API Spigot, car ce qui concerne les commandes c'est plus simple par un plugin



  • Oui mais je m'y connais que en Modding 😕



  • Pourtant faire une commande sur Spigot n'est pas compliqué, la workspace est très simple à créer, et après tu utilises la fonction onCommand. Regarde sur youtube il y a des tuto dessus 🙂


  • Moddeurs confirmés Rédacteurs Administrateurs

    Bonjour,

    Les commandes sont exécutés sur le serveur, elles ne peuvent pas modifier le rendu du client comme ça.
    Il faut soit utiliser un paquet, soit faire une commande client.



  • @robin4002 Mais ducoup comment c'est ça ma question xD (Je débute hein)


  • Moddeurs confirmés Rédacteurs Administrateurs

    Pour les paquets il y a un tutoriel sur ce forum même.

    Pour les commandes clients: https://www.minecraftforge.net/forum/topic/59139-adding-a-client-side-only-command/



  • @robin4002 Quand j'appui sur "/" sur mon serveur de test (avec ma commande dessus) mon jeu crash

    ---- Minecraft Crash Report ----
    // Daisy, daisy...
    
    Time: 10/07/19 22:11
    Description: Unexpected error
    
    java.lang.NullPointerException: Unexpected error
    	at com.mrp.kah.proxy.ClientProxy.RemoveTab(ClientProxy.java:49)
    	at cpw.mods.fml.common.eventhandler.ASMEventHandler_0_ClientProxy_RemoveTab_KeyInputEvent.invoke(.dynamic)
    	at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    	at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    	at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540)
    	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1964)
    	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
    	at net.minecraft.client.Minecraft.run(Minecraft.java:962)
    	at net.minecraft.client.main.Main.main(Main.java:164)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    	at GradleStart.main(Unknown Source)
    
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    	at com.mrp.kah.proxy.ClientProxy.RemoveTab(ClientProxy.java:49)
    	at cpw.mods.fml.common.eventhandler.ASMEventHandler_0_ClientProxy_RemoveTab_KeyInputEvent.invoke(.dynamic)
    	at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
    	at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
    	at cpw.mods.fml.common.FMLCommonHandler.fireKeyInput(FMLCommonHandler.java:540)
    
    -- Affected level --
    Details:
    	Level name: MpServer
    	All players: 1 total; [EntityClientPlayerMP['KAHDOS'/553, l='MpServer', x=149,59, y=66,62, z=203,89]]
    	Chunk stats: MultiplayerChunkCache: 70, 70
    	Level seed: 0
    	Level generator: ID 00 - default, ver 1. Features enabled: false
    	Level generator options: 
    	Level spawn location: World: (136,64,212), Chunk: (at 8,4,4 in 8,13; contains blocks 128,0,208 to 143,255,223), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    	Level time: 271006 game time, 271006 day time
    	Level dimension: 0
    	Level storage version: 0x00000 - Unknown?
    	Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    	Forced entities: 113 total; [EntityItem['item.item.egg'/256, l='MpServer', x=164,69, y=64,13, z=144,78], EntityChicken['Chicken'/257, l='MpServer', x=175,59, y=62,34, z=173,44], EntityChicken['Chicken'/258, l='MpServer', x=169,16, y=62,48, z=172,47], EntityItem['item.item.egg'/259, l='MpServer', x=169,13, y=62,13, z=172,47], EntityItem['item.item.egg'/260, l='MpServer', x=175,63, y=62,13, z=173,25], EntityEnderman['Enderman'/261, l='MpServer', x=165,53, y=45,00, z=188,63], EntityCreeper['Creeper'/262, l='MpServer', x=160,31, y=45,00, z=178,69], EntitySpider['Spider'/532, l='MpServer', x=167,06, y=34,00, z=144,81], EntityZombie['Zombie'/535, l='MpServer', x=165,16, y=34,00, z=144,50], EntityZombie['Zombie'/283, l='MpServer', x=180,09, y=51,00, z=151,56], EntityChicken['Chicken'/284, l='MpServer', x=172,56, y=64,00, z=166,44], EntityChicken['Chicken'/285, l='MpServer', x=178,53, y=64,00, z=157,53], EntityItem['item.item.egg'/287, l='MpServer', x=178,78, y=64,13, z=155,88], EntitySkeleton['Skeleton'/288, l='MpServer', x=188,50, y=46,00, z=166,50], EntityChicken['Chicken'/289, l='MpServer', x=190,59, y=65,00, z=169,56], EntityChicken['Chicken'/290, l='MpServer', x=182,56, y=64,00, z=161,59], EntityChicken['Chicken'/291, l='MpServer', x=178,47, y=64,00, z=168,47], EntityItem['item.item.egg'/292, l='MpServer', x=176,69, y=64,13, z=167,66], EntityItem['item.item.egg'/293, l='MpServer', x=181,81, y=64,13, z=165,63], EntitySpider['Spider'/294, l='MpServer', x=180,00, y=40,00, z=195,91], EntityCreeper['Creeper'/295, l='MpServer', x=179,50, y=40,00, z=204,50], EntityZombie['Zombie'/296, l='MpServer', x=190,50, y=44,00, z=201,50], EntityBat['Bat'/297, l='MpServer', x=188,24, y=45,33, z=207,63], EntityBat['Bat'/298, l='MpServer', x=202,14, y=44,80, z=205,44], EntityBat['Bat'/299, l='MpServer', x=204,66, y=43,64, z=203,00], EntityBat['Bat'/300, l='MpServer', x=200,30, y=45,45, z=203,53], EntityChicken['Chicken'/301, l='MpServer', x=184,56, y=63,00, z=229,44], EntityItem['item.item.egg'/302, l='MpServer', x=185,03, y=63,13, z=227,59], EntityChicken['Chicken'/303, l='MpServer', x=188,41, y=64,00, z=227,38], EntityChicken['Chicken'/304, l='MpServer', x=176,44, y=75,00, z=232,38], EntityItem['item.item.egg'/305, l='MpServer', x=187,97, y=64,13, z=226,28], EntityItem['item.item.egg'/306, l='MpServer', x=177,06, y=75,13, z=230,75], EntityPig['Pig'/307, l='MpServer', x=183,47, y=66,00, z=248,03], EntityChicken['Chicken'/329, l='MpServer', x=205,38, y=67,00, z=165,41], EntityItem['item.item.egg'/330, l='MpServer', x=203,06, y=66,13, z=166,34], EntityItem['item.item.egg'/331, l='MpServer', x=192,66, y=65,13, z=169,56], EntityChicken['Chicken'/348, l='MpServer', x=209,53, y=66,00, z=148,59], EntityPig['Pig'/350, l='MpServer', x=208,50, y=69,00, z=167,31], EntityChicken['Chicken'/351, l='MpServer', x=221,53, y=72,00, z=176,53], EntityPig['Pig'/353, l='MpServer', x=208,56, y=70,00, z=225,31], EntityEnderman['Enderman'/106, l='MpServer', x=80,97, y=30,00, z=245,84], EntityBat['Bat'/108, l='MpServer', x=87,47, y=22,78, z=271,59], EntityChicken['Chicken'/372, l='MpServer', x=221,59, y=66,00, z=197,56], EntitySquid['Squid'/122, l='MpServer', x=101,16, y=59,00, z=171,81], EntityPig['Pig'/124, l='MpServer', x=83,31, y=64,00, z=198,53], EntityPig['Pig'/125, l='MpServer', x=86,88, y=64,00, z=195,59], EntitySkeleton['Skeleton'/127, l='MpServer', x=83,50, y=22,00, z=268,91], EntitySkeleton['Skeleton'/128, l='MpServer', x=80,91, y=23,00, z=267,50], EntitySpider['Spider'/129, l='MpServer', x=83,34, y=22,00, z=267,09], EntityZombie['Zombie'/149, l='MpServer', x=100,00, y=20,00, z=156,56], EntitySquid['Squid'/150, l='MpServer', x=99,44, y=62,38, z=175,47], EntitySquid['Squid'/152, l='MpServer', x=96,56, y=59,31, z=168,50], EntityClientPlayerMP['KAHDOS'/553, l='MpServer', x=149,59, y=66,62, z=203,89], EntitySquid['Squid'/153, l='MpServer', x=96,72, y=59,16, z=171,47], EntityChicken['Chicken'/155, l='MpServer', x=97,59, y=62,37, z=179,41], EntityItem['item.item.egg'/156, l='MpServer', x=98,88, y=60,13, z=180,47], EntityZombie['Zombie'/157, l='MpServer', x=101,75, y=27,00, z=219,50], EntitySkeleton['Skeleton'/158, l='MpServer', x=104,50, y=26,00, z=221,50], EntitySkeleton['Skeleton'/159, l='MpServer', x=104,59, y=25,00, z=216,31], EntitySkeleton['Skeleton'/160, l='MpServer', x=105,25, y=25,00, z=218,09], EntitySkeleton['Skeleton'/161, l='MpServer', x=104,41, y=25,00, z=217,13], EntityBat['Bat'/162, l='MpServer', x=105,06, y=16,99, z=220,25], EntitySquid['Squid'/163, l='MpServer', x=109,75, y=60,34, z=234,81], EntitySquid['Squid'/164, l='MpServer', x=105,50, y=60,22, z=236,75], EntitySquid['Squid'/165, l='MpServer', x=107,63, y=61,00, z=241,72], EntityBat['Bat'/176, l='MpServer', x=124,59, y=19,10, z=154,34], EntitySkeleton['Skeleton'/177, l='MpServer', x=117,50, y=32,00, z=159,50], EntityItem['item.item.rottenFlesh'/178, l='MpServer', x=118,47, y=67,13, z=156,88], EntityBat['Bat'/179, l='MpServer', x=113,47, y=18,10, z=163,25], EntityCreeper['Creeper'/180, l='MpServer', x=120,50, y=32,00, z=163,50], EntityZombie['Zombie'/181, l='MpServer', x=120,50, y=32,00, z=162,66], EntitySkeleton['Skeleton'/182, l='MpServer', x=114,91, y=35,00, z=173,50], EntitySkeleton['Skeleton'/183, l='MpServer', x=106,56, y=44,00, z=164,06], EntityBat['Bat'/184, l='MpServer', x=123,57, y=32,00, z=163,75], EntityChicken['Chicken'/185, l='MpServer', x=125,59, y=71,00, z=172,63], EntityChicken['Chicken'/186, l='MpServer', x=122,34, y=66,00, z=166,47], EntityItem['item.item.egg'/187, l='MpServer', x=119,38, y=65,13, z=166,41], EntityCreeper['Creeper'/188, l='MpServer', x=122,69, y=37,00, z=205,06], EntityZombie['Zombie'/189, l='MpServer', x=126,31, y=34,00, z=199,53], EntityZombie['Zombie'/190, l='MpServer', x=121,50, y=38,00, z=200,50], EntityZombie['Zombie'/191, l='MpServer', x=129,50, y=42,00, z=191,03], EntitySkeleton['Skeleton'/192, l='MpServer', x=124,66, y=37,00, z=203,78], EntityWitch['Witch'/193, l='MpServer', x=127,50, y=38,00, z=201,50], EntityCreeper['Creeper'/194, l='MpServer', x=126,50, y=40,00, z=227,50], EntitySpider['Spider'/195, l='MpServer', x=124,88, y=41,00, z=235,09], EntityZombie['Zombie'/210, l='MpServer', x=139,50, y=28,00, z=153,50], EntityBat['Bat'/211, l='MpServer', x=135,75, y=27,10, z=150,75], EntityZombie['Zombie'/212, l='MpServer', x=133,31, y=37,00, z=166,97], EntityCreeper['Creeper'/213, l='MpServer', x=131,44, y=37,00, z=162,50], EntityChicken['Chicken'/214, l='MpServer', x=136,28, y=68,00, z=164,41], EntityChicken['Chicken'/215, l='MpServer', x=135,56, y=68,00, z=169,41], EntityItem['item.item.rottenFlesh'/218, l='MpServer', x=136,28, y=67,13, z=170,31], EntitySpider['Spider'/219, l='MpServer', x=143,81, y=17,00, z=206,81], EntityCreeper['Creeper'/220, l='MpServer', x=128,50, y=35,00, z=197,50], EntityZombie['Zombie'/221, l='MpServer', x=129,03, y=33,00, z=198,66], EntityZombie['Zombie'/222, l='MpServer', x=132,00, y=24,00, z=237,56], EntitySkeleton['Skeleton'/225, l='MpServer', x=147,50, y=41,00, z=144,16], EntityBat['Bat'/226, l='MpServer', x=149,55, y=28,70, z=159,11], EntitySkeleton['Skeleton'/227, l='MpServer', x=150,50, y=36,00, z=156,50], EntityChicken['Chicken'/228, l='MpServer', x=159,59, y=64,00, z=147,66], EntityCreeper['Creeper'/229, l='MpServer', x=151,50, y=21,00, z=172,50], EntityCreeper['Creeper'/230, l='MpServer', x=148,50, y=21,00, z=169,50], EntityZombie['Zombie'/231, l='MpServer', x=152,50, y=21,00, z=173,50], EntityZombie['Zombie'/232, l='MpServer', x=155,16, y=22,00, z=179,25], EntityZombie['Zombie'/489, l='MpServer', x=126,30, y=12,00, z=193,70], EntityZombie['Zombie'/233, l='MpServer', x=152,50, y=21,00, z=174,50], EntityCreeper['Creeper'/234, l='MpServer', x=148,63, y=46,00, z=173,94], EntitySkeleton['Skeleton'/235, l='MpServer', x=154,50, y=24,00, z=183,50], EntitySkeleton['Skeleton'/236, l='MpServer', x=151,50, y=46,00, z=176,09], EntityCreeper['Creeper'/237, l='MpServer', x=144,50, y=17,00, z=220,50], EntityCreeper['Creeper'/238, l='MpServer', x=148,31, y=17,00, z=222,09], EntitySkeleton['Skeleton'/254, l='MpServer', x=161,50, y=34,00, z=152,50], EntityItem['item.item.egg'/255, l='MpServer', x=160,22, y=64,13, z=149,59]]
    	Retry entities: 0 total; []
    	Server brand: fml,forge
    	Server type: Non-integrated multiplayer server
    Stacktrace:
    	at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
    	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
    	at net.minecraft.client.Minecraft.run(Minecraft.java:991)
    	at net.minecraft.client.main.Main.main(Main.java:164)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    	at GradleStart.main(Unknown Source)
    
    -- System Details --
    Details:
    	Minecraft Version: 1.7.10
    	Operating System: Windows 10 (amd64) version 10.0
    	Java Version: 1.8.0_151, Oracle Corporation
    	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    	Memory: 1847993056 bytes (1762 MB) / 2087452672 bytes (1990 MB) up to 3136028672 bytes (2990 MB)
    	JVM Flags: 3 total; -Xincgc -Xmx3024M -Xms2024M
    	AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    	IntCache: cache: 9, tcache: 0, allocated: 13, tallocated: 95
    	FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
    	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    	UCHIJAAAAAA	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    	UCHIJAAAAAA	FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
    	UCHIJAAAAAA	Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
    	UCHIJAAAAAA	mrp{7.1} [MineRPMod] (bin) 
    	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 388.46' Renderer: 'GeForce GTX 1050/PCIe/SSE2'
    	Launched Version: 1.7.10
    	LWJGL: 2.9.1
    	OpenGL: GeForce GTX 1050/PCIe/SSE2 GL version 4.6.0 NVIDIA 388.46, NVIDIA Corporation
    	GL Caps: Using GL 1.3 multitexturing.
    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
    Anisotropic filtering is supported and maximum anisotropy is 16.
    Shaders are available because OpenGL 2.1 is supported.
    
    	Is Modded: Definitely; Client brand changed to 'fml,forge'
    	Type: Client (map_client.txt)
    	Resource Packs: []
    	Current Language: English (US)
    	Profiler Position: N/A (disabled)
    	Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    	Anisotropic Filtering: Off (1)
    

  • Moddeurs confirmés Rédacteurs Administrateurs

    @KAHDOS a dit dans Problème sur une Commande :

    at com.mrp.kah.proxy.ClientProxy.RemoveTab(ClientProxy.java:49)

    Ta fonction RemoveTab cause un npe (ligne 49).
    Fais voir ton code, il est foireux (penses aussi à utiliser le style de code markdown pour une meilleur lisibilité).



  • @robin4002 Quand j'exécute la commande rien ne se passe et aucun message


  • Moddeurs confirmés Rédacteurs Administrateurs

    Sans le code de ta commande je ne peux pas te dire pourquoi ça ne fonctionne pas ...



  • public class InitMoney extends CommandBase {
    
    	@Override
    	public int compareTo(Object arg0) {
    		return 0;
    	}
    
    	@Override
    	public String getCommandName() {
    		return "test";
    	}
    
    	@Override
    	public String getCommandUsage(ICommandSender p_71518_1_) {
    		return null;
    	}
    
    	@Override
    	public List getCommandAliases() {
    		return null;
    	}
    
    	@Override
    	public void processCommand(ICommandSender p_71515_1_, String[] args) {
    		OverlayMain.text = "test";
    	}
    
    	@Override
    	public boolean canCommandSenderUseCommand(ICommandSender p_71519_1_) {
    		return true;
    	}
    
    	@Override
    	public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] p_71516_2_) {
    		return null;
    	}
    
    	@Override
    	public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) {
    		return false;
    	}
    
    }
    

  • Moddeurs confirmés Rédacteurs Administrateurs

    	@Override
    	public void processCommand(ICommandSender p_71515_1_, String[] args) {
    		OverlayMain.text = "test";
    	}
    

    Comme déjà dis, les commandes sont exécutes sur le serveur, elles ne peuvent pas modifier du contenu client, ou alors il faut un paquet.
    Cela ne peut pas fonctionner comme ça ...

    Ou alors faut faire une commande client, et dans ce cas il te manque implements IClientCommand et il faut changer la façon de l'enregistrer (je t'ai déjà envoyé toutes les ressources qu'il faut ...).



  • @robin4002 Oui mais le tutoriel apparament il est en 1.12 fin à partir de la 1.12, je dois rappeler que je suis en 1.7.10 ?


  • Moddeurs confirmés Rédacteurs Administrateurs

    En effet. Pas sûr que les commandes clients existaient déjà en 1.7, va falloir vérifier.
    Si ce n'est pas le cas il te faut forcement un paquet.



  • @robin4002 ça n'existe pas 😞 Tu pourrais me montrer comment faire un Paquet ?


  • Moddeurs confirmés Rédacteurs Administrateurs

    Il y a tout ce qu'il faut dans ce tutoriel : https://www.minecraftforgefrance.fr/topic/1000/1-7-2-le-network/



  • @robin4002 Et ça je le met ou ? Et comment ? a48c6c3a-3411-4e06-97a6-6c3adb6d4179-image.png


  • Moddeurs confirmés Rédacteurs Administrateurs

    Il te manque une variable là ... Regardes l'exemple.
    https://www.minecraftforgefrance.fr/topic/1000/1-7-2-le-network#exempleAbstrait




Log in to reply