I wanted a soft depend on factions, but without factions, it will say that it can't find factions. Is there a way for me to let the plugin ignore anything that has to do with factions if factions isn't present?
@Hex_27 If factions is not found, then don't enable any of your faction related content. One easy way to do this would be to have a class dedicated to your faction stuff, and then only enable that class (i.e. by registering events/commands) if factions was found
@AdamOpzm So I need make alternate versions of my classes with nothing to do with factions? And also, if I softdepend muliple plugins, then how do I check for that? I can't possibly make tons of classes for each scenario
@Hex_27 It's not ideal, but it would likely be best to congregate everything that requires factions into a group of classes that all implement interfaces, and have separate versions of those classes that implement the same interface, and instantiate them based on whether or not you have factions.
@Mythbusterma yes, but for example, if I softdepend worldguard AND factions, and the owner doesn't have 1 of them, do I need to make 4 different classes based on 4 different scenarios?
@Hex_27 My class idea was just an example. There are other solutions, if you think about it enough. Hint: You won't get "class not found" errors if the methods don't attempt to find the classes they know don't exist
@AdamQpzm How? I can't do a try/ catch on imports. @mythbusterma They don't, but now I'm thinking of cloning every single class that contains factions imports and just make new ones that don't import factions.
@timtower So.. there's no way for me to let my code ignore anything in the class that has to do with factions? (Now I'm using 2 different sets of classes, one if factions is present, and the other for when factions is not present.)
@Hex_27 Your way is a good one. Can't recall how I did stuff like this in the past. I believe that I just ignored a certain variable.
@timtower I decided to make new classes because my ordinary classes already have a LOT of if() stuff, such that the code is...a little untidy. Would be hard to make another surrounding if and double the code size.