Finish changing modid to 'ebwizardry'
- Fix up translations, resource IDs, paths etc. - Where possible, the modid part in most strings now just reuses Wizardry.MODID
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package electroblob.wizardry.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.event.SpellCastEvent;
|
||||
@@ -10,12 +8,7 @@ import electroblob.wizardry.packet.PacketCastSpell;
|
||||
import electroblob.wizardry.packet.WizardryPacketHandler;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import electroblob.wizardry.util.SpellModifiers;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.NumberInvalidException;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
@@ -29,6 +22,8 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandCastSpell extends CommandBase {
|
||||
|
||||
@Override
|
||||
@@ -46,8 +41,8 @@ public class CommandCastSpell extends CommandBase {
|
||||
public String getUsage(ICommandSender sender){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:cast.usage";
|
||||
// return I18n.format("commands.wizardry:cast.usage", Wizardry.settings.castCommandName);
|
||||
return "commands." + Wizardry.MODID + ":cast.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":cast.usage", Wizardry.settings.castCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +61,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException{
|
||||
|
||||
if(arguments.length < 1){
|
||||
throw new WrongUsageException("commands.wizardry:cast.usage", Wizardry.settings.castCommandName);
|
||||
throw new WrongUsageException("commands." + Wizardry.MODID + ":cast.usage", Wizardry.settings.castCommandName);
|
||||
}else{
|
||||
|
||||
// ===== Parameter retrieval =====
|
||||
@@ -85,7 +80,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
Spell spell = Spell.get(arguments[i++]);
|
||||
|
||||
if(spell == null){
|
||||
throw new NumberInvalidException("commands.wizardry:cast.not_found", new Object[]{arguments[i - 1]});
|
||||
throw new NumberInvalidException("commands." + Wizardry.MODID + ":cast.not_found", new Object[]{arguments[i - 1]});
|
||||
}
|
||||
|
||||
boolean castAsOtherPlayer = false;
|
||||
@@ -120,7 +115,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
try{
|
||||
modifiers = SpellModifiers.fromNBT(JsonToNBT.getTagFromJson(nbt));
|
||||
}catch (NBTException nbtexception){
|
||||
throw new CommandException("commands.wizardry:cast.tag_error", nbtexception.getMessage());
|
||||
throw new CommandException("commands." + Wizardry.MODID + ":cast.tag_error", nbtexception.getMessage());
|
||||
}
|
||||
|
||||
for(float multiplier : modifiers.getModifiers().values()){
|
||||
@@ -157,10 +152,10 @@ public class CommandCastSpell extends CommandBase {
|
||||
|
||||
if(castAsOtherPlayer){
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:cast.success_remote_continuous",
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success_remote_continuous",
|
||||
spell.getNameForTranslationFormatted(), caster.getName()));
|
||||
}else{
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:cast.success_continuous",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success_continuous",
|
||||
spell.getNameForTranslationFormatted()));
|
||||
}
|
||||
}
|
||||
@@ -183,10 +178,10 @@ public class CommandCastSpell extends CommandBase {
|
||||
}
|
||||
|
||||
if(castAsOtherPlayer){
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:cast.success_remote",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success_remote",
|
||||
spell.getNameForTranslationFormatted(), caster.getName()));
|
||||
}else{
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:cast.success",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.success",
|
||||
spell.getNameForTranslationFormatted()));
|
||||
}
|
||||
return;
|
||||
@@ -199,7 +194,7 @@ public class CommandCastSpell extends CommandBase {
|
||||
|
||||
/** Displays the "Unable to cast [spell]" message in the chat. */
|
||||
private void displayFailMessage(ICommandSender sender, Spell spell){
|
||||
ITextComponent message = new TextComponentTranslation("commands.wizardry:cast.fail",
|
||||
ITextComponent message = new TextComponentTranslation("commands." + Wizardry.MODID + ":cast.fail",
|
||||
spell.getNameForTranslationFormatted());
|
||||
message.getStyle().setColor(TextFormatting.RED);
|
||||
sender.sendMessage(message);
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
package electroblob.wizardry.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import electroblob.wizardry.WizardData;
|
||||
import electroblob.wizardry.Wizardry;
|
||||
import electroblob.wizardry.event.DiscoverSpellEvent;
|
||||
import electroblob.wizardry.registry.Spells;
|
||||
import electroblob.wizardry.spell.Spell;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.NumberInvalidException;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandDiscoverSpell extends CommandBase {
|
||||
|
||||
@Override
|
||||
@@ -41,8 +36,8 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
public String getUsage(ICommandSender sender){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:discoverspell.usage";
|
||||
// return I18n.format("commands.wizardry:discoverspell.usage", Wizardry.settings.discoverspellCommandName);
|
||||
return "commands." + Wizardry.MODID + ":discoverspell.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":discoverspell.usage", Wizardry.settings.discoverspellCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +56,7 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException{
|
||||
|
||||
if(arguments.length < 1){
|
||||
throw new WrongUsageException("commands.wizardry:discoverspell.usage",
|
||||
throw new WrongUsageException("commands." + Wizardry.MODID + ":discoverspell.usage",
|
||||
Wizardry.settings.discoverspellCommandName);
|
||||
}else{
|
||||
|
||||
@@ -91,7 +86,7 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
spell = Spell.get(arguments[i++]);
|
||||
|
||||
if(spell == null){
|
||||
throw new NumberInvalidException("commands.wizardry:discoverspell.not_found",
|
||||
throw new NumberInvalidException("commands." + Wizardry.MODID + ":discoverspell.not_found",
|
||||
new Object[]{arguments[i - 1]});
|
||||
}
|
||||
}
|
||||
@@ -116,21 +111,21 @@ public class CommandDiscoverSpell extends CommandBase {
|
||||
if(clear){
|
||||
properties.spellsDiscovered.clear();
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:discoverspell.clear", player.getName()));
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.clear", player.getName()));
|
||||
}else if(all){
|
||||
properties.spellsDiscovered.addAll(Spell.getSpells(Spell.allSpells));
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:discoverspell.all", player.getName()));
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.all", player.getName()));
|
||||
}else{
|
||||
if(properties.hasSpellBeenDiscovered(spell)){
|
||||
properties.spellsDiscovered.remove(spell);
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:discoverspell.removespell",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.removespell",
|
||||
spell.getNameForTranslationFormatted(), player.getName()));
|
||||
}else{
|
||||
if(!MinecraftForge.EVENT_BUS
|
||||
.post(new DiscoverSpellEvent(player, spell, DiscoverSpellEvent.Source.COMMAND))){
|
||||
properties.discoverSpell(spell);
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:discoverspell.addspell",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":discoverspell.addspell",
|
||||
spell.getNameForTranslationFormatted(), player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public class CommandSetAlly extends CommandBase {
|
||||
public String getUsage(ICommandSender p_71518_1_){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:ally.usage";
|
||||
// return I18n.format("commands.wizardry:ally.usage", Wizardry.settings.allyCommandName);
|
||||
return "commands." + Wizardry.MODID + ":ally.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":ally.usage", Wizardry.settings.allyCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,7 +60,7 @@ public class CommandSetAlly extends CommandBase {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] arguments) throws CommandException{
|
||||
|
||||
if(arguments.length < 1){
|
||||
throw new WrongUsageException("commands.wizardry:ally.usage", Wizardry.settings.allyCommandName);
|
||||
throw new WrongUsageException("commands." + Wizardry.MODID + ":ally.usage", Wizardry.settings.allyCommandName);
|
||||
}else{
|
||||
|
||||
EntityPlayerMP allyOf = null;
|
||||
@@ -86,7 +86,7 @@ public class CommandSetAlly extends CommandBase {
|
||||
&& !WizardryUtilities.isPlayerOp((EntityPlayer)sender, server)){
|
||||
// Displays a chat message if a non-op tries to modify another player's allies.
|
||||
TextComponentTranslation TextComponentTranslation2 = new TextComponentTranslation(
|
||||
"commands.wizardry:ally.permission");
|
||||
"commands." + Wizardry.MODID + ":ally.permission");
|
||||
TextComponentTranslation2.getStyle().setColor(TextFormatting.RED);
|
||||
allyOf.sendMessage(TextComponentTranslation2);
|
||||
return;
|
||||
@@ -100,12 +100,12 @@ public class CommandSetAlly extends CommandBase {
|
||||
if(allyOf == null)
|
||||
throw new PlayerNotFoundException("You must specify which player you wish to perform this action on.");
|
||||
|
||||
if(allyOf == ally) throw new NumberInvalidException("commands.wizardry:ally.self");
|
||||
if(allyOf == ally) throw new NumberInvalidException("commands." + Wizardry.MODID + ":ally.self");
|
||||
|
||||
if(WizardData.get(allyOf) != null){
|
||||
String string = WizardData.get(allyOf).toggleAlly(ally) ? "add" : "remove";
|
||||
if(executeAsOtherPlayer){
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:ally." + string + "ally",
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":ally." + string + "ally",
|
||||
ally.getName(), allyOf.getName()));
|
||||
// In this case, the player whose allies have been modified is also notified.
|
||||
allyOf.sendMessage(new TextComponentTranslation("item.wand." + string + "ally", ally.getName()));
|
||||
|
||||
@@ -40,8 +40,8 @@ public class CommandViewAllies extends CommandBase {
|
||||
public String getUsage(ICommandSender p_71518_1_){
|
||||
// Not ideal, but the way this is implemented means I have no choice. Only used in the help command, so in there
|
||||
// the custom command name will not display.
|
||||
return "commands.wizardry:allies.usage";
|
||||
// return I18n.format("commands.wizardry:allies.usage", Wizardry.settings.alliesCommandName);
|
||||
return "commands." + Wizardry.MODID + ":allies.usage";
|
||||
// return I18n.format("commands." + Wizardry.MODID + ":allies.usage", Wizardry.settings.alliesCommandName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +76,7 @@ public class CommandViewAllies extends CommandBase {
|
||||
&& !WizardryUtilities.isPlayerOp((EntityPlayer)sender, server)){
|
||||
// Displays a chat message if a non-op tries to view another player's allies.
|
||||
TextComponentTranslation TextComponentTranslation2 = new TextComponentTranslation(
|
||||
"commands.wizardry:allies.permission");
|
||||
"commands." + Wizardry.MODID + ":allies.permission");
|
||||
TextComponentTranslation2.getStyle().setColor(TextFormatting.RED);
|
||||
player.sendMessage(TextComponentTranslation2);
|
||||
return;
|
||||
@@ -102,14 +102,14 @@ public class CommandViewAllies extends CommandBase {
|
||||
// Cuts the last " ," off of the string.
|
||||
string = string.substring(0, string.length() - 2);
|
||||
}else{
|
||||
string = I18n.format("commands.wizardry:allies.none");
|
||||
string = I18n.format("commands." + Wizardry.MODID + ":allies.none");
|
||||
}
|
||||
|
||||
if(executeAsOtherPlayer){
|
||||
sender.sendMessage(
|
||||
new TextComponentTranslation("commands.wizardry:allies.list_other", player.getName(), string));
|
||||
new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list_other", player.getName(), string));
|
||||
}else{
|
||||
sender.sendMessage(new TextComponentTranslation("commands.wizardry:allies.list", string));
|
||||
sender.sendMessage(new TextComponentTranslation("commands." + Wizardry.MODID + ":allies.list", string));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user