Migration to Maven, removing buggy code

In preparation for using sk89q's command framework
This commit is contained in:
Charlie
2014-07-28 09:37:04 -04:00
parent 70a94aa4b1
commit b490df861e
9 changed files with 214 additions and 56 deletions

View File

@@ -276,7 +276,7 @@ public class DiscoParty {
}
loc = player.getLocation();
this.spawnFloor(world, new Location(world, loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()));
//this.spawnFloor(world, new Location(world, loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ()));
}
void spawnSheep(World world, Location loc) {
@@ -428,9 +428,9 @@ public class DiscoParty {
}
}
for (Block block : this.floorBlocks) {
this.randomizeFloor(block);
}
/* for (Block block : this.floorBlocks) {
this.randomizeFloor(block);
}*/
}

View File

@@ -25,7 +25,7 @@ public final class DiscoSheep extends JavaPlugin {
static final String PERMISSION_SPAWNGUESTS = "discosheep.party.spawnguests";
static final String PERMISSION_TOGGLEPARTYONJOIN = "discosheep.admin.toggleonjoin";
static final String PERMISSION_LIGHTNING = "discosheep.party.lightning";
static boolean partyOnJoin = true;
static boolean partyOnJoin = false;
Map<String, DiscoParty> parties = new HashMap<String, DiscoParty>();
@Override
@@ -48,22 +48,21 @@ public final class DiscoSheep extends JavaPlugin {
* Iterate through all live entities and create default configuration values for them
* excludes bosses and other mobs that throw NPE
*/
for (EntityType ent : EntityType.values()) {
if (ent.isAlive()
&& !ent.equals(EntityType.ENDER_DRAGON)
&& !ent.equals(EntityType.WITHER)
&& !ent.equals(EntityType.PIG_ZOMBIE)
&& !ent.equals(EntityType.OCELOT)
&& !ent.equals(EntityType.CAVE_SPIDER)
&& !ent.equals(EntityType.MAGMA_CUBE)
&& !ent.equals(EntityType.MUSHROOM_COW)
&& !ent.equals(EntityType.IRON_GOLEM)
&& !ent.equals(EntityType.PLAYER)) {
getConfig().addDefault("default.guests." + ent.toString(), 0);
getConfig().addDefault("max.guests." + ent.toString(), 0);
}
}
/* for (EntityType ent : EntityType.values()) {
if (ent.isAlive()
&& !ent.equals(EntityType.ENDER_DRAGON)
&& !ent.equals(EntityType.WITHER)
&& !ent.equals(EntityType.PIG_ZOMBIE)
&& !ent.equals(EntityType.OCELOT)
&& !ent.equals(EntityType.CAVE_SPIDER)
&& !ent.equals(EntityType.MAGMA_CUBE)
&& !ent.equals(EntityType.MUSHROOM_COW)
&& !ent.equals(EntityType.IRON_GOLEM)
&& !ent.equals(EntityType.PLAYER)) {
getConfig().addDefault("default.guests." + ent.toString(), 0);
getConfig().addDefault("max.guests." + ent.toString(), 0);
}
}*/
loadConfigFromDisk();
}
@@ -82,13 +81,13 @@ public final class DiscoSheep extends JavaPlugin {
DiscoParty.defaultDuration = toTicks(getConfig().getInt("default.duration"));
DiscoParty.defaultPeriod = getConfig().getInt("default.period-ticks");
for (String key : getConfig().getConfigurationSection("default.guests").getKeys(false)) {
DiscoParty.getDefaultGuestNumbers().put(key, getConfig().getInt("default.guests." + key));
}
for (String key : getConfig().getConfigurationSection("max.guests").getKeys(false)) {
DiscoParty.getMaxGuestNumbers().put(key, getConfig().getInt("max.guests." + key));
}
/* for (String key : getConfig().getConfigurationSection("default.guests").getKeys(false)) {
DiscoParty.getDefaultGuestNumbers().put(key, getConfig().getInt("default.guests." + key));
}
for (String key : getConfig().getConfigurationSection("max.guests").getKeys(false)) {
DiscoParty.getMaxGuestNumbers().put(key, getConfig().getInt("max.guests." + key));
}*/
}
@@ -104,9 +103,9 @@ public final class DiscoSheep extends JavaPlugin {
getConfig().set("default.duration", toSeconds_i(DiscoParty.defaultDuration));
getConfig().set("default.period-ticks", DiscoParty.defaultPeriod);
for (Map.Entry<String, Integer> entry : DiscoParty.getDefaultGuestNumbers().entrySet()) {
getConfig().set("default.guests." + entry.getKey(), entry.getValue());
}
/* for (Map.Entry<String, Integer> entry : DiscoParty.getDefaultGuestNumbers().entrySet()) {
getConfig().set("default.guests." + entry.getKey(), entry.getValue());
}*/
saveConfig();
}
@@ -176,8 +175,8 @@ public final class DiscoSheep extends JavaPlugin {
+ "-t <integer>: set the party duration in seconds\n"
+ "-p <ticks>: set the number of ticks between each disco beat\n"
+ "-r <integer>: set radius of the area in which sheep can spawn\n"
+ "-g <mob> <number>: set spawns for other mobs"
+ "-l: enables lightning"
//+ "-g <mob> <number>: set spawns for other mobs\n"
+ "-l: enables lightning\n"
+ "-fw: enables fireworks");
return true;
}
@@ -219,7 +218,10 @@ public final class DiscoSheep extends JavaPlugin {
return noPermsMessage(sender, PERMISSION_RELOAD);
}
}
@SuppressWarnings( "deprecation" )
// UUIDs not necessary since DiscoSheep only lasts for one session at most
// and permissions will handle onJoin DiscoSheep
boolean partyOtherCommand(String[] players, CommandSender sender, DiscoParty party) {
if (sender.hasPermission(PERMISSION_OTHER)) {
Player p;

View File

@@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
public class DiscoSheepCommandExecutor implements CommandExecutor {
private DiscoSheep parent;
private final DiscoSheep parent;
public DiscoSheepCommandExecutor(DiscoSheep parent) {
this.parent = parent;
@@ -147,26 +147,26 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
+ DiscoParty.maxPeriod + "]");
return false;
}
} else if (args[i].equalsIgnoreCase("-g")) {
if (!sender.hasPermission(DiscoSheep.PERMISSION_SPAWNGUESTS)) {
return parent.noPermsMessage(sender, DiscoSheep.PERMISSION_SPAWNGUESTS);
}
if (parseNextArg(args, i, "none")) {
return parent.clearGuests(mainParty);
}
String[] guests = getNextArgs(args, i + 1);
int j = 0;
while (j < guests.length - 1) {
try {
mainParty.setGuestNumber(guests[j], getNextIntArg(guests, j));
} catch (IllegalArgumentException e) {
sender.sendMessage(ChatColor.RED + "Invalid arguments: " + ChatColor.WHITE + guests[j] + ", " + guests[j + 1]
+ ".\nEither a name typo or a number that is not within limits.");
}
j += 2; // skip over two arguments, since they come in pairs of entity-number
}
// } else if (args[i].equalsIgnoreCase("-g")) {
// if (!sender.hasPermission(DiscoSheep.PERMISSION_SPAWNGUESTS)) {
// return parent.noPermsMessage(sender, DiscoSheep.PERMISSION_SPAWNGUESTS);
// }
//
// if (parseNextArg(args, i, "none")) {
// return parent.clearGuests(mainParty);
// }
//
// String[] guests = getNextArgs(args, i + 1);
// int j = 0;
// while (j < guests.length - 1) {
// try {
// mainParty.setGuestNumber(guests[j], getNextIntArg(guests, j));
// } catch (IllegalArgumentException e) {
// sender.sendMessage(ChatColor.RED + "Invalid arguments: " + ChatColor.WHITE + guests[j] + ", " + guests[j + 1]
// + ".\nEither a name typo or a number that is not within limits.");
// }
// j += 2; // skip over two arguments, since they come in pairs of entity-number
// }
} else if (args[i].equalsIgnoreCase("-l")) {
if (!sender.hasPermission(DiscoSheep.PERMISSION_LIGHTNING)) {
return parent.noPermsMessage(sender, DiscoSheep.PERMISSION_LIGHTNING);

View File

@@ -0,0 +1,93 @@
name: DiscoSheep
main: ca.gibstick.discosheep.DiscoSheep
authors: [Gibstick, RangerMauve]
version: 1.1.1
commands:
ds:
description: "Main DiscoSheep command"
usage: |
<command> <subcommand> [arguments]
Use /ds help for more information
To stop your party, use /ds stop.
permissions:
# If default is set to false, console will not have permission!
discosheep.*:
description: Permission node for all DiscoSheep commands
default: op
children:
discosheep.party: true
discosheep.admin: true
discosheep.party.*:
description: All permissions related to parties
defualt: op
children:
discosheep.party.me: true
discosheep.party.all: true
discosheep.party.fireworks: true
discosheep.party.other: true
discosheep.party.changeperiod: true
discosheep.party.spawnguests: true
discosheep.party.lightning: true
discosheep.admin.*:
description: Suggested permissions for administrators
default: op
children:
discosheep.admin.stopall: true
discosheep.admin.reload: true
discosheep.admin.changedefaults: true
discosheep.admin.saveconfig: true
discosheep.admin.toggleonjoin: true
discosheep.party.me:
description: Allows a player to have a party of one
default: op
discosheep.party.all:
description: Allows a player to call a server-wide party
default: op
discosheep.admin.stopall:
description: Allows a player to stop all parties on the server
default: op
discosheep.party.fireworks:
description: Allows a player to enable have parties with fireworks
default: op
discosheep.admin.reload:
description: Allows a player to reload settings from config.yml
default: op
discosheep.party.other:
description: Allows a player to call parties for other people, including themselves.
default: op
children:
discosheep.party.me: true
discosheep.party.changeperiod:
description: Allows a player to use the -p switch
default: op
discosheep.admin.changedefaults:
description: Allows a player to change the default settings
default: op
discosheep.admin.saveconfig:
description: Allows a player to save the config with current values set in memory
default: op
discosheep.party.onjoin:
description: Gives a player a disco party on join
default: false
discosheep.party.spawnguests:
description: Allow a player to spawn other mobs
default: op
discosheep.admin.toggleonjoin:
description: Allow a player to toggle party-on-join functionality (force disable)
default: op
discosheep.party.lightning:
description: Allow a player to use lightning for parties
default: op
# FOR BACKWARDS COMPAT FROM 1.1 TO 1.1.1
discosheep.party:
children:
discosheep.party.me: true
discosheep.partyall:
children:
discosheep.party.all: true
discosheep.reload:
children:
discoshep.admin.reload: true
discosheep.stopall:
children:
discosheep.admin.stopall: true