Compare commits
No commits in common. '0435805069a8db695bbda7150c579870023cd55b' and '54c2dbec62eea5c638b3b671aa445c4c6d7542d0' have entirely different histories.
0435805069
...
54c2dbec62
@ -1,32 +0,0 @@
|
|||||||
package com.zivilon.cinder_loe.character;
|
|
||||||
|
|
||||||
import lotr.common.entity.npc.LOTREntityNPC;
|
|
||||||
import lotr.common.entity.npc.LOTRHireableBase;
|
|
||||||
import lotr.common.entity.npc.LOTRUnitTradeEntry;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class MouthOfSauronEntityHandler extends LOTRUnitTradeEntry {
|
|
||||||
|
|
||||||
private final LOTREntityNPC npc;
|
|
||||||
|
|
||||||
public MouthOfSauronEntityHandler(LOTREntityNPC npc, float alignmentRequired) {
|
|
||||||
super(npc.getClass(), 0 /*costless*/, alignmentRequired);
|
|
||||||
this.npc = npc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LOTREntityNPC getOrCreateHiredNPC(World world) {
|
|
||||||
// Return the very same NPC, no new spawn.
|
|
||||||
return npc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasRequiredCostAndAlignment(EntityPlayer player, LOTRHireableBase trader) {
|
|
||||||
// If they're already hired, disallow re-hiring
|
|
||||||
if (npc.hiredNPCInfo != null && npc.hiredNPCInfo.isActive) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.hasRequiredCostAndAlignment(player, trader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
package com.zivilon.cinder_loe.command;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.command.WrongUsageException;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import static com.zivilon.cinder_loe.character.CharacterEventListener.hiringEnabled;
|
|
||||||
|
|
||||||
public class CommandMouthOfSauron extends CommandBase {
|
|
||||||
@Override
|
|
||||||
public String getCommandName() {
|
|
||||||
return "MouthofSauron";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCommandUsage(ICommandSender sender) {
|
|
||||||
return "/MouthofSauron <on|off>";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void processCommand(ICommandSender sender, String[] args) {
|
|
||||||
if (!(sender instanceof EntityPlayerMP)) {
|
|
||||||
sender.addChatMessage(new ChatComponentText("Only players may use this command."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (args.length != 1 ||
|
|
||||||
(!args[0].equalsIgnoreCase("on") && !args[0].equalsIgnoreCase("off"))) {
|
|
||||||
throw new WrongUsageException(getCommandUsage(sender));
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityPlayerMP player = (EntityPlayerMP) sender;
|
|
||||||
UUID id = player.getUniqueID();
|
|
||||||
boolean enable = args[0].equalsIgnoreCase("on");
|
|
||||||
|
|
||||||
if (enable) {
|
|
||||||
hiringEnabled.add(id);
|
|
||||||
player.addChatMessage(new ChatComponentText("MouthOfSauron auto-hire ENABLED."));
|
|
||||||
} else {
|
|
||||||
hiringEnabled.remove(id);
|
|
||||||
player.addChatMessage(new ChatComponentText("MouthOfSauron auto-hire DISABLED."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue