I've maded two plugins, when i try them one by one, they works fine. But when i do at the same time, i don't know why, one doesn't work. If someone can tell me why plugin incompatibility is produced for, I'll be so thankfull. If need more info about my plugins, tell me. Thanks
@Xfqlo23 1. WHAT doesn't work. 2. What are your Plugins doing? 3. Do you use CB or Bukkit as lib? 4. If there is a Stacktrace -> Post stacktrace and relevant Classes
The 1st i've done is A simple elevator, this is the first plugin that stops working when I add the second. There is the main class: JSEmain.java (Move your mouse to reveal the content) JSEmain.java (open) JSEmain.java (close) Code: package io.github.xfqlo23.jushelevator; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class JSEmain extends JavaPlugin{ public static final Logger log = Logger.getLogger("Minecraft"); public JSEevents JSEevents = new JSEevents(this); public PluginManager manager = this.getServer().getPluginManager(); @Override public void onEnable(){ log.log(Level.INFO, "JushElevator Activado"); manager.registerEvents(JSEevents, this); JSEdb.load(); } @Override public void onDisable(){ log.log(Level.INFO, "JushElevator Desactivado"); } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if(label.equals("jsedisable")){ if(sender.getName() == "CONSOLE"){ manager.disablePlugin(JSEmain.this); } } if(label.equalsIgnoreCase("jsecreate") && args.length >= 1){ if(isNumber(args[0])){ int i = Integer.parseInt(args[0]); switch (args.length){ case 1: //auto crear if(sender.hasPermission("jse.create")){ if(i <= 10 && i >= 1){ int c = 0; List<String> ls = new ArrayList<String>(); do{ ls.add("Elevator"); ((Player) sender).getInventory().addItem(newFloor(new ItemStack(Material.WOOL),ls)); c++; }while(c<i); sender.sendMessage("Se han añadido "+ i + " Elevator Center"); } else sender.sendMessage(JSEmessages.notNumber); } break; case 2: //crear a otro if(sender.hasPermission("jse.admin.create")){ if(getServer().getPlayer(args[1]).isOnline()){ if(i <= 10 && i >= 1){ int c = 0; List<String> ls = new ArrayList<String>(); do{ ls.add("Elevator"); sender.getServer().getPlayer(args[1]).getInventory().addItem(newFloor(new ItemStack(Material.WOOL),ls)); c++; }while(c<i); sender.sendMessage("Se han añadido "+ i + " Elevator Center"); } else sender.sendMessage(JSEmessages.notNumber); }else sender.sendMessage(JSEmessages.noPlayer); } break; } }else{ sender.sendMessage(JSEmessages.notNumber); } } return true; } private ItemStack newFloor(ItemStack is, List<String> lore){ ItemMeta im = is.getItemMeta(); im.setDisplayName("Elevator Center"); if(lore != null){ im.setLore(lore); } is.setItemMeta(im); return is; } public static boolean isNumber(String string) { if (string == null || string.isEmpty()) { return false; } int i = 0; if (string.charAt(0) == '-') { if (string.length() > 1) { i++; } else { return false; } } for (; i < string.length(); i++) { if (!Character.isDigit(string.charAt(i))) { return false; } } return true; } } The second I'm doing is a plugin that gives coins for killing people, and next u can buy some things in a custom inventory shop. And there u got the main class: KRmain.java (Move your mouse to reveal the content) KRmain.java (open) KRmain.java (close) Code: package io.github.xfqlo23.KillRewards; import io.github.xfqlo23.KillRewards.db.KRitemdb; import io.github.xfqlo23.KillRewards.db.KRuserdb; import io.github.xfqlo23.KillRewards.events.KRevents; import io.github.xfqlo23.KillRewards.gui.KRguiShop; import java.util.logging.Level; import java.util.logging.Logger; 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.plugin.java.JavaPlugin; public class KRmain extends JavaPlugin{ public static final Logger log = Logger.getLogger("Minecraft"); public KRguiShop gui; @Override public void onEnable(){ log.log(Level.INFO, ChatColor.GREEN + "Activado!"); Bukkit.getPluginManager().registerEvents(new KRevents(this), this); KRuserdb.load(); KRitemdb.load(); } @Override public void onDisable(){ log.log(Level.INFO, ChatColor.RED + "Desactivado!"); } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ Player p = (Player)sender; if(label.equals("krshop")){ gui.openGUI(p); } if(label.equals("kraddcoins") && p.hasPermission("kr.admin.addcoins")){ if(args.length == 2){ try{ KRuserdb.addCoins(p, Integer.parseInt(args[1])); }catch(Exception ex){ p.sendMessage(ex.toString()); } } } if(label.equals("kradditem") && p.hasPermission("kr.admin.additem")){ if(args.length > 1){ try{ String finalarg = ""; for(String arg:args){ finalarg = finalarg + arg + " "; } p.sendMessage("ITEM: " +finalarg); KRitemdb.additems(finalarg); }catch(Exception ex){ p.sendMessage(ex.toString()); } } } return true; } } I'm pretty sure, that i haven't got more than 1 class with the same name, because i use "Prefix of plugin" + name Example: 1.- JSEmain => JuShElevator 2.- KRmain => KillRewards
@Xfqlo23 did you export it correctly (2nd plugin not overwriting the first one) ?, did they both load? also public static final Logger log = Logger.getLogger("Minecraft"); you dont have to use it. the bukkit getLogger() is completely fine
@guitargun I exported them correctly, and they loaded nice. i changed Logger.getLogger for Bukkit.getLogger and sitll happeing The new thing i've seen is New thing I've seen is that when I load the plugin and i do a "reload" the 1st one stops working, and when I go out and get back into a minecraft, both are working again.
@Xfqlo23 What do you mean by "doesn't work", does it say internal error? Or when you typed the command nothing comes up? Or else?
@Xfqlo23 that seems like the plugin isn't loading. try implementing the commandexecutor. I never worked with everything in the main class so dont know if that has to be in
@Xfqlo23 Do the 2 plugins have the same name in the plugin.yml ? @guitargun If you put commands in the main class it doesnt need to be imported but you at least need to import JavaPlugin