Implemented instanced room system in preparation for Challenge Rooms.
This commit is contained in:
parent
05582519fc
commit
51b39cc298
Binary file not shown.
@ -244,6 +244,7 @@ public class Artifact {
|
||||
m.setLore(lore);
|
||||
m.setDisplayName(ChatColor.GOLD+""+ChatColor.BOLD+"T"+tier+ChatColor.RESET+ChatColor.GOLD+" Artifact "+GenericFunctions.CapitalizeFirstLetters(item.getItemName())+" Recipe");
|
||||
newitem.setItemMeta(m);
|
||||
newitem.addUnsafeEnchantment(Enchantment.LUCK, tier);
|
||||
return newitem.clone();
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||
import sig.plugin.TwosideKeeper.Monster.DarkSpider;
|
||||
import sig.plugin.TwosideKeeper.Monster.DarkSpiderMinion;
|
||||
import sig.plugin.TwosideKeeper.Monster.Dummy;
|
||||
import sig.plugin.TwosideKeeper.Monster.GenericBoss;
|
||||
import sig.plugin.TwosideKeeper.Monster.HellfireGhast;
|
||||
import sig.plugin.TwosideKeeper.Monster.HellfireSpider;
|
||||
import sig.plugin.TwosideKeeper.Monster.Knight;
|
||||
@ -309,6 +310,7 @@ public class CustomDamage {
|
||||
dmg += addMultiplierToPlayerLogger(damager,target,"Damage Pool Bonus Mult",dmg * calculateDamagePoolBonusMultiplier(shooter));
|
||||
dmg += addMultiplierToPlayerLogger(damager,target,"Stealth Mult",dmg * calculateStealthMultiplier(shooter));
|
||||
dmg += addMultiplierToPlayerLogger(damager,target,"Dark Reverie Mult",dmg * calculateDarkReverieMultiplier(shooter));
|
||||
dmg += addMultiplierToPlayerLogger(damager,target,"Boss Mult",dmg * calculateBossDamageMultiplier(shooter));
|
||||
if (reason==null || !reason.equalsIgnoreCase("Test Damage")) {
|
||||
double critdmg = addMultiplierToPlayerLogger(damager,target,"Critical Strike Mult",dmg * calculateCriticalStrikeMultiplier(weapon,shooter,target,reason,flags));
|
||||
if (critdmg!=0.0) {crit=true;
|
||||
@ -344,6 +346,18 @@ public class CustomDamage {
|
||||
return dmg;
|
||||
}
|
||||
|
||||
private static double calculateBossDamageMultiplier(LivingEntity shooter) {
|
||||
double mult = 0.0;
|
||||
if (TwosideKeeper.custommonsters.containsKey(shooter.getUniqueId())) {
|
||||
CustomMonster cm = TwosideKeeper.custommonsters.get(shooter.getUniqueId());
|
||||
if (cm instanceof GenericBoss) {
|
||||
GenericBoss gb = (GenericBoss)cm;
|
||||
mult += (gb.getParticipants().size()>=4)?((gb.getParticipants().size()-3)*0.1):0.0;
|
||||
}
|
||||
}
|
||||
return mult;
|
||||
}
|
||||
|
||||
private static double calculateDarkReverieMultiplier(LivingEntity shooter) {
|
||||
double mult = 0.0;
|
||||
if (shooter!=null) {
|
||||
|
14
src/sig/plugin/TwosideKeeper/Generators/DPSRoom.java
Normal file
14
src/sig/plugin/TwosideKeeper/Generators/DPSRoom.java
Normal file
@ -0,0 +1,14 @@
|
||||
package sig.plugin.TwosideKeeper.Generators;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public class DPSRoom extends Room{
|
||||
|
||||
public DPSRoom(int width,int length) {
|
||||
super(width,length);
|
||||
}
|
||||
}
|
83
src/sig/plugin/TwosideKeeper/Generators/Room.java
Normal file
83
src/sig/plugin/TwosideKeeper/Generators/Room.java
Normal file
@ -0,0 +1,83 @@
|
||||
package sig.plugin.TwosideKeeper.Generators;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public class Room extends ChunkGenerator{
|
||||
int ROOM_WIDTH = 32;
|
||||
int ROOM_LENGTH = 32;
|
||||
|
||||
public Room() {
|
||||
|
||||
}
|
||||
|
||||
public Room(int width, int length) {
|
||||
ROOM_WIDTH=width;
|
||||
ROOM_LENGTH=length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSpawn(World world, int x, int z) {
|
||||
return true;
|
||||
}
|
||||
public int xyzToByte(int x, int y, int z) {
|
||||
return (x * 16 + z) * 256 + y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
|
||||
byte[] result = new byte[65536];
|
||||
if (chunkx<ROOM_WIDTH/16 &&
|
||||
chunkz<ROOM_LENGTH/16 &&
|
||||
chunkx>=0 &&
|
||||
chunkz>=0) {
|
||||
for(int x=0; x<16; x++){
|
||||
for(int z=0; z<16; z++) {
|
||||
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
|
||||
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
}
|
||||
GenerateOuterWalls(chunkx, chunkz, result);
|
||||
}
|
||||
/*for(int x=0; x<16; x++){
|
||||
for(int z=0; z<16; z++) {
|
||||
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
|
||||
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
}*/
|
||||
return result;
|
||||
}
|
||||
|
||||
private void GenerateOuterWalls(int chunkx, int chunkz, byte[] result) {
|
||||
int wallslotx = Math.floorMod(chunkx,ROOM_WIDTH/16);
|
||||
int wallslotz = Math.floorMod(chunkz,ROOM_LENGTH/16);
|
||||
for (int y=1;y<255;y++) {
|
||||
for(int x=0; x<16; x++){
|
||||
for (int z=0;z<16;z++) {
|
||||
if (wallslotx==0) {
|
||||
result[xyzToByte(0,y,z)] = (byte) Material.BEDROCK.getId();
|
||||
} else
|
||||
if (wallslotx==(ROOM_WIDTH/16)-1){
|
||||
result[xyzToByte(15,y,z)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
if (wallslotz==0) {
|
||||
result[xyzToByte(x,y,0)] = (byte) Material.BEDROCK.getId();
|
||||
} else
|
||||
if (wallslotz==(ROOM_LENGTH/16)-1){
|
||||
result[xyzToByte(x,y,15)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getRoomWidth() {
|
||||
return ROOM_WIDTH;
|
||||
}
|
||||
public int getRoomLength() {
|
||||
return ROOM_LENGTH;
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ public class GlobalLoot {
|
||||
|
||||
public boolean runTick() {
|
||||
if ((item!=null && item.isValid())) {
|
||||
List<Player> players = GenericFunctions.getNearbyPlayers(item.getLocation(), 1);
|
||||
List<Player> players = GenericFunctions.getNearbyPlayers(item.getLocation(), 1.5);
|
||||
for (Player p : players) {
|
||||
if (p.getOpenInventory().getType()==InventoryType.CRAFTING &&
|
||||
drop_inventories.containsKey(p.getUniqueId())) {
|
||||
|
@ -4081,7 +4081,7 @@ public class GenericFunctions {
|
||||
return monsterlist;
|
||||
}
|
||||
|
||||
public static List<Player> getNearbyPlayers(Location l, int range) {
|
||||
public static List<Player> getNearbyPlayers(Location l, double range) {
|
||||
List<Player> players = new ArrayList<Player>();
|
||||
Collection<Entity> nearbyentities = l.getWorld().getNearbyEntities(l, range, range, range);
|
||||
for (Entity i : nearbyentities) {
|
||||
|
@ -0,0 +1,17 @@
|
||||
package sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
|
||||
public class InstanceFilter implements FileFilter{
|
||||
|
||||
@Override
|
||||
public boolean accept(File arg0) {
|
||||
if (arg0.getName().contains("Instance")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -37,6 +37,7 @@ public class GenericBoss extends CustomMonster{
|
||||
private Location lastLoc = null;
|
||||
private long stuckTimer=0;
|
||||
long lasthit;
|
||||
double baseHP;
|
||||
|
||||
public GenericBoss(LivingEntity m) {
|
||||
super(m);
|
||||
@ -53,6 +54,24 @@ public class GenericBoss extends CustomMonster{
|
||||
keepHealthbarUpdated();
|
||||
unstuckIfStuck();
|
||||
increaseBarTextScroll();
|
||||
adjustHPBasedOnPartyMembers();
|
||||
}
|
||||
|
||||
private void adjustHPBasedOnPartyMembers() {
|
||||
if (participantlist.size()>=4 &&
|
||||
m.getMaxHealth()<adjustedHPAmount()) {
|
||||
double prevhp = m.getMaxHealth();
|
||||
m.setMaxHealth(adjustedHPAmount());
|
||||
m.setHealth(m.getHealth()+(m.getMaxHealth()-prevhp));
|
||||
}
|
||||
}
|
||||
|
||||
private double adjustedHPAmount() {
|
||||
double amt = baseHP;
|
||||
if (participantlist.size()>=4) {
|
||||
amt += (participantlist.size()-3)*(baseHP*0.25);
|
||||
}
|
||||
return amt;
|
||||
}
|
||||
|
||||
protected void increaseBarTextScroll() {
|
||||
|
@ -130,6 +130,7 @@ public class Knight extends GenericBoss{
|
||||
}break;
|
||||
}
|
||||
m.setHealth(m.getMaxHealth());
|
||||
baseHP = m.getMaxHealth();
|
||||
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.31f);
|
||||
relinkToSpider();
|
||||
m.setAI(false);
|
||||
|
@ -111,6 +111,7 @@ public class SniperSkeleton extends GenericBoss{
|
||||
}break;
|
||||
}
|
||||
m.setHealth(m.getMaxHealth());
|
||||
baseHP = m.getMaxHealth();
|
||||
m.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.3625f);
|
||||
m.setAI(false);
|
||||
m.setRemoveWhenFarAway(false);
|
||||
|
@ -222,6 +222,7 @@ public class PlayerStructure {
|
||||
public float MoveSpeedMultBeforeCripple=1f;
|
||||
public Channel currentChannel=null;
|
||||
public long lastFailedCastTime=0;
|
||||
public Location locBeforeInstance=null;
|
||||
|
||||
List<ItemStack> equipmentset = new ArrayList<ItemStack>();
|
||||
|
||||
@ -417,6 +418,14 @@ public class PlayerStructure {
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (locBeforeInstance!=null) {
|
||||
workable.set("instanceloc_x",locBeforeInstance.getX());
|
||||
workable.set("instanceloc_y",locBeforeInstance.getY());
|
||||
workable.set("instanceloc_z",locBeforeInstance.getZ());
|
||||
workable.set("instanceloc_world", locBeforeInstance.getWorld().getName());
|
||||
} else {
|
||||
workable.set("instanceloc_world", "null");
|
||||
}
|
||||
workable.set("deathloc_x", deathloc_x);
|
||||
workable.set("deathloc_y", deathloc_y);
|
||||
workable.set("deathloc_z", deathloc_z);
|
||||
@ -549,6 +558,7 @@ public class PlayerStructure {
|
||||
workable.addDefault("rangermode", "CLOSE");
|
||||
workable.addDefault("damagenumbers", damagenumbers);
|
||||
workable.addDefault("healthbardisplay", healthbardisplay);
|
||||
workable.addDefault("instanceloc_world", "null");
|
||||
|
||||
workable.options().copyDefaults();
|
||||
|
||||
@ -614,6 +624,13 @@ public class PlayerStructure {
|
||||
this.damagenumbers = workable.getBoolean("damagenumbers");
|
||||
this.healthbardisplay = workable.getBoolean("healthbardisplay");
|
||||
String tempworld = workable.getString("restartloc_world");
|
||||
if (!workable.getString("instanceloc_world").equalsIgnoreCase("null")) {
|
||||
locBeforeInstance = new Location(
|
||||
Bukkit.getWorld(workable.getString("instanceloc_world")),
|
||||
workable.getDouble("instanceloc_x"),
|
||||
workable.getDouble("instanceloc_y"),
|
||||
workable.getDouble("instanceloc_z"));
|
||||
}
|
||||
if (tempworld!=null && !tempworld.equalsIgnoreCase("null")) {
|
||||
this.restartLoc = new Location(Bukkit.getWorld(tempworld),workable.getDouble("restartloc_x"),workable.getDouble("restartloc_y"),workable.getDouble("restartloc_z"));
|
||||
}
|
||||
|
38
src/sig/plugin/TwosideKeeper/Room.java
Normal file
38
src/sig/plugin/TwosideKeeper/Room.java
Normal file
@ -0,0 +1,38 @@
|
||||
package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public class Room {
|
||||
public String id;
|
||||
ChunkGenerator generator;
|
||||
|
||||
public Room(ChunkGenerator generator) {
|
||||
id = "Instance"+(TwosideKeeper.ROOM_ID++);
|
||||
WorldCreator room = new WorldCreator(id);
|
||||
room.generator(generator);
|
||||
Bukkit.createWorld(room);
|
||||
TwosideKeeper.roominstances.add(this);
|
||||
}
|
||||
|
||||
public void killWorld() {
|
||||
Bukkit.unloadWorld(id, false);
|
||||
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
|
||||
File world = new File(TwosideKeeper.plugin.getDataFolder()+"/../../"+id);
|
||||
FileUtils.deleteQuietly(world);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
public boolean runTick() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
killWorld();
|
||||
}
|
||||
}
|
48
src/sig/plugin/TwosideKeeper/RoomWorldGenerator.java
Normal file
48
src/sig/plugin/TwosideKeeper/RoomWorldGenerator.java
Normal file
@ -0,0 +1,48 @@
|
||||
package sig.plugin.TwosideKeeper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public class RoomWorldGenerator extends ChunkGenerator{
|
||||
@Override
|
||||
public boolean canSpawn(World world, int x, int z) {
|
||||
return true;
|
||||
}
|
||||
public int xyzToByte(int x, int y, int z) {
|
||||
return (x * 16 + z) * 256 + y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
|
||||
byte[] result = new byte[65536];
|
||||
for(int x=0; x<16; x++){
|
||||
for(int z=0; z<16; z++) {
|
||||
result[xyzToByte(x,0,z)] = (byte) Material.BEDROCK.getId();
|
||||
result[xyzToByte(x,255,z)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
}
|
||||
|
||||
int wallslotx = Math.floorMod(chunkx,2);
|
||||
int wallslotz = Math.floorMod(chunkz,2);
|
||||
for (int y=1;y<255;y++) {
|
||||
for(int x=0; x<16; x++){
|
||||
for (int z=0;z<16;z++) {
|
||||
if (wallslotx==0) {
|
||||
result[xyzToByte(0,y,z)] = (byte) Material.BEDROCK.getId();
|
||||
} else {
|
||||
result[xyzToByte(15,y,z)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
if (wallslotz==0) {
|
||||
result[xyzToByte(x,y,0)] = (byte) Material.BEDROCK.getId();
|
||||
} else {
|
||||
result[xyzToByte(x,y,15)] = (byte) Material.BEDROCK.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
65
src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java
Normal file
65
src/sig/plugin/TwosideKeeper/Rooms/DPSChallengeRoom.java
Normal file
@ -0,0 +1,65 @@
|
||||
package sig.plugin.TwosideKeeper.Rooms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import sig.plugin.TwosideKeeper.PlayerStructure;
|
||||
import sig.plugin.TwosideKeeper.Room;
|
||||
import sig.plugin.TwosideKeeper.Generators.DPSRoom;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.GenericFunctions;
|
||||
|
||||
public class DPSChallengeRoom extends Room{
|
||||
Player p;
|
||||
double dmg;
|
||||
long expireTime;
|
||||
boolean started=false;
|
||||
List<LivingEntity> mobs = new ArrayList<LivingEntity>();
|
||||
World instance;
|
||||
|
||||
int ROOM_WIDTH;
|
||||
int ROOM_LENGTH;
|
||||
|
||||
public DPSChallengeRoom(Player p, ChunkGenerator generator) {
|
||||
super(generator);
|
||||
this.p=p;
|
||||
this.dmg=0;
|
||||
this.expireTime=0;
|
||||
this.started=false;
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
pd.locBeforeInstance = p.getLocation().clone();
|
||||
instance = Bukkit.getWorld(id);
|
||||
ROOM_WIDTH=((DPSRoom)generator).getRoomWidth();
|
||||
ROOM_LENGTH=((DPSRoom)generator).getRoomLength();
|
||||
p.teleport(new Location(instance,ROOM_WIDTH/2,64,ROOM_LENGTH/2));
|
||||
GenericFunctions.logAndApplyPotionEffectToEntity(PotionEffectType.LEVITATION, 20*3, -30, p, true);
|
||||
setupChallengeRoom();
|
||||
}
|
||||
|
||||
private void setupChallengeRoom() {
|
||||
|
||||
}
|
||||
|
||||
public boolean runTick() {
|
||||
if (p!=null && p.isValid()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
if (p!=null && p.isValid()) {
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
|
||||
p.teleport(pd.locBeforeInstance);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -160,6 +161,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.event.world.WorldSaveEvent;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -200,6 +202,7 @@ import sig.plugin.TwosideKeeper.Events.EntityDamagedEvent;
|
||||
import sig.plugin.TwosideKeeper.Events.InventoryUpdateEvent;
|
||||
import sig.plugin.TwosideKeeper.Events.InventoryUpdateEvent.UpdateReason;
|
||||
import sig.plugin.TwosideKeeper.Events.PlayerDodgeEvent;
|
||||
import sig.plugin.TwosideKeeper.Generators.DPSRoom;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.AnvilItem;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactAbility;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.ArtifactItem;
|
||||
@ -265,6 +268,7 @@ import sig.plugin.TwosideKeeper.HelperStructures.Utils.PlayerUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.TimeUtils;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.ColoredParticle;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.InstanceFilter;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.MixedDamage;
|
||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.Classes.SoundData;
|
||||
import sig.plugin.TwosideKeeper.HolidayEvents.Christmas;
|
||||
@ -278,6 +282,7 @@ import sig.plugin.TwosideKeeper.Monster.HellfireGhast;
|
||||
import sig.plugin.TwosideKeeper.Monster.Knight;
|
||||
import sig.plugin.TwosideKeeper.Monster.MonsterTemplate;
|
||||
import sig.plugin.TwosideKeeper.Monster.SniperSkeleton;
|
||||
import sig.plugin.TwosideKeeper.Rooms.DPSChallengeRoom;
|
||||
|
||||
|
||||
public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
@ -536,6 +541,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public static HashMap<UUID,CustomMonster> custommonsters = new HashMap<UUID,CustomMonster>();
|
||||
public static HashMap<UUID,GlobalLoot> globalloot = new HashMap<UUID,GlobalLoot>();
|
||||
public static List<EliteMonster> elitemonsters = new ArrayList<EliteMonster>();
|
||||
public static List<Room> roominstances = new ArrayList<Room>();
|
||||
|
||||
public static RecyclingCenter TwosideRecyclingCenter;
|
||||
|
||||
@ -557,6 +563,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
public static List<Material> validsetitems = new ArrayList<Material>();
|
||||
|
||||
public static double DEAL_OF_THE_DAY_PCT=0.2;
|
||||
public static int ROOM_ID=0;
|
||||
|
||||
public final static boolean CHRISTMASEVENT_ACTIVATED=false;
|
||||
public final static boolean CHRISTMASLINGERINGEVENT_ACTIVATED=false;
|
||||
@ -922,6 +929,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
}
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Effect Pool Handling", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
for (Room rm : roominstances) {
|
||||
if (!rm.runTick()) {
|
||||
rm.cleanup();
|
||||
ScheduleRemoval(roominstances,rm);
|
||||
}
|
||||
}
|
||||
TwosideKeeper.HeartbeatLogger.AddEntry("Effect Pool Handling", (int)(System.nanoTime()-time));time=System.nanoTime();
|
||||
|
||||
if ((int)(System.nanoTime()-totaltime)/1000000d>50) {
|
||||
TwosideKeeper.log("WARNING! Structure Handling took longer than 1 tick! "+((int)(System.nanoTime()-totaltime)/1000000d)+"ms", 0);
|
||||
}
|
||||
@ -1062,9 +1077,29 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
},1);
|
||||
|
||||
Bukkit.createWorld(new WorldCreator("FilterCube"));
|
||||
/*WorldCreator room_creator = new WorldCreator("Room");
|
||||
room_creator.generator(new RoomWorldGenerator());
|
||||
Bukkit.createWorld(room_creator);
|
||||
Bukkit.unloadWorld("Room", false);*/
|
||||
//Bukkit.createWorld(new WorldCreator("Room"));
|
||||
|
||||
filesave=getDataFolder(); //Store the location of where our data folder is.
|
||||
log("Data folder at "+filesave+".",3);
|
||||
File worlds = new File(TwosideKeeper.plugin.getDataFolder()+"/../../");
|
||||
String[] files = worlds.list();
|
||||
for (String s : files) {
|
||||
//TwosideKeeper.log("Found "+s, 0);
|
||||
if (s.contains("Instance")) {
|
||||
try {
|
||||
File w = new File(TwosideKeeper.plugin.getDataFolder()+"/../../"+s);
|
||||
if (w.isDirectory()) {
|
||||
FileUtils.deleteDirectory(w);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
//Without the '/'. Add / then folder name to get the next folder. Example: /arrowquivers/, /itemcubes/, etc
|
||||
//log("Spawn Radius is "+Bukkit.getServer().getSpawnRadius(),0);
|
||||
|
||||
@ -1212,6 +1247,10 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
//aPlugin.API.addCommand(StatCommand, "stats");
|
||||
}
|
||||
|
||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||
return new RoomWorldGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
//Clear out remaining parties.
|
||||
@ -1289,6 +1328,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
//TwosideKeeper.log("Saving unloaded monster "+les.getUnloadedName(), 0);
|
||||
}
|
||||
log(ChatColor.YELLOW+" "+(System.currentTimeMillis()-betweentime)+"ms",CLEANUP_DEBUG);
|
||||
log("Removing Instances ["+roominstances.size()+"]",CLEANUP_DEBUG);
|
||||
for (Room room : roominstances) {
|
||||
room.killWorld();
|
||||
}
|
||||
log(ChatColor.YELLOW+" "+(System.currentTimeMillis()-betweentime)+"ms",CLEANUP_DEBUG);
|
||||
long endtime = System.currentTimeMillis();
|
||||
log("Cleanup Maintenance completed. Total Time: "+(endtime-starttime)+"ms.",CLEANUP_DEBUG);
|
||||
}
|
||||
@ -2130,6 +2174,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
TwosideKeeperAPI.setUpgradeShardTier(shard, Integer.parseInt(args[1]));
|
||||
GenericFunctions.giveItem(p, shard);
|
||||
}
|
||||
case "INSTANCE":{
|
||||
new DPSChallengeRoom(p,new DPSRoom(32,32));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
//LivingEntity m = MonsterController.convertMonster((Monster)p.getWorld().spawnEntity(p.getLocation(),EntityType.ZOMBIE), MonsterDifficulty.ELITE);
|
||||
@ -2925,6 +2972,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
ev.getPlayer().getScoreboard().getTeam(ev.getPlayer().getName().toLowerCase()).setPrefix(GenericFunctions.PlayerModePrefix(ev.getPlayer()));
|
||||
ev.getPlayer().getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(4.0d);
|
||||
|
||||
PlayerStructure pd = PlayerStructure.GetPlayerStructure(ev.getPlayer());
|
||||
if (pd.locBeforeInstance!=null) {
|
||||
ev.getPlayer().teleport(pd.locBeforeInstance);
|
||||
pd.locBeforeInstance=null;
|
||||
}
|
||||
//ItemCubeUtils.populateItemCubeGraph(ev.getPlayer());
|
||||
}
|
||||
|
||||
@ -9961,6 +10013,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
getConfig().set("LAST_DEAL", LAST_DEAL);
|
||||
getConfig().set("WEATHER_WATCH_USERS", weather_watch_users);
|
||||
getConfig().set("LAST_SPECIAL_SPAWN", LAST_SPECIAL_SPAWN);
|
||||
getConfig().set("ROOM_ID", ROOM_ID);
|
||||
if (ELITE_LOCATION!=null) {
|
||||
getConfig().set("ELITE_LOCATION_X", ELITE_LOCATION.getBlockX());
|
||||
getConfig().set("ELITE_LOCATION_Z", ELITE_LOCATION.getBlockZ());
|
||||
@ -10027,6 +10080,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
getConfig().addDefault("LAST_DEAL", TimeUtils.GetCurrentDayOfWeek());
|
||||
getConfig().addDefault("WEATHER_WATCH_USERS", weather_watch_users);
|
||||
getConfig().addDefault("LAST_SPECIAL_SPAWN", LAST_SPECIAL_SPAWN);
|
||||
getConfig().addDefault("ROOM_ID", ROOM_ID);
|
||||
getConfig().options().copyDefaults(true);
|
||||
saveConfig();
|
||||
SERVERTICK = getConfig().getLong("SERVERTICK");
|
||||
@ -10066,6 +10120,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
|
||||
LAST_DEAL = getConfig().getInt("LAST_DEAL");
|
||||
weather_watch_users = (List<String>)getConfig().getList("WEATHER_WATCH_USERS");
|
||||
LAST_SPECIAL_SPAWN = getConfig().getLong("LAST_SPECIAL_SPAWN");
|
||||
ROOM_ID = getConfig().getInt("ROOM_ID");
|
||||
if (getConfig().contains("ELITE_LOCATION_X")) {
|
||||
int x = getConfig().getInt("ELITE_LOCATION_X");
|
||||
int z = getConfig().getInt("ELITE_LOCATION_Z");
|
||||
|
Loading…
x
Reference in New Issue
Block a user