|
|
|
@ -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.
|
|
|
|
|