You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
15 KiB

package cx.sfy.TheBridge.managers;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
public class GlassManager {
@SuppressWarnings("deprecation")
public void createCage(Location loc, ChatColor team) {
World world = loc.getWorld();
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
world.getBlockAt(x, y, z).setType(Material.GLASS);
world.getBlockAt(x, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x, y, z - 1).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z).setType(Material.GLASS);
world.getBlockAt(x - 1, y, z).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z - 1).setType(Material.GLASS);
world.getBlockAt(x - 1, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x - 1, y, z - 1).setType(Material.GLASS);
world.getBlockAt(x, y, z + 2).setType(Material.GLASS);
world.getBlockAt(x, y, z - 2).setType(Material.GLASS);
world.getBlockAt(x + 2, y, z).setType(Material.GLASS);
world.getBlockAt(x - 2, y, z).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z + 2).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z - 2).setType(Material.GLASS);
world.getBlockAt(x + 2, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x - 2, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x + 2, y, z + 2).setType(Material.GLASS);
world.getBlockAt(x + 2, y, z - 2).setType(Material.GLASS);
world.getBlockAt(x - 2, y, z - 2).setType(Material.GLASS);
world.getBlockAt(x - 2, y, z + 2).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z + 2).setType(Material.GLASS);
world.getBlockAt(x + 1, y, z - 2).setType(Material.GLASS);
world.getBlockAt(x + 2, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x - 2, y, z + 1).setType(Material.GLASS);
world.getBlockAt(x - 1, y, z - 2).setType(Material.GLASS);
world.getBlockAt(x - 1, y, z + 2).setType(Material.GLASS);
world.getBlockAt(x + 2, y, z - 1).setType(Material.GLASS);
world.getBlockAt(x - 2, y, z - 1).setType(Material.GLASS);
world.getBlockAt(x, y + 1, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 1, y + 1, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 1, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 1, z - 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 1, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 1, y + 1, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 1, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 1, z - 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 1, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 1, z + 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 1, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 1, y + 1, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x, y + 1, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 1, y + 1, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 1, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 1, z + 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 1, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x, y + 2, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 1, y + 2, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 2, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 2, z - 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 2, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 1, y + 2, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 2, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 2, z - 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 2, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 2, z + 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 2, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 1, y + 2, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x, y + 2, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 1, y + 2, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 2, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 2, z + 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 2, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x, y + 3, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 1, y + 3, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 3, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 3, z - 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 3, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 1, y + 3, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 3, z - 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 3, z - 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 3, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 3, z + 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 2, y + 3, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x - 1, y + 3, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x, y + 3, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 1, y + 3, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 3, z + 2).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 3, z + 1).setType(Material.STAINED_GLASS);
world.getBlockAt(x + 2, y + 3, z).setType(Material.STAINED_GLASS);
world.getBlockAt(x, y + 1, z - 2).setData(getColor(team));
world.getBlockAt(x + 1, y + 1, z - 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 1, z - 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 1, z - 1).setData(getColor(team));
world.getBlockAt(x + 2, y + 1, z).setData(getColor(team));
world.getBlockAt(x - 1, y + 1, z - 2).setData(getColor(team));
world.getBlockAt(x - 2, y + 1, z - 2).setData(getColor(team));
world.getBlockAt(x - 2, y + 1, z - 1).setData(getColor(team));
world.getBlockAt(x - 2, y + 1, z).setData(getColor(team));
world.getBlockAt(x - 2, y + 1, z + 1).setData(getColor(team));
world.getBlockAt(x - 2, y + 1, z + 2).setData(getColor(team));
world.getBlockAt(x - 1, y + 1, z + 2).setData(getColor(team));
world.getBlockAt(x, y + 1, z + 2).setData(getColor(team));
world.getBlockAt(x + 1, y + 1, z + 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 1, z + 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 1, z + 1).setData(getColor(team));
world.getBlockAt(x + 2, y + 1, z).setData(getColor(team));
world.getBlockAt(x, y + 2, z - 2).setData(getColor(team));
world.getBlockAt(x + 1, y + 2, z - 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 2, z - 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 2, z - 1).setData(getColor(team));
world.getBlockAt(x + 2, y + 2, z).setData(getColor(team));
world.getBlockAt(x - 1, y + 2, z - 2).setData(getColor(team));
world.getBlockAt(x - 2, y + 2, z - 2).setData(getColor(team));
world.getBlockAt(x - 2, y + 2, z - 1).setData(getColor(team));
world.getBlockAt(x - 2, y + 2, z).setData(getColor(team));
world.getBlockAt(x - 2, y + 2, z + 1).setData(getColor(team));
world.getBlockAt(x - 2, y + 2, z + 2).setData(getColor(team));
world.getBlockAt(x - 1, y + 2, z + 2).setData(getColor(team));
world.getBlockAt(x, y + 2, z + 2).setData(getColor(team));
world.getBlockAt(x + 1, y + 2, z + 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 2, z + 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 2, z + 1).setData(getColor(team));
world.getBlockAt(x + 2, y + 2, z).setData(getColor(team));
world.getBlockAt(x, y + 3, z - 2).setData(getColor(team));
world.getBlockAt(x + 1, y + 3, z - 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 3, z - 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 3, z - 1).setData(getColor(team));
world.getBlockAt(x + 2, y + 3, z).setData(getColor(team));
world.getBlockAt(x - 1, y + 3, z - 2).setData(getColor(team));
world.getBlockAt(x - 2, y + 3, z - 2).setData(getColor(team));
world.getBlockAt(x - 2, y + 3, z - 1).setData(getColor(team));
world.getBlockAt(x - 2, y + 3, z).setData(getColor(team));
world.getBlockAt(x - 2, y + 3, z + 1).setData(getColor(team));
world.getBlockAt(x - 2, y + 3, z + 2).setData(getColor(team));
world.getBlockAt(x - 1, y + 3, z + 2).setData(getColor(team));
world.getBlockAt(x, y + 3, z + 2).setData(getColor(team));
world.getBlockAt(x + 1, y + 3, z + 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 3, z + 2).setData(getColor(team));
world.getBlockAt(x + 2, y + 3, z + 1).setData(getColor(team));
world.getBlockAt(x + 2, y + 3, z).setData(getColor(team));
}
public void removeGlass(Location loc) {
World world = loc.getWorld();
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
world.getBlockAt(x, y, z).setType(Material.AIR);
world.getBlockAt(x, y, z + 1).setType(Material.AIR);
world.getBlockAt(x, y, z - 1).setType(Material.AIR);
world.getBlockAt(x + 1, y, z).setType(Material.AIR);
world.getBlockAt(x - 1, y, z).setType(Material.AIR);
world.getBlockAt(x + 1, y, z + 1).setType(Material.AIR);
world.getBlockAt(x + 1, y, z - 1).setType(Material.AIR);
world.getBlockAt(x - 1, y, z + 1).setType(Material.AIR);
world.getBlockAt(x - 1, y, z - 1).setType(Material.AIR);
world.getBlockAt(x, y, z + 2).setType(Material.AIR);
world.getBlockAt(x, y, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y, z).setType(Material.AIR);
world.getBlockAt(x - 2, y, z).setType(Material.AIR);
world.getBlockAt(x + 1, y, z + 2).setType(Material.AIR);
world.getBlockAt(x + 1, y, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y, z + 1).setType(Material.AIR);
world.getBlockAt(x - 2, y, z + 1).setType(Material.AIR);
world.getBlockAt(x + 2, y, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y, z + 2).setType(Material.AIR);
world.getBlockAt(x + 1, y, z + 2).setType(Material.AIR);
world.getBlockAt(x + 1, y, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y, z + 1).setType(Material.AIR);
world.getBlockAt(x - 2, y, z + 1).setType(Material.AIR);
world.getBlockAt(x - 1, y, z - 2).setType(Material.AIR);
world.getBlockAt(x - 1, y, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y, z - 1).setType(Material.AIR);
world.getBlockAt(x - 2, y, z - 1).setType(Material.AIR);
world.getBlockAt(x, y + 1, z - 2).setType(Material.AIR);
world.getBlockAt(x + 1, y + 1, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 1, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 1, z - 1).setType(Material.AIR);
world.getBlockAt(x + 2, y + 1, z).setType(Material.AIR);
world.getBlockAt(x - 1, y + 1, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y + 1, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y + 1, z - 1).setType(Material.AIR);
world.getBlockAt(x - 2, y + 1, z).setType(Material.AIR);
world.getBlockAt(x - 2, y + 1, z + 1).setType(Material.AIR);
world.getBlockAt(x - 2, y + 1, z + 2).setType(Material.AIR);
world.getBlockAt(x - 1, y + 1, z + 2).setType(Material.AIR);
world.getBlockAt(x, y + 1, z + 2).setType(Material.AIR);
world.getBlockAt(x + 1, y + 1, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 1, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 1, z + 1).setType(Material.AIR);
world.getBlockAt(x + 2, y + 1, z).setType(Material.AIR);
world.getBlockAt(x, y + 2, z - 2).setType(Material.AIR);
world.getBlockAt(x + 1, y + 2, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 2, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 2, z - 1).setType(Material.AIR);
world.getBlockAt(x + 2, y + 2, z).setType(Material.AIR);
world.getBlockAt(x - 1, y + 2, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y + 2, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y + 2, z - 1).setType(Material.AIR);
world.getBlockAt(x - 2, y + 2, z).setType(Material.AIR);
world.getBlockAt(x - 2, y + 2, z + 1).setType(Material.AIR);
world.getBlockAt(x - 2, y + 2, z + 2).setType(Material.AIR);
world.getBlockAt(x - 1, y + 2, z + 2).setType(Material.AIR);
world.getBlockAt(x, y + 2, z + 2).setType(Material.AIR);
world.getBlockAt(x + 1, y + 2, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 2, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 2, z + 1).setType(Material.AIR);
world.getBlockAt(x + 2, y + 2, z).setType(Material.AIR);
world.getBlockAt(x, y + 3, z - 2).setType(Material.AIR);
world.getBlockAt(x + 1, y + 3, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 3, z - 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 3, z - 1).setType(Material.AIR);
world.getBlockAt(x + 2, y + 3, z).setType(Material.AIR);
world.getBlockAt(x - 1, y + 3, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y + 3, z - 2).setType(Material.AIR);
world.getBlockAt(x - 2, y + 3, z - 1).setType(Material.AIR);
world.getBlockAt(x - 2, y + 3, z).setType(Material.AIR);
world.getBlockAt(x - 2, y + 3, z + 1).setType(Material.AIR);
world.getBlockAt(x - 2, y + 3, z + 2).setType(Material.AIR);
world.getBlockAt(x - 1, y + 3, z + 2).setType(Material.AIR);
world.getBlockAt(x, y + 3, z + 2).setType(Material.AIR);
world.getBlockAt(x + 1, y + 3, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 3, z + 2).setType(Material.AIR);
world.getBlockAt(x + 2, y + 3, z + 1).setType(Material.AIR);
world.getBlockAt(x + 2, y + 3, z).setType(Material.AIR);
}
public byte getColor(ChatColor team) {
if (team.equals(ChatColor.RED)) {
return 14;
}
if (team.equals(ChatColor.BLUE)) {
return 11;
}
if (team.equals(ChatColor.YELLOW)) {
return 4;
}
if (team.equals(ChatColor.GREEN)) {
return 5;
}
return 0;
}
}