Skip to content

Instantly share code, notes, and snippets.

@fpigerre
Forked from ScruffyRules/AMazIng.java
Created May 14, 2014 09:30
Show Gist options
  • Save fpigerre/0530184812acd9cd19f7 to your computer and use it in GitHub Desktop.
Save fpigerre/0530184812acd9cd19f7 to your computer and use it in GitHub Desktop.
package com.oresomecraft.maps.battles.maps;
import com.oresomecraft.OresomeBattles.api.BattlePlayer;
import com.oresomecraft.OresomeBattles.api.Gamemode;
import com.oresomecraft.OresomeBattles.api.InvUtils;
import com.oresomecraft.maps.battles.BattleMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class AMazIng extends BattleMap implements Listener {
public AMazIng() {
super.initiate(this, name, fullName, creators, modes);
setAllowBuild(false);
disableDrops(new Material[]{Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, Material.STONE_SWORD});
}
String name = "amazing";
String fullName = "A Maz Ing";
String[] creators = {"Beadycottonwood", "Huxtech"};
Gamemode[] modes = {Gamemode.INFECTION, Gamemode.LTS, Gamemode.LMS};
public void readyTDMSpawns() {
redSpawns.add(new Location(w, 47, 71, 0));
blueSpawns.add(new Location(w, -46, 71, 0));
}
public void readyFFASpawns() {
FFASpawns.add(new Location(w, -23, 71, 42));
FFASpawns.add(new Location(w, -29, 71, 37));
FFASpawns.add(new Location(w, -31, 71, 19));
FFASpawns.add(new Location(w, -29, 71, -24));
FFASpawns.add(new Location(w, 0, 71, -42));
FFASpawns.add(new Location(w, -42, 71, -19));
FFASpawns.add(new Location(w, -12, 71, 45));
}
public void applyInventory(final BattlePlayer p) {
Inventory i = p.getInventory();
ItemStack LEATHER_HELMET = new ItemStack(Material.LEATHER_HELMET, 1);
ItemStack LEATHER_CHESTPLATE = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
ItemStack LEATHER_PANTS = new ItemStack(Material.LEATHER_LEGGINGS, 1);
ItemStack LEATHER_BOOTS = new ItemStack(Material.LEATHER_BOOTS, 1);
ItemStack SWORD = new ItemStack(Material.IRON_SWORD, 1);
ItemStack BOW = new ItemStack(Material.BOW, 1);
ItemStack STEAK = new ItemStack(Material.COOKED_BEEF, 3);
ItemStack HEALTH = new ItemStack(Material.GOLDEN_APPLE, 3);
ItemStack ARROWS = new ItemStack(Material.ARROW, 64);
InvUtils.colourArmourAccordingToTeam(p, new ItemStack[]{LEATHER_CHESTPLATE, LEATHER_PANTS, LEATHER_HELMET, LEATHER_BOOTS});
BOW.addEnchantment(Enchantment.ARROW_INFINITE, 1);
p.getInventory().setBoots(LEATHER_BOOTS);
p.getInventory().setLeggings(LEATHER_PANTS);
p.getInventory().setChestplate(LEATHER_CHESTPLATE);
p.getInventory().setHelmet(LEATHER_HELMET);
i.setItem(0, SWORD);
i.setItem(1, BOW);
i.setItem(3, STEAK);
i.setItem(2, HEALTH);
i.setItem(10, ARROWS);
}
// Region. (Top corner block and bottom corner block.
// Top left corner.
public int x1 = -55;
public int y1 = 115;
public int z1 = 55;
//Bottom right corner.
public int x2 = 55;
public int y2 = 60;
public int z2 = -55;
@EventHandler
public void arrowAway(ProjectileHitEvent event) {
Entity projectile = event.getEntity();
Location loc = projectile.getLocation();
if (loc.getWorld().getName().equals(name)) {
if (projectile instanceof Arrow) {
Arrow arrow = (Arrow) projectile;
arrow.remove();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment