All pastes #2120986 Raw Edit

Anonymous

public text v1 · immutable
#2120986 ·published 2012-02-23 08:10 UTC
rendered paste body
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Map;
import java.util.logging.Logger;

import net.minecraft.server.Block;

import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.command.CommandExecutor;

import com.eldercrest.boom.vault.Playerloc;
import com.eldercrest.boom.vault.ListMaker;

public class Main extends JavaPlugin {
	String things;
	String stuff;
	ArrayList<Playerloc> list;
	static ArrayList<Playerloc> tempList;
	Logger log = Logger.getLogger("Minecraft");
	Player admin;

	@Override
	public void onEnable() {
		log.info("Vault Enabled");
		ListMaker.readDataFromFile();
		ListMaker.print();
		list = tempList;
	}

	public boolean onCommand(CommandSender sender, Command cmd, String label,
			String[] args) {
		Player player = null;
		if (sender instanceof Player) {
			player = (Player) sender;
			this.admin = player;

			if (cmd.getName().equalsIgnoreCase("vault")
					&& player.hasPermission("vault.player.access")
					&& args.length == 2) {
				String[] temp;
				String split = " ";

				temp = cmd.getName().toString().split(split);
				for (int i = 0; i < temp.length; i++) {
					things = temp[i];
					if (things != null && things != "vault") {

						if (temp[i].equalsIgnoreCase("enter")) {
							Playerloc[] temp2;
							Playerloc temp3;
							for (int i1 = 0; i1 < list.size(); i1++) {
								temp3 = temp2[i1];
								if (player.getName() == temp3.getName()) {
									Location loc = Location(player.getWorld(),
											temp3.getX(), temp3.getY(),
											temp3.getZ());
									Chunk c = loc.getChunk();
									if (!(c.isLoaded())) {
										c.load();
										player.teleport(loc);
									}

								}
							}
						}

						else if (temp[i].equalsIgnoreCase("exit")) {
							Playerloc[] temp2;
							Playerloc temp3;
							for (int i1 = 0; i1 < list.size(); i1++) {
								temp3 = temp2[i1];

							}
						}
					}
				}
			} else if (cmd.getName().equalsIgnoreCase("newvault")
					&& player.hasPermission("vault.admin.access")
					&& args.length > 1) {
				String[] temp1;
				String split1 = " ";

				temp1 = cmd.getName().toString().split(split1);
				for (int i1 = 0; i1 < temp1.length; i1++) {
					things = temp1[i1];
					if (things != null && things != "newvault") {

						if (temp1[i1].equalsIgnoreCase(getServer()
								.getPlayer(split1).getName().toString())) {
							ArrayList<Playerloc> list;
							Playerloc newVault;
							Player pl;
							String name;
							name = temp1[i1];
							pl = getServer().getPlayer(name);

							newVault.setName(pl.getName().toString());
							newVault.setX(this.admin.getLocation().getBlockX());
							newVault.setY(this.admin.getLocation().getBlockY());
							newVault.setZ(this.admin.getLocation().getBlockZ());

							list.add(newVault);
							player.sendMessage("Vault Created");
						}

						else if (temp1[i1].equalsIgnoreCase("setexit")) {
							Playerloc[] temp2;
							Playerloc temp3;
							Boolean b;
							b = false;
							for (int i11 = 0; i11 < list.size(); i11++) {
								temp3 = temp2[i11];
								if (temp3.getName().equalsIgnoreCase("exit")) {
									b = true;
								}

								if (b == true) {
									temp3.setX(this.admin.getLocation()
											.getBlockX());
									temp3.setY(this.admin.getLocation()
											.getBlockY());
									temp3.setZ(this.admin.getLocation()
											.getBlockZ());
								}

								if (b == false) {
									Playerloc newexit;

									newexit.setName("exit");
									newexit.setX(this.admin.getLocation()
											.getBlockX());
									newexit.setY(this.admin.getLocation()
											.getBlockY());
									newexit.setZ(this.admin.getLocation()
											.getBlockZ());

									list.add(newexit);
								}
							}
						} else {
							player.sendMessage("Error... Is the player online?");
						}

					} else if (cmd.getName().equalsIgnoreCase("gotovault")
							&& player.hasPermission("vault.admin.access")) {
						String[] temp2;
						String split2 = " ";

						temp2 = cmd.getName().toString().split(split1);
						for (int i2 = 0; i2 < temp2.length; i2++) {
							things = temp2[i2];
							if (things != null && things != "gotovault") {
								if (things
										.equalsIgnoreCase(getServer()
												.getPlayer(split1).getName()
												.toString())) {
									Playerloc[] temp21;
									Playerloc temp3;

									for (int o = 0; 0 < list.size(); o++) {
										temp3 = temp21[o];
										if (temp3.getName().equalsIgnoreCase(
												getServer().getPlayer(split1)
														.getName().toString())) {
											Location loc = Location(
													player.getWorld(),
													temp3.getX(), temp3.getY(),
													temp3.getZ());
											Chunk c = loc.getChunk();
											if (!(c.isLoaded())) {
												c.load();
												player.teleport(loc);
											}
										}
									}
								} else {
									player.sendMessage("Fool! ./gotovault [player]");
								}
							}

						}
					} else {
						player.sendMessage("You do not have access to that command or you typed it wrong");
					}

				}

			} else {
				log.info("Stephen, you're doin it wrong!");
			}
		}
		return true;
	}

	@Override
	public void onDisable() {
		log.info("Vault Disabled... And Saved");
		ListMaker.updateFile("src/files/list.txt", list);

	}

}