From eda4007b1e53fe25c68536f8c29b6ad7a2e9de00 Mon Sep 17 00:00:00 2001 From: Charlie Wang Date: Sun, 30 Jun 2013 14:48:36 -0400 Subject: [PATCH] I cannot into git --- .../bukkit/discosheep/DiscoSheep.java | 194 +++++++++--------- .../discosheep/DiscoSheepCommandExecutor.java | 44 ++-- .../bukkit/discosheep/DiscoUpdater.java | 1 - src/plugin.yml | 2 +- 4 files changed, 120 insertions(+), 121 deletions(-) diff --git a/src/gibstick/bukkit/discosheep/DiscoSheep.java b/src/gibstick/bukkit/discosheep/DiscoSheep.java index 44a4553..011df2f 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheep.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheep.java @@ -1,97 +1,97 @@ -package gibstick.bukkit.discosheep; - -import java.util.ArrayList; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.entity.Sheep; -import org.bukkit.Location; -import org.bukkit.entity.EntityType; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - -public final class DiscoSheep extends JavaPlugin { - - private ArrayList sheepArray = new ArrayList<>(); - private DiscoUpdater updater = new DiscoUpdater(this); - // radius for random sheep spawns around player - private static int sheepSpawnRadius = 5; - - @Override - public void onEnable() { - getCommand("ds").setExecutor(new DiscoSheepCommandExecutor(this)); - } - - @Override - public void onDisable() { - // Watashi Wa Kawaii, Ne? - } - - void spawnSheep(World world, Location loc) { - Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP); - newSheep.setMaxHealth(10000); - newSheep.setHealth(10000); - sheepArray.add(newSheep); - } - - // Spawn some number of sheep next to given player - void spawnSheep(Player player, int num) { - Location loc; - World world = player.getWorld(); - - for (int i = 0; i < num; i++) { - double x, y, z; - - // random x and z coordinates within a 5 block radius - // safe y-coordinate - x = -sheepSpawnRadius + (Math.random() * ((sheepSpawnRadius * 2) + 1)) + player.getLocation().getX(); - z = -sheepSpawnRadius + (Math.random() * ((sheepSpawnRadius * 2) + 1)) + player.getLocation().getZ(); - y = world.getHighestBlockYAt((int) x, (int) z); - loc = new Location(world, x, y, z); - spawnSheep(world, loc); - } - } - - // Mark all sheep in the sheep array for removal - void removeAllSheep() { - for (int i = 0; i < sheepArray.size(); i++) { - sheepArray.get(i).remove(); - } - sheepArray.clear(); - } - - // Cycle colours of all sheep in the array - void cycleSheepColours() { - for (int i = 0; i < sheepArray.size(); i++) { - //sheepArray.get(i) something something - } - } - - void playSounds() { - // TODO: generate list of players to send sounds to - } - - void playSounds(Player player) { - //TODO: Add sound playing here - } - - // Called after discosheep is stopped - void cleanUp() { - removeAllSheep(); - } - - void scheduleUpdate() { - updater.runTaskLater((Plugin) updater, updater.frequency); - } - - void startDisco(int frequency, int duration) { - updater.start(frequency, duration); - } - - void startDisco() { - this.startDisco(); - } - - void stopDisco() { - updater.stop(); - } -} +package gibstick.bukkit.discosheep; + +import java.util.ArrayList; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.entity.Sheep; +import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +public final class DiscoSheep extends JavaPlugin { + + private ArrayList sheepArray = new ArrayList<>(); + private DiscoUpdater updater = new DiscoUpdater(this); + // radius for random sheep spawns around player + private static int sheepSpawnRadius = 5; + + @Override + public void onEnable() { + getCommand("ds").setExecutor(new DiscoSheepCommandExecutor(this)); + } + + @Override + public void onDisable() { + // Watashi Wa Kawaii, Ne? + } + + void spawnSheep(World world, Location loc) { + Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP); + newSheep.setMaxHealth(10000); + newSheep.setHealth(10000); + sheepArray.add(newSheep); + } + + // Spawn some number of sheep next to given player + void spawnSheep(Player player, int num) { + Location loc; + World world = player.getWorld(); + + for (int i = 0; i < num; i++) { + double x, y, z; + + // random x and z coordinates within a 5 block radius + // safe y-coordinate + x = -sheepSpawnRadius + (Math.random() * ((sheepSpawnRadius * 2) + 1)) + player.getLocation().getX(); + z = -sheepSpawnRadius + (Math.random() * ((sheepSpawnRadius * 2) + 1)) + player.getLocation().getZ(); + y = world.getHighestBlockYAt((int) x, (int) z); + loc = new Location(world, x, y, z); + spawnSheep(world, loc); + } + } + + // Mark all sheep in the sheep array for removal + void removeAllSheep() { + for (int i = 0; i < sheepArray.size(); i++) { + sheepArray.get(i).remove(); + } + sheepArray.clear(); + } + + // Cycle colours of all sheep in the array + void cycleSheepColours() { + for (int i = 0; i < sheepArray.size(); i++) { + //sheepArray.get(i) something something + } + } + + void playSounds() { + // TODO: generate list of players to send sounds to + } + + void playSounds(Player player) { + //TODO: Add sound playing here + } + + // Called after discosheep is stopped + void cleanUp() { + removeAllSheep(); + } + + void scheduleUpdate() { + updater.runTaskLater((Plugin) updater, updater.frequency); + } + + void startDisco(int frequency, int duration) { + updater.start(frequency, duration); + } + + void startDisco() { + this.startDisco(); + } + + void stopDisco() { + updater.stop(); + } +} diff --git a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java index f634d73..10c6e7e 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java @@ -1,22 +1,22 @@ -package gibstick.bukkit.DiscoSheep; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.CommandExecutor; - - -public class DiscoSheepCommandExecutor implements CommandExecutor { - - private DiscoSheep plugin; - - public DiscoSheepCommandExecutor(DiscoSheep plugin) { - this.plugin = plugin; - } - - @Override - public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - - return true; - } - -} +package gibstick.bukkit.discosheep; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandExecutor; + + +public class DiscoSheepCommandExecutor implements CommandExecutor { + + private DiscoSheep parent; + + public DiscoSheepCommandExecutor(DiscoSheep parent) { + this.parent = parent; + } + + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + + return true; + } + +} diff --git a/src/gibstick/bukkit/discosheep/DiscoUpdater.java b/src/gibstick/bukkit/discosheep/DiscoUpdater.java index bafc8d7..2c059ee 100644 --- a/src/gibstick/bukkit/discosheep/DiscoUpdater.java +++ b/src/gibstick/bukkit/discosheep/DiscoUpdater.java @@ -1,6 +1,5 @@ package gibstick.bukkit.discosheep; -import gibstick.bukkit.DiscoSheep.DiscoSheep; import org.bukkit.scheduler.BukkitRunnable; public class DiscoUpdater extends BukkitRunnable { diff --git a/src/plugin.yml b/src/plugin.yml index e646bf3..936f622 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,3 +1,3 @@ name: DiscoSheep main: gibstick.bukkit.DiscoSheep.DiscoSheep -version: 0.5 \ No newline at end of file +version: 0.6 \ No newline at end of file