Fix house tele

This commit is contained in:
dginovker 2020-03-08 15:44:09 -04:00
parent c34349bb60
commit 8028b019b3
2 changed files with 7 additions and 5 deletions

View file

@ -224,19 +224,22 @@ public final class BetaCommandPlugin extends CommandPlugin {
player.sendMessage("Syntax: ::give id amt playername");
}
String n = "";
for (int i = 1; i < args.length; i++) {
if (i == 1) {
for (int i = 3; i < args.length; i++) {
if (i == 3) {
n += args[i];
continue;
}
n += " " + args[i];
}
player.sendMessage("Giving " + n + " item..");
Player recipient = Repository.getPlayer(n);
if (recipient == null) {
player.debug("syntax error: name");
return true;
}
recipient.getInventory().add(new Item(toInteger(args[1]), toInteger(args[2])));
item = new Item(toInteger(args[1]), toInteger(args[2]));
item.setAmount(toInteger(args[2]));
recipient.getInventory().add(item);
return true;
// Get item by name

View file

@ -35,7 +35,6 @@ public class HouseTeleportPlugin extends MagicSpell {
@Override
public boolean cast(Entity entity, Node target) {
System.out.println("Casting house tele");
if (((Player)entity).getHouseManager().getLocation().getExitLocation() == null) {
((Player)entity).sendMessage("You must have a house to teleport to before attempting that.");
return false;
@ -45,9 +44,9 @@ public class HouseTeleportPlugin extends MagicSpell {
return false;
}
if (entity.getTeleporter().send(location.transform(0, RandomFunction.random(3), 0), TeleportType.NORMAL)) {
entity.setAttribute("teleport:items", super.runes);
entity.setAttribute("magic-delay", GameWorld.getTicks() + 5);
((Player) entity).getInventory().remove(super.runes);
return true;
}
return false;