A whole bunch of assorted changes

This commit is contained in:
alisolarflare 2016-11-28 13:59:25 -05:00
parent 9b4f3f3803
commit c120f2e46f
30 changed files with 359 additions and 480 deletions

View file

@ -1,3 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding/<project>=UTF-8 encoding/<project>=UTF-8
encoding/metrics=UTF-8
encoding/src=UTF-8 encoding/src=UTF-8

View file

@ -11,10 +11,8 @@ commands:
description: Official g-power command that activates the ghostie powerups description: Official g-power command that activates the ghostie powerups
powerdown: powerdown:
description: Offical g-power command that deactivates the ghostie powerups description: Offical g-power command that deactivates the ghostie powerups
pressalilink: alilink:
description: Presses an Ali Link pressalilink frequency description: Arguments: <press/set>
setalilink:
description: Creates an Ali Link setalilink frequency
cbgm0: cbgm0:
description: Creative Boundaries Gamemode 0 - allows players to return to survival description: Creative Boundaries Gamemode 0 - allows players to return to survival
cbgm1: cbgm1:

View file

@ -0,0 +1,15 @@
package alisolarflare.architecture.commands.subcommands;
public abstract class ModSubCommand extends SubCommand{
@Override
public boolean getPlayerOnly() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean getModOnly() {
// TODO Auto-generated method stub
return true;
}
}

View file

@ -0,0 +1,16 @@
package alisolarflare.architecture.commands.subcommands;
public abstract class PlayerSubCommand extends SubCommand{
@Override
public boolean getModOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean getPlayerOnly() {
// TODO Auto-generated method stub
return true;
}
}

View file

@ -0,0 +1,10 @@
package alisolarflare.architecture.commands.subcommands;
import org.bukkit.entity.Player;
public abstract class SubCommand {
public abstract boolean run(Player player, String label, String[] args);
public abstract boolean getPlayerOnly();
public abstract boolean getModOnly();
public abstract String[] GetHelpText(String alias);
}

View file

@ -8,23 +8,21 @@ import org.bukkit.Server;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.architecture.Component; import alisolarflare.architecture.Component;
import alisolarflare.components.alilinks.commands.PressAliLink; import alisolarflare.components.alilinks.commands.AliLink;
import alisolarflare.components.alilinks.commands.SetAliLink;
import alisolarflare.components.alilinks.entities.Link; import alisolarflare.components.alilinks.entities.Link;
public class AliLinkComponent extends Component { public class AliLinkComponent extends Component {
private List<Link> linkList; private List<Link> linkList;
private List<Map<String,String>> linkData; private List<Map<String,String>> linkMap;
@Override @Override
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
this.linkList = MapToLinkList(plugin.getConfig().getMapList("aliLinkList"), plugin.getServer()); this.linkList = MapToLinkList(plugin.getConfig().getMapList("aliLinkList"), plugin.getServer());
for (Link link: linkList){ for (Link link: linkList){
linkData.add(link.toMap()); linkMap.add(link.toMap());
} }
registerCommand(plugin, new PressAliLink(plugin, linkList)); registerCommand(plugin, new AliLink(plugin, linkList));
registerCommand(plugin, new SetAliLink(plugin.getConfig(), linkList, linkData));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -1,29 +1,60 @@
package alisolarflare.components.alilinks.commands; package alisolarflare.components.alilinks.commands;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.architecture.commands.PlayerCommand; import alisolarflare.architecture.commands.PlayerCommand;
import alisolarflare.components.alilinks.entities.Link; import alisolarflare.components.alilinks.entities.Link;
public class SetAliLink extends PlayerCommand { public class AliLink extends PlayerCommand{
public List<Link> linkList; private JavaPlugin plugin;
public List<Map<String, String>> linkData; private List<Link> linkList;
private FileConfiguration config;
public SetAliLink(FileConfiguration config, List<Link> linkList, List<Map<String, String>> linkData) { public AliLink(JavaPlugin plugin, List<Link> linkList) {
this.plugin = plugin;
this.linkList = linkList; this.linkList = linkList;
this.linkData = linkData; }
this.config = config; @Override
public boolean OnCommand(Player player, String alias, String[] args) {
if(args.length < 1)
return false;
switch (args[0].toLowerCase()){
case "press":
return press(player, alias, args);
case "set":
return set(player, alias, args);
default:
return false;
} }
@Override }
public boolean OnCommand(Player player, String label, String[] args) { /**"Usage: /pressalilink <frequency>"*/
private boolean press(Player player, String alias, String[] inputFrequencies) {
if (inputFrequencies.length == 0) {
player.sendMessage("You must specify a link frequency");
return false;
}
List<String> inputFrequencyList= Arrays.asList(inputFrequencies);
for (Link link : linkList) {
if(inputFrequencyList.contains(link.frequency)){
link.press(plugin);
}
}
player.sendMessage("Link pressed!");
return true;
}
/**Usage: /setalilink <frequency> [x] [y] [z]*/
public boolean set(Player player, String label, String[] args) {
if (args == null || args.length < 1) { if (args == null || args.length < 1) {
player.sendMessage("You must specify a link frequency"); player.sendMessage("You must specify a link frequency");
player.sendMessage("/pressalilink [name]"); player.sendMessage("/pressalilink [name]");
@ -49,17 +80,7 @@ public class SetAliLink extends PlayerCommand {
Link link = new Link(frequency, world, x, y, z); Link link = new Link(frequency, world, x, y, z);
linkList.add(link); linkList.add(link);
linkData.add(link.toMap());
saveLinkList();
return true; return true;
} }
private void saveLinkList(){
config.set("aliLinkList", linkData);
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /setalilink <frequency> [x] [y] [z]"
};
}
} }

View file

@ -1,43 +0,0 @@
package alisolarflare.components.alilinks.commands;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.architecture.commands.PlayerCommand;
import alisolarflare.components.alilinks.entities.Link;
public class PressAliLink extends PlayerCommand {
private JavaPlugin plugin;
private List<Link> linkList;
public PressAliLink(JavaPlugin plugin, List<Link> linkList) {
this.plugin = plugin;
this.linkList = linkList;
}
@Override
public boolean OnCommand(Player player, String label, String[] inputFrequencies) {
if (inputFrequencies.length < 1) {
player.sendMessage("You must specify a link frequency");
return false;
}
for (Link link : linkList) {
for (String frequency : inputFrequencies) {
if (frequency.equals(link.frequency)) {
link.press(plugin);
}
}
}
player.sendMessage("Link pressed!");
return true;
}
@Override
public String[] GetHelpText(String alias){
return new String[]{
"Usage: /pressalilink <frequency>"
};
}
}

View file

@ -12,6 +12,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.components.alilinks.tasks.UnpressTask; import alisolarflare.components.alilinks.tasks.UnpressTask;
public class Link{ public class Link{
public String frequency; public String frequency;
public World world; public World world;
public int x; public int x;

View file

@ -23,8 +23,6 @@ public class Cbgm0 extends PlayerCommand{
return true; return true;
} }
public String[] GetHelpText(String alias){ public String[] GetHelpText(String alias){
return new String[]{ return new String[]{"Creative Boundaries Usage: /cbgm0"};
"Creative Boundaries Usage: /cbgm0"
};
} }
} }

View file

@ -1,6 +0,0 @@
package alisolarflare.components.creativeboundaries.listeners;
import org.bukkit.event.Listener;
public class ItemRestrictionListener implements Listener {
}

View file

@ -4,13 +4,6 @@ import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.architecture.Component; import alisolarflare.architecture.Component;
import alisolarflare.components.easyuhc.commands.ActivatePowers;
import alisolarflare.components.easyuhc.commands.SetUHCLobby;
import alisolarflare.components.easyuhc.commands.SetWorldBorders;
import alisolarflare.components.easyuhc.commands.SpreadPlayers;
import alisolarflare.components.easyuhc.commands.StartTimer;
import alisolarflare.components.easyuhc.commands.StartUHC;
import alisolarflare.components.easyuhc.commands.TeleportToUHC;
public class EasyUHCComponent extends Component{ public class EasyUHCComponent extends Component{
public Location lobbyLocation; public Location lobbyLocation;
@ -19,14 +12,14 @@ public class EasyUHCComponent extends Component{
registerCommand(plugin, new ActivatePowers()); // registerCommand(plugin, new ActivatePowers());
registerCommand(plugin, new SetUHCLobby(this)); // registerCommand(plugin, new SetUHCLobby(this));
registerCommand(plugin, new SetWorldBorders()); // registerCommand(plugin, new SetWorldBorders());
registerCommand(plugin, new SetWorldBorders()); // registerCommand(plugin, new SetWorldBorders());
registerCommand(plugin, new SpreadPlayers()); // registerCommand(plugin, new SpreadPlayers());
registerCommand(plugin, new StartTimer()); // registerCommand(plugin, new StartTimer());
registerCommand(plugin, new StartUHC()); // registerCommand(plugin, new StartUHC());
registerCommand(plugin, new TeleportToUHC()); // registerCommand(plugin, new TeleportToUHC());
} }
} }

View file

@ -1,13 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
public class ActivatePowers extends ModCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
return false;
}
}

View file

@ -1,20 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
import alisolarflare.components.easyuhc.EasyUHCComponent;
public class SetUHCLobby extends ModCommand{
EasyUHCComponent module;
public SetUHCLobby(EasyUHCComponent easyUHCModule) {
this.module = easyUHCModule;
}
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
module.lobbyLocation = player.getLocation();
return false;
}
}

View file

@ -1,14 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
public class SetWorldBorders extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
return false;
}
}

View file

@ -1,14 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
public class ShrinkWorldBorders extends ModCommand {
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,15 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
public class SpreadPlayers extends ModCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,14 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
public class StartTimer extends ModCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,14 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.ModCommand;
public class StartUHC extends ModCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,14 +0,0 @@
package alisolarflare.components.easyuhc.commands;
import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.PlayerCommand;
public class TeleportToUHC extends PlayerCommand{
@Override
public boolean OnCommand(Player player, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -14,39 +14,57 @@ public class PlayerProximityLoop extends BukkitRunnable implements Listener{
private Location startLocation; private Location startLocation;
private Location endLocation; private Location endLocation;
private int sX;
private int sY;
private int sZ;
private int eX;
private int eY;
private int eZ;
public PlayerProximityLoop(JavaPlugin plugin, FlairDoorComponent component) { public PlayerProximityLoop(JavaPlugin plugin, FlairDoorComponent component) {
this.plugin = plugin; this.plugin = plugin;
this.component = component; this.component = component;
this.startLocation = component.startLocation; setStartLocation(component.startLocation);
this.endLocation = component.endLocation; setEndLocation(component.endLocation);
this.runTaskTimer(plugin, 0, 20); this.runTaskTimer(plugin, 0, 20);
} }
public void setStartLocation(Location location){
this.sX = startLocation.getBlockX();
this.sY = startLocation.getBlockY();
this.sZ = startLocation.getBlockZ();
this.startLocation = location;
this.endLocation.setWorld(location.getWorld());
}
public void setEndLocation(Location location){
this.eX = startLocation.getBlockX();
this.eY = startLocation.getBlockY();
this.eZ = startLocation.getBlockZ();
this.endLocation = location;
this.startLocation.setWorld(location.getWorld());
}
@Override @Override
public void run() { public void run() {
if (startLocation == null || endLocation == null){ if (startLocation == null || endLocation == null){
return; return;
} }
int sX = startLocation.getBlockX();
int sY = startLocation.getBlockY();
int sZ = startLocation.getBlockZ();
int eX = endLocation.getBlockX();
int eY = endLocation.getBlockY();
int eZ = endLocation.getBlockZ();
int playerX; int playerX;
int playerY; int playerY;
int playerZ; int playerZ;
Location playerLocation;
for (Player player : plugin.getServer().getOnlinePlayers()){ for (Player player : plugin.getServer().getOnlinePlayers()){
playerX = player.getLocation().getBlockX(); playerLocation = player.getLocation();
playerY = player.getLocation().getBlockY(); if(playerLocation.getWorld() != startLocation.getWorld())
playerZ = player.getLocation().getBlockZ();
if(player.getLocation().getWorld() != startLocation.getWorld())
continue; continue;
if((playerX < sX && playerX < eX) ||(playerX > sX && playerX > eX))
playerX = playerLocation.getBlockX();
if((playerX < sX && playerX < eX) || (playerX > sX && playerX > eX))
continue; continue;
if((playerY < sY && playerY < eY) ||(playerY > sY && playerY > eY)) playerY = playerLocation.getBlockY();
if((playerY < sY && playerY < eY) || (playerY > sY && playerY > eY))
continue; continue;
if((playerZ < sZ && playerZ < eZ) ||(playerZ > sZ && playerZ > eZ)) playerZ = playerLocation.getBlockZ();
if((playerZ < sZ && playerZ < eZ) || (playerZ > sZ && playerZ > eZ))
continue; continue;
component.playersToBeFlaired.add(player); component.playersToBeFlaired.add(player);

View file

@ -12,6 +12,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@ -41,26 +42,27 @@ public class BoomBowListener implements Listener {
//PLAYER SANITATION //PLAYER SANITATION
Player player = event.getPlayer(); Player player = event.getPlayer();
if(player.getGameMode().equals(GameMode.CREATIVE))return; PlayerInventory inventory = player.getInventory();
if(player.getGameMode().equals(GameMode.SPECTATOR))return;
if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){ if(bow.containsEnchantment(Enchantment.ARROW_INFINITE)){
//HAS INIFINITY //HAS INIFINITY
Activate(event); Activate(event);
}else if((player.getInventory().contains(Material.TNT))){ }else if((inventory.contains(Material.TNT))){
//HAS TNT //HAS TNT
Activate(event); Activate(event);
//Reduce tnt by 1 //Reduce TNT
int tntSlot = player.getInventory().first(Material.TNT); ItemStack tnt = inventory.getItem(inventory.first(Material.TNT));
ItemStack tntStack = player.getInventory().getItem(tntSlot);
if(tntStack.getAmount() > 3){ if(tnt.getAmount() > 3){
tntStack.setAmount(tntStack.getAmount()-3); tnt.setAmount(tnt.getAmount()-3);
}else{ }else{
player.getInventory().remove(tntStack); inventory.remove(tnt);
} }
if (bow.getDurability() < 0){ if (bow.getDurability() < 0){
player.getInventory().clear(player.getInventory().getHeldItemSlot()); inventory.clear(inventory.getHeldItemSlot());
} }
}else{ }else{
@ -100,10 +102,9 @@ public class BoomBowListener implements Listener {
player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2); player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2);
player.damage(7.42425, player); player.damage(7.42425, player);
boomBow.setDurability((short) (boomBow.getDurability() + 3)); boomBow.setDurability((short) (boomBow.getDurability() + 3));
if(boomBow.getDurability() < 0){ if(boomBow.getDurability() > 385){
player.getInventory().setItemInMainHand(null); player.getInventory().setItemInMainHand(null);
player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0) player.getWorld().playSound(playerLocation, Sound.ENTITY_ITEM_BREAK, 0, 0);
;
} }
} }

View file

@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class CannonBowListener implements Listener { public class CannonBowListener implements Listener {
public final static String launchedTNTName = "CANNON BOW TNT:42170";
JavaPlugin plugin; JavaPlugin plugin;
public CannonBowListener(JavaPlugin plugin){ public CannonBowListener(JavaPlugin plugin){
this.plugin = plugin; this.plugin = plugin;
@ -24,32 +25,33 @@ public class CannonBowListener implements Listener {
@EventHandler @EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent event){ public void onProjectileLaunch(ProjectileLaunchEvent event){
if(event.getEntity().getType() != EntityType.ARROW) //ENTITY SANITATION
return; if(event.getEntity().getType() != EntityType.ARROW)return;
//ARROW SANITATION
Arrow arrow = (Arrow) event.getEntity(); Arrow arrow = (Arrow) event.getEntity();
if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player)) if (!(arrow.isCritical()) || !(arrow.getShooter() instanceof Player))return;
return;
//PLAYER SANITATION
Player player = (Player) arrow.getShooter(); Player player = (Player) arrow.getShooter();
if (!player.getInventory().contains(Material.TNT))return;
//BOW SANITATION
ItemStack bow; ItemStack bow;
if ((bow = player.getInventory().getItemInMainHand()).getType() != Material.BOW) if (!((bow = player.getInventory().getItemInMainHand()).getType() == Material.BOW))return;
return; if (!(bow.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS)))return;
if (!bow.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS)) if (!(bow.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) == 10))return;
return; if (!(bow.getItemMeta().getDisplayName().toUpperCase().contains("CANNON BOW")))return;
if(!(bow.getEnchantmentLevel(Enchantment.PROTECTION_EXPLOSIONS) == 10))
return;
if (!bow.getItemMeta().getDisplayName().toUpperCase().contains("CANNON BOW"))
return;
if (!player.getInventory().contains(Material.TNT))
return;
TNTPrimed tnt = (TNTPrimed) arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT); TNTPrimed tnt = (TNTPrimed) arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT);
tnt.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(1.0)); tnt.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(1.0));
tnt.setCustomName("CANNON BOW TNT"); tnt.setCustomName(launchedTNTName);
tnt.setFuseTicks(40); tnt.setFuseTicks(40);
player.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(-1)); player.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(-1));
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2.0F, 0); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2.0F, 0);
player.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, player.getLocation(), 1); player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, player.getLocation(), 2);
arrow.remove(); arrow.remove();
return; return;
@ -57,10 +59,9 @@ public class CannonBowListener implements Listener {
@EventHandler @EventHandler
public void onTnTExplode(EntityExplodeEvent event) { public void onTnTExplode(EntityExplodeEvent event) {
if (event.getEntityType() != EntityType.PRIMED_TNT) if (event.getEntityType() != EntityType.PRIMED_TNT) return;
return; if (!event.getEntity().getCustomName().equals(launchedTNTName)) return;
if (!event.getEntity().getCustomName().equals("CANNON BOW TNT"))
return;
Location loc = event.getEntity().getLocation(); Location loc = event.getEntity().getLocation();
event.getEntity().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 3, false, false); event.getEntity().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 3, false, false);
event.setCancelled(true); event.setCancelled(true);

View file

@ -2,6 +2,7 @@ package alisolarflare.components.minigames;
import java.util.List; import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.architecture.Component; import alisolarflare.architecture.Component;
@ -14,7 +15,7 @@ import alisolarflare.components.minigames.data.SpawnSet;
public class MinigameComponent extends Component{ public class MinigameComponent extends Component{
public SpawnSet spawnSet; public SpawnSet spawnSet;
public List<String> fighters; public List<String> fighters;
private GameState gameState; public GameState gameState;
@Override @Override
public void register(JavaPlugin plugin) { public void register(JavaPlugin plugin) {
@ -25,9 +26,11 @@ public class MinigameComponent extends Component{
registerCommand(plugin, new ListFighters(this)); registerCommand(plugin, new ListFighters(this));
} }
public class Fighter {
public GameState getGameState() {return gameState;} public Player player;
public void setGameState(GameState gameState) {this.gameState = gameState;} public String colour;
public Fighter(Player player, String colour){
this.colour = colour;
}
}
} }

View file

@ -1,28 +1,25 @@
package alisolarflare.components.minigames.commands; package alisolarflare.components.minigames.commands;
import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.PlayerCommand; import alisolarflare.architecture.commands.PlayerCommand;
import alisolarflare.components.minigames.MinigameComponent; import alisolarflare.components.minigames.MinigameComponent;
public class JoinMinigame extends PlayerCommand { public class JoinMinigame extends PlayerCommand {
private MinigameComponent module; private List<String> fighterList;
public JoinMinigame(MinigameComponent module) { public JoinMinigame(MinigameComponent component) {
this.module = module; this.fighterList = component.fighters;
} }
@Override @Override
public boolean OnCommand(Player player, String arg2, String[] arg3) { public boolean OnCommand(Player player, String arg2, String[] arg3) {
String name = player.getName(); if (fighterList.contains(player.getName())) {
if (module.fighters.contains(name)) {
player.sendMessage("You are already in the minigame!"); player.sendMessage("You are already in the minigame!");
return true; }else{
} fighterList.add(player.getName());
module.fighters.add(name);
if (module.fighters.contains(name)) {
player.sendMessage("You have joined the minigame!"); player.sendMessage("You have joined the minigame!");
} }
return true; return true;

View file

@ -1,16 +1,17 @@
package alisolarflare.components.minigames.commands; package alisolarflare.components.minigames.commands;
import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import alisolarflare.architecture.commands.PlayerCommand; import alisolarflare.architecture.commands.PlayerCommand;
import alisolarflare.components.minigames.MinigameComponent; import alisolarflare.components.minigames.MinigameComponent;
public class LeaveMinigame extends PlayerCommand { public class LeaveMinigame extends PlayerCommand {
private List<String> fighters;
private MinigameComponent module; public LeaveMinigame(MinigameComponent components) {
this.fighters = components.fighters;
public LeaveMinigame(MinigameComponent module) {
this.module = module;
} }
@Override @Override
@ -18,15 +19,14 @@ public class LeaveMinigame extends PlayerCommand {
if(!(player instanceof Player)) if(!(player instanceof Player))
player.sendMessage("You must be a player to use this command!"); player.sendMessage("You must be a player to use this command!");
String name = player.getName(); String name = player.getName();
if (!(module.fighters.contains(name))) { if (!(fighters.contains(name))) {
player.sendMessage("You are not fighting!"); player.sendMessage("You are not fighting!");
return true; return true;
} }
while(module.fighters.contains(name)){ while(fighters.contains(name)){
module.fighters.remove(name); fighters.remove(name);
} }
player.sendMessage("You have left the fighters category!"); player.sendMessage("You have left the fighters category!");

View file

@ -6,15 +6,15 @@ import alisolarflare.architecture.commands.PlayerCommand;
import alisolarflare.components.minigames.MinigameComponent; import alisolarflare.components.minigames.MinigameComponent;
public class ListFighters extends PlayerCommand { public class ListFighters extends PlayerCommand {
private MinigameComponent lobby; private MinigameComponent component;
public ListFighters(MinigameComponent lobby) { public ListFighters(MinigameComponent component) {
this.lobby = lobby; this.component = component;
} }
@Override @Override
public boolean OnCommand(Player player, String arg2, String[] arg3) { public boolean OnCommand(Player player, String arg2, String[] arg3) {
player.sendMessage(lobby.fighters.toString()); player.sendMessage(component.fighters.toString());
return true; return true;
} }
@Override @Override

View file

@ -24,32 +24,32 @@ public class SetColourSpawn extends ModCommand{
switch(input){ switch(input){
case ("r"): case ("r"):
player.sendMessage("Setting Red Spawn..."); player.sendMessage("Setting Red Spawn...");
spawnSet.setRSpawn(player.getLocation()); spawnSet.RSpawn = player.getLocation();
player.sendMessage("Red Spawn Set!"); player.sendMessage("Red Spawn Set!");
break; break;
case ("o"): case ("o"):
player.sendMessage("Setting Orange Spawn..."); player.sendMessage("Setting Orange Spawn...");
spawnSet.setRSpawn(player.getLocation()); spawnSet.OSpawn = player.getLocation();
player.sendMessage("Orange Spawn Set!"); player.sendMessage("Orange Spawn Set!");
break; break;
case ("y"): case ("y"):
player.sendMessage("Setting Yellow Spawn..."); player.sendMessage("Setting Yellow Spawn...");
spawnSet.setRSpawn(player.getLocation()); spawnSet.YSpawn = player.getLocation();
player.sendMessage("Yellow Spawn Set!"); player.sendMessage("Yellow Spawn Set!");
break; break;
case ("g"): case ("g"):
player.sendMessage("Setting Green Spawn..."); player.sendMessage("Setting Green Spawn...");
spawnSet.setRSpawn(player.getLocation()); spawnSet.GSpawn = player.getLocation();
player.sendMessage("Green Spawn Set!"); player.sendMessage("Green Spawn Set!");
break; break;
case ("b"): case ("b"):
player.sendMessage("Setting Blue Spawn..."); player.sendMessage("Setting Blue Spawn...");
spawnSet.setRSpawn(player.getLocation()); spawnSet.BSpawn = player.getLocation();
player.sendMessage("Blue Spawn Set!"); player.sendMessage("Blue Spawn Set!");
break; break;
case ("p"): case ("p"):
player.sendMessage("Setting Purple Spawn..."); player.sendMessage("Setting Purple Spawn...");
spawnSet.setRSpawn(player.getLocation()); spawnSet.PSpawn = player.getLocation();
player.sendMessage("Purple Spawn Set!"); player.sendMessage("Purple Spawn Set!");
break; break;
} }

View file

@ -3,25 +3,11 @@ package alisolarflare.components.minigames.data;
import org.bukkit.Location; import org.bukkit.Location;
public class SpawnSet { public class SpawnSet {
private Location RSpawn; public Location RSpawn;
private Location OSpawn; public Location OSpawn;
private Location YSpawn; public Location YSpawn;
private Location GSpawn; public Location GSpawn;
private Location BSpawn; public Location BSpawn;
private Location PSpawn; public Location PSpawn;
public Location getRSpawn(){return RSpawn;}
public Location getOSpawn(){return OSpawn;}
public Location getYSpawn(){return YSpawn;}
public Location getGSpawn(){return GSpawn;}
public Location getBSpawn(){return BSpawn;}
public Location getPSpawn(){return PSpawn;}
public void setRSpawn(Location RSpawn){this.RSpawn = RSpawn; return;}
public void setOSpawn(Location OSpawn){this.OSpawn = OSpawn; return;}
public void setYSpawn(Location YSpawn){this.YSpawn = YSpawn; return;}
public void setGSpawn(Location GSpawn){this.GSpawn = GSpawn; return;}
public void setBSpawn(Location BSpawn){this.BSpawn = BSpawn; return;}
public void setPSpawn(Location PSpawn){this.PSpawn = PSpawn; return;}
} }

View file

@ -1,11 +0,0 @@
package alisolarflare.components.minigames.entities;
import org.bukkit.entity.Player;
public class Fighter {
public Player player;
public String colour;
public Fighter(Player player, String colour){
this.colour = colour;
}
}