cleanup
This commit is contained in:
parent
d40be65188
commit
19791d8bf6
@ -126,7 +126,7 @@ public class DiscoCommands {
|
|||||||
String dirtyArgs[] = args.getParsedSlice(0);
|
String dirtyArgs[] = args.getParsedSlice(0);
|
||||||
//sender.sendMessage(dirtyArgs);
|
//sender.sendMessage(dirtyArgs);
|
||||||
for (int i = 0; i < dirtyArgs.length; i++) {
|
for (int i = 0; i < dirtyArgs.length; i++) {
|
||||||
if ("none".equals(dirtyArgs[0])) {
|
if ("none".equals(dirtyArgs[0])) { // wtf??
|
||||||
plugin.clearGuests(party);
|
plugin.clearGuests(party);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import static org.bukkit.EntityEffect.*;
|
import static org.bukkit.EntityEffect.*;
|
||||||
@ -43,8 +42,8 @@ public class DiscoParty {
|
|||||||
static int maxRadius = 100;
|
static int maxRadius = 100;
|
||||||
static int minPeriod = 5; // 0.25 seconds
|
static int minPeriod = 5; // 0.25 seconds
|
||||||
static int maxPeriod = 40; // 2.0 seconds
|
static int maxPeriod = 40; // 2.0 seconds
|
||||||
private static HashMap<String, Integer> defaultGuestNumbers = new HashMap<String, Integer>();
|
private static HashMap<String, Integer> defaultGuestNumbers = new HashMap<>();
|
||||||
private static HashMap<String, Integer> maxGuestNumbers = new HashMap<String, Integer>();
|
private static HashMap<String, Integer> maxGuestNumbers = new HashMap<>();
|
||||||
private static final EnumSet<Material> floorExceptions = EnumSet.of(
|
private static final EnumSet<Material> floorExceptions = EnumSet.of(
|
||||||
//Material.STAINED_GLASS,
|
//Material.STAINED_GLASS,
|
||||||
Material.FURNACE,
|
Material.FURNACE,
|
||||||
@ -88,13 +87,13 @@ public class DiscoParty {
|
|||||||
private PartyEvents partyEvents;
|
private PartyEvents partyEvents;
|
||||||
private final DiscoSheep plugin = DiscoSheep.getInstance();
|
private final DiscoSheep plugin = DiscoSheep.getInstance();
|
||||||
private Player player;
|
private Player player;
|
||||||
private final ArrayList<Sheep> sheepList = new ArrayList<Sheep>();
|
private final ArrayList<Sheep> sheepList = new ArrayList<>();
|
||||||
private final HashSet<Sheep> sheepSet = new HashSet<Sheep>();
|
private final HashSet<Sheep> sheepSet = new HashSet<>();
|
||||||
private final ArrayList<Entity> guestList = new ArrayList<Entity>();
|
private final ArrayList<Entity> guestList = new ArrayList<>();
|
||||||
private final HashSet<Entity> guestSet = new HashSet<Entity>();
|
private final HashSet<Entity> guestSet = new HashSet<>();
|
||||||
private final ArrayList<BlockState> floorBlockCache = new ArrayList<BlockState>();
|
private final ArrayList<BlockState> floorBlockCache = new ArrayList<>();
|
||||||
private final ArrayList<Block> floorBlocks = new ArrayList<Block>();
|
private final ArrayList<Block> floorBlocks = new ArrayList<>();
|
||||||
private HashMap<String, Integer> guestNumbers = new HashMap<String, Integer>();
|
private HashMap<String, Integer> guestNumbers = new HashMap<>();
|
||||||
private boolean doFireworks = false;
|
private boolean doFireworks = false;
|
||||||
private final boolean doJump = true;
|
private final boolean doJump = true;
|
||||||
private boolean doLightning = false;
|
private boolean doLightning = false;
|
||||||
@ -116,7 +115,7 @@ public class DiscoParty {
|
|||||||
this.period = DiscoParty.defaultPeriod;
|
this.period = DiscoParty.defaultPeriod;
|
||||||
this.radius = DiscoParty.defaultRadius;
|
this.radius = DiscoParty.defaultRadius;
|
||||||
this.sheep = DiscoParty.defaultSheep;
|
this.sheep = DiscoParty.defaultSheep;
|
||||||
this.guestNumbers = new HashMap<String, Integer>(DiscoParty.defaultGuestNumbers);
|
this.guestNumbers = new HashMap<>(DiscoParty.defaultGuestNumbers);
|
||||||
r = new Random();
|
r = new Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +264,7 @@ public class DiscoParty {
|
|||||||
DiscoParty.defaultPeriod = this.period;
|
DiscoParty.defaultPeriod = this.period;
|
||||||
DiscoParty.defaultRadius = this.radius;
|
DiscoParty.defaultRadius = this.radius;
|
||||||
DiscoParty.defaultSheep = this.sheep;
|
DiscoParty.defaultSheep = this.sheep;
|
||||||
DiscoParty.defaultGuestNumbers = new HashMap<String, Integer>(this.getGuestNumbers());
|
DiscoParty.defaultGuestNumbers = new HashMap<>(this.getGuestNumbers());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,9 +441,9 @@ public class DiscoParty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this.floorBlocks.size(); i++) {
|
// for (int i = 0; i < this.floorBlocks.size(); i++) {
|
||||||
this.randomizeFloor(floorBlocks.get(i), i);
|
// this.randomizeFloor(floorBlocks.get(i), i);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
float getPentatonicNote() {
|
float getPentatonicNote() {
|
||||||
|
@ -7,7 +7,6 @@ import com.sk89q.minecraft.util.commands.CommandsManager;
|
|||||||
import com.sk89q.minecraft.util.commands.MissingNestedCommandException;
|
import com.sk89q.minecraft.util.commands.MissingNestedCommandException;
|
||||||
import com.sk89q.minecraft.util.commands.WrappedCommandException;
|
import com.sk89q.minecraft.util.commands.WrappedCommandException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -15,7 +14,6 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandException;
|
import org.bukkit.command.CommandException;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -29,7 +27,7 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
private static DiscoSheep instance;
|
private static DiscoSheep instance;
|
||||||
|
|
||||||
boolean partyOnJoin = true;
|
boolean partyOnJoin = true;
|
||||||
Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
|
Map<String, DiscoParty> parties = new HashMap<>();
|
||||||
private CommandsManager<CommandSender> commands;
|
private CommandsManager<CommandSender> commands;
|
||||||
|
|
||||||
public static DiscoSheep getInstance() {
|
public static DiscoSheep getInstance() {
|
||||||
@ -69,7 +67,6 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
sender.sendMessage(ChatColor.RED + "Illegal argument (out of bounds or bad format).");
|
sender.sendMessage(ChatColor.RED + "Illegal argument (out of bounds or bad format).");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + "An error has occurred. See console.");
|
sender.sendMessage(ChatColor.RED + "An error has occurred. See console.");
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
sender.sendMessage(ChatColor.RED + e.getMessage());
|
sender.sendMessage(ChatColor.RED + e.getMessage());
|
||||||
@ -82,7 +79,6 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
instance = this;
|
instance = this;
|
||||||
//getCommand("ds").setExecutor(new DiscoSheepCommandExecutor(this));
|
|
||||||
setupCommands();
|
setupCommands();
|
||||||
getServer().getPluginManager().registerEvents(new GlobalEvents(), this);
|
getServer().getPluginManager().registerEvents(new GlobalEvents(), this);
|
||||||
|
|
||||||
@ -182,7 +178,7 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ArrayList<DiscoParty> getParties() {
|
public synchronized ArrayList<DiscoParty> getParties() {
|
||||||
return new ArrayList<DiscoParty>(this.getPartyMap().values());
|
return new ArrayList<>(this.getPartyMap().values());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopParty(String name) {
|
public void stopParty(String name) {
|
||||||
@ -239,7 +235,7 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
|
|
||||||
// From user "desht" on bukkit forums
|
// From user "desht" on bukkit forums
|
||||||
public List<Player> getPlayersWithin(Player player, int distance) {
|
public List<Player> getPlayersWithin(Player player, int distance) {
|
||||||
List<Player> res = new ArrayList<Player>();
|
List<Player> res = new ArrayList<>();
|
||||||
int d2 = distance * distance;
|
int d2 = distance * distance;
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
if (p.getWorld() == player.getWorld() && p.getLocation().distanceSquared(player.getLocation()) <= d2) {
|
if (p.getWorld() == player.getWorld() && p.getLocation().distanceSquared(player.getLocation()) <= d2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user