Some optimization, fixed copyright.

This commit is contained in:
Sauilitired 2014-11-08 20:27:09 +01:00
parent bcc34e7cd8
commit f71fabbfbf
143 changed files with 5090 additions and 4580 deletions

View file

@ -1,27 +1,32 @@
/*
* Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
* and/or monetize any of our intellectual property. IntellectualCrafters is not
* affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
*
* >> File = Auto.java >> Generated by: Citymonstret at 2014-08-09 01:40
*/
////////////////////////////////////////////////////////////////////////////////////////////////////
// PlotSquared - A plot manager and world generator for the Bukkit API /
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
// /
// This program is free software; you can redistribute it and/or modify /
// it under the terms of the GNU General Public License as published by /
// the Free Software Foundation; either version 3 of the License, or /
// (at your option) any later version. /
// /
// This program is distributed in the hope that it will be useful, /
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
// GNU General Public License for more details. /
// /
// You should have received a copy of the GNU General Public License /
// along with this program; if not, write to the Free Software Foundation, /
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.*;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.FlagManager;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotHelper;
import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.PlotWorld;
@SuppressWarnings("deprecation")
public class Auto extends SubCommand {
public Auto() {
@ -39,12 +44,10 @@ public class Auto extends SubCommand {
String schematic = "";
if (PlotMain.getPlotWorlds().length == 1) {
world = Bukkit.getWorld(PlotMain.getPlotWorlds()[0]);
}
else {
} else {
if (PlotMain.isPlotWorld(plr.getWorld())) {
world = plr.getWorld();
}
else {
} else {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}
@ -64,15 +67,13 @@ public class Auto extends SubCommand {
if (args.length > 1) {
schematic = args[1];
}
}
catch (final Exception e) {
} catch (final Exception e) {
schematic = args[0];
// PlayerFunctions.sendMessage(plr,
// "&cError: Invalid size (X,Y)");
// return false;
}
}
else {
} else {
schematic = args[0];
// PlayerFunctions.sendMessage(plr, C.NO_PERMISSION);
// return false;
@ -124,14 +125,16 @@ public class Auto extends SubCommand {
}
Auto.lastPlot = getNextPlot(Auto.lastPlot, 1);
}
}
else {
final boolean claimed = true;
} else {
// FIXME: Not used
// TODO: Fix this!
// final boolean claimed = true;
while (!br) {
final PlotId start = getNextPlot(Auto.lastPlot, 1);
// FIXME: Wtf is going on here?
if (claimed) {
/*if (claimed) */
{
if ((PlotMain.getPlots(world).get(start) == null) || (PlotMain.getPlots(world).get(start).owner == null)) {
Auto.lastPlot = start;
continue;
@ -168,20 +171,16 @@ public class Auto extends SubCommand {
if (absX > absY) {
if (id.x > 0) {
return new PlotId(id.x, id.y + 1);
}
else {
} else {
return new PlotId(id.x, id.y - 1);
}
}
else if (absY > absX) {
} else if (absY > absX) {
if (id.y > 0) {
return new PlotId(id.x - 1, id.y);
}
else {
} else {
return new PlotId(id.x + 1, id.y);
}
}
else {
} else {
if (id.x.equals(id.y) && (id.x > 0)) {
return new PlotId(id.x, id.y + step);
}