Update SetPropCommand strings, send cmd usage on target fail

This commit is contained in:
AnimeGitB 2022-08-25 15:15:17 +09:30
parent 40eeba9d90
commit f5c8959688
3 changed files with 19 additions and 14 deletions

View File

@ -253,16 +253,19 @@ public final class CommandMap {
Command.TargetRequirement targetRequirement = annotation.targetRequirement(); Command.TargetRequirement targetRequirement = annotation.targetRequirement();
if (targetRequirement != Command.TargetRequirement.NONE) { if (targetRequirement != Command.TargetRequirement.NONE) {
if (targetPlayer == null) { if (targetPlayer == null) {
CommandHandler.sendTranslatedMessage(null, "commands.execution.need_target"); handler.sendUsageMessage(player);
CommandHandler.sendTranslatedMessage(player, "commands.execution.need_target");
return; return;
} }
if ((targetRequirement == Command.TargetRequirement.ONLINE) && !targetPlayer.isOnline()) { if ((targetRequirement == Command.TargetRequirement.ONLINE) && !targetPlayer.isOnline()) {
handler.sendUsageMessage(player);
CommandHandler.sendTranslatedMessage(player, "commands.execution.need_target_online"); CommandHandler.sendTranslatedMessage(player, "commands.execution.need_target_online");
return; return;
} }
if ((targetRequirement == Command.TargetRequirement.OFFLINE) && targetPlayer.isOnline()) { if ((targetRequirement == Command.TargetRequirement.OFFLINE) && targetPlayer.isOnline()) {
handler.sendUsageMessage(player);
CommandHandler.sendTranslatedMessage(player, "commands.execution.need_target_offline"); CommandHandler.sendTranslatedMessage(player, "commands.execution.need_target_offline");
return; return;
} }

View File

@ -22,11 +22,11 @@ public final class SetPropCommand implements CommandHandler {
TOWER_LEVEL, TOWER_LEVEL,
BP_LEVEL, BP_LEVEL,
GOD_MODE, GOD_MODE,
NO_STAMINA, UNLIMITED_STAMINA,
UNLIMITED_ENERGY, UNLIMITED_ENERGY,
SET_OPENSTATE, SET_OPENSTATE,
UNSET_OPENSTATE, UNSET_OPENSTATE,
UNLOCKMAP UNLOCK_MAP
} }
static class Prop { static class Prop {
@ -85,28 +85,30 @@ public final class SetPropCommand implements CommandHandler {
this.props.put("bp", bplevel); this.props.put("bp", bplevel);
this.props.put("battlepass", bplevel); this.props.put("battlepass", bplevel);
Prop godmode = new Prop("godmode", PseudoProp.GOD_MODE); Prop godmode = new Prop("GodMode", PseudoProp.GOD_MODE);
this.props.put("godmode", godmode); this.props.put("godmode", godmode);
this.props.put("god", godmode); this.props.put("god", godmode);
Prop nostamina = new Prop("nostamina", PseudoProp.NO_STAMINA); Prop nostamina = new Prop("UnlimitedStamina", PseudoProp.UNLIMITED_STAMINA);
this.props.put("unlimitedstamina", nostamina);
this.props.put("us", nostamina);
this.props.put("nostamina", nostamina); this.props.put("nostamina", nostamina);
this.props.put("nostam", nostamina); this.props.put("nostam", nostamina);
this.props.put("ns", nostamina); this.props.put("ns", nostamina);
Prop unlimitedenergy = new Prop("unlimitedenergy", PseudoProp.UNLIMITED_ENERGY); Prop unlimitedenergy = new Prop("UnlimitedEnergy", PseudoProp.UNLIMITED_ENERGY);
this.props.put("unlimitedenergy", unlimitedenergy); this.props.put("unlimitedenergy", unlimitedenergy);
this.props.put("ue", unlimitedenergy); this.props.put("ue", unlimitedenergy);
Prop setopenstate = new Prop("setopenstate", PseudoProp.SET_OPENSTATE); Prop setopenstate = new Prop("SetOpenstate", PseudoProp.SET_OPENSTATE);
this.props.put("setopenstate", setopenstate); this.props.put("setopenstate", setopenstate);
this.props.put("so", setopenstate); this.props.put("so", setopenstate);
Prop unsetopenstate = new Prop("unsetopenstate", PseudoProp.UNSET_OPENSTATE); Prop unsetopenstate = new Prop("UnsetOpenstate", PseudoProp.UNSET_OPENSTATE);
this.props.put("unsetopenstate", unsetopenstate); this.props.put("unsetopenstate", unsetopenstate);
this.props.put("uo", unsetopenstate); this.props.put("uo", unsetopenstate);
Prop unlockmap = new Prop("unlockmap", PseudoProp.UNLOCKMAP); Prop unlockmap = new Prop("UnlockMap", PseudoProp.UNLOCK_MAP);
this.props.put("unlockmap", unlockmap); this.props.put("unlockmap", unlockmap);
this.props.put("um", unlockmap); this.props.put("um", unlockmap);
} }
@ -144,10 +146,10 @@ public final class SetPropCommand implements CommandHandler {
case WORLD_LEVEL -> targetPlayer.setWorldLevel(value); case WORLD_LEVEL -> targetPlayer.setWorldLevel(value);
case BP_LEVEL -> targetPlayer.getBattlePassManager().setLevel(value); case BP_LEVEL -> targetPlayer.getBattlePassManager().setLevel(value);
case TOWER_LEVEL -> this.setTowerLevel(sender, targetPlayer, value); case TOWER_LEVEL -> this.setTowerLevel(sender, targetPlayer, value);
case GOD_MODE, NO_STAMINA, UNLIMITED_ENERGY -> this.setBool(sender, targetPlayer, prop.pseudoProp, value); case GOD_MODE, UNLIMITED_STAMINA, UNLIMITED_ENERGY -> this.setBool(sender, targetPlayer, prop.pseudoProp, value);
case SET_OPENSTATE -> this.setOpenState(targetPlayer, value, 1); case SET_OPENSTATE -> this.setOpenState(targetPlayer, value, 1);
case UNSET_OPENSTATE -> this.setOpenState(targetPlayer, value, 0); case UNSET_OPENSTATE -> this.setOpenState(targetPlayer, value, 0);
case UNLOCKMAP -> unlockMap(targetPlayer); case UNLOCK_MAP -> unlockMap(targetPlayer);
default -> targetPlayer.setProperty(prop.prop, value); default -> targetPlayer.setProperty(prop.prop, value);
}; };
@ -197,7 +199,7 @@ public final class SetPropCommand implements CommandHandler {
private boolean setBool(Player sender, Player targetPlayer, PseudoProp pseudoProp, int value) { private boolean setBool(Player sender, Player targetPlayer, PseudoProp pseudoProp, int value) {
boolean enabled = switch (pseudoProp) { boolean enabled = switch (pseudoProp) {
case GOD_MODE -> targetPlayer.inGodmode(); case GOD_MODE -> targetPlayer.inGodmode();
case NO_STAMINA -> targetPlayer.getUnlimitedStamina(); case UNLIMITED_STAMINA -> targetPlayer.getUnlimitedStamina();
case UNLIMITED_ENERGY -> !targetPlayer.getEnergyManager().getEnergyUsage(); case UNLIMITED_ENERGY -> !targetPlayer.getEnergyManager().getEnergyUsage();
default -> false; default -> false;
}; };
@ -211,7 +213,7 @@ public final class SetPropCommand implements CommandHandler {
case GOD_MODE: case GOD_MODE:
targetPlayer.setGodmode(enabled); targetPlayer.setGodmode(enabled);
break; break;
case NO_STAMINA: case UNLIMITED_STAMINA:
targetPlayer.setUnlimitedStamina(enabled); targetPlayer.setUnlimitedStamina(enabled);
break; break;
case UNLIMITED_ENERGY: case UNLIMITED_ENERGY:

View File

@ -271,7 +271,7 @@
"description": "Sets your fetter level for your current active character" "description": "Sets your fetter level for your current active character"
}, },
"setProp": { "setProp": {
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress.\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyss | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume" "description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress.\n\tValues for <prop> (case-insensitive): GodMode | UnlimitedStamina | UnlimitedEnergy | TowerLevel | WorldLevel | BPLevel | SetOpenState | UnsetOpenState | UnlockMap\n\t(cont.) see PlayerProperty enum for other possible values, of the form PROP_MAX_SPRING_VOLUME -> max_spring_volume"
}, },
"setStats": { "setStats": {
"description": "Sets fight property for your current active character\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys", "description": "Sets fight property for your current active character\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys",