Yo norbi this is pretty cool
This commit is contained in:
parent
848811dbfb
commit
7dfb9a9c72
2 changed files with 62 additions and 60 deletions
|
@ -1,35 +1,34 @@
|
||||||
package alisolarflare.uhc;
|
package alisolarflare.uhc;
|
||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
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;
|
||||||
|
|
||||||
public class AddToUHC implements CommandExecutor{
|
public class AddToUHC implements CommandExecutor{
|
||||||
private UHCMemoryUnit generalMemory;
|
private UHCMemoryUnit generalMemory;
|
||||||
|
|
||||||
public AddToUHC(UHCSubPlugin uhcSubPlugin){
|
public AddToUHC(UHCSubPlugin uhcSubPlugin){
|
||||||
this.generalMemory = uhcSubPlugin.generalMemory;
|
this.generalMemory = uhcSubPlugin.generalMemory;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (player.getName() != "alisolarflare"){
|
if (player.getName() != "alisolarflare"){
|
||||||
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions");
|
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i > args.length; i++){
|
||||||
for (int i = 0; i > args.length; i++){
|
generalMemory.addPlayerToMatch(player);
|
||||||
//TO BE CONTINUED
|
}
|
||||||
}
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
package alisolarflare.uhc;
|
package alisolarflare.uhc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class UHCMemoryUnit {
|
public class UHCMemoryUnit {
|
||||||
private List<Player> matchPlayers = new ArrayList<Player>();
|
private List<String> matchPlayerUsernames = new ArrayList<String>();
|
||||||
|
|
||||||
public void addPlayerToMatch(Player player){
|
public void addPlayerToMatch(String playername){
|
||||||
matchPlayers.add(player);
|
matchPlayerUsernames.add(playername);
|
||||||
}
|
}
|
||||||
public void removePlayerFromMatch(Player player){
|
public void addPlayerToMatch(Player player){
|
||||||
if (matchPlayers.contains(player)){
|
matchPlayerUsernames.add(player.toString());
|
||||||
matchPlayers.remove(player);
|
}
|
||||||
}
|
public void removePlayerFromMatch(Player player){
|
||||||
}
|
if (matchPlayerUsernames.contains(player)){
|
||||||
public void removeAllPlayersFromMatch(){
|
matchPlayerUsernames.remove(player.toString());
|
||||||
matchPlayers.clear();
|
}
|
||||||
}
|
}
|
||||||
public void endMatch(){
|
public void removeAllPlayersFromMatch(){
|
||||||
matchPlayers.clear();
|
matchPlayerUsernames.clear();
|
||||||
}
|
}
|
||||||
}
|
public void endMatch(){
|
||||||
|
matchPlayerUsernames.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue