Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
v6 release.
Browse files Browse the repository at this point in the history
- the "protect" option is now a config file only setting
- "ticks" config file option allows you to change the interval
  at which the plugin runs, so it can be slowed down further
  • Loading branch information
ahkok committed Dec 10, 2013
1 parent 16ea729 commit 83c80a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
blocks: 10
ticks: 1
protect: true
worlds:
- world
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Sedimentology
main: org.foo_projects.sofar.Sedimentology.Sedimentology
version: 5
version: 6
softdepend: [Factions, Towny]
commands:
sedimentology:
Expand Down
36 changes: 8 additions & 28 deletions src/org/foo_projects/sofar/Sedimentology/Sedimentology.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public final class Sedimentology extends JavaPlugin {
private int stat_lastz;

private long conf_blocks = 10;
private long conf_ticks = 1;
private boolean conf_protect = true;
private boolean conf_compensate = true;

Expand Down Expand Up @@ -879,7 +880,6 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
"/sedimentology stats - display statistics\n" +
"/sedimentology list - display enabled worlds\n" +
"/sedimentology blocks <int> - sed number of block attempts per cycle\n" +
"/sedimentology protect <bool> - use Factions or Towny protection\n" +
"/sedimentology enable <world> - enable for world\n" +
"/sedimentology disable <world> - enable for world";

Expand All @@ -893,29 +893,6 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}
msg = "number of blocks set to " + conf_blocks;
break;
case "protect":
if (split.length == 2) {
switch (split[1].toLowerCase()) {
case "true":
case "on":
case "yes":
case "1":
conf_protect = true;
break;
case "false":
case "off":
case "no":
case "0":
conf_protect = false;
break;
default:
break;
}
getConfig().set("protect", conf_protect);
saveConfig();
}
msg = "protection is set to " + (conf_protect ? "true" : "false");
break;
case "list":
msg = "plugin enabled for worlds:\n";
for (SedWorld s: sedWorldList) {
Expand Down Expand Up @@ -945,11 +922,11 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
case "stats":
World world = org.bukkit.Bukkit.getWorld("world");
Chunk ChunkList[] = world.getLoadedChunks();
msg = String.format("blocks: %d protect: %s\n" +
msg = String.format("blocks: %d ticks: %d protect: %s\n" +
"considered %d, displaced %d, degraded %d blocks in %d chunks %d errors\nlast one at %d %d %d\n" +
"ignored: edge %d, type %d, storm %d, vegetation %d, resistance %d, water %d, wave %d, sand %d, hardness %d," +
"protected %d, locked in %d, rate %d",
conf_blocks, conf_protect ? "true" : "false",
conf_blocks, conf_ticks, conf_protect ? "true" : "false",
stat_considered, stat_displaced, stat_degraded, ChunkList.length, stat_errors,
stat_lastx, stat_lasty, stat_lastz,
stat_ignored_edge, stat_ignored_type, stat_ignored_storm, stat_ignored_vegetation,
Expand Down Expand Up @@ -1071,7 +1048,8 @@ public void onEnable() {
saveDefaultConfig();

conf_blocks = getConfig().getInt("blocks");
conf_protect = getConfig().getBoolean("protect");
conf_ticks = getConfig().getInt("ticks");
getLogger().info("blocks: " + conf_blocks + ", ticks: " + conf_ticks);

List<String> worldStringList = getConfig().getStringList("worlds");

Expand All @@ -1091,14 +1069,16 @@ public void onEnable() {
}
}
getLogger().info("Towny support is " + (have_towny ? "enabled" : "disabled"));
conf_protect = getConfig().getBoolean("protect");
getLogger().info("protection is " + (conf_protect ? "on" : "off"));

/* even handler takes care of updating it from there */
getServer().getPluginManager().registerEvents(new SedimentologyListener(), this);

getCommand("sedimentology").setExecutor(new SedimentologyCommand());

BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(this, new SedimentologyRunnable(), 1L, 1L);
scheduler.scheduleSyncRepeatingTask(this, new SedimentologyRunnable(), 1L, conf_ticks);
}
}

0 comments on commit 83c80a9

Please sign in to comment.