Setup code for the Christmas Holiday Event.
This commit is contained in:
parent
c94ae9836f
commit
b1adb5eeac
Binary file not shown.
@ -1,124 +1,134 @@
|
|||||||
name: TwosideKeeper
|
name: TwosideKeeper
|
||||||
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
main: sig.plugin.TwosideKeeper.TwosideKeeper
|
||||||
version: 3.10.0b
|
version: 3.10.1
|
||||||
commands:
|
commands:
|
||||||
money:
|
money:
|
||||||
description: Tells the player the amount of money they are holding.
|
description: Tells the player the amount of money they are holding.
|
||||||
usage: /money
|
usage: /money
|
||||||
permission: AutoPluginUpdate.money
|
permission: TwosideKeeper.money
|
||||||
permission-message: You don't have permission to check your balance!
|
permission-message: You don't have permission to check your balance!
|
||||||
enchant_advanced:
|
enchant_advanced:
|
||||||
description: Enchants items with more properties.
|
description: Enchants items with more properties.
|
||||||
usage: /enchant_advanced <enchantment> <level>
|
usage: /enchant_advanced <enchantment> <level>
|
||||||
permission: AutoPluginUpdate.enchant
|
permission: TwosideKeeper.enchant
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
harden_armor:
|
harden_armor:
|
||||||
description: Hardens a piece of armor.
|
description: Hardens a piece of armor.
|
||||||
usage: /harden_armor <breaks>
|
usage: /harden_armor <breaks>
|
||||||
permission: AutoPluginUpdate.harden
|
permission: TwosideKeeper.harden
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
item_cube:
|
item_cube:
|
||||||
description: Sets this item as an item cube.
|
description: Sets this item as an item cube.
|
||||||
usage: /item_cube <id>
|
usage: /item_cube <id>
|
||||||
permission: AutoPluginUpdate.item_cube
|
permission: TwosideKeeper.item_cube
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
artifact:
|
artifact:
|
||||||
description: Gives the player an artifact.
|
description: Gives the player an artifact.
|
||||||
usage: /artifact <ArtifactType> [amt]
|
usage: /artifact <ArtifactType> [amt]
|
||||||
permission: AutoPluginUpdate.artifact
|
permission: TwosideKeeper.artifact
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
recyclingcenter:
|
recyclingcenter:
|
||||||
description: Defines a new container for a Recycling Center.
|
description: Defines a new container for a Recycling Center.
|
||||||
usage: /recyclingcenter
|
usage: /recyclingcenter
|
||||||
permission: AutoPluginUpdate.recyclingcenter
|
permission: TwosideKeeper.recyclingcenter
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
glowingitem:
|
glowingitem:
|
||||||
description: Creates a new glowing item.
|
description: Creates a new glowing item.
|
||||||
usage: /glowingitem
|
usage: /glowingitem
|
||||||
permission: AutoPluginUpdate.glowingitem
|
permission: TwosideKeeper.glowingitem
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
sound:
|
sound:
|
||||||
description: Toggle sound message notifications.
|
description: Toggle sound message notifications.
|
||||||
usage: /sound
|
usage: /sound
|
||||||
permission: AutoPluginUpdate.sound
|
permission: TwosideKeeper.sound
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
log:
|
log:
|
||||||
description: Adjusts the debugging log level for AutoPluginUpdate in the console.
|
description: Adjusts the debugging log level for TwosideKeeper in the console.
|
||||||
usage: /log
|
usage: /log
|
||||||
permission: AutoPluginUpdate.log
|
permission: TwosideKeeper.log
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
servertype:
|
servertype:
|
||||||
description: Sets the server type to another type.
|
description: Sets the server type to another type.
|
||||||
usage: /servertype <MAIN|TEST|QUIET>
|
usage: /servertype <MAIN|TEST|QUIET>
|
||||||
permission: AutoPluginUpdate.servertype
|
permission: TwosideKeeper.servertype
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
ess:
|
ess:
|
||||||
description: Generates a Mysterious Essence report.
|
description: Generates a Mysterious Essence report.
|
||||||
usage: /ess
|
usage: /ess
|
||||||
permission: AutoPluginUpdate.report
|
permission: TwosideKeeper.report
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
bow:
|
bow:
|
||||||
description: Generates a Bow report.
|
description: Generates a Bow report.
|
||||||
usage: /bow
|
usage: /bow
|
||||||
permission: AutoPluginUpdate.report
|
permission: TwosideKeeper.report
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
loot:
|
loot:
|
||||||
description: Generates a Loot report.
|
description: Generates a Loot report.
|
||||||
usage: /loot
|
usage: /loot
|
||||||
permission: AutoPluginUpdate.report
|
permission: TwosideKeeper.report
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
mega:
|
mega:
|
||||||
description: Generates a Mega Piece.
|
description: Generates a Mega Piece.
|
||||||
usage: /mega <MATERIAL> <false|true>
|
usage: /mega <MATERIAL> <false|true>
|
||||||
permission: AutoPluginUpdate.mega
|
permission: TwosideKeeper.mega
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
fix:
|
fix:
|
||||||
description: Does many things depending on what item is being held. Typically if it's broken, typing this will help.
|
description: Does many things depending on what item is being held. Typically if it's broken, typing this will help.
|
||||||
usage: /fix
|
usage: /fix
|
||||||
permission: AutoPluginUpdate.fix
|
permission: TwosideKeeper.fix
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
tp_world:
|
tp_world:
|
||||||
description: Teleports to a location in a specified world.
|
description: Teleports to a location in a specified world.
|
||||||
usage: /tp_world <world> <x> <y> <z>
|
usage: /tp_world <world> <x> <y> <z>
|
||||||
permission: AutoPluginUpdate.tp_world
|
permission: TwosideKeeper.tp_world
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
stats:
|
stats:
|
||||||
description: Display statistics for damage and defense.
|
description: Display statistics for damage and defense.
|
||||||
usage: /stats [username]
|
usage: /stats [username]
|
||||||
permission: AutoPluginUpdate.money
|
permission: TwosideKeeper.money
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
awakenedartifact:
|
awakenedartifact:
|
||||||
description: Used for upgrading awakened artifacts.
|
description: Used for upgrading awakened artifacts.
|
||||||
usage: /awakenedartifact
|
usage: /awakenedartifact
|
||||||
permission: AutoPluginUpdate.money
|
permission: TwosideKeeper.money
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
awakenedartifact_ability:
|
awakenedartifact_ability:
|
||||||
description: Apply an awakened artifact ability to an item.
|
description: Apply an awakened artifact ability to an item.
|
||||||
usage: /awakenedartifact_ability <ABILITY> <level>
|
usage: /awakenedartifact_ability <ABILITY> <level>
|
||||||
permission: AutoPluginUpdate.artifact
|
permission: TwosideKeeper.artifact
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
mode:
|
mode:
|
||||||
description: Displays information about a mode.
|
description: Displays information about a mode.
|
||||||
usage: /mode <modename>
|
usage: /mode <modename>
|
||||||
permission: AutoPluginUpdate.money
|
permission: TwosideKeeper.money
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
dps:
|
dps:
|
||||||
description: DPS Logger.
|
description: DPS Logger.
|
||||||
usage: /dps
|
usage: /dps
|
||||||
permission: AutoPluginUpdate.money
|
permission: TwosideKeeper.money
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
muchlogsmuchwow:
|
muchlogsmuchwow:
|
||||||
description: D00d.
|
description: D00d.
|
||||||
usage: /muchlogsmuchwow
|
usage: /muchlogsmuchwow
|
||||||
permission: AutoPluginUpdate.muchlogsmuchwow
|
permission: TwosideKeeper.muchlogsmuchwow
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
make_set_item:
|
make_set_item:
|
||||||
description: Turns an item into a set.
|
description: Turns an item into a set.
|
||||||
usage: /make_set_item <SET> <TIER>
|
usage: /make_set_item <SET> <TIER>
|
||||||
permission: AutoPluginUpdate.makesetitem
|
permission: TwosideKeeper.makesetitem
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
||||||
craft:
|
craft:
|
||||||
description: Displays the crafting recipe for a custom item. Press Tab after typing /craft to see options.
|
description: Displays the crafting recipe for a custom item. Press Tab after typing /craft to see options.
|
||||||
usage: /craft ITEM
|
usage: /craft ITEM
|
||||||
permission: AutoPluginUpdate.money
|
permission: TwosideKeeper.money
|
||||||
|
permission-message: No permissions!
|
||||||
|
weather:
|
||||||
|
description: Toggles the sending of a weather warning message to the player.
|
||||||
|
usage: /weather <DISCORD NAME>
|
||||||
|
permission: TwosideKeeper.money
|
||||||
|
permission-message: No permissions!
|
||||||
|
ready:
|
||||||
|
description: Ready up for the tree climbing race.
|
||||||
|
usage: /ready
|
||||||
|
permission: TwosideKeeper.money
|
||||||
permission-message: No permissions!
|
permission-message: No permissions!
|
@ -1,10 +1,12 @@
|
|||||||
package sig.plugin.TwosideKeeper;
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -23,7 +25,7 @@ public class DropDeathItems implements Runnable{
|
|||||||
this.p=p;
|
this.p=p;
|
||||||
this.deathloc=deathloc;
|
this.deathloc=deathloc;
|
||||||
this.contents=contents;
|
this.contents=contents;
|
||||||
this.inv_contents = Bukkit.createInventory(p, 36);
|
this.inv_contents = Bukkit.createInventory(p, 63);
|
||||||
for (ItemStack it : contents) {
|
for (ItemStack it : contents) {
|
||||||
if (it!=null) {
|
if (it!=null) {
|
||||||
inv_contents.addItem(it);
|
inv_contents.addItem(it);
|
||||||
@ -34,7 +36,14 @@ public class DropDeathItems implements Runnable{
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!AttemptToDropItems(p,deathloc)) {
|
if (!AttemptToDropItems(p,deathloc)) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new DropDeathItems(p,contents,deathloc),1); //Keep trying until the chunk is loaded!!!
|
TwosideKeeper.log("Re-running...",0);
|
||||||
|
List<ItemStack> tempcontents = new ArrayList<ItemStack>();
|
||||||
|
for (ItemStack it : inv_contents.getContents()) {
|
||||||
|
if (it!=null && it.getType()!=Material.AIR) {
|
||||||
|
tempcontents.add(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin,new DropDeathItems(p,tempcontents,deathloc),1); //Keep trying until the chunk is loaded!!!
|
||||||
TwosideKeeper.temporary_chunks.clear();
|
TwosideKeeper.temporary_chunks.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,13 +56,16 @@ public class DropDeathItems implements Runnable{
|
|||||||
while (!InventoryUtils.hasEmptyInventory(inv_contents)) {
|
while (!InventoryUtils.hasEmptyInventory(inv_contents)) {
|
||||||
if (deathloc.getChunk().isLoaded()) {
|
if (deathloc.getChunk().isLoaded()) {
|
||||||
Item it = deathloc.getWorld().dropItemNaturally(deathloc, InventoryUtils.getFirstItemThatIsNotEmpty(inv_contents));
|
Item it = deathloc.getWorld().dropItemNaturally(deathloc, InventoryUtils.getFirstItemThatIsNotEmpty(inv_contents));
|
||||||
if (it!=null) {
|
it.setInvulnerable(true);
|
||||||
|
if (it!=null && it.isValid()) {
|
||||||
inv_contents.removeItem(it.getItemStack());
|
inv_contents.removeItem(it.getItemStack());
|
||||||
TwosideKeeper.log("Dropping "+it.getItemStack().toString()+" at Death location "+deathloc,2);
|
TwosideKeeper.log("Dropping "+it.getItemStack().toString()+" at Death location "+deathloc,2);
|
||||||
} else {
|
} else {
|
||||||
|
TwosideKeeper.log("Item did not spawn! Will try again.",0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
TwosideKeeper.log("Chunk is not loaded! Will try again.",0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1376,6 +1376,9 @@ public class GenericFunctions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case MYCEL:{
|
||||||
|
return "Mycelium";
|
||||||
|
}
|
||||||
case HARD_CLAY:{
|
case HARD_CLAY:{
|
||||||
return "Hardened Clay";
|
return "Hardened Clay";
|
||||||
}
|
}
|
||||||
@ -3206,9 +3209,19 @@ public class GenericFunctions {
|
|||||||
UpdateHuntersCompass(item);
|
UpdateHuntersCompass(item);
|
||||||
UpdateUpgradeShard(item);
|
UpdateUpgradeShard(item);
|
||||||
UpdateOldQuivers(item);
|
UpdateOldQuivers(item);
|
||||||
|
UpdateItemCubeContentsList(item);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO Item Cube Contents list.
|
||||||
|
private static void UpdateItemCubeContentsList(ItemStack item) {
|
||||||
|
/*if (ItemUtils.isValidLoreItem(item) &&
|
||||||
|
item.getItemMeta().getLore().size()>=4 &&
|
||||||
|
) {
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
private static void UpdateOldQuivers(ItemStack item) {
|
private static void UpdateOldQuivers(ItemStack item) {
|
||||||
if (item!=null &&
|
if (item!=null &&
|
||||||
item.getType()==Material.TIPPED_ARROW &&
|
item.getType()==Material.TIPPED_ARROW &&
|
||||||
|
@ -28,7 +28,7 @@ public enum RecipeLinker {
|
|||||||
eic(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Ender Item Cube",new ItemStack[]{
|
eic(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Ender Item Cube",new ItemStack[]{
|
||||||
CustomItem.EnderItemCube(),
|
CustomItem.EnderItemCube(),
|
||||||
new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),
|
new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),
|
||||||
new ItemStack(Material.EMERALD),new ItemStack(Material.CHEST),new ItemStack(Material.EMERALD),
|
new ItemStack(Material.EMERALD),new ItemStack(Material.ENDER_CHEST),new ItemStack(Material.EMERALD),
|
||||||
new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),
|
new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),new ItemStack(Material.OBSIDIAN),
|
||||||
}),
|
}),
|
||||||
vacuumcube(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Vacuum Cube",new ItemStack[]{
|
vacuumcube(RecipeCategory.CONTAINERS,ChatColor.YELLOW,"Vacuum Cube",new ItemStack[]{
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||||
|
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
public class BiomeUtils {
|
||||||
|
|
||||||
|
public static boolean isColdBiome(Biome biome) {
|
||||||
|
return (biome==Biome.ICE_FLATS ||
|
||||||
|
biome==Biome.ICE_MOUNTAINS ||
|
||||||
|
biome==Biome.MUTATED_ICE_FLATS ||
|
||||||
|
biome==Biome.TAIGA_COLD ||
|
||||||
|
biome==Biome.TAIGA_COLD_HILLS ||
|
||||||
|
biome==Biome.FROZEN_RIVER ||
|
||||||
|
biome==Biome.COLD_BEACH ||
|
||||||
|
biome==Biome.FROZEN_OCEAN);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||||
|
|
||||||
|
public enum DirtBlockReply {
|
||||||
|
HOLDING5DIRT,
|
||||||
|
NOTENOUGHDIRT,
|
||||||
|
TOOMUCHDIRT,
|
||||||
|
NOTEMPTYINVENTORY
|
||||||
|
}
|
@ -15,6 +15,7 @@ import sig.plugin.TwosideKeeper.TwosideKeeper;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
|
import sig.plugin.TwosideKeeper.HelperStructures.CubeType;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
|
import sig.plugin.TwosideKeeper.HelperStructures.CustomItem;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
|
import sig.plugin.TwosideKeeper.HelperStructures.ItemCube;
|
||||||
|
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||||
|
|
||||||
public class InventoryUtils {
|
public class InventoryUtils {
|
||||||
public static boolean isCarryingVacuumCube(Player p) {
|
public static boolean isCarryingVacuumCube(Player p) {
|
||||||
@ -130,4 +131,28 @@ public class InventoryUtils {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public static DirtBlockReply onlyHoldingFiveDirtBlocks(Player p) {
|
||||||
|
Inventory inv = p.getInventory();
|
||||||
|
int dirtblockcount=0;
|
||||||
|
for (ItemStack i : inv.getContents()) {
|
||||||
|
if (i!=null) {
|
||||||
|
if (i.getType()==Material.DIRT) {
|
||||||
|
dirtblockcount+=i.getAmount();
|
||||||
|
} else {
|
||||||
|
if (!Christmas.isCookieItem(i)) {
|
||||||
|
return DirtBlockReply.NOTEMPTYINVENTORY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dirtblockcount==5) {
|
||||||
|
return DirtBlockReply.HOLDING5DIRT;
|
||||||
|
} else
|
||||||
|
if (dirtblockcount<5) {
|
||||||
|
return DirtBlockReply.NOTENOUGHDIRT;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return DirtBlockReply.TOOMUCHDIRT;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,4 +81,14 @@ public class ItemCubeUtils {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public static boolean isItemCubeMaterial(Material mat) {
|
||||||
|
if (mat==Material.CHEST ||
|
||||||
|
mat==Material.ENDER_CHEST ||
|
||||||
|
mat==Material.HOPPER_MINECART ||
|
||||||
|
mat==Material.STORAGE_MINECART) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HelperStructures.Utils;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
public class TextUtils {
|
||||||
|
|
||||||
|
public static ChatColor RandomColor() {
|
||||||
|
ChatColor[] colors = {ChatColor.AQUA,
|
||||||
|
ChatColor.BLACK,
|
||||||
|
ChatColor.BLUE,ChatColor.DARK_AQUA,
|
||||||
|
ChatColor.DARK_BLUE,ChatColor.DARK_GRAY,
|
||||||
|
ChatColor.DARK_GREEN,ChatColor.DARK_PURPLE,
|
||||||
|
ChatColor.DARK_RED,ChatColor.GOLD,
|
||||||
|
ChatColor.GRAY,ChatColor.GREEN,
|
||||||
|
ChatColor.LIGHT_PURPLE,ChatColor.RED,
|
||||||
|
ChatColor.WHITE,ChatColor.YELLOW};
|
||||||
|
|
||||||
|
return colors[((int)(Math.random()*colors.length))];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
238
src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
Normal file
238
src/sig/plugin/TwosideKeeper/HolidayEvents/Christmas.java
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HolidayEvents;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.Chest;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Snowman;
|
||||||
|
import org.bukkit.event.Event.Result;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import aPlugin.API.Chests;
|
||||||
|
import aPlugin.DropItem;
|
||||||
|
import aPlugin.DropMaterial;
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BiomeUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TextUtils;
|
||||||
|
|
||||||
|
public class Christmas {
|
||||||
|
public final static String CHRISTMAS_TAG = ChatColor.BLUE+"Christmas Event Item"+ChatColor.RESET;
|
||||||
|
|
||||||
|
public static void insertChristmasTag(ItemStack item) {
|
||||||
|
ItemUtils.addLore(item, CHRISTMAS_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getRocketBoosterItem() {
|
||||||
|
ItemStack item = new ItemStack(Material.FIREWORK);
|
||||||
|
ItemUtils.setDisplayName(item, ChatColor.DARK_AQUA+"Rocket Booster");
|
||||||
|
insertChristmasTag(item);
|
||||||
|
ItemUtils.addLore(item, "A Launcher that shoots you");
|
||||||
|
ItemUtils.addLore(item, "extremely fast in your facing");
|
||||||
|
ItemUtils.addLore(item, "direction. Slowly recharges");
|
||||||
|
ItemUtils.addLore(item, "over time if kept on the hotbar.");
|
||||||
|
item.addUnsafeEnchantment(Enchantment.LUCK, 0);
|
||||||
|
ItemUtils.hideEnchantments(item);
|
||||||
|
return item.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRocketBoosterItem(ItemStack item) {
|
||||||
|
return ItemUtils.isValidLoreItem(item) && item.getType()==Material.FIREWORK && ItemUtils.LoreContains(item, CHRISTMAS_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getCookieItem() {
|
||||||
|
ItemStack item = new ItemStack(Material.COOKIE);
|
||||||
|
ItemUtils.setDisplayName(item, ChatColor.AQUA+"Holiday Cookie");
|
||||||
|
ItemUtils.addLore(item, ChatColor.WHITE+"Heals"+ChatColor.YELLOW+" 256 "+ChatColor.RESET+"health.");
|
||||||
|
ItemUtils.addLore(item, ChatColor.GRAY+"- Strength II (15:00)");
|
||||||
|
ItemUtils.addLore(item, ChatColor.GRAY+"- Resistance II (15:00)");
|
||||||
|
ItemUtils.addLore(item, ChatColor.GRAY+"- Regeneration III (15:00)");
|
||||||
|
ItemUtils.addLore(item, ChatColor.GRAY+"- Saturation (5:00)");
|
||||||
|
ItemUtils.addLore(item, "");
|
||||||
|
insertChristmasTag(item);
|
||||||
|
ItemUtils.addLore(item, "A sweet and delicious cookie");
|
||||||
|
ItemUtils.addLore(item, "that provides wonderful buffs.");
|
||||||
|
return item.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isCookieItem(ItemStack item) {
|
||||||
|
return ItemUtils.isValidLoreItem(item) && item.getType()==Material.COOKIE && ItemUtils.LoreContains(item, CHRISTMAS_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getChristmasEventToken() {
|
||||||
|
ItemStack item = new ItemStack(Material.COMMAND_REPEATING);
|
||||||
|
ItemUtils.setDisplayName(item, ChatColor.AQUA+"Christmas Token");
|
||||||
|
insertChristmasTag(item);
|
||||||
|
ItemUtils.addLore(item, "A token used to obtain special");
|
||||||
|
ItemUtils.addLore(item, "treats and goodies for the Christmas");
|
||||||
|
ItemUtils.addLore(item, "event. Turn in tokens to the ");
|
||||||
|
ItemUtils.addLore(item, "Twoside Bank Tree.");
|
||||||
|
ItemUtils.addLore(item, "");
|
||||||
|
return item.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isChristmasEventToken(ItemStack item) {
|
||||||
|
return ItemUtils.isValidLoreItem(item) && item.getType()==Material.COMMAND_REPEATING && ItemUtils.LoreContains(item, CHRISTMAS_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getChristmasTreeSchematic() {
|
||||||
|
ItemStack item = new ItemStack(Material.PAPER);
|
||||||
|
ItemUtils.setDisplayName(item, ChatColor.AQUA+"Christmas Tree Schematic");
|
||||||
|
insertChristmasTag(item);
|
||||||
|
ItemUtils.addLore(item, "A blueprint for the creation of an");
|
||||||
|
ItemUtils.addLore(item, "excellent Christmas Tree. Must be");
|
||||||
|
ItemUtils.addLore(item, "placed on a proper Tree plot to");
|
||||||
|
ItemUtils.addLore(item, "grow.");
|
||||||
|
return item.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isChristmasTreeSchematic(ItemStack item) {
|
||||||
|
return ItemUtils.isValidLoreItem(item) && item.getType()==Material.PAPER && ItemUtils.LoreContains(item, CHRISTMAS_TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void InitializeChristmasBox() {
|
||||||
|
Chests c = aPlugin.API.Chests.LOOT_CUSTOM_2;
|
||||||
|
c.addDrop(new DropMaterial(Material.COAL,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.IRON_INGOT,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.GOLD_INGOT,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.REDSTONE,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.GLOWSTONE_DUST,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.QUARTZ,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.INK_SACK,1,4,10,(short)4));
|
||||||
|
c.addDrop(new DropMaterial(Material.DIAMOND,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.EMERALD,1,4,10));
|
||||||
|
c.addDrop(new DropMaterial(Material.COAL_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.IRON_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.GOLD_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.REDSTONE_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.GLOWSTONE,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.QUARTZ_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.LAPIS_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.DIAMOND_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropMaterial(Material.EMERALD_BLOCK,1,4,5));
|
||||||
|
c.addDrop(new DropItem(getCookieItem(),1,3,5));
|
||||||
|
c.addDrop(new DropItem(getChristmasEventToken(),10));
|
||||||
|
//aPlugin.API.getChestItem(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean RunPlayerInteractEvent(PlayerInteractEvent ev) {
|
||||||
|
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
|
||||||
|
Player p = ev.getPlayer();
|
||||||
|
if (ev.getAction()==Action.RIGHT_CLICK_BLOCK) {
|
||||||
|
Block b = ev.getClickedBlock();
|
||||||
|
if (b.getType()==Material.SMOOTH_BRICK && isChristmasTreeSchematic(p.getEquipment().getItemInMainHand())) {
|
||||||
|
//Remove the item from the player.
|
||||||
|
p.getEquipment().setItemInMainHand(new ItemStack(Material.AIR));
|
||||||
|
//Plant a tree.
|
||||||
|
TreeBuilder.BuildNewTree(b.getLocation().add(15,1,15), 12, 13, 0);
|
||||||
|
p.sendMessage(ChatColor.AQUA+"You place the schematic down...");
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{p.sendMessage(ChatColor.GREEN+" Magic seems to activate inside the ground.");},5);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{b.setType(Material.HOPPER);},2);
|
||||||
|
Block babove = b.getRelative(0, 1, 0);
|
||||||
|
Block bbelow = b.getRelative(0, -1, 0);
|
||||||
|
bbelow.setType(Material.CHEST);
|
||||||
|
babove.setType(Material.SIGN_POST);
|
||||||
|
Sign s = (Sign)babove.getState();
|
||||||
|
s.setLine(1, RandomDarkColor()+p.getName()+"'s");
|
||||||
|
s.setLine(2, "Tree");
|
||||||
|
s.setRawData((byte)4);
|
||||||
|
s.update();
|
||||||
|
ev.setUseInteractedBlock(Result.DENY);
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ChatColor RandomDarkColor() {
|
||||||
|
ChatColor[] choices = new ChatColor[]{ChatColor.DARK_AQUA,ChatColor.DARK_BLUE,ChatColor.DARK_GRAY,ChatColor.DARK_GREEN,ChatColor.DARK_PURPLE,ChatColor.DARK_RED,ChatColor.GOLD};
|
||||||
|
return choices[(int)(Math.random()*choices.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ChristmasHeartbeat() {
|
||||||
|
int range = 8;
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
|
//Check a random block around the player.
|
||||||
|
int blockx = (int)(Math.random()*(range*2))-range;
|
||||||
|
int blockz = (int)(Math.random()*(range*2))-range;
|
||||||
|
Block b = p.getWorld().getHighestBlockAt(p.getLocation().getBlockX()+blockx, p.getLocation().getBlockZ()+blockz);
|
||||||
|
Block bbelow = b.getRelative(0, -1, 0);
|
||||||
|
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
|
||||||
|
if (b.getType()==Material.AIR && bbelow.getType().isSolid() && !bbelow.getType().name().contains("STEP") && b.getTemperature()<=0.95) {
|
||||||
|
b.setType(Material.SNOW);
|
||||||
|
b.setData((byte)0);
|
||||||
|
if (TwosideKeeper.last_snow_golem+TwosideKeeper.SNOW_GOLEM_COOLDOWN<TwosideKeeper.getServerTickTime()) {
|
||||||
|
//There might be a chance to spawn one of these.
|
||||||
|
List<Entity> nearbyents = p.getNearbyEntities(32, 24, 32);
|
||||||
|
boolean snowmannearby=false;
|
||||||
|
for (Entity ent : nearbyents) {
|
||||||
|
if (ent instanceof Snowman) {
|
||||||
|
snowmannearby=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!snowmannearby) {
|
||||||
|
//Spawn one on the snow.
|
||||||
|
Snowman snowy = (Snowman)p.getWorld().spawnEntity(b.getLocation().add(0,2,0), EntityType.SNOWMAN);
|
||||||
|
snowy.setCustomName(RandomSnowmanName());
|
||||||
|
snowy.setMaxHealth(Math.random()*100+20);
|
||||||
|
snowy.setHealth(snowy.getMaxHealth());
|
||||||
|
snowy.setAI(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (b.getType()==Material.SNOW && b.getData()<7) {
|
||||||
|
b.setData((byte)(b.getData()+1));
|
||||||
|
}
|
||||||
|
}/* else { //Unnecessary. Snow will automatically melt.
|
||||||
|
if (b.getType()==Material.SNOW && b.getTemperature()>0.15) {
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String RandomSnowmanName() {
|
||||||
|
String[] name1 = {"Jingle","Merry","Bells",
|
||||||
|
"Tinkle","Angel","Twinkle",
|
||||||
|
"Rosie","Holly","Berry",
|
||||||
|
"Festive","Candy","Magic",
|
||||||
|
"Sparkle","Sugarplum","Joy",
|
||||||
|
"Tinsel","Robin","Cookie",
|
||||||
|
"Hope","Sweetie","Teddy",
|
||||||
|
"Jolly","Cosy","Sherry",
|
||||||
|
"Eve","Pinky"};
|
||||||
|
String[] name2 = {"McSnowy","McSlushy","McChilly",
|
||||||
|
"McGlisten","McSparkle","McFrosty",
|
||||||
|
"McFreeze","McSnowballs","McIcicles",
|
||||||
|
"McBlizzard","McSparkles","McSnowflake"};
|
||||||
|
|
||||||
|
ChatColor col = TextUtils.RandomColor();
|
||||||
|
|
||||||
|
return col+name1[(int)(Math.random()*name1.length)]+" "+name2[(int)(Math.random()*name2.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean ChristmasDamageEvent(EntityDamageEvent ev) {
|
||||||
|
if (TwosideKeeper.CHRISTMASEVENT_ACTIVATED) {
|
||||||
|
if (ev.getCause()==DamageCause.MELTING && (ev.getEntity() instanceof Snowman)) {
|
||||||
|
ev.setCancelled(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
163
src/sig/plugin/TwosideKeeper/HolidayEvents/TreeBuilder.java
Normal file
163
src/sig/plugin/TwosideKeeper/HolidayEvents/TreeBuilder.java
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
package sig.plugin.TwosideKeeper.HolidayEvents;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
|
||||||
|
|
||||||
|
public class TreeBuilder{
|
||||||
|
int height = 8;
|
||||||
|
double radius = 10;
|
||||||
|
double initialradius = 10;
|
||||||
|
int branches = 10;
|
||||||
|
int spacing = 3;
|
||||||
|
int baserad = 0;
|
||||||
|
Location loc;
|
||||||
|
|
||||||
|
public static TreeBuilder BuildNewTree(Location loc, int height, double radius, int baseradius) {
|
||||||
|
TreeBuilder builder = new TreeBuilder(loc,height,radius,baseradius);
|
||||||
|
builder.BuildTree();
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeBuilder(Location loc, int height, double radius, int baseradius) {
|
||||||
|
this.height=height;
|
||||||
|
this.radius=radius;
|
||||||
|
this.initialradius=radius;
|
||||||
|
this.branches=height+2;
|
||||||
|
this.loc=loc.clone();
|
||||||
|
this.baserad=baseradius;
|
||||||
|
this.spacing=height/6+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BuildTree() {
|
||||||
|
//BuildTreeBase(loc,baserad,height*spacing);
|
||||||
|
for (int y=0;y<height;y++) {
|
||||||
|
//int buildy = (y*spacing)+spacing;
|
||||||
|
|
||||||
|
if ((double)radius/4<baserad) {
|
||||||
|
BuildTreeBase(loc,0,spacing);
|
||||||
|
} else {
|
||||||
|
BuildTreeBase(loc,baserad,spacing);
|
||||||
|
}
|
||||||
|
|
||||||
|
loc.add(0, spacing, 0);
|
||||||
|
double randoffsetdir = java.util.concurrent.ThreadLocalRandom.current().nextDouble()*360;
|
||||||
|
for (int split=branches;split>0;split--) {
|
||||||
|
double randminoroffsetdir = (java.util.concurrent.ThreadLocalRandom.current().nextDouble()*(360/(double)branches))/4;
|
||||||
|
TreeBranch branch = new TreeBranch(loc,(360/(double)branches)*(double)split+randoffsetdir+randminoroffsetdir,radius);
|
||||||
|
branch.build();
|
||||||
|
}
|
||||||
|
radius-=(initialradius/(double)height);
|
||||||
|
branches--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildTreeBase(Location loc, int width, int height) {
|
||||||
|
Location currentloc = loc.clone().add(-1,0,-1);
|
||||||
|
for (int i=0;i<height;i++) {
|
||||||
|
for (int x=-(width-1);x<=width+1;x++) {
|
||||||
|
for (int z=-(width-1);z<=width+1;z++) {
|
||||||
|
Block b = currentloc.clone().add(x, 0, z).getBlock();
|
||||||
|
if (b.getType()==Material.AIR || b.getType()==Material.SNOW || b.getType()==Material.LEAVES) {
|
||||||
|
b.setType(Material.LOG);
|
||||||
|
b.setData((byte)13);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentloc.add(0,1,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TreeBranch{
|
||||||
|
double dir; //0-360 degrees.
|
||||||
|
double length;
|
||||||
|
int twigs;
|
||||||
|
Location baseloc;
|
||||||
|
TreeBranch(Location loc, double dir, double length) {
|
||||||
|
this.dir=dir;
|
||||||
|
this.length=length;
|
||||||
|
this.baseloc=loc.clone();
|
||||||
|
this.twigs=(int)length/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void build() {
|
||||||
|
//Builds a line of blocks for this branch based on given dir and length.
|
||||||
|
double velx = Math.sin(Math.toRadians(dir));
|
||||||
|
double vely = java.util.concurrent.ThreadLocalRandom.current().nextDouble()*0.1-0.2;
|
||||||
|
double velz = Math.cos(Math.toRadians(dir));
|
||||||
|
double x = velx; //Offset X.
|
||||||
|
double z = velz; //Offset Z.
|
||||||
|
double y = vely;
|
||||||
|
for (int i=0;i<length;i++) {
|
||||||
|
Location newloc = baseloc.clone();
|
||||||
|
Block b = newloc.add(x, y, z).getBlock();
|
||||||
|
/*if (b.getType()==Material.AIR) {
|
||||||
|
b.setType(Material.LEAVES);
|
||||||
|
b.setData((byte)5);
|
||||||
|
}*/
|
||||||
|
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,Material.AIR,(byte)0,Material.LEAVES,(byte)5));
|
||||||
|
if (Math.random()<=0.4) {
|
||||||
|
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b.getRelative(0, 1, 0),Material.AIR,(byte)0,Material.SNOW,(byte)0));
|
||||||
|
} else
|
||||||
|
if (Math.random()<=0.1) {
|
||||||
|
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b.getRelative(0, 1, 0),Material.AIR,(byte)0,Material.SNOW,(byte)1));
|
||||||
|
}
|
||||||
|
if (Math.random()<=0.1) {
|
||||||
|
TreeTwig twig = new TreeTwig(newloc,(int)(java.util.concurrent.ThreadLocalRandom.current().nextDouble()*twigs),length/4);
|
||||||
|
twig.CreateTwigs();
|
||||||
|
}
|
||||||
|
x+=velx;
|
||||||
|
y+=vely;
|
||||||
|
z+=velz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TreeTwig{
|
||||||
|
//Creates a fan of leaves projecting outward from a branch.
|
||||||
|
Location loc;
|
||||||
|
int split; //Number of splits.
|
||||||
|
double length; //Length in meters.
|
||||||
|
TreeTwig(Location loc, int twigs, double length) {
|
||||||
|
this.loc=loc.clone();
|
||||||
|
this.split=twigs;
|
||||||
|
this.length=length;
|
||||||
|
}
|
||||||
|
void CreateTwigs() {
|
||||||
|
double randoffsetdir = java.util.concurrent.ThreadLocalRandom.current().nextDouble()*360;
|
||||||
|
for (int i=0;i<split;i++) {
|
||||||
|
Location newloc = loc.clone();
|
||||||
|
double dir = (double)360/split*i+randoffsetdir;
|
||||||
|
double randspread = (java.util.concurrent.ThreadLocalRandom.current().nextDouble()*length)-(length/2);
|
||||||
|
double angle = Math.atan2(Math.sin(dir), Math.cos(dir));
|
||||||
|
double angle2 = Math.atan2(randspread, length);
|
||||||
|
double xvel = Math.sin(angle);
|
||||||
|
double yvel = Math.sin(angle2);
|
||||||
|
double zvel = Math.cos(angle);
|
||||||
|
for (int j=0;j<length;j++) {
|
||||||
|
Block b = newloc.add(xvel,yvel,zvel).getBlock();
|
||||||
|
/*if (b.getType()==Material.AIR) {
|
||||||
|
b.setType(Material.LEAVES);
|
||||||
|
b.setData((byte)4);
|
||||||
|
}*/
|
||||||
|
if (b.getType()==Material.AIR) {
|
||||||
|
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b,Material.AIR,(byte)0,Material.LEAVES,(byte)4));
|
||||||
|
if (Math.random()<=0.2) {
|
||||||
|
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b.getRelative(0, 1, 0),Material.AIR,(byte)0,Material.SNOW,(byte)0));
|
||||||
|
} else
|
||||||
|
if (Math.random()<=0.1) {
|
||||||
|
TwosideKeeper.blockqueue.add(new BlockModifyQueue(b.getRelative(0, 1, 0),Material.AIR,(byte)0,Material.SNOW,(byte)1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -922,7 +922,7 @@ public class MonsterController {
|
|||||||
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
SetupCustomName(ChatColor.GOLD+"Deadly",m);
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",0);
|
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||||
m.setMaxHealth(1200); //Target is 1200 HP.
|
m.setMaxHealth(1200); //Target is 1200 HP.
|
||||||
m.setHealth(m.getMaxHealth());
|
m.setHealth(m.getMaxHealth());
|
||||||
@ -956,7 +956,7 @@ public class MonsterController {
|
|||||||
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
SetupCustomName(ChatColor.DARK_RED+"Hellfire",m);
|
||||||
if(isZombieLeader(m))
|
if(isZombieLeader(m))
|
||||||
{
|
{
|
||||||
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",0);
|
TwosideKeeper.log(" Converting "+GenericFunctions.GetEntityDisplayName(m)+" to Leader.",TwosideKeeper.SPAWN_DEBUG_LEVEL);
|
||||||
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
m.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,Integer.MAX_VALUE,8));
|
||||||
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
LivingEntityStructure ms = LivingEntityStructure.getLivingEntityStructure(m);
|
||||||
ms.SetLeader(true);
|
ms.SetLeader(true);
|
||||||
@ -1226,7 +1226,7 @@ public class MonsterController {
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removeZombieLeaderAttribute(LivingEntity m) {
|
public static void removeZombieLeaderAttribute(LivingEntity m) {
|
||||||
final AttributeInstance attribute = m.getAttribute(Attribute.GENERIC_MAX_HEALTH);
|
final AttributeInstance attribute = m.getAttribute(Attribute.GENERIC_MAX_HEALTH);
|
||||||
final Collection<AttributeModifier> modifiers = attribute.getModifiers();
|
final Collection<AttributeModifier> modifiers = attribute.getModifiers();
|
||||||
for (AttributeModifier modifier : modifiers) {
|
for (AttributeModifier modifier : modifiers) {
|
||||||
|
@ -122,6 +122,8 @@ public class PlayerStructure {
|
|||||||
public long lastvendettastack=0;
|
public long lastvendettastack=0;
|
||||||
public long lastlavaplume=0;
|
public long lastlavaplume=0;
|
||||||
public long usetimer=0;
|
public long usetimer=0;
|
||||||
|
public boolean weatherwatch=false;
|
||||||
|
public String weatherwatch_user="";
|
||||||
|
|
||||||
public long iframetime = 0;
|
public long iframetime = 0;
|
||||||
|
|
||||||
@ -294,6 +296,8 @@ public class PlayerStructure {
|
|||||||
workable.set("weaponcharges", weaponcharges);
|
workable.set("weaponcharges", weaponcharges);
|
||||||
workable.set("damagepool", damagepool);
|
workable.set("damagepool", damagepool);
|
||||||
workable.set("vendetta_amt", vendetta_amt);
|
workable.set("vendetta_amt", vendetta_amt);
|
||||||
|
workable.set("weatherwatch", weatherwatch);
|
||||||
|
workable.set("weatherwatch_user", weatherwatch_user);
|
||||||
//ConfigurationSection deathlootlist = workable.createSection("deathloot");
|
//ConfigurationSection deathlootlist = workable.createSection("deathloot");
|
||||||
if (DeathManager.deathStructureExists(Bukkit.getPlayer(name))) {
|
if (DeathManager.deathStructureExists(Bukkit.getPlayer(name))) {
|
||||||
DeathStructure ds = DeathManager.getDeathStructure(Bukkit.getPlayer(name));
|
DeathStructure ds = DeathManager.getDeathStructure(Bukkit.getPlayer(name));
|
||||||
@ -342,6 +346,8 @@ public class PlayerStructure {
|
|||||||
workable.addDefault("weaponcharges", weaponcharges);
|
workable.addDefault("weaponcharges", weaponcharges);
|
||||||
workable.addDefault("lifestealstacks", lifestealstacks);
|
workable.addDefault("lifestealstacks", lifestealstacks);
|
||||||
workable.addDefault("vendetta_amt", vendetta_amt);
|
workable.addDefault("vendetta_amt", vendetta_amt);
|
||||||
|
workable.addDefault("weatherwatch", weatherwatch);
|
||||||
|
workable.addDefault("weatherwatch_user", weatherwatch_user);
|
||||||
|
|
||||||
workable.options().copyDefaults();
|
workable.options().copyDefaults();
|
||||||
|
|
||||||
@ -369,6 +375,8 @@ public class PlayerStructure {
|
|||||||
this.weaponcharges = workable.getInt("weaponcharges");
|
this.weaponcharges = workable.getInt("weaponcharges");
|
||||||
this.lastattacked = TwosideKeeper.getServerTickTime();
|
this.lastattacked = TwosideKeeper.getServerTickTime();
|
||||||
this.lastcombat = TwosideKeeper.getServerTickTime();
|
this.lastcombat = TwosideKeeper.getServerTickTime();
|
||||||
|
this.weatherwatch = workable.getBoolean("weatherwatch");
|
||||||
|
this.weatherwatch_user = workable.getString("weatherwatch_user");
|
||||||
|
|
||||||
if (this.hasDied) {
|
if (this.hasDied) {
|
||||||
List<ItemStack> deathlootlist = new ArrayList<ItemStack>();
|
List<ItemStack> deathlootlist = new ArrayList<ItemStack>();
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||||
@ -175,24 +176,23 @@ public class RecyclingCenter {
|
|||||||
b.getType()==Material.TRAPPED_CHEST) {
|
b.getType()==Material.TRAPPED_CHEST) {
|
||||||
if (b.getState()!=null) {
|
if (b.getState()!=null) {
|
||||||
Chest c = (Chest) b.getState();
|
Chest c = (Chest) b.getState();
|
||||||
for (int j=0;j<27;j++) {
|
int itemslot = RandomlyChooseEmptySpot(c.getBlockInventory());
|
||||||
if (c.getBlockInventory().getItem(j)!=null && c.getBlockInventory().getItem(j).getType()==i.getType()) {
|
//ItemStack oldItem = c.getBlockInventory().getItem(itemslot);
|
||||||
}
|
|
||||||
}
|
|
||||||
int itemslot = (int)Math.floor(Math.random()*27);
|
|
||||||
ItemStack oldItem = c.getBlockInventory().getItem(itemslot);
|
|
||||||
//There is also a chance to move this item to another random spot.
|
//There is also a chance to move this item to another random spot.
|
||||||
if (!isCommon(i.getType()) || mustBeRecycled(i)) {
|
if (!isCommon(i.getType()) || mustBeRecycled(i)) {
|
||||||
if (oldItem!=null && (Math.random()*100<=TwosideKeeper.RECYCLECHANCE || mustBeRecycled(i))) {
|
/*if (oldItem!=null && (Math.random()*100<=TwosideKeeper.RECYCLECHANCE || mustBeRecycled(i))) {
|
||||||
int itemslot2 = (int)Math.floor(Math.random()*27);
|
int itemslot2 = (int)Math.floor(Math.random()*27);
|
||||||
c.getBlockInventory().setItem(itemslot2, oldItem);
|
c.getBlockInventory().setItem(itemslot2, oldItem);
|
||||||
}
|
}*/
|
||||||
c.getBlockInventory().setItem(itemslot, i);
|
c.getBlockInventory().setItem(itemslot, i);
|
||||||
populateItemList(i);
|
populateItemList(i);
|
||||||
if (TwosideKeeper.LOGGING_LEVEL>=3) {
|
if (TwosideKeeper.LOGGING_LEVEL>=2) {
|
||||||
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i)+((i.getAmount()>1)?ChatColor.YELLOW+" x"+i.getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),2);
|
TwosideKeeper.log("Sent "+ChatColor.AQUA+i.toString()+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),2);
|
||||||
} else {
|
} else {
|
||||||
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i)+((i.getAmount()>1)?ChatColor.YELLOW+" x"+i.getAmount():"")+ChatColor.RESET+" to Recycling Center.",2);
|
if (TwosideKeeper.LOGGING_LEVEL>=1) {
|
||||||
|
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i)+((i.getAmount()>1)?ChatColor.YELLOW+" x"+i.getAmount():"")+ChatColor.RESET+" to Recycling Center Node "+rand_node.toString(),1);
|
||||||
|
} else {
|
||||||
|
TwosideKeeper.log("Sent "+ChatColor.AQUA+GenericFunctions.UserFriendlyMaterialName(i)+((i.getAmount()>1)?ChatColor.YELLOW+" x"+i.getAmount():"")+ChatColor.RESET+" to Recycling Center.",0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,6 +202,21 @@ public class RecyclingCenter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int RandomlyChooseEmptySpot(Inventory blockInventory) {
|
||||||
|
int i=54;
|
||||||
|
while (i>0) {
|
||||||
|
int randomslot = (int)Math.floor(Math.random()*27);
|
||||||
|
ItemStack item = blockInventory.getItem(randomslot);
|
||||||
|
if (item==null || item.getType()==Material.AIR) {
|
||||||
|
//This is empty.
|
||||||
|
return randomslot;
|
||||||
|
}
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
return (int)Math.floor(Math.random()*27);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean mustBeRecycled(ItemStack it) {
|
public static boolean mustBeRecycled(ItemStack it) {
|
||||||
if (GenericFunctions.isArtifactEquip(it) || ItemUtils.isArtifactDust(it)) {
|
if (GenericFunctions.isArtifactEquip(it) || ItemUtils.isArtifactDust(it)) {
|
||||||
|
@ -202,11 +202,14 @@ import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava;
|
import sig.plugin.TwosideKeeper.HelperStructures.Effects.TemporaryLava;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ArrayUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.BlockUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.DirtBlockReply;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemCubeUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.ItemUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||||
|
import sig.plugin.TwosideKeeper.HolidayEvents.TreeBuilder;
|
||||||
import sig.plugin.TwosideKeeper.Logging.BowModeLogger;
|
import sig.plugin.TwosideKeeper.Logging.BowModeLogger;
|
||||||
import sig.plugin.TwosideKeeper.Logging.LootLogger;
|
import sig.plugin.TwosideKeeper.Logging.LootLogger;
|
||||||
import sig.plugin.TwosideKeeper.Logging.MysteriousEssenceLogger;
|
import sig.plugin.TwosideKeeper.Logging.MysteriousEssenceLogger;
|
||||||
@ -376,6 +379,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public static final int SPAWN_DEBUG_LEVEL=5;
|
public static final int SPAWN_DEBUG_LEVEL=5;
|
||||||
public static final int LAVA_PLUME_COOLDOWN=60;
|
public static final int LAVA_PLUME_COOLDOWN=60;
|
||||||
|
|
||||||
|
public static final int SNOW_GOLEM_COOLDOWN=60;
|
||||||
|
|
||||||
public static final int DODGE_COOLDOWN=100;
|
public static final int DODGE_COOLDOWN=100;
|
||||||
public static final int DEATHMARK_COOLDOWN=240;
|
public static final int DEATHMARK_COOLDOWN=240;
|
||||||
public static final int EARTHWAVE_COOLDOWN=100;
|
public static final int EARTHWAVE_COOLDOWN=100;
|
||||||
@ -399,6 +404,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public static double worldShopPriceMult = 2.0; //How much higher the price increases for every increment of worlsShopDistanceSquared.
|
public static double worldShopPriceMult = 2.0; //How much higher the price increases for every increment of worlsShopDistanceSquared.
|
||||||
|
|
||||||
public static String lastActionBarMessage="";
|
public static String lastActionBarMessage="";
|
||||||
|
public static long last_snow_golem = 0;
|
||||||
|
|
||||||
public static File filesave;
|
public static File filesave;
|
||||||
public static HashMap<UUID,PlayerStructure> playerdata;
|
public static HashMap<UUID,PlayerStructure> playerdata;
|
||||||
@ -428,11 +434,16 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//Bank timers and users.
|
//Bank timers and users.
|
||||||
public static HashMap<UUID,BankSession> banksessions;
|
public static HashMap<UUID,BankSession> banksessions;
|
||||||
public static Habitation habitat_data;
|
public static Habitation habitat_data;
|
||||||
|
public static boolean last_announced_storm = false; //Whether or not the last announcement was about a storm.
|
||||||
|
|
||||||
|
public static List<String> weather_watch_users = new ArrayList<String>();
|
||||||
|
|
||||||
public static Plugin plugin;
|
public static Plugin plugin;
|
||||||
public int sleepingPlayers=0;
|
public int sleepingPlayers=0;
|
||||||
public static List<Material> validsetitems = new ArrayList<Material>();
|
public static List<Material> validsetitems = new ArrayList<Material>();
|
||||||
|
|
||||||
|
public final static boolean CHRISTMASEVENT_ACTIVATED=true;
|
||||||
|
|
||||||
boolean reloadedchunk=false;
|
boolean reloadedchunk=false;
|
||||||
|
|
||||||
int[] lampblocks = {1626,71,-255, //List of all lamp blocks in the city to be lit.
|
int[] lampblocks = {1626,71,-255, //List of all lamp blocks in the city to be lit.
|
||||||
@ -1049,6 +1060,67 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
case "SPAWN":{
|
||||||
|
Location loc = new Location(Bukkit.getWorld(args[1]),Double.parseDouble(args[2]),Double.parseDouble(args[3]),Double.parseDouble(args[4]));
|
||||||
|
|
||||||
|
Item it = p.getWorld().dropItemNaturally(loc, new ItemStack(Material.DIAMOND));
|
||||||
|
if (it.isValid()) {
|
||||||
|
log("Spawned a "+it.getItemStack(),0);
|
||||||
|
} else {
|
||||||
|
log("Failed to spawn "+it.getItemStack(),0);
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case "RECYCLE":{
|
||||||
|
Item it = p.getWorld().dropItemNaturally(p.getLocation(), new ItemStack(p.getEquipment().getItemInMainHand()));
|
||||||
|
it.setPickupDelay(100);
|
||||||
|
it.setTicksLived(28000);
|
||||||
|
}break;
|
||||||
|
case "STORM":{
|
||||||
|
TwosideKeeper.log("Storm: "+p.getWorld().hasStorm()+". Thunder: "+p.getWorld().isThundering(), 1);
|
||||||
|
}break;
|
||||||
|
case "SETRAIN":{
|
||||||
|
p.getWorld().setStorm(true);
|
||||||
|
//TwosideKeeper.log("Storm: "+p.getWorld().hasStorm()+". Thunder: "+p.getWorld().isThundering(), 1);
|
||||||
|
}break;
|
||||||
|
case "SETTHUNDER":{
|
||||||
|
p.getWorld().setThundering(true);
|
||||||
|
//TwosideKeeper.log("Storm: "+p.getWorld().hasStorm()+". Thunder: "+p.getWorld().isThundering(), 1);
|
||||||
|
}break;
|
||||||
|
case "BUILDTREE":{
|
||||||
|
if (args.length==4) {
|
||||||
|
TreeBuilder builder = new TreeBuilder(p.getLocation(),Integer.parseInt(args[1]),Integer.parseInt(args[2]),Integer.parseInt(args[3]));
|
||||||
|
builder.BuildTree();
|
||||||
|
} else {
|
||||||
|
p.sendMessage("/fix BUILDTREE <height> <radius> <baseradius>");
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case "GIVESCHEMATIC":{
|
||||||
|
if (args.length==1) {
|
||||||
|
GenericFunctions.giveItem(p, Christmas.getChristmasTreeSchematic());
|
||||||
|
} else
|
||||||
|
if (args.length==2) {
|
||||||
|
ItemStack schematic = Christmas.getChristmasTreeSchematic();
|
||||||
|
schematic.setAmount(Integer.parseInt(args[1]));
|
||||||
|
GenericFunctions.giveItem(p, schematic);
|
||||||
|
} else {
|
||||||
|
p.sendMessage("/fix GIVESCHEMATIC [amount]");
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case "FORCEBLOCKQUEUE":{
|
||||||
|
BlockModifyQueue.Cleanup(blockqueue);
|
||||||
|
}break;
|
||||||
|
case "COOKIE":{
|
||||||
|
if (args.length==1) {
|
||||||
|
GenericFunctions.giveItem(p, Christmas.getCookieItem());
|
||||||
|
} else
|
||||||
|
if (args.length==2) {
|
||||||
|
ItemStack schematic = Christmas.getCookieItem();
|
||||||
|
schematic.setAmount(Integer.parseInt(args[1]));
|
||||||
|
GenericFunctions.giveItem(p, schematic);
|
||||||
|
} else {
|
||||||
|
p.sendMessage("/fix COOKIE [amount]");
|
||||||
|
}
|
||||||
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
||||||
@ -1171,7 +1243,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if (cmd.getName().equalsIgnoreCase("money")) {
|
if (cmd.getName().equalsIgnoreCase("money")) {
|
||||||
sender.sendMessage("You are currently holding "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(Bukkit.getPlayer(sender.getName()))));
|
Player p = (Player)sender;
|
||||||
|
sender.sendMessage("You are currently holding "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(p)));
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
if (cmd.getName().equalsIgnoreCase("enchant_advanced")) {
|
if (cmd.getName().equalsIgnoreCase("enchant_advanced")) {
|
||||||
@ -1405,6 +1478,52 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
} else
|
||||||
|
if (cmd.getName().equalsIgnoreCase("weather")) {
|
||||||
|
Player p = (Player)sender;
|
||||||
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||||
|
if (args.length==0) {
|
||||||
|
if (!pd.weatherwatch_user.isEmpty() && !pd.weatherwatch) {
|
||||||
|
p.sendMessage("Turned "+ChatColor.GREEN+"ON"+ChatColor.RESET+" weather warning for Discord user "+pd.weatherwatch_user+".");
|
||||||
|
p.sendMessage(ChatColor.ITALIC+" To disable them, type /weather");
|
||||||
|
pd.weatherwatch=true;
|
||||||
|
AddUserToWeatherWatch(p);
|
||||||
|
} else {
|
||||||
|
p.sendMessage("Weather warnings are turned "+ChatColor.RED+"OFF"+ChatColor.RESET+".");
|
||||||
|
p.sendMessage(ChatColor.ITALIC+" To enable them, type /weather <DISCORD NAME>");
|
||||||
|
p.sendMessage(ChatColor.ITALIC+" and replace <DISCORD NAME> with your name.");
|
||||||
|
pd.weatherwatch=false;
|
||||||
|
RemoveUserFromWeatherWatch(p);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p.sendMessage("Turned "+ChatColor.GREEN+"ON"+ChatColor.RESET+" weather warning for Discord user "+args[0]+".");
|
||||||
|
p.sendMessage(ChatColor.ITALIC+" To disable them, type /weather");
|
||||||
|
pd.weatherwatch_user = args[0];
|
||||||
|
pd.weatherwatch=true;
|
||||||
|
AddUserToWeatherWatch(p);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
if (cmd.getName().equalsIgnoreCase("ready")) {
|
||||||
|
Player p = (Player)sender;
|
||||||
|
switch (InventoryUtils.onlyHoldingFiveDirtBlocks(p)) {
|
||||||
|
case HOLDING5DIRT:{
|
||||||
|
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.GREEN+"READY"+".");
|
||||||
|
}break;
|
||||||
|
case NOTEMPTYINVENTORY:
|
||||||
|
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
|
||||||
|
p.sendMessage(" You need to get rid of "+ChatColor.RED+"ALL ITEMS"+ChatColor.RESET+" to play.");
|
||||||
|
break;
|
||||||
|
case NOTENOUGHDIRT:
|
||||||
|
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
|
||||||
|
p.sendMessage(" You need to have exactly "+ChatColor.YELLOW+"5 DIRT BLOCKS"+ChatColor.RESET+" to play.");
|
||||||
|
break;
|
||||||
|
case TOOMUCHDIRT:
|
||||||
|
Bukkit.broadcastMessage(p.getName()+" is "+ChatColor.RED+"NOT READY"+".");
|
||||||
|
p.sendMessage(" You need to have exactly "+ChatColor.YELLOW+"5 DIRT BLOCKS"+ChatColor.RESET+" to play.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Implement console/admin version later (Let's you check any name's money.)
|
//Implement console/admin version later (Let's you check any name's money.)
|
||||||
@ -1412,6 +1531,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RemoveUserFromWeatherWatch(Player p) {
|
||||||
|
weather_watch_users.remove(p.getName());
|
||||||
|
}
|
||||||
|
private void AddUserToWeatherWatch(Player p) {
|
||||||
|
if (!weather_watch_users.contains(p.getName())) {
|
||||||
|
weather_watch_users.add(p.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DisplayCraftingRecipe(Player p, String string) {
|
private void DisplayCraftingRecipe(Player p, String string) {
|
||||||
RecipeLinker l = RecipeLinker.valueOf(string);
|
RecipeLinker l = RecipeLinker.valueOf(string);
|
||||||
ItemStack[] newarray = Arrays.copyOfRange(l.getRec(), 1, l.getRec().length);
|
ItemStack[] newarray = Arrays.copyOfRange(l.getRec(), 1, l.getRec().length);
|
||||||
@ -2161,6 +2289,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
setPlayerMaxHealth(p);
|
setPlayerMaxHealth(p);
|
||||||
}
|
}
|
||||||
},1);
|
},1);
|
||||||
|
|
||||||
|
if (!Christmas.RunPlayerInteractEvent(ev)) {return;}
|
||||||
|
|
||||||
if (ev.getClickedBlock()!=null && ev.getClickedBlock().getType()==Material.CHEST &&
|
if (ev.getClickedBlock()!=null && ev.getClickedBlock().getType()==Material.CHEST &&
|
||||||
TwosideRecyclingCenter.isChoosingRecyclingCenter() &&
|
TwosideRecyclingCenter.isChoosingRecyclingCenter() &&
|
||||||
ev.getPlayer().hasPermission("TwosideKeeper.recyclingcenter")) {
|
ev.getPlayer().hasPermission("TwosideKeeper.recyclingcenter")) {
|
||||||
@ -2515,7 +2646,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ev.getClickedBlock().getType().toString().contains("RAIL") &&
|
ev.getClickedBlock().getType().toString().contains("RAIL") &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
|
ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()==4 &&
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()>=4 &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
ev.setCancelled(true); //Do not place minecarts on rails -.-
|
ev.setCancelled(true); //Do not place minecarts on rails -.-
|
||||||
ev.getPlayer().updateInventory();
|
ev.getPlayer().updateInventory();
|
||||||
@ -2524,7 +2655,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) {
|
if (ev.getAction()==Action.RIGHT_CLICK_AIR || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_AIR) || (ev.getPlayer().isSneaking() && ev.getAction()==Action.RIGHT_CLICK_BLOCK && !GenericFunctions.isDumpableContainer(ev.getClickedBlock().getType()))) {
|
||||||
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
|
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()==4 &&
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()>=4 &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
//This is an item cube.
|
//This is an item cube.
|
||||||
log("In we are",5);
|
log("In we are",5);
|
||||||
@ -2561,7 +2692,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//This is an attempt to insert an item cube into a container. See what item cube we're holding.
|
//This is an attempt to insert an item cube into a container. See what item cube we're holding.
|
||||||
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
|
if (ev.getPlayer().getInventory().getItemInMainHand().hasItemMeta() &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasLore() &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()==4 &&
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().size()>=4 &&
|
||||||
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
ev.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
|
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
@ -3085,7 +3216,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
if (ev.getItemInHand().hasItemMeta() &&
|
if (ev.getItemInHand().hasItemMeta() &&
|
||||||
ev.getItemInHand().getItemMeta().hasLore() &&
|
ev.getItemInHand().getItemMeta().hasLore() &&
|
||||||
ev.getItemInHand().getItemMeta().getLore().size()==4 &&
|
ev.getItemInHand().getItemMeta().getLore().size()>=4 &&
|
||||||
ev.getItemInHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
ev.getItemInHand().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
//This is an item cube.
|
//This is an item cube.
|
||||||
ev.setCancelled(true);
|
ev.setCancelled(true);
|
||||||
@ -3135,7 +3266,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
if (p!=null) {
|
if (p!=null) {
|
||||||
p.sendMessage(ChatColor.GRAY+"Due to death, you lost "+DEATHPENALTY+"% of your holding money. ");
|
p.sendMessage(ChatColor.GRAY+"Due to death, you lost "+DEATHPENALTY+"% of your holding money. ");
|
||||||
givePlayerMoney(p,-Math.round(getPlayerMoney(p)/2));
|
givePlayerMoney(p,-(getPlayerMoney(p)/2));
|
||||||
p.sendMessage(" Now Holding: "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(p)));
|
p.sendMessage(" Now Holding: "+ChatColor.GREEN+"$"+df.format(getPlayerMoney(p)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3459,7 +3590,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
if (ev.getItemDrop().getItemStack().hasItemMeta()) {
|
if (ev.getItemDrop().getItemStack().hasItemMeta()) {
|
||||||
if (ev.getItemDrop().getItemStack().getItemMeta().hasLore()) {
|
if (ev.getItemDrop().getItemStack().getItemMeta().hasLore()) {
|
||||||
if (ev.getItemDrop().getItemStack().getItemMeta().getLore().size()==4) {
|
if (ev.getItemDrop().getItemStack().getItemMeta().getLore().size()>=4) {
|
||||||
if (ev.getItemDrop().getItemStack().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
if (ev.getItemDrop().getItemStack().getItemMeta().getLore().get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
//We have an item cube.
|
//We have an item cube.
|
||||||
int itemcube_id=Integer.parseInt(ev.getItemDrop().getItemStack().getItemMeta().getLore().get(3).split("#")[1]);
|
int itemcube_id=Integer.parseInt(ev.getItemDrop().getItemStack().getItemMeta().getLore().get(3).split("#")[1]);
|
||||||
@ -3615,7 +3746,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
amounttotake = diff;
|
amounttotake = diff;
|
||||||
givePlayerBankMoney(p,-amounttotake);
|
givePlayerBankMoney(p,-amounttotake);
|
||||||
}
|
}
|
||||||
DropDeathInventoryContents(p, deathloc, 1);
|
DropDeathInventoryContents(p, deathloc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerStructure pd = (PlayerStructure) playerdata.get(p.getUniqueId());
|
PlayerStructure pd = (PlayerStructure) playerdata.get(p.getUniqueId());
|
||||||
@ -3679,9 +3810,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
do {
|
do {
|
||||||
deathloc.getWorld().loadChunk(deathloc.getChunk());
|
deathloc.getWorld().loadChunk(deathloc.getChunk());
|
||||||
it=deathloc.getWorld().dropItemNaturally(deathloc, list.get(0));
|
it=deathloc.getWorld().dropItemNaturally(deathloc, list.get(0));
|
||||||
|
it.setInvulnerable(true);
|
||||||
TwosideKeeper.temporary_chunks.add(deathloc.getChunk());
|
TwosideKeeper.temporary_chunks.add(deathloc.getChunk());
|
||||||
} while (it==null || !it.isValid());
|
} while (it==null || !it.isValid());
|
||||||
it.setInvulnerable(true);
|
|
||||||
TwosideKeeper.log("Dropping "+list.get(0).toString()+" at Death location "+deathloc,2);
|
TwosideKeeper.log("Dropping "+list.get(0).toString()+" at Death location "+deathloc,2);
|
||||||
list.remove(0);
|
list.remove(0);
|
||||||
} else {
|
} else {
|
||||||
@ -3721,20 +3852,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AttemptToDropItems(Player p, Location deathloc) {
|
|
||||||
deathloc.getWorld().loadChunk(deathloc.getChunk());
|
|
||||||
if (deathloc.getChunk().isLoaded()) {
|
|
||||||
for (int i=0;i<p.getOpenInventory().getTopInventory().getSize();i++) {
|
|
||||||
if (p.getOpenInventory().getTopInventory().getItem(i)!=null &&
|
|
||||||
p.getOpenInventory().getTopInventory().getItem(i).getType()!=Material.AIR) {
|
|
||||||
Item it = deathloc.getWorld().dropItemNaturally(deathloc, p.getOpenInventory().getTopInventory().getItem(i));
|
|
||||||
it.setInvulnerable(true);
|
|
||||||
log("Dropping "+p.getOpenInventory().getTopInventory().getItem(i).toString()+" at Death location "+deathloc,2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
public void onItemChange(PlayerItemHeldEvent ev) {
|
public void onItemChange(PlayerItemHeldEvent ev) {
|
||||||
final Player player = ev.getPlayer();
|
final Player player = ev.getPlayer();
|
||||||
@ -4024,7 +4141,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
||||||
if (item_meta.hasLore()) {
|
if (item_meta.hasLore()) {
|
||||||
List<String> item_meta_lore = item_meta.getLore();
|
List<String> item_meta_lore = item_meta.getLore();
|
||||||
if (item_meta_lore.size()==4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
if (item_meta_lore.size()>=4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
int itemcubeid = -1;
|
int itemcubeid = -1;
|
||||||
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
|
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
|
||||||
ev.getWhoClicked().getOpenInventory().getTitle().contains("Item Cube #")) {
|
ev.getWhoClicked().getOpenInventory().getTitle().contains("Item Cube #")) {
|
||||||
@ -4067,7 +4184,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
||||||
if (item_meta.hasLore()) {
|
if (item_meta.hasLore()) {
|
||||||
List<String> item_meta_lore = item_meta.getLore();
|
List<String> item_meta_lore = item_meta.getLore();
|
||||||
if (item_meta_lore.size()==4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
if (item_meta_lore.size()>=4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
int idnumb = Integer.parseInt(item_meta_lore.get(3).split("#")[1]);
|
int idnumb = Integer.parseInt(item_meta_lore.get(3).split("#")[1]);
|
||||||
int itemcubeid = -1; //This is the ID of the window we are looking at, if one exists.
|
int itemcubeid = -1; //This is the ID of the window we are looking at, if one exists.
|
||||||
CubeType cubetype = CubeType.NORMAL;
|
CubeType cubetype = CubeType.NORMAL;
|
||||||
@ -4215,7 +4332,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
ItemMeta item_meta = ev.getCurrentItem().getItemMeta();
|
||||||
if (item_meta.hasLore()) {
|
if (item_meta.hasLore()) {
|
||||||
List<String> item_meta_lore = item_meta.getLore();
|
List<String> item_meta_lore = item_meta.getLore();
|
||||||
if (item_meta_lore.size()==4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
if (item_meta_lore.size()>=4 && item_meta_lore.get(3).contains(ChatColor.DARK_PURPLE+"ID#")) {
|
||||||
int idnumb = Integer.parseInt(item_meta_lore.get(3).split("#")[1]);
|
int idnumb = Integer.parseInt(item_meta_lore.get(3).split("#")[1]);
|
||||||
int itemcubeid = -1;
|
int itemcubeid = -1;
|
||||||
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
|
if (((PlayerStructure)playerdata.get(ev.getWhoClicked().getUniqueId())).isViewingItemCube &&
|
||||||
@ -4489,6 +4606,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
} else {
|
} else {
|
||||||
log("Reason for spawn: "+ev.getSpawnReason().toString(),4);
|
log("Reason for spawn: "+ev.getSpawnReason().toString(),4);
|
||||||
}
|
}
|
||||||
|
if (ev.getSpawnReason().equals(SpawnReason.SPAWNER)) {
|
||||||
|
if (MonsterController.isZombieLeader(ev.getEntity())) {
|
||||||
|
MonsterController.removeZombieLeaderAttribute(ev.getEntity());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ev.getLocation().getWorld().getName().equalsIgnoreCase("world") &&
|
if (ev.getLocation().getWorld().getName().equalsIgnoreCase("world") &&
|
||||||
ev.getEntityType()==EntityType.HORSE) {
|
ev.getEntityType()==EntityType.HORSE) {
|
||||||
Horse h = (Horse)ev.getEntity();
|
Horse h = (Horse)ev.getEntity();
|
||||||
@ -4570,6 +4692,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
public void updateHealthbarDamageEvent(EntityDamageEvent ev) {
|
public void updateHealthbarDamageEvent(EntityDamageEvent ev) {
|
||||||
if (ev.getEntity().isDead()) {ev.setCancelled(true); return;}
|
if (ev.getEntity().isDead()) {ev.setCancelled(true); return;}
|
||||||
|
if (!Christmas.ChristmasDamageEvent(ev)) {return;}
|
||||||
if (ev.getCause()!=DamageCause.ENTITY_ATTACK &&
|
if (ev.getCause()!=DamageCause.ENTITY_ATTACK &&
|
||||||
ev.getCause()!=DamageCause.PROJECTILE &&
|
ev.getCause()!=DamageCause.PROJECTILE &&
|
||||||
ev.getCause()!=DamageCause.ENTITY_EXPLOSION &&
|
ev.getCause()!=DamageCause.ENTITY_EXPLOSION &&
|
||||||
@ -4931,7 +5054,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
public void announcePluginUpdateEvent(AnnounceUpdateEvent ev) {
|
public void announcePluginUpdateEvent(AnnounceUpdateEvent ev) {
|
||||||
aPlugin.API.discordSendRaw(ev.getAnnouncementMessage());
|
aPlugin.API.discordSendRawItalicized(ev.getAnnouncementMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
|
||||||
@ -6507,7 +6630,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
//Item cube should be in slot 4.
|
//Item cube should be in slot 4.
|
||||||
if (ev.getInventory().getItem(5)!=null) {
|
if (ev.getInventory().getItem(5)!=null) {
|
||||||
ItemMeta inventory_itemMeta=ev.getInventory().getItem(5).getItemMeta();
|
ItemMeta inventory_itemMeta=ev.getInventory().getItem(5).getItemMeta();
|
||||||
if (inventory_itemMeta.hasLore() && inventory_itemMeta.getLore().size()==4) {
|
if (inventory_itemMeta.hasLore() && inventory_itemMeta.getLore().size()>=4) {
|
||||||
log("4 Elements detected.",5);
|
log("4 Elements detected.",5);
|
||||||
String loreitem = inventory_itemMeta.getLore().get(3);
|
String loreitem = inventory_itemMeta.getLore().get(3);
|
||||||
log("Lore data is: "+loreitem,5);
|
log("Lore data is: "+loreitem,5);
|
||||||
@ -6951,6 +7074,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue());
|
getConfig().set("SERVER_TYPE", SERVER_TYPE.GetValue());
|
||||||
getConfig().set("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN);
|
getConfig().set("LAST_ELITE_SPAWN", LAST_ELITE_SPAWN);
|
||||||
getConfig().set("LAST_DEAL", LAST_DEAL);
|
getConfig().set("LAST_DEAL", LAST_DEAL);
|
||||||
|
getConfig().set("WEATHER_WATCH_USERS", weather_watch_users);
|
||||||
if (ELITE_LOCATION!=null) {
|
if (ELITE_LOCATION!=null) {
|
||||||
getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX());
|
getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX());
|
||||||
getConfig().set("ELITE_LOCATION_Z", ELITE_LOCATION.getBlockZ());
|
getConfig().set("ELITE_LOCATION_Z", ELITE_LOCATION.getBlockZ());
|
||||||
@ -7014,6 +7138,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
getConfig().addDefault("WORLD_SHOP_DIST", worldShopDistanceSquared);
|
getConfig().addDefault("WORLD_SHOP_DIST", worldShopDistanceSquared);
|
||||||
getConfig().addDefault("WORLD_SHOP_MULT", worldShopPriceMult);
|
getConfig().addDefault("WORLD_SHOP_MULT", worldShopPriceMult);
|
||||||
getConfig().addDefault("LAST_DEAL", TimeUtils.GetCurrentDayOfWeek());
|
getConfig().addDefault("LAST_DEAL", TimeUtils.GetCurrentDayOfWeek());
|
||||||
|
getConfig().addDefault("WEATHER_WATCH_USERS", weather_watch_users);
|
||||||
getConfig().options().copyDefaults(true);
|
getConfig().options().copyDefaults(true);
|
||||||
saveConfig();
|
saveConfig();
|
||||||
SERVERTICK = getConfig().getLong("SERVERTICK");
|
SERVERTICK = getConfig().getLong("SERVERTICK");
|
||||||
@ -7050,6 +7175,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
worldShopDistanceSquared = getConfig().getDouble("WORLD_SHOP_DIST");
|
worldShopDistanceSquared = getConfig().getDouble("WORLD_SHOP_DIST");
|
||||||
worldShopPriceMult = getConfig().getDouble("WORLD_SHOP_MULT");
|
worldShopPriceMult = getConfig().getDouble("WORLD_SHOP_MULT");
|
||||||
LAST_DEAL = getConfig().getInt("LAST_DEAL");
|
LAST_DEAL = getConfig().getInt("LAST_DEAL");
|
||||||
|
weather_watch_users = getConfig().getStringList("WEATHER_WATCH_USERS");
|
||||||
if (getConfig().contains("ELITE_LOCATION_X")) {
|
if (getConfig().contains("ELITE_LOCATION_X")) {
|
||||||
int x = getConfig().getInt("ELITE_LOCATION_X");
|
int x = getConfig().getInt("ELITE_LOCATION_X");
|
||||||
int z = getConfig().getInt("ELITE_LOCATION_Z");
|
int z = getConfig().getInt("ELITE_LOCATION_Z");
|
||||||
@ -7963,6 +8089,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
|||||||
public static void announcePluginVersions() {
|
public static void announcePluginVersions() {
|
||||||
if (SERVER_TYPE!=ServerType.QUIET) {
|
if (SERVER_TYPE!=ServerType.QUIET) {
|
||||||
aPlugin.API.discordSendRawItalicized(SERVER_TYPE.GetServerName()+"Server has been restarted.\nRunning v."+Bukkit.getPluginManager().getPlugin("TwosideKeeper").getDescription().getVersion()+" of TwosideKeeper\nRunning v"+Bukkit.getPluginManager().getPlugin("aPlugin").getDescription().getVersion()+" of Jobs.");
|
aPlugin.API.discordSendRawItalicized(SERVER_TYPE.GetServerName()+"Server has been restarted.\nRunning v."+Bukkit.getPluginManager().getPlugin("TwosideKeeper").getDescription().getVersion()+" of TwosideKeeper\nRunning v"+Bukkit.getPluginManager().getPlugin("aPlugin").getDescription().getVersion()+" of Jobs.");
|
||||||
|
if (CHRISTMASEVENT_ACTIVATED) {
|
||||||
|
aPlugin.API.discordSendRaw("___________________");
|
||||||
|
aPlugin.API.discordSendRaw("**Christmas Holiday Event** is currently active! Please visit <> for full details.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package sig.plugin.TwosideKeeper;
|
package sig.plugin.TwosideKeeper;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -16,6 +17,8 @@ import org.bukkit.Particle;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
@ -41,6 +44,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Effects.LavaPlume;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.InventoryUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.MessageUtils;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||||
|
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||||
|
|
||||||
final class runServerHeartbeat implements Runnable {
|
final class runServerHeartbeat implements Runnable {
|
||||||
/**
|
/**
|
||||||
@ -347,6 +351,10 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
//TwosideKeeper.outputArmorDurability(p,">");
|
//TwosideKeeper.outputArmorDurability(p,">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckAndAnnounceWeather();
|
||||||
|
|
||||||
|
Christmas.ChristmasHeartbeat();
|
||||||
|
|
||||||
MaintainMonsterData();
|
MaintainMonsterData();
|
||||||
|
|
||||||
PartyManager.SetupParties();
|
PartyManager.SetupParties();
|
||||||
@ -355,6 +363,27 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CheckAndAnnounceWeather() {
|
||||||
|
if (Bukkit.getWorld("world").hasStorm()) {
|
||||||
|
if (!TwosideKeeper.last_announced_storm) {
|
||||||
|
TwosideKeeper.last_announced_storm=true;
|
||||||
|
for (String user : TwosideKeeper.weather_watch_users) {
|
||||||
|
if (Bukkit.getPlayer(user)!=null) {
|
||||||
|
Player p = Bukkit.getPlayer(user);
|
||||||
|
p.sendMessage(ChatColor.ITALIC+""+ChatColor.GRAY+"A storm"+((Bukkit.getWorld("world").isThundering())?" (With Thunder)":"")+" is now occuring on the server. (Day "+(int)(TwosideKeeper.getServerTickTime()/48000)+")");
|
||||||
|
}
|
||||||
|
File config;
|
||||||
|
config = new File(TwosideKeeper.filesave,"users/"+user+".data");
|
||||||
|
FileConfiguration workable = YamlConfiguration.loadConfiguration(config);
|
||||||
|
aPlugin.DiscordMessageSender.sendPM("A storm"+((Bukkit.getWorld("world").isThundering())?" (With Thunder)":"")+" is now occuring on the server. (Day "+(int)(TwosideKeeper.getServerTickTime()/48000)+")", workable.getString("weatherwatch_user"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TwosideKeeper.last_announced_storm=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void runFilterCubeCollection(Player p) {
|
public static void runFilterCubeCollection(Player p) {
|
||||||
if (InventoryUtils.hasFullInventory(p) && InventoryUtils.isCarryingFilterCube(p)) {
|
if (InventoryUtils.hasFullInventory(p) && InventoryUtils.isCarryingFilterCube(p)) {
|
||||||
List<Entity> ents = p.getNearbyEntities(0.25, 0.25, 0.25);
|
List<Entity> ents = p.getNearbyEntities(0.25, 0.25, 0.25);
|
||||||
@ -512,7 +541,7 @@ final class runServerHeartbeat implements Runnable {
|
|||||||
TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 5);
|
TwosideKeeper.log("Size: "+TwosideKeeper.livingentitydata.size(), 5);
|
||||||
for (UUID id : data) {
|
for (UUID id : data) {
|
||||||
LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(id);
|
LivingEntityStructure ms = TwosideKeeper.livingentitydata.get(id);
|
||||||
if (!ms.m.isValid()) {
|
if (!ms.m.isValid() || ms.m instanceof Player) {
|
||||||
//TwosideKeeper.monsterdata.remove(data);
|
//TwosideKeeper.monsterdata.remove(data);
|
||||||
TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms);
|
TwosideKeeper.ScheduleRemoval(TwosideKeeper.livingentitydata, ms);
|
||||||
TwosideKeeper.ScheduleRemoval(data, id);
|
TwosideKeeper.ScheduleRemoval(data, id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user