Naming Main Class of Bukkit Plugins

Status
This thread has been locked.

Shortninja

♥ Java Enthusiast ♥
Supreme
Feedback score
2
Posts
1,143
Reactions
734
Resources
0
Ah, another argument with McFeedle, the name of your main class in a Bukkit/Spigot plugin.

I used to have my main class named after the project, so if my plugin was called "Staff+" then my main class would be "StaffPlus". However, I decided to switch to "Main" because I found it more preferable.

On the other hand, McFeedle, claims that the main class should NOT be named "Main" because of the fact that Bukkit is an API and, "it may or may not use the Main class already" (McFeedle, page 24). He also linked me a picture of the Bukkit docs that says that it is preferable to name your main class like the latter.

The conventions of a class name is to state its function, so saying "Main" makes sense to me because it will be the "Main" class. While naming your main class the way McFeedle likes it doesn't necessarily follow this rule, your class can't be "StaffPlus" class really.

I think it matters on personal preference in the end, but McFeedle claims that my way is wrong. Like usual, it's his way or NO way.

I'd like to see the input of a few knowledgeable developers around here and others. Is there any set rule that can be seen at all (McFeedle claims this) or is it personal preference (my claim)?

Skionz Badger ItsMonkey saint
 
Last edited:
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

JustRayz

Feedback score
4
Posts
516
Reactions
119
Resources
0
This also comes up with package names, how you HAVE to do me.JustRayz.projectname ....... I always do com.commands com.inventories com.sys and more sometimes. But with the classes if it's an experiment plugin I do Main but if not I call it something appropriate...
 

saint

IPVP.ORG
Premium
Feedback score
2
Posts
86
Reactions
87
Resources
0
Personally I don't agree with naming your class "Main" and typically name my 'main' class <Plugin Type>Plugin (ie. BackpackPlugin).

My reasoning for frowning at naming it Main is that it isn't the main class of the whole program and doesn't contain the main(String[] args) method.

As for the name I choose, I typically append Plugin to the name because that signifies to me that it is the primary class that controls the whole plugin. It also extends the JavaPlugin class, so by suffixing Plugin I feel like I'm conforming to some convention that this is also a plugin.

Another reason I do this is for the sake of preventing a situation where if you have a plugin such as a backpack plugin, naming the plugin class "Backpack" could cause confusion if I later want to create a class to represent actual backpack objects (containing inventory, id, etc). Appending Plugin fixes this issue.
 

Shortninja

♥ Java Enthusiast ♥
Supreme
Feedback score
2
Posts
1,143
Reactions
734
Resources
0
saint Yeah I get the point about the main method not being there, and I agree with that.

I think naming it "Plugin" does make a bit more sense than the latter. Thanks for your input![DOUBLEPOST=1447449584,1447449512][/DOUBLEPOST]LINGLING I don't know if I like that because it seems a bit vague. Base of what? It isn't necessarily the base of the plugin because really it's just starting the plugin.

Thanks for your input though
 

Grrocks

Feedback score
0
Posts
228
Reactions
76
Resources
0
me.determined.<pluginname>.<PluginName>
Never really got into using Main as the primary class just looks odd to me idk why.
 
Status
This thread has been locked.
Top