Started commenting my code so that I can work on a javadoc
This commit is contained in:
parent
8e0908cd68
commit
43beadfcc1
3 changed files with 58 additions and 31 deletions
|
@ -5,14 +5,34 @@ import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
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{
|
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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
//INPUT SANITATION
|
||||||
if (!(sender instanceof Player)){
|
if (!(sender instanceof Player)){
|
||||||
sender.sendMessage("You must be a player to use this command!");
|
sender.sendMessage("You must be a player to use this command!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,6 +45,8 @@ public class AddToUHC implements CommandExecutor{
|
||||||
if (args.length <= 1){
|
if (args.length <= 1){
|
||||||
sender.sendMessage("You must supply at least one playername");
|
sender.sendMessage("You must supply at least one playername");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Adds players to memory
|
||||||
for (int i = 0; i > args.length; i++){
|
for (int i = 0; i > args.length; i++){
|
||||||
generalMemory.addPlayerToMatch(player);
|
generalMemory.addPlayerToMatch(player);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@ import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
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>();
|
private List<String> matchPlayerUsernames = new ArrayList<String>();
|
||||||
|
|
||||||
public void addPlayerToMatch(String playername){
|
public void addPlayerToMatch(String playername){
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
package alisolarflare.uhc;
|
package alisolarflare.uhc;
|
||||||
|
|
||||||
import alisolarflare.AliPresents;
|
import alisolarflare.AliPresents;
|
||||||
|
|
||||||
public class UHCSubPlugin {
|
public class UHCSubPlugin {
|
||||||
public AliPresents plugin;
|
public AliPresents plugin;
|
||||||
public UHCMemoryUnit generalMemory;
|
public UHCMatch generalMemory;
|
||||||
|
|
||||||
public UHCSubPlugin(AliPresents plugin){
|
public UHCSubPlugin(AliPresents plugin){
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
public void register(){
|
public void register(){
|
||||||
registerCommands();
|
registerCommands();
|
||||||
registerListeners();
|
registerListeners();
|
||||||
registerMemoryUnits();
|
registerMemoryUnits();
|
||||||
}
|
}
|
||||||
private void registerListeners() {
|
private void registerListeners() {
|
||||||
}
|
}
|
||||||
private void registerCommands() {
|
private void registerCommands() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
plugin.getCommand("addToUHC").setExecutor(new AddToUHC(this));
|
plugin.getCommand("addToUHC").setExecutor(new AddToUHC(this.generalMemory));
|
||||||
}
|
}
|
||||||
private void registerMemoryUnits(){
|
private void registerMemoryUnits(){
|
||||||
generalMemory = new UHCMemoryUnit();
|
generalMemory = new UHCMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue