fixed problem with certain commands not saving changes to disk

This commit is contained in:
Tobias Ottenweller 2012-04-03 20:57:24 +02:00
parent 3e80f67770
commit af24d7365a
9 changed files with 27 additions and 1 deletions

View File

@ -274,6 +274,7 @@ public class Gate
try try
{ {
DiscUtil.write(file, Plugin.gson.toJson(instances)); DiscUtil.write(file, Plugin.gson.toJson(instances));
Plugin.log("Saved gates to disk");
} }
catch (IOException e) catch (IOException e)
{ {
@ -288,6 +289,7 @@ public class Gate
return false; return false;
} }
return true; return true;
} }

View File

@ -1,5 +1,7 @@
package org.mcteam.ancientgates.commands; package org.mcteam.ancientgates.commands;
import org.mcteam.ancientgates.Gate;
public class CommandClose extends BaseCommand { public class CommandClose extends BaseCommand {
public CommandClose() { public CommandClose() {
@ -12,7 +14,10 @@ public class CommandClose extends BaseCommand {
public void perform() { public void perform() {
gate.close(); gate.close();
sendMessage("The gate was closed."); sendMessage("The gate was closed.");
Gate.save();
} }
} }

View File

@ -36,7 +36,6 @@ public class CommandCreateSetFrom extends BaseCommand
} }
Gate.create(id); Gate.create(id);
Gate.save();
sendMessage("Gate with id \"" + id + "\" was created."); sendMessage("Gate with id \"" + id + "\" was created.");
gate = Gate.get(id); gate = Gate.get(id);
@ -76,5 +75,7 @@ public class CommandCreateSetFrom extends BaseCommand
sendMessage("From location for gate \""+gate.getId()+"\" is now where you stand."); sendMessage("From location for gate \""+gate.getId()+"\" is now where you stand.");
sendMessage("Your gate includes " + gateBlocks.size() + " Blocks."); sendMessage("Your gate includes " + gateBlocks.size() + " Blocks.");
Gate.save();
} }
} }

View File

@ -1,5 +1,7 @@
package org.mcteam.ancientgates.commands; package org.mcteam.ancientgates.commands;
import org.mcteam.ancientgates.Gate;
public class CommandHide extends BaseCommand public class CommandHide extends BaseCommand
{ {
@ -16,5 +18,7 @@ public class CommandHide extends BaseCommand
{ {
gate.setHidden(true); gate.setHidden(true);
sendMessage("The gate " + gate.getId() + " is now hidden."); sendMessage("The gate " + gate.getId() + " is now hidden.");
Gate.save();
} }
} }

View File

@ -1,6 +1,7 @@
package org.mcteam.ancientgates.commands; package org.mcteam.ancientgates.commands;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.mcteam.ancientgates.Gate;
public class CommandInfo extends BaseCommand public class CommandInfo extends BaseCommand
@ -44,5 +45,7 @@ public class CommandInfo extends BaseCommand
else else
sendMessage(ChatColor.GREEN + "this gate has no 'to' location"); sendMessage(ChatColor.GREEN + "this gate has no 'to' location");
Gate.save();
} }
} }

View File

@ -210,6 +210,8 @@ public class CommandList extends BaseCommand
else else
sendMessage(messages); sendMessage(messages);
} }
Gate.save();
} }
} }

View File

@ -1,6 +1,7 @@
package org.mcteam.ancientgates.commands; package org.mcteam.ancientgates.commands;
import org.bukkit.Material; import org.bukkit.Material;
import org.mcteam.ancientgates.Gate;
public class CommandOpen extends BaseCommand { public class CommandOpen extends BaseCommand {
@ -35,6 +36,8 @@ public class CommandOpen extends BaseCommand {
sendMessage("Failed to open the gate. Have you built a frame?"); sendMessage("Failed to open the gate. Have you built a frame?");
sendMessage("More info here: " + new CommandHelp().getUsageTemplate(true, true)); sendMessage("More info here: " + new CommandHelp().getUsageTemplate(true, true));
} }
Gate.save();
} }
} }

View File

@ -36,5 +36,7 @@ public class CommandRename extends BaseCommand
Gate.rename(gate, newId); Gate.rename(gate, newId);
sendMessage("Gate " + oldId + " is now known as " + newId + "."); sendMessage("Gate " + oldId + " is now known as " + newId + ".");
Gate.save();
} }
} }

View File

@ -1,5 +1,7 @@
package org.mcteam.ancientgates.commands; package org.mcteam.ancientgates.commands;
import org.mcteam.ancientgates.Gate;
public class CommandUnhide extends BaseCommand public class CommandUnhide extends BaseCommand
{ {
@ -18,5 +20,7 @@ public class CommandUnhide extends BaseCommand
sendMessage("The gate " + gate.getId() + " is no longer hidden."); sendMessage("The gate " + gate.getId() + " is no longer hidden.");
else else
sendMessage("Failed to unhide the gate. Does the portal have a frame?"); sendMessage("Failed to unhide the gate. Does the portal have a frame?");
Gate.save();
} }
} }