use of redempt.redlib.commandmanager.CommandHook in project PrivateMinesOOP by UntouchedOdin0.
the class PrivateMinesCommand method expand.
// Add 1 to whatever args you put so if you want to expand by one do /pmine expand 2
@CommandHook("expand")
public void expand(CommandSender commandSender, Player target, int amount) {
Player player = (Player) commandSender;
String targetDoesNotOwnMine = Messages.msg("targetDoesNotOwnMine");
if (!mineStorage.hasMine(target.getUniqueId())) {
utils.sendMessage(commandSender, targetDoesNotOwnMine);
return;
}
Mine mine = mineStorage.getMine(target.getUniqueId());
mine.expand(amount);
mineStorage.replaceMine(player.getUniqueId(), mine);
}
use of redempt.redlib.commandmanager.CommandHook in project PrivateMinesOOP by UntouchedOdin0.
the class PrivateMinesCommand method unban.
@CommandHook("unban")
public void unban(Player player, Player target) {
Mine mine;
MineData mineData;
UUID uuid = player.getUniqueId();
UUID targetUUID = target.getUniqueId();
String doNotOwnMine = Messages.msg("doNotOwnMine");
String youHaveBeenUnbanned = Messages.msg("youHaveBeenUnbanned");
String youHaveUnbannedPlayer = Messages.msg("youHaveUnbanned");
String replacedYouHaveBeenUnbanned = youHaveBeenUnbanned.replace("%name%", player.getName());
String replacedYouHaveUnbannedPlayer = youHaveUnbannedPlayer.replace("%name%", target.getName());
if (!privateMines.getMineStorage().hasMine(uuid)) {
player.sendMessage(doNotOwnMine);
}
mine = privateMines.getMineStorage().getMine(uuid);
mineData = mine.getMineData();
mineData.addBannedPlayer(targetUUID);
mine.setMineData(mineData);
privateMines.getMineStorage().replaceMine(uuid, mine);
player.sendMessage(replacedYouHaveBeenUnbanned);
target.sendMessage(replacedYouHaveUnbannedPlayer);
}
use of redempt.redlib.commandmanager.CommandHook in project PrivateMinesOOP by UntouchedOdin0.
the class PrivateMinesCommand method upgrade.
@CommandHook("upgrade")
public void upgrade(CommandSender commandSender, Player target) {
String targetDoesNotOwnMine = Messages.msg("targetDoesNotOwnMine");
if (!mineStorage.hasMine(target.getUniqueId())) {
utils.sendMessage(commandSender, targetDoesNotOwnMine);
return;
}
Mine mine = mineStorage.getMine(target.getUniqueId());
try {
mine.upgrade();
} catch (MineAlreadyMaxedException e) {
e.printStackTrace();
}
}
use of redempt.redlib.commandmanager.CommandHook in project PrivateMinesOOP by UntouchedOdin0.
the class PrivateMinesCommand method close.
@CommandHook("close")
public void close(Player player) {
Mine mine;
MineData mineData;
UUID uuid = player.getUniqueId();
String doNotOwnMine = Messages.msg("doNotOwnMine");
String mineAlreadyClosed = Messages.msg("mineAlreadyClosed");
String mineClosed = Messages.msg("mineClosed");
if (!mineStorage.hasMine(uuid)) {
utils.sendMessage(player, doNotOwnMine);
return;
}
mine = mineStorage.getMine(player.getUniqueId());
mineData = mine.getMineData();
boolean isOpen = mineData.isOpen();
if (!isOpen) {
player.sendMessage(mineAlreadyClosed);
} else {
mineData.setOpen(false);
mine.setMineData(mineData);
privateMines.getMineStorage().replaceMine(uuid, mine);
player.sendMessage(mineClosed);
}
}
use of redempt.redlib.commandmanager.CommandHook in project PrivateMinesOOP by UntouchedOdin0.
the class PrivateMinesCommand method setType.
@CommandHook("settype")
public void setType(CommandSender commandSender, Player target, String type) {
String invalidMineType = Messages.msg("invalidMineType");
if (!mineStorage.hasMine(target.getUniqueId())) {
utils.sendMessage(commandSender, Utils.sendColorMessage(invalidMineType));
return;
}
UUID uuid = target.getUniqueId();
Mine mine = mineStorage.getMine(target.getUniqueId());
MineData mineData = mine.getMineData();
MineType newType = privateMines.getMineTypeManager().getMineType(type);
if (newType == null) {
commandSender.sendMessage(Utils.colorStatic(invalidMineType));
return;
}
mine.cancelResetTask();
mineData.setMineType(type);
mine.setMineType(newType);
mine.setMineData(mineData);
utils.saveMineData(uuid, mineData);
mine.reset();
mine.startResetTask();
mineStorage.replaceMine(target.getUniqueId(), mine);
mine.teleport(target);
}
Aggregations