Skip to content

Commit

Permalink
Added extra config options.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Feb 6, 2015
1 parent 4e9508f commit 8d9bc96
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 63 deletions.
19 changes: 16 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,33 @@ general:
#How long a player must wait before they can reset their island again in second
resetwait: 300

#The number of seconds to wait for confirmation of a reset
resetconfirmwait: 10

#How long a player must wait until they can rejoin a team island after being
#kicked in minutes. This slows the effectiveness of players repeating challenges
#by repetitively being invited to a team island.
invitewait: 60

# Island level calculation cool down in seconds
levelwait: 60

#How many resets a player is allowed (override with /asadmin clearreset <player>
#Value of -1 means unlimited, 0 means hardcore - no resets.
#Example, 2 resets means they get 2 resets or 3 islands lifetime
resetlimit: 2

#Commands to run when the player resets their island (uncomment and customize)
# [player] is the player name of who is reseting
#resetcommands:
# - kit tools [player]
# - some other command
resetcommands:
#- kit tools [player]
#- some other command

# Commands to execute when player leaves a team, either by leaving or being kicked
# Commands will execute even if the player is offline, so may cause errors in
# the console if the commands doesn't make sense
leavecommands:
#- kit tools [player]

# Ops receive damage from acid (Set to true if you want Ops to play properly)
damageops: false
Expand Down Expand Up @@ -180,6 +192,7 @@ general:
# like water will not flow from the schematic
usephysics: false


##### Island Related Settings #####

