Minor changes to naming.

This commit is contained in:
RangerMauve 2013-07-29 19:50:14 -04:00
parent a7f9b4358a
commit ae93d9a5e4
5 changed files with 357 additions and 390 deletions

View File

@ -18,12 +18,9 @@ import org.bukkit.FireworkEffect.Builder;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
/**
*
* @author Georgiy
*/
public class DiscoParty { public class DiscoParty {
private DiscoSheep parent; private DiscoSheep parent;
@ -426,34 +423,17 @@ public class DiscoParty {
playSounds(); playSounds();
duration -= period; duration -= period;
this.scheduleUpdate(); this.scheduleUpdate();
if (state < 10000) { this.state = (this.state + 1) % 10000;
this.state++;
} else {
state = 1; // prevent overflow
}
} else { } else {
this.stopDisco(); this.stopDisco();
} }
} }
void scheduleUpdate() { void scheduleUpdate() {
updater = new DiscoUpdater(this); updater = new DiscoUpdater();
updater.runTaskLater(parent, this.period); updater.runTaskLater(parent, this.period);
} }
@Deprecated
void startDisco(int duration, int sheepAmount, int radius, int period, boolean fireworks) {
if (this.duration > 0) {
stopDisco();
}
this.spawnAll(sheepAmount, radius);
this.doFireworks = fireworks;
this.period = period;
this.duration = duration;
this.scheduleUpdate();
parent.getPartyMap().put(this.player.getName(), this);
}
void startDisco() { void startDisco() {
this.spawnAll(sheep, radius); this.spawnAll(sheep, radius);
this.scheduleUpdate(); this.scheduleUpdate();
@ -474,4 +454,12 @@ public class DiscoParty {
// stop listening // stop listening
HandlerList.unregisterAll(this.partyEvents); HandlerList.unregisterAll(this.partyEvents);
} }
class DiscoUpdater extends BukkitRunnable {
@Override
public void run() {
update();
}
}
} }

View File

@ -115,15 +115,15 @@ public final class DiscoSheep extends JavaPlugin {
this.stopAllParties(); // or else the parties will continue FOREVER this.stopAllParties(); // or else the parties will continue FOREVER
} }
int toTicks(double seconds) { static int toTicks(double seconds) {
return (int) Math.round(seconds * 20.0); return (int) Math.round(seconds * 20.0);
} }
double toSeconds(int ticks) { static double toSeconds(int ticks) {
return (double) Math.round(ticks / 20.0); return (double) Math.round(ticks / 20.0);
} }
int toSeconds_i(int ticks) { static int toSeconds_i(int ticks) {
return (int) Math.round(ticks / 20.0); return (int) Math.round(ticks / 20.0);
} }
@ -297,7 +297,7 @@ public final class DiscoSheep extends JavaPlugin {
} }
boolean zeroGuests(DiscoParty party) { boolean clearGuests(DiscoParty party) {
party.getGuestNumbers().clear(); party.getGuestNumbers().clear();
return true; return true;
} }

View File

@ -3,8 +3,8 @@ package ca.gibstick.discosheep;
import java.util.Arrays; import java.util.Arrays;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class DiscoSheepCommandExecutor implements CommandExecutor { public class DiscoSheepCommandExecutor implements CommandExecutor {
@ -153,7 +153,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
} }
if (parseNextArg(args, i, "none")) { if (parseNextArg(args, i, "none")) {
return parent.zeroGuests(mainParty); return parent.clearGuests(mainParty);
} }
String[] guests = getNextArgs(args, i + 1); String[] guests = getNextArgs(args, i + 1);

View File

@ -1,17 +0,0 @@
package ca.gibstick.discosheep;
import org.bukkit.scheduler.BukkitRunnable;
public class DiscoUpdater extends BukkitRunnable {
private DiscoParty parent;
public DiscoUpdater(DiscoParty parent) {
this.parent = parent;
}
@Override
public void run() {
parent.update();
}
}

View File

@ -12,10 +12,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
/**
*
* @author Mauve
*/
public class GlobalEvents implements Listener { public class GlobalEvents implements Listener {
DiscoSheep parent; DiscoSheep parent;