예제 #1
0
  @Override
  public boolean cmd(
      BukkitCommand bkcmd, CommandSender sender, Command cmd, String label, String[] args) {
    if (!isPlayer(sender)) {
      sk(sender, "playeronly");
      return true;
    }

    Resident r = Resident.getResident(getPlayer(sender));
    Village v = Village.getPlayersVillage(r);
    if (v == null) {
      sk(sender, "notinvillage");
      return true;
    }

    if (v.isMayor(r)) {
      sk(sender, "leavevillagemayor");
      return true;
    }

    ResidentRemovedEvent event = new ResidentRemovedEvent(r, v);
    event.fireEvent();
    if (event.isCancelled()) return true;

    v.broadcast(gk("leftvillage", r));
    v.removeResident(r);
    return true;
  }
  @Override
  public boolean cmd(
      BukkitCommand bkcmd, CommandSender sender, Command cmd, String label, String[] args) {
    if (!getConfig().getBoolean("features.plots", true)) {
      sk(sender, "plotsnotenabled");
      return true;
    }
    if (!isPlayer(sender)) {
      sk(sender, "playeronly");
      return true;
    }

    Resident r = Resident.getResident(getPlayer(sender));
    Village v = Village.getPlayersVillage(r);
    if (v == null) {
      sk(sender, "notinvillage");
      return true;
    }
    if (!v.isMayor(r)) {
      sk(sender, "onlymayorplot");
      return true;
    }

    if (!Base.useEconomy) {
      sk(sender, "economydisabled");
      return true;
    }

    Region standing = Region.getRegion(getPlayer(sender));
    if (standing == null) return true;

    if (!v.isRegionOverlappingVillage(standing)) {
      sk(sender, "plotnotinvillage");
      return true;
    }

    if (args.length < 1) {
      sk(sender, "enteramt");
      return true;
    }

    if (!isDouble(args[0])) {
      sk(sender, "mustbenumber");
      return true;
    }

    double amt = getDouble(args[0]);
    if (amt <= 0) {
      sk(sender, "mustbeone");
      return true;
    }

    Plot plot = v.getPlot(standing);
    if (plot == null) {
      plot = new Plot(v, standing);
      v.addPlot(plot);
    }

    plot.setPrice(amt);
    sk(sender, "setplotprice", PluginHook.VAULT_HOOK.formatEconomy(amt));
    return true;
  }