Developer Halp

Status
This thread has been locked.

Brazy

CEO of Occasionally Returning
Supreme
Feedback score
14
Posts
2,698
Reactions
1,373
Resources
0
So, I'm making this plugin right and it doesn't seem to work! I used it on my developer server that is super top secret but like.. It don't work!

package me.skription.medicgui;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class gui extends JavaPlugin implements Listener {

public void onEnable() {
getLogger().info("MedicGUI has been enabled!");
}

public void onDisable() {
getLogger().info("MedicGUI has been disabled!");
}

Brazy
public void onInteract(PlayerInteractEvent e) {


if (e.getAction() == Action.LEFT_CLICK_AIR) {

ItemStack medic = new ItemStack(Material.FEATHER);
ItemMeta meta = medic.getItemMeta();
meta.setDisplayName(ChatColor.RED + "Magical Healing Potion");
medic.setItemMeta(meta);


Inventory gui = Bukkit.createInventory(null,27, ChatColor.GREEN + "MedicGUI - By Skription");
gui.setItem(1, medic);

e.getPlayer().openInventory(gui);
}
}

}
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Brazy

CEO of Occasionally Returning
Supreme
Feedback score
14
Posts
2,698
Reactions
1,373
Resources
0
Why are you coding everything 1 class? Why not make a seperate class for each event so the plugin is more 'clear'.
I don't feel like that it needs to be in a separate class.


Also, it still don't work.
 

Brazy

CEO of Occasionally Returning
Supreme
Feedback score
14
Posts
2,698
Reactions
1,373
Resources
0
Does it give an error on the console when you left click? If it does please link me a pastebin :)
At first, it was plugin.yml but I added it and it doesn't show anything.
 

mrsean

Premium
Feedback score
0
Posts
226
Reactions
121
Resources
0
Just put this in the on enable:
Bukkit.getServer().getPluginManager().registerEvents((Listener) this, this);
That fixed it for me
 
Status
This thread has been locked.
Top