Skip to content

Commit

Permalink
add server save and save_citizens mechanisms
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 14, 2019
1 parent d8a14ed commit ce6a50e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Expand Up @@ -53,8 +53,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
String lower = path.eventLower;
String item_test = CoreUtilities.getXthArg(0, lower);
String item_test = CoreUtilities.getXthArg(0, path.eventLower);

if (!tryItem(item, item_test)) {
return false;
Expand Down
Expand Up @@ -37,6 +37,7 @@
import net.aufdemrand.denizencore.utilities.javaluator.DoubleEvaluator;
import net.citizensnpcs.Citizens;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.command.CommandContext;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.*;
import org.bukkit.block.Biome;
Expand Down Expand Up @@ -1621,6 +1622,32 @@ public static void adjustServer(Mechanism mechanism) {
Bukkit.spigot().restart();
}

// <--[mechanism]
// @object server
// @name save
// @input None
// @description
// Immediately saves the Denizen saves files.
// @tags
// None
// -->
if (mechanism.matches("save")) {
DenizenAPI.getCurrentInstance().saveSaves();
}

// <--[mechanism]
// @object server
// @name save_citizens
// @input None
// @description
// Immediately saves the Citizens saves files.
// @tags
// None
// -->
if (Depends.citizens != null && mechanism.matches("save_citizens")) {
Depends.citizens.storeNPCs(new CommandContext(new String[0]));
}

// <--[mechanism]
// @object server
// @name shutdown
Expand Down

0 comments on commit ce6a50e

Please sign in to comment.