So I added mod/plugin support in my java game. But I don't want give users allowance to every public variable, classes, and methods. I have used protected where I can. But in some cases It's impossible. I have been thinking of putting all classes inside one package, and go nuts with protected. But that seams wrong to me, or is it?
Asked
Active
Viewed 64 times
0
-
How are you supporting plugins? Via a "common" interface layer and custom class loaders? Oh, yes it sounds wrong - to me anyway :P – MadProgrammer Oct 04 '13 at 02:13
-
I'm using class loaders, interface, and Annotations – Yemto Oct 04 '13 at 02:20
-
Unless the plugins have direct access to your "implementation" code, they shouldn't be able to access you "implementation" code at runtime, they are restricted to the `interface`s you provide (which I assume are common across the plugin and application) ... as I understand it anyway... – MadProgrammer Oct 04 '13 at 02:22
-
They have access to all public static classes, and variables. – Yemto Oct 04 '13 at 02:29
-
Then you should correct your common API to remove this ability...unless they start doing blind group for a particular class they know might be available at runtime, they should be allowed any access to anything (via the common API) that you don't want to... – MadProgrammer Oct 04 '13 at 02:31
-
I'm not sure I understand. – Yemto Oct 04 '13 at 10:29
-
If a plugin or mod can access a part of your API you don't want them to, then your API needs to be modified to hide that functionality - IMHO – MadProgrammer Oct 04 '13 at 10:36
-
That's the point, I don't know how to. I manage to move some files into the same packet and use protected. But I don't know if it's a better way to do it. – Yemto Oct 04 '13 at 12:21