Merge branch 'masterdev' into dev

Conflicts:
	BankEconomyMod/src/me/kaZep/Base/Main.java
dev
sigonasr2 11 years ago
commit c3e762d89e
  1. 128
      BankEconomyMod/src/me/kaZep/Base/Main.java
  2. 49
      BankEconomyMod/src/me/kaZep/Base/PlayerListener.java

@ -6,6 +6,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
@ -28,8 +29,10 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Color;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
@ -50,6 +53,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
@ -64,6 +68,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.map.MapRenderer;
@ -82,6 +87,10 @@ import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.util.Vector;
import org.bukkit.enchantments.Enchantment;
import sig.ItemSets.ColorSet;
import sig.ItemSets.ItemSet;
import sig.ItemSets.ItemSetList;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
@ -169,6 +178,7 @@ public class Main extends JavaPlugin
public static List<RecyclingCenterNode> recycling_center_list = null;
public DamageAPI DMGCALC = null;
public long lastMessage = 0;
public static ItemSetList ItemSetList = null;
public FileWriter outputStream = null;
@ -558,6 +568,24 @@ public class Main extends JavaPlugin
item_cube.setIngredient('c', Material.EMERALD_BLOCK);
Bukkit.addRecipe(item_cube);
ItemSetList = new ItemSetList();
ItemSetList.Init();
//Create a list of item sets.
ItemSet set = new ItemSet("Acrobat",new ColorSet(
Color.fromRGB(149, 193, 149),
Color.fromRGB(133, 184, 133),
Color.fromRGB(133, 184, 159),
Color.fromRGB(159, 184, 133)),
"Thin and light armor made for" +
"nimble and precise movement.",
"When getting hit, you will gain" +
"40% movement speed.",
"Every 20% of bonus movement speed" +
"gives you 10% block chance.",
"When jumping, you cannot be hit.");
ItemSetList.addSet(set);
DMGCALC = new DamageAPI();
//System.out.println("Running BankEconomy in "+this.getDataFolder().getAbsolutePath());
//System.out.println("File size: "+f.length());
@ -4845,6 +4873,56 @@ public void payDay(int time)
}
}
private static Method getMethod(Class<?> cl, String method)
{
for (Method m : cl.getMethods())
if (m.getName().equals(method))
return m;
return null;
}
/**
* Explodes random firework on location
*
* @param loc
* Location to explode
*/
public static void playFirework(Location loc)
{
Random gen = new Random();
try
{
Firework fw = loc.getWorld().spawn(loc, Firework.class);
Method d0 = getMethod(loc.getWorld().getClass(), "getHandle");
Method d2 = getMethod(fw.getClass(), "getHandle");
Object o3 = d0.invoke(loc.getWorld(), (Object[]) null);
Object o4 = d2.invoke(fw, (Object[]) null);
Method d1 = getMethod(o3.getClass(), "broadcastEntityEffect");
FireworkMeta data = fw.getFireworkMeta();
data.addEffect(FireworkEffect
.builder()
.with(FireworkEffect.Type.values()[gen
.nextInt(FireworkEffect.Type.values().length)])
.flicker(gen.nextBoolean())
.trail(gen.nextBoolean())
.withColor(
Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
gen.nextInt(255)))
.withFade(
Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
gen.nextInt(255))).build());
fw.setFireworkMeta(data);
d1.invoke(o3, new Object[] { o4, (byte) 17 });
fw.remove();
}
catch (Exception ex)
{
// not a Beta1.4.6R0.2 Server
}
}
public void setLv30Choice(Player p, String arg1, String arg2) {
if (getJobLv(arg1, p)>=30) {
if (arg2.equals("1") || arg2.equals("2")) {
@ -4868,6 +4946,56 @@ public void payDay(int time)
notifyBuffMessages(p, 20);
}
private static Method getMethod(Class<?> cl, String method)
{
for (Method m : cl.getMethods())
if (m.getName().equals(method))
return m;
return null;
}
/**
* Explodes random firework on location
*
* @param loc
* Location to explode
*/
public static void playFirework(Location loc)
{
Random gen = new Random();
try
{
Firework fw = loc.getWorld().spawn(loc, Firework.class);
Method d0 = getMethod(loc.getWorld().getClass(), "getHandle");
Method d2 = getMethod(fw.getClass(), "getHandle");
Object o3 = d0.invoke(loc.getWorld(), (Object[]) null);
Object o4 = d2.invoke(fw, (Object[]) null);
Method d1 = getMethod(o3.getClass(), "broadcastEntityEffect");
FireworkMeta data = fw.getFireworkMeta();
data.addEffect(FireworkEffect
.builder()
.with(FireworkEffect.Type.values()[gen
.nextInt(FireworkEffect.Type.values().length)])
.flicker(gen.nextBoolean())
.trail(gen.nextBoolean())
.withColor(
Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
gen.nextInt(255)))
.withFade(
Color.fromRGB(gen.nextInt(255), gen.nextInt(255),
gen.nextInt(255))).build());
fw.setFireworkMeta(data);
d1.invoke(o3, new Object[] { o4, (byte) 17 });
fw.remove();
}
catch (Exception ex)
{
// not a Beta1.4.6R0.2 Server
}
}
public void notifyBuffMessages(final Player p, int tick_delay) {
//Same as notifyBuffMessages(), but waits a number of ticks before displaying it.
//See which messages we have to display.

@ -5674,15 +5674,15 @@ implements Listener
return getGoodie(0);
}
public ItemStack getGoodie(int rar /*1=Mythical 0=Normal*/) {
public ItemStack getGoodie(int rar /*1=Mythical 0=Normal -1=Only an equipment*/) {
ItemStack item = null;
if (Math.random()<0.33) {
if (Math.random()<0.33 || rar==-1) {
//Add a weapon/armor piece.
int rand = (int)(Math.random()*5);
String type = "";
String type2 = "";
int rarity=0; //0 = Normal, 1 = Rare, 2 = Legendary, 3 = Mythical
switch ((int)(Math.random()*20)) {
int rarity=0; //0 = Normal, 1 = Rare, 2 = Legendary, 3 = Mythical, 4 = Set
switch ((int)(Math.random()*22)) {
case 0:
case 1:
case 2:
@ -5708,13 +5708,52 @@ implements Listener
case 17:{
rarity=2;
}break;
case 19:{
case 19:
case 20:{
rarity=4;
}break;
case 21:{
rarity=3;
}break;
}
if (rar==1) {
rarity=3;
}
if (rar==-1) {
if (Math.random()<=0.05) {
rarity=4;
} else {
rarity=(int)(Math.random()*3);
}
}
if (rarity==4) {
//Drop a leather piece / diamond sword that's mysterious. It will have 0 durability, so cannot be used until identified.
ItemStack i = null;
switch ((int)(Math.random()*10)) {
case 0:{
i = new ItemStack(Material.DIAMOND_SWORD);
}break;
case 1:{
i = new ItemStack(Material.LEATHER_CHESTPLATE);
}break;
case 2:{
i = new ItemStack(Material.LEATHER_BOOTS);
}break;
case 3:{
i = new ItemStack(Material.LEATHER_HELMET);
}break;
case 4:{
i = new ItemStack(Material.LEATHER_LEGGINGS);
}break;
default:{
i = new ItemStack(Material.LEATHER);
}
}
if (i.getType()==Material.LEATHER) {
//We will drop a leather piece that builds a set item.
}
}
switch (rand) {
case 0: {
type = "LEATHER";

Loading…
Cancel
Save