island:
Expand Down
2 changes: 1 addition & 1 deletion locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ island:
#Cool down warning - [time] is number of seconds left
resetWait: "You have to wait [time] seconds before you can do that again."
#Confirm
resetConfirm: "Type /island confirm within 10 seconds to delete your island and restart!"
resetConfirm: "Type /island confirm within [seconds] seconds to delete your island and restart!"
resetYouHave: "You have [number] resets left."
resetNoMore: "No more resets are allowed for your island!"
resetTo: "Cleared reset limit"
Expand Down
5 changes: 4 additions & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ permissions:
askyblock.island.lock:
description: Allows island locking
default: false
askyblock.island.expel:
description: Allows expelling of visitors
default: true
askyblock.team.*:
children:
askyblock.team.create:
Expand All @@ -82,7 +85,7 @@ permissions:
default: false
askyblock.coop:
description: Allows player to use the coop command
default: false
default: false
askyblock.craft.*:
children:
askyblock.craft.enderchest:
Expand Down
43 changes: 29 additions & 14 deletions src/com/wasteofplastic/askyblock/ASkyBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,34 +154,38 @@ protected static World getIslandWorld() {
//Bukkit.getLogger().info("DEBUG worldName = " + Settings.worldName);
acidWorld = WorldCreator.name(Settings.worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL)
.generator(new ChunkGeneratorWorld()).createWorld();
// Make the nether if it does not exist
if (Settings.createNether) {
if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) {
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
if (!Settings.newNether) {
World netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
} else {
World netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld()).environment(World.Environment.NETHER).createWorld();
}
//netherWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit);
// netherWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit);
}
}
// Multiverse configuration
if (Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) {
Bukkit.getLogger().info("Trying to register generator with Multiverse ");
try {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + Settings.worldName + " normal -g " + plugin.getName());
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv modify set generator " + plugin.getName() + " " + Settings.worldName);
if (Settings.newNether) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + Settings.worldName + "_nether nether -g " + plugin.getName());
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv modify set generator " + plugin.getName() + " " + Settings.worldName + "_nether");
} else {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv import " + Settings.worldName + "_nether nether");
}
} catch (Exception e) {
Bukkit.getLogger().info("Not successfull! Disabling " + plugin.getName() + "!");
e.printStackTrace();
Bukkit.getServer().getPluginManager().disablePlugin(plugin);
}
}
// Make the nether if it does not exist
if (Settings.createNether) {
if (plugin.getServer().getWorld(Settings.worldName + "_nether") == null) {
Bukkit.getLogger().info("Creating " + plugin.getName() + "'s Nether...");
if (!Settings.newNether) {
World netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.NORMAL).environment(World.Environment.NETHER).createWorld();
} else {
World netherWorld = WorldCreator.name(Settings.worldName + "_nether").type(WorldType.FLAT).generator(new ChunkGeneratorWorld()).environment(World.Environment.NETHER).createWorld();
}
//netherWorld.setMonsterSpawnLimit(Settings.monsterSpawnLimit);
// netherWorld.setAnimalSpawnLimit(Settings.animalSpawnLimit);
}
}

}
// Set world settings
acidWorld.setWaterAnimalSpawnLimit(Settings.waterAnimalSpawnLimit);
Expand Down Expand Up @@ -958,6 +962,7 @@ protected void loadPluginConfig() {
Settings.useEconomy = getConfig().getBoolean("general.useeconomy",true);
// Island reset commands
Settings.resetCommands = getConfig().getStringList("general.resetcommands");
Settings.leaveCommands = getConfig().getStringList("general.leavecommands");
Settings.useControlPanel = getConfig().getBoolean("general.usecontrolpanel", false);
// Check if /island command is allowed when falling
Settings.allowTeleportWhenFalling = getConfig().getBoolean("general.allowfallingteleport", true);
Expand Down Expand Up @@ -1149,6 +1154,15 @@ protected void loadPluginConfig() {
if (Settings.inviteWait < 0) {
Settings.inviteWait = 0;
}
Settings.levelWait = getConfig().getInt("general.levelwait", 60);
if (Settings.levelWait < 0) {
Settings.levelWait = 0;
}
// Seconds to wait for a confirmation of reset
Settings.resetConfirmWait = getConfig().getInt("general.resetconfirmwait", 10);
if (Settings.resetConfirmWait < 0) {
Settings.resetConfirmWait = 0;
}
Settings.damageOps = getConfig().getBoolean("general.damageops", false);
//Settings.ultraSafeBoats = getConfig().getBoolean("general.ultrasafeboats", true);
Settings.logInRemoveMobs = getConfig().getBoolean("general.loginremovemobs", true);
Expand Down Expand Up @@ -1446,7 +1460,7 @@ else if (amountdata.length == 4) {
Locale.islandresetMustRemovePlayers = ChatColor.translateAlternateColorCodes('&',locale.getString("island.resetMustRemovePlayers","You must remove all players from your island before you can restart it (/island kick <player>). See a list of players currently part of your island using /island team."));
Locale.islandresetPleaseWait = ChatColor.translateAlternateColorCodes('&',locale.getString("island.resetPleaseWait","Please wait, generating new island"));
Locale.islandresetWait = ChatColor.translateAlternateColorCodes('&',locale.getString("island.resetWait","You have to wait [time] seconds before you can do that again."));
Locale.islandresetConfirm = ChatColor.translateAlternateColorCodes('&',locale.getString("island.resetConfirm", "Type /island confirm within 10 seconds to delete your island and restart!"));
Locale.islandresetConfirm = ChatColor.translateAlternateColorCodes('&',locale.getString("island.resetConfirm", "Type /island confirm within [seconds] seconds to delete your island and restart!"));
Locale.islandhelpIsland = ChatColor.translateAlternateColorCodes('&',locale.getString("island.helpIsland","start an island, or teleport to your island."));
Locale.islandhelpTeleport = ChatColor.translateAlternateColorCodes('&',locale.getString("island.helpTeleport", "teleport to your island."));
Locale.islandhelpControlPanel = ChatColor.translateAlternateColorCodes('&',locale.getString("island.helpControlPanel","open the island GUI."));
Expand Down Expand Up @@ -1721,6 +1735,7 @@ public void run() {
// Load grid
grid = new GridManager(plugin);
topTenLoad();
getLogger().info("All files loaded. Ready to play...");
}
});
// This part will kill monsters if they fall into the water because it
Expand Down
13 changes: 7 additions & 6 deletions src/com/wasteofplastic/askyblock/GridManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void loadGrid() {
// check if island folder exists
plugin.getLogger().info("islands.yml does not exist. Creating...");
convert();
plugin.getLogger().info("islands.yml created. You can play now. :-)");
plugin.getLogger().info("islands.yml created.");
} else {
plugin.getLogger().info("Loading islands.yml");
YamlConfiguration islandYaml = ASkyBlock.loadYamlFile("islands.yml");
Expand Down Expand Up @@ -117,7 +117,7 @@ private void convert() {
final File playerFolder = new File(plugin.getDataFolder() + File.separator + "players");
YamlConfiguration playerFile = new YamlConfiguration();
int count = 0;
if (playerFolder.exists()) {
if (playerFolder.exists() && playerFolder.listFiles().length > 0) {
plugin.getLogger().warning("Reading player folder. This could time some time with a large number of players...");
for (File f: playerFolder.listFiles()) {
// Need to remove the .yml suffix
Expand Down Expand Up @@ -169,13 +169,14 @@ private void convert() {
}
}
}
plugin.getLogger().info("Converted "+ count + " islands from player's folder");
}
plugin.topTenSave();
plugin.getLogger().info("Converted "+ count + " islands from player's folder");

int count2 = 0;
// Check island folder
final File islandFolder = new File(plugin.getDataFolder() + File.separator + "islands");
if (islandFolder.exists()) {
if (islandFolder.exists() && islandFolder.listFiles().length > 0) {
plugin.getLogger().warning("Reading island folder. This could time some time with a large number of islands...");
for (File f: islandFolder.listFiles()) {
// Need to remove the .yml suffix
Expand Down Expand Up @@ -204,9 +205,9 @@ private void convert() {
}
}
}
plugin.getLogger().info("Converted "+ count2 + " islands from island folder");
plugin.getLogger().info("Total "+ (count+count2) + " islands converted.");
}
plugin.getLogger().info("Converted "+ count2 + " islands from island folder");
plugin.getLogger().info("Total "+ (count+count2) + " islands converted.");
// Now save the islandGrid
saveGrid();
}
Expand Down
Loading

0 comments on commit 8d9bc96

Please sign in to comment.