Started work on the UHC module

This commit is contained in:
alisolarflare 2016-10-26 14:55:07 -04:00
parent 895e9d9611
commit 848811dbfb
3 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,35 @@
package alisolarflare.uhc;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class AddToUHC implements CommandExecutor{
private UHCMemoryUnit generalMemory;
public AddToUHC(UHCSubPlugin uhcSubPlugin){
this.generalMemory = uhcSubPlugin.generalMemory;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)){
sender.sendMessage("You must be a player to use this command!");
return false;
}
Player player = (Player) sender;
if (player.getName() != "alisolarflare"){
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions");
return false;
}
if (args.length <= 1){
sender.sendMessage("You must supply at least one playername");
}
for (int i = 0; i > args.length; i++){
//TO BE CONTINUED
}
return false;
}
}

View file

@ -0,0 +1,25 @@
package alisolarflare.uhc;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
public class UHCMemoryUnit {
private List<Player> matchPlayers = new ArrayList<Player>();
public void addPlayerToMatch(Player player){
matchPlayers.add(player);
}
public void removePlayerFromMatch(Player player){
if (matchPlayers.contains(player)){
matchPlayers.remove(player);
}
}
public void removeAllPlayersFromMatch(){
matchPlayers.clear();
}
public void endMatch(){
matchPlayers.clear();
}
}

View file

@ -0,0 +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();
}
}