-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
278 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ forge*changelog.txt | |
|
||
# Libs directory | ||
/libs | ||
mcmodsrepo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/co/runed/multicharacter/commands/CommandAddRole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package co.runed.multicharacter.commands; | ||
|
||
import co.runed.multicharacter.MultiCharacterMod; | ||
import net.minecraft.command.CommandBase; | ||
import net.minecraft.command.CommandException; | ||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.util.text.TextComponentString; | ||
|
||
public class CommandAddRole extends CommandBase | ||
{ | ||
@Override | ||
public void execute(MinecraftServer server, ICommandSender sender, String[] params) throws CommandException | ||
{ | ||
try { | ||
String playerName = params[0]; | ||
String role = params[1]; | ||
|
||
EntityPlayer player = server.getPlayerList().getPlayerByUsername(playerName); | ||
|
||
MultiCharacterMod.getCharacterManager().getActiveCharacter(player).addRole(role); | ||
|
||
sender.sendMessage(new TextComponentString("Role '" + role + "' has been added to " + playerName)); | ||
} | ||
catch (Exception e) { | ||
sender.sendMessage(new TextComponentString("Error running command.")); | ||
} | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "addrole"; | ||
} | ||
|
||
@Override | ||
public String getUsage(ICommandSender sender) { | ||
return "command.addrole.usage"; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/co/runed/multicharacter/commands/CommandRemoveRole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package co.runed.multicharacter.commands; | ||
|
||
import co.runed.multicharacter.MultiCharacterMod; | ||
import co.runed.multicharacter.character.Character; | ||
import net.minecraft.command.CommandBase; | ||
import net.minecraft.command.CommandException; | ||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.util.text.TextComponentString; | ||
|
||
// /removerole <player> <index/role> | ||
public class CommandRemoveRole extends CommandBase | ||
{ | ||
@Override | ||
public void execute(MinecraftServer server, ICommandSender sender, String[] params) throws CommandException | ||
{ | ||
try { | ||
String playerName = params[0]; | ||
String role = params[1]; | ||
|
||
EntityPlayer player = server.getPlayerList().getPlayerByUsername(playerName); | ||
Character character = MultiCharacterMod.getCharacterManager().getActiveCharacter(player); | ||
|
||
boolean success; | ||
if(role.matches("-?\\d+")) { | ||
success = character.removeRole(parseInt(role) - 1); | ||
} else { | ||
success = character.removeRole(role); | ||
} | ||
|
||
if(success) { | ||
sender.sendMessage(new TextComponentString(playerName + "'s role has been removed")); | ||
return; | ||
} | ||
|
||
sender.sendMessage(new TextComponentString("Invalid role.")); | ||
} | ||
catch (Exception e) { | ||
sender.sendMessage(new TextComponentString("Error running command.")); | ||
} | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "removerole"; | ||
} | ||
|
||
@Override | ||
public String getUsage(ICommandSender sender) { | ||
return "command.removerole.usage"; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/co/runed/multicharacter/commands/CommandSetRole.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package co.runed.multicharacter.commands; | ||
|
||
import co.runed.multicharacter.MultiCharacterMod; | ||
import net.minecraft.command.CommandBase; | ||
import net.minecraft.command.CommandException; | ||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.server.MinecraftServer; | ||
import net.minecraft.util.text.TextComponentString; | ||
|
||
public class CommandSetRole extends CommandBase | ||
{ | ||
@Override | ||
public void execute(MinecraftServer server, ICommandSender sender, String[] params) throws CommandException | ||
{ | ||
try { | ||
String playerName = params[0]; | ||
int index = parseInt(params[1]); | ||
String role = params[2]; | ||
|
||
EntityPlayer player = server.getPlayerList().getPlayerByUsername(playerName); | ||
|
||
MultiCharacterMod.getCharacterManager().getActiveCharacter(player).setRole(index - 1, role); | ||
|
||
sender.sendMessage(new TextComponentString(playerName + "'s role has been set to '" + role + "'")); | ||
} | ||
catch (Exception e) { | ||
sender.sendMessage(new TextComponentString("Error running command.")); | ||
} | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "setrole"; | ||
} | ||
|
||
@Override | ||
public String getUsage(ICommandSender sender) { | ||
return "command.setrole.usage"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters