[Free] zEssentials - Essentials Plugin - Supports Offline Players

Status
This thread has been locked.

BrianGrug

Full time failure
Supreme
Feedback score
56
Posts
1,473
Reactions
995
Resources
1
zEssentials

This is an open source project that I will work on for a few days.

All information as well as source code is on GitHub.

Enjoy!

https://github.com/coleedwards/zEssentials

I will finish it within a few days.​
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Deleted User

Deactivated
Feedback score
18
Posts
218
Reactions
344
Resources
0
Rather than having 20 if-or checks for gamemodes, you can create a map in your constructor which stores the gamemode alias and the gamemode. Example:

Code:
Map<String, GameMode> gamemodes = Maps.newHashMap();
gamemodes.put("0", GameMode.SURVIVAL);
gamemodes.put("s", GameMode.SURVIVAL);
gamemodes.put("survival", GameMode.SURVIVAL);

// ..
GameMode mode = gamemodes.get(args[0].toLowerCase());

if (mode == null) {
    // invalid gamemode
    return;
}

and for parsing your messages:
Code:
player.sendMessage("Set your gamemode to " + mode.name().toLowerCase());

Cuts out a lot of duplicate code you have. Also, I noticed you had other gamemode classes, make use of the 'label' string which is passed when executing. This is the alias the player used to invoke the command.
 
Last edited:
Status
This thread has been locked.
Top