Skip to content

Commit

Permalink
Add command meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Jan 25, 2014
1 parent 10a7103 commit 0e803c8
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 37 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -141,7 +141,7 @@
<dependency>
<groupId>me.limebyte</groupId>
<artifactId>BattleNight</artifactId>
<version>1.5.1</version>
<version>1.10.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/BattleNight.jar</systemPath>
</dependency>
Expand Down
Expand Up @@ -10,7 +10,42 @@
import net.aufdemrand.denizen.utilities.debugging.dB;

public class BattleNightCommands extends AbstractCommand {
//TODO: CLASS ?

// <--[command]
// @Name BN
// @Syntax bn [add/kick/start/end]
// @Plugin BattleNight
// @Required 1
// @Stable stable
// @Short Adds/kicks player, starts/ends battle.
// @Author GnomeffinWay

// @Description
// With this command, you can add or kick players to/from the current battle. By default,
// this uses the player currently attached to the running Denizen queue. However, you can
// change the player by using Denizen's command-wide "player:" prefix. You can also use
// this command to start or end a battle.

// @Tags None

// @Usage
// Use to add the current player to a battle.
// - bn add

// @Usage
// Use to kick unattached player from a battle.
// - bn kick player:BlackCoyote

// @Usage
// Use to start a battle.
// - bn start

// @Usage
// Use to end a battle.
// - bn end

// -->

private enum Action {
ADD, KICK, START, END
}
Expand All @@ -26,7 +61,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {

if (!scriptEntry.hasObject("action")
&& arg.matches("ADD, KICK, START, END")) {
&& arg.matchesEnum(Action.values())) {
scriptEntry.addObject("action", Action.valueOf(arg.getValue()));
}

Expand Down
Expand Up @@ -29,10 +29,17 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
// @Stable untested
// @Short Modifies the specified job of a player.
// @Author Morphan1
//
// @Description Todo
// @Tags Todo
// @Usage Todo

// @Description
// This allows you to promote or demote a player's job level. This also allows you
// to force a player to join or quit a job.

// @Tags
// TODO

// @Usage
// TODO

// -->

// Iterate through arguments
Expand Down
Expand Up @@ -2,7 +2,15 @@

import com.gmail.nossr50.api.ExperienceAPI;
import com.gmail.nossr50.api.PartyAPI;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.database.DatabaseManagerFactory;
import com.gmail.nossr50.database.FlatfileDatabaseManager;
import com.gmail.nossr50.datatypes.database.DatabaseUpdateType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Misc;
import net.aufdemrand.denizen.exceptions.CommandExecutionException;
import net.aufdemrand.denizen.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizen.objects.Element;
Expand All @@ -13,6 +21,38 @@
import org.bukkit.entity.Player;

public class McMMOCommands extends AbstractCommand {

// <--[command]
// @Name mcMMO
// @Syntax mcmmo [add/remove/set] [levels/xp/xprate/vampirism/hardcore/leader] (skill:<skill>) (state:{toggle}/true/false) (qty:<#>) (party:<party>)
// @Plugin mcMMO
// @Required 1
// @Stable untested
// @Short Edits mcMMO information.
// @Author GnomeffinWay

// @Description
// This command allows you to add or remove skill levels and experience for players, add or remove
// players to/from parties, set the level, xp, xprate, vampirism state, hardcore state of a player's
// skill, or set the leader of a party.

// @Tags
// <player.mcmmo. * >

// @Usage
// Use to add 5 levels to a player's skill.
// - mcmmo add levels skill:acrobatics qty:5

// @Usage
// Use to remove a player from a party.
// - mcmmo remove player:SerpentX party:SerpentPeople

// @Usage
// Use to set vampirism mode for a player's skill.
// - mcmmo set vampirism skill:woodcutting state:true

// -->

private enum Action {ADD, REMOVE, SET}

private enum State {TRUE, FALSE, TOGGLE}
Expand Down Expand Up @@ -104,12 +144,12 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
} else if (PartyManager.isParty(party)) {
PartyAPI.addToParty(player, party);
}
return;
break;

}
case REMOVE: {

if (qty >= 0 && skill != null) {
if (qty >= 0 && !skill.equals("")) {
if (type == Type.LEVELS) {
if (player.isOnline())
ExperienceAPI.setLevel(player, skill, ExperienceAPI.getLevel(player, skill) - (int) qty);
Expand All @@ -121,29 +161,18 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
else
ExperienceAPI.removeXPOffline(player.getName(), skill, (int) qty);
}
} else if (PartyManager.isParty(party)) {
}
else if (PartyManager.isParty(party)) {
if (PartyAPI.getPartyLeader(party).equals(player.getName()))
PartyManager.disbandParty(PartyManager.getParty(party));

else
PartyAPI.removeFromParty(player);
}

// Don't know what changed here, will figure it out soon

/*
else if (player != null) {
if (Config.getInstance().getUseMySQL()) {
String tablePrefix = Config.getInstance().getMySQLTablePrefix();
if (DatabaseUpdateType.update("DELETE FROM " + tablePrefix + "users WHERE " + tablePrefix + "users.user = '" + player.getName() + "'") != 0)
Misc.profileCleanup(player.getName());
}
else if (LeaderboardManager.removeFlatFileUser(player.getName()))
Misc.profileCleanup(player.getName());
DatabaseManagerFactory.getDatabaseManager().removeUser(player.getName());
}
return;
*/
break;

}
case SET: {
Expand All @@ -162,33 +191,34 @@ else if (LeaderboardManager.removeFlatFileUser(player.getName()))
}
} else if (type == Type.LEADER && !party.equals(""))
PartyAPI.setPartyLeader(party, player.getName());
/*
else if(type == Type.XPRATE)
Config.getInstance().setExperienceGainsGlobalMultiplier(qty);
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(qty);
else if(type == Type.HARDCORE) {
boolean isEnabled = Config.getInstance().getHardcoreEnabled();
SkillType skillType = SkillType.getSkill(skill);
boolean isEnabled = Config.getInstance().getHardcoreStatLossEnabled(skillType);

if(state == State.TOGGLE)
Config.getInstance().setHardcoreEnabled(!isEnabled);
Config.getInstance().setHardcoreStatLossEnabled(skillType, !isEnabled);
else if(state == State.TRUE)
Config.getInstance().setHardcoreEnabled(true);
Config.getInstance().setHardcoreStatLossEnabled(skillType, true);
else if(state == State.FALSE)
Config.getInstance().setHardcoreEnabled(false);
Config.getInstance().setHardcoreStatLossEnabled(skillType, false);

}
else if(type == Type.VAMPIRISM) {
boolean isEnabled = Config.getInstance().getHardcoreVampirismEnabled();
SkillType skillType = SkillType.getSkill(skill);
boolean isEnabled = Config.getInstance().getHardcoreVampirismEnabled(skillType);

if(state == State.TOGGLE)
Config.getInstance().setHardcoreVampirismEnabled(!isEnabled);
Config.getInstance().setHardcoreVampirismEnabled(skillType, !isEnabled);
else if(state == State.TRUE)
Config.getInstance().setHardcoreVampirismEnabled(true);
Config.getInstance().setHardcoreVampirismEnabled(skillType, true);
else if(state == State.FALSE)
Config.getInstance().setHardcoreVampirismEnabled(false);
Config.getInstance().setHardcoreVampirismEnabled(skillType, false);

}
*/
return;
break;

}
}
}
Expand Down
Expand Up @@ -11,7 +11,9 @@
import net.gnomeffinway.depenizen.objects.dTown;

public class TownyCommands extends AbstractCommand {
//TODO: CLASS ?

// TODO: make this work

private enum Action {
ADD, REMOVE, SET
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/gnomeffinway/depenizen/objects/dNation.java
Expand Up @@ -112,6 +112,7 @@ public String getAttribute(Attribute attribute) {
}

// <--[tag]
// @attribute <nation@nation.capital>
// @returns dTown
// @description
// Returns the capital city of the nation as a dTown.
Expand Down Expand Up @@ -156,6 +157,7 @@ else if (attribute.startsWith("name"))
.getAttribute(attribute.fulfill(1));

// <--[tag]
// @attribute <nation@nation.player_count>
// @returns Element(Number)
// @description
// Returns the amount of players in the nation.
Expand Down
Expand Up @@ -113,6 +113,7 @@ else if (attribute.startsWith("isempty") || attribute.startsWith("is_ready")) {
if (attribute.startsWith("playercount") || attribute.startsWith("player_count")) {
event.setReplaced(new Element(player.getArenaTeam().getTeamMembers().size())
.getAttribute(attribute.fulfill(1)));
return;
}

// <--[tag]
Expand Down
Binary file modified src/main/resources/BattleNight.jar
Binary file not shown.

0 comments on commit 0e803c8

Please sign in to comment.