Started commenting my code so that I can work on a javadoc

This commit is contained in:
alisolarflare 2016-10-30 00:46:14 -04:00
parent 8e0908cd68
commit 43beadfcc1
3 changed files with 58 additions and 31 deletions

View file

@ -5,14 +5,34 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* This class handles the specific command /addToUHC which, in-game,
* adds a player to a specific UltraHardcore match, that is defined
* by the constructor: {@linkplain #AddToUHC(UHCMatch)}
* @author Alisolarflare
*/
public class AddToUHC implements CommandExecutor{
private UHCMemoryUnit generalMemory;
private UHCMatch generalMemory;
public AddToUHC(UHCSubPlugin uhcSubPlugin){
this.generalMemory = uhcSubPlugin.generalMemory;
/**
* Constructor for this AddToUHC
* @param generalMemory The Memory Unit for the current match
*/
public AddToUHC(UHCMatch generalMemory){
this.generalMemory = generalMemory;
}
/**
* Activated function when /addtoUHC <> is typed in-game
* @param sender CommandSender which sent the command /addToUHC
* @param command Command object created when /addToUHC is called in-game
* @param label Name of the command called
* @param args Arguments passed onto /addToUHC by the player
*/
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
//INPUT SANITATION
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
@ -25,6 +45,8 @@ public class AddToUHC implements CommandExecutor{
if (args.length <= 1){
sender.sendMessage("You must supply at least one playername");
}
//Adds players to memory
for (int i = 0; i > args.length; i++){
generalMemory.addPlayerToMatch(player);
}

View file

@ -5,7 +5,12 @@ import java.util.List;
import org.bukkit.entity.Player;
public class UHCMemoryUnit {
/**
* Class that contains the data for a single UltraHardcore Match,
* which represents a single game.
* @author Alisolarflare
*/
public class UHCMatch {
private List<String> matchPlayerUsernames = new ArrayList<String>();
public void addPlayerToMatch(String playername){

View file

@ -1,27 +1,27 @@
package alisolarflare.uhc;
import alisolarflare.AliPresents;
public class UHCSubPlugin {
public AliPresents plugin;
public UHCMemoryUnit generalMemory;
public UHCSubPlugin(AliPresents plugin){
this.plugin = plugin;
}
public void register(){
registerCommands();
registerListeners();
registerMemoryUnits();
}
private void registerListeners() {
}
private void registerCommands() {
// TODO Auto-generated method stub
plugin.getCommand("addToUHC").setExecutor(new AddToUHC(this));
}
private void registerMemoryUnits(){
generalMemory = new UHCMemoryUnit();
}
}
package alisolarflare.uhc;
import alisolarflare.AliPresents;
public class UHCSubPlugin {
public AliPresents plugin;
public UHCMatch generalMemory;
public UHCSubPlugin(AliPresents plugin){
this.plugin = plugin;
}
public void register(){
registerCommands();
registerListeners();
registerMemoryUnits();
}
private void registerListeners() {
}
private void registerCommands() {
// TODO Auto-generated method stub
plugin.getCommand("addToUHC").setExecutor(new AddToUHC(this.generalMemory));
}
private void registerMemoryUnits(){
generalMemory = new UHCMatch();
}
}