Merge remote-tracking branch 'origin/limit-parties'

This commit is contained in:
Charlie Wang 2013-06-30 20:53:49 -04:00
commit 9c44f3daec
2 changed files with 19 additions and 17 deletions

View File

@ -9,7 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class DiscoSheep extends JavaPlugin { public final class DiscoSheep extends JavaPlugin {
Map<String,DiscoParty> parties = new HashMap<String,DiscoParty>(); Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
private SheepDeshearer deshear = new SheepDeshearer(this); private SheepDeshearer deshear = new SheepDeshearer(this);
// array of accetable disco colours (order not important) // array of accetable disco colours (order not important)
@ -23,35 +23,37 @@ public final class DiscoSheep extends JavaPlugin {
public void onDisable() { public void onDisable() {
} }
public Map<String,DiscoParty> getPartyMap() { public Map<String, DiscoParty> getPartyMap() {
return this.parties; return this.parties;
} }
public List<DiscoParty> getParties(){ public List<DiscoParty> getParties() {
return new ArrayList(this.parties.values()); return new ArrayList(this.parties.values());
} }
public void stopParty(String name){ public void stopParty(String name) {
if(this.hasParty(name)){ if (this.hasParty(name)) {
this.getParty(name).stopDisco(); this.getParty(name).stopDisco();
} }
} }
public boolean hasParty(String name){ public boolean hasParty(String name) {
return this.parties.containsKey(name); return this.parties.containsKey(name);
} }
public DiscoParty getParty(String name){ public DiscoParty getParty(String name) {
return this.parties.get(name); return this.parties.get(name);
} }
public void removeParty(String name){ public void removeParty(String name) {
if(this.hasParty(name)){ if (this.hasParty(name)) {
this.parties.remove(name); this.parties.remove(name);
} }
} }
public void startDisco(Player player) { public void startParty(Player player) {
if (!hasParty(player.getName())) {
new DiscoParty(this, player).startDisco(); new DiscoParty(this, player).startDisco();
} }
}
} }

View File

@ -16,7 +16,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) { if (sender instanceof Player) {
parent.startDisco((Player)sender); parent.startParty((Player)sender);
} }
return true; return true;
} }