Files
Jail/src/main/java/com/graywolf336/jail/command/subcommands/JailStopCommand.java
graywolf336 12f35a01bf Don't resave cells on stopping creation, fixes #74
We was saving everything again when the players stop creating anything,
this was causing issues with duplicate cells when using any storage with
SQL (due to insert and no primary key).

Also, added a hasChanged to the cell class which will prevent resaving
things in sql if it hasn't changed.
2015-05-26 14:57:38 -05:00

40 lines
1.2 KiB
Java

package com.graywolf336.jail.command.subcommands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.graywolf336.jail.JailManager;
import com.graywolf336.jail.command.Command;
import com.graywolf336.jail.command.CommandInfo;
@CommandInfo(
maxArgs = 0,
minimumArgs = 0,
needsPlayer = true,
pattern = "stop",
permission = "jail.command.jailstop",
usage = "/jail stop"
)
public class JailStopCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) {
boolean nothing = true;
if(jm.isCreatingACell(sender.getName())) {
jm.removeCellCreationPlayer(sender.getName());
sender.sendMessage(ChatColor.RED + "You have stopped creating cells.");
nothing = false;
}
if(jm.isCreatingAJail(sender.getName())) {
jm.removeJailCreationPlayer(sender.getName());
sender.sendMessage(ChatColor.RED + "You have stopped creating a jail.");
nothing = false;
}
if(nothing) {
sender.sendMessage(ChatColor.RED + "You've stopped creating....nothing.");
}
return true;
}
}