The End has been made unidentifiable for the time being.

dev
sigonasr2 9 years ago
parent 05ea2f24ea
commit 81ad5cd243
  1. BIN
      TwosideKeeper.jar
  2. 21
      src/sig/plugin/TwosideKeeper/CustomDamage.java
  3. 25
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/GenericFunctions.java
  4. 19
      src/sig/plugin/TwosideKeeper/HelperStructures/Loot.java
  5. 17
      src/sig/plugin/TwosideKeeper/HelperStructures/MonsterDifficulty.java
  6. 50
      src/sig/plugin/TwosideKeeper/MonsterController.java
  7. 1
      src/sig/plugin/TwosideKeeper/PlayerStructure.java
  8. 110
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java
  9. 2
      src/sig/plugin/TwosideKeeper/WorldShopManager.java

Binary file not shown.

@ -653,9 +653,11 @@ public class CustomDamage {
}
static void leaderRallyNearbyMonsters(Monster m, Player p) {
if (MonsterController.isZombieLeader(m) &&
if ((MonsterController.isZombieLeader(m) || (
m.getCustomName()!=null && m.getCustomName().contains(ChatColor.MAGIC+"")
)) &&
!m.hasPotionEffect(PotionEffectType.GLOWING)) {
rallyNearbyMonsters(m,p,10);
rallyNearbyMonsters(m,p,24);
}
}
@ -1120,10 +1122,6 @@ public class CustomDamage {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (pd.iframetime<TwosideKeeper.getServerTickTime()+ticks) {
pd.iframetime=TwosideKeeper.getServerTickTime()+ticks;
int level = GenericFunctions.getPotionEffectLevel(PotionEffectType.NIGHT_VISION, p);
if (level==64) {
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.NIGHT_VISION,p);
}
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.GLOWING, ticks, 0, p, true);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.NIGHT_VISION,ticks,64, p);
}
@ -1143,11 +1141,9 @@ public class CustomDamage {
if (p!=null) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
pd.iframetime=0;
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.GLOWING,1,1,p,true);
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.GLOWING,p);
int level = GenericFunctions.getPotionEffectLevel(PotionEffectType.NIGHT_VISION, p);
if (level==64) {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.NIGHT_VISION,1,1,p,true);
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.NIGHT_VISION,p);
}
}
@ -1282,7 +1278,7 @@ public class CustomDamage {
} else {
dmg+=addToPlayerLogger(damager,target,"SHARPNESS",(weapon.containsEnchantment(Enchantment.DAMAGE_ALL))?1.0+weapon.getEnchantmentLevel(Enchantment.DAMAGE_ALL)*0.5:0.0);
if (weapon.containsEnchantment(Enchantment.DAMAGE_ARTHROPODS) &&
(target instanceof Spider)) {
((target instanceof Spider))) {
dmg+=addToPlayerLogger(damager,target,"BANE OF ARTHROPODS",weapon.getEnchantmentLevel(Enchantment.DAMAGE_ARTHROPODS)*2.5);
}
if (weapon.containsEnchantment(Enchantment.DAMAGE_UNDEAD) &&
@ -1763,10 +1759,10 @@ public class CustomDamage {
difficulty_damage=new double[]{6.0,12.0,20.0};
break;
case SHULKER:
difficulty_damage=new double[]{8.0,16.0,24.0};
difficulty_damage=new double[]{8.0,16.0,960.0};
break;
case SHULKER_BULLET:
difficulty_damage=new double[]{8.0,16.0,24.0};
difficulty_damage=new double[]{8.0,16.0,960.0};
break;
case SILVERFISH:
difficulty_damage=new double[]{1.0,2.0,4.0};
@ -1847,6 +1843,9 @@ public class CustomDamage {
case ELITE:
mult*=40.0;
break;
case END:
mult*=24.0;
break;
default:
mult*=1.0;
break;

@ -2961,7 +2961,6 @@ public class GenericFunctions {
if (pd.last_rejuvenate+TwosideKeeper.REJUVENATE_COOLDOWN<=TwosideKeeper.getServerTickTime()) {
player.playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1.0f, 1.0f);
addIFrame(player,40);
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.REGENERATION,player);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.REGENERATION,200,9,player,true);
aPlugin.API.sendCooldownPacket(player, player.getEquipment().getItemInMainHand(), TwosideKeeper.REJUVENATE_COOLDOWN);
}
@ -3725,7 +3724,6 @@ public class GenericFunctions {
int currentlv = getPotionEffectLevel(type,p);
PotionEffect neweffect = new PotionEffect(type,tick_duration,(currentlv+incr_amt<maxlv)?(currentlv+incr_amt):maxlv);
if (tick_duration+BUFFER >= duration) {
logAndRemovePotionEffectFromPlayer(type,p);
logAndApplyPotionEffectToPlayer(neweffect.getType(), neweffect.getDuration(),neweffect.getAmplifier(), p, true);
}
} else {
@ -3811,4 +3809,27 @@ public class GenericFunctions {
}
}
}
public static void logToFile(String message) {
try {
if (!TwosideKeeper..exists()) {
savePath.mkdir();
}
File saveTo = new File(plugin.getDataFolder(), "aPluginLogger.txt");
if (!saveTo.exists()) {
saveTo.createNewFile();
}
FileWriter fw = new FileWriter(saveTo, true);
PrintWriter pw = new PrintWriter(fw);
pw.println(message);
pw.flush();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -105,6 +105,25 @@ public class Loot {
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),4));
aPlugin.API.Chests.LOOT_HELLFIRE.addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),4));
aPlugin.API.Chests.LOOT_HELLFIRE.printDrops();
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_SWORD,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_SWORD,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_AXE,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_PICKAXE,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_HOE,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_SPADE,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.BOW,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.FISHING_ROD,8));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_LEGGINGS,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_BOOTS,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.DIAMOND_HELMET,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_CHESTPLATE,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_LEGGINGS,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_BOOTS,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropMaterial(Material.GOLD_HELMET,78));
aPlugin.API.Chests.LOOT_CUSTOM.addDrop(new DropItem(Artifact.createArtifactItem(ArtifactItem.DIVINE_CORE),4));
aPlugin.API.Chests.LOOT_CUSTOM.printDrops();
//aPlugin.API.Chests..addDrop(new DropItem(TwosideKeeper.HUNTERS_COMPASS.getItemStack(),10));
}

@ -201,7 +201,18 @@ public enum MonsterDifficulty {
new LootStructure[]{ //Legendary Loot
new LootStructure(Material.END_CRYSTAL),
}
);
),
END(
new LootStructure[]{ //Common Loot
new LootStructure(Material.EMERALD),
},
new LootStructure[]{ //Rare Loot
new LootStructure(Material.EMERALD_BLOCK),
},
new LootStructure[]{ //Legendary Loot
new LootStructure(Material.END_CRYSTAL),
}
);
LootStructure[] loot_regular;
LootStructure[] loot_rare;
@ -256,6 +267,10 @@ public enum MonsterDifficulty {
goodie=aPlugin.API.Chests.LOOT_HELLFIRE.getSingleDrop();
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_HELLFIRE, damager);
}break;
case END:{
goodie=aPlugin.API.Chests.LOOT_CUSTOM.getSingleDrop();
KeepRollingForBosses(isBoss, droplist, goodie, aPlugin.API.Chests.LOOT_CUSTOM, damager);
}break;
case ELITE:{
}break;

@ -58,7 +58,7 @@ public class MonsterController {
ent.remove();
return false;
}
}
} else
if (!meetsConditionsToSpawn(ent)) {
return false;
}
@ -79,6 +79,11 @@ public class MonsterController {
convertMonster(m,md);
return true;
}
if (ent.getWorld().getName().equalsIgnoreCase("world_the_end")) {
Monster m = (Monster)ent;
convertMonster(m,MonsterDifficulty.END);
return true;
} else
if (ylv>=128) {
//This is a 95% chance this will despawn.
if (Math.random()<=0.95 && !ent.getWorld().hasStorm() &&
@ -148,9 +153,11 @@ public class MonsterController {
double dist = 999999999;
int nearbyplayers=0;
for (Player p : Bukkit.getOnlinePlayers()) {
double temp = ent.getLocation().distanceSquared(p.getLocation());
if (temp<4096) {nearbyplayers++;}
dist = (temp<dist)?temp:dist;
if (ent.getWorld().equals(p.getWorld())) {
double temp = ent.getLocation().distanceSquared(p.getLocation());
if (temp<4096) {nearbyplayers++;}
dist = (temp<dist)?temp:dist;
}
}
return (dist<4096 && ent.getNearbyEntities(16, 16, 16).size()<nearbyplayers*3);
}
@ -650,7 +657,8 @@ public class MonsterController {
(md==MonsterDifficulty.NORMAL && ent.getMaxHealth()>20) ||
(md==MonsterDifficulty.DANGEROUS && ent.getMaxHealth()>20*2) ||
(md==MonsterDifficulty.DEADLY && ent.getMaxHealth()>20*3) ||
(md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4)
(md==MonsterDifficulty.HELLFIRE && ent.getMaxHealth()>20*4) ||
(md==MonsterDifficulty.END && ent.getMaxHealth()>20*80)
)
{
return true;
@ -663,6 +671,9 @@ public class MonsterController {
}
public static Monster convertMonster(Monster m) {
if (m.getWorld().getName().equalsIgnoreCase("world_the_end")) {
convertMonster(m,MonsterDifficulty.END);
}
if (m.getLocation().getY()<48) {
if (m.getLocation().getY()>=32)
return convertMonster(m,MonsterDifficulty.DANGEROUS);
@ -689,6 +700,9 @@ public class MonsterController {
if (m.getCustomName().contains("Elite")) {
return MonsterDifficulty.ELITE;
} else
if (m.getCustomName().contains("End")) {
return MonsterDifficulty.END;
} else
{
return MonsterDifficulty.NORMAL;
}
@ -844,6 +858,32 @@ public class MonsterController {
}
m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(24.0);
}break;
case END:{
//m.setCustomName(ChatColor.DARK_AQUA+"Dangerous Mob");
//m.setCustomNameVisible(true);
if (m.getType()!=EntityType.ENDERMAN) {
m.setFireTicks(Integer.MAX_VALUE);
}
if (isAllowedToEquipItems(m)) {
m.getEquipment().clear();
RandomizeEquipment(m,0);
}
m.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,1));
m.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,3));
SetupCustomName(ChatColor.DARK_BLUE+""+ChatColor.MAGIC+"End",m);
if(isZombieLeader(m))
{
GlowAPI.setGlowing(m, Color.DARK_RED, Bukkit.getOnlinePlayers());
m.setMaxHealth(32000); //Target is 1600 HP.
m.setHealth(m.getMaxHealth());
MonsterStructure.getMonsterStructure(m).SetLeader(true);
TwosideKeeper.log("->Setting a monster with Difficulty "+md.name()+" w/"+m.getHealth()+"/"+m.getMaxHealth()+" HP to a Leader.",5);
} else {
m.setMaxHealth(m.getMaxHealth()*80.0);
m.setHealth(m.getMaxHealth());
}
m.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(64.0);
}break;
}
removeZombieLeaderAttribute(m);
return m;

@ -103,6 +103,7 @@ public class PlayerStructure {
public List<PotionEffect> lasteffectlist=null;
public boolean stealthmode=false;
public long lastcompassnotification=0;
public long endnotification=0;
public long iframetime = 0;

@ -45,6 +45,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Shulker;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.TippedArrow;
@ -479,6 +480,13 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
p.setHealth((p.getHealth()+totalregen>p.getMaxHealth())?p.getMaxHealth():p.getHealth()+totalregen);
}
}
if (pd.endnotification+72000<getServerTickTime() &&
p.getWorld().getName().equalsIgnoreCase("world_the_end")) {
pd.endnotification=getServerTickTime();
playEndWarningNotification(p);
}
//See if this player is sleeping.
if (p.isSleeping()) {
p.setHealth(Bukkit.getPlayer(pd.name).getMaxHealth()); //Heals the player fully when sleeping.
@ -515,6 +523,54 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
TwosideSpleefGames.TickEvent();
}
private void playEndWarningNotification(Player p) {
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.sendMessage(ChatColor.GOLD+"A Mysterious Entity glares at you...");
}
},1);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.sendMessage(ChatColor.BLUE+" \"You DO NOT BELONG HERE.\"");
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},20);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.playSound(p.getLocation().add(0,20,0), Sound.ENTITY_GHAST_WARN, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},23);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.playSound(p.getLocation().add(-10,0,-5), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},27);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.playSound(p.getLocation().add(-10,0,-5), Sound.ENTITY_GHAST_SCREAM, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_AMBIENT, 1.0f, 1.0f);
p.playSound(p.getLocation(), Sound.ENTITY_GHAST_SHOOT, 1.0f, 1.0f);
}
},30);
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, new Runnable() {
@Override
public void run() {
p.sendMessage(ChatColor.RED+"You cannot identify The End properly!");
}
},90);
}
private void sendAllLoggedMessagesToSpam() {
StringBuilder finalstring = new StringBuilder();
for (String msg : TwosideKeeper.log_messages) {
@ -609,7 +665,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (absorption_amt>0) {
if (p.hasPotionEffect(PotionEffectType.ABSORPTION)) {
int oldlv = GenericFunctions.getPotionEffectLevel(PotionEffectType.ABSORPTION, p);
GenericFunctions.logAndRemovePotionEffectFromPlayer(PotionEffectType.ABSORPTION,p);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.ABSORPTION,599,(int)(absorption_amt/4)+oldlv,p);
} else {
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.ABSORPTION,599,(int)(absorption_amt/4),p);
@ -4046,10 +4101,15 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
return;
}
if (ev.getEntity() instanceof Shulker) {
convertToStrongerShulker(ev.getEntity());
}
if ((ev.getSpawnReason().equals(SpawnReason.NATURAL) ||
ev.getSpawnReason().equals(SpawnReason.SPAWNER_EGG) ||
ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) ||
ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) &&
ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION) ||
ev.getSpawnReason().equals(SpawnReason.CHUNK_GEN)) &&
ev.getEntity() instanceof Monster) {
if (ev.getSpawnReason().equals(SpawnReason.REINFORCEMENTS) || ev.getSpawnReason().equals(SpawnReason.VILLAGE_INVASION)) {
//Remove this one and spawn another one.
@ -4093,7 +4153,18 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
//A fix to make achievemnt announcements not show the healthbar!
private void convertToStrongerShulker(LivingEntity entity) {
if (entity.getWorld().getName().equalsIgnoreCase("world_the_end")) {
entity.setFireTicks(Integer.MAX_VALUE);
entity.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,Integer.MAX_VALUE,1));
entity.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,Integer.MAX_VALUE,3));
entity.setCustomName(ChatColor.DARK_BLUE+""+ChatColor.MAGIC+"End"+" "+GenericFunctions.CapitalizeFirstLetters(entity.getType().name()));
entity.setMaxHealth(entity.getMaxHealth()*420.0);
entity.setHealth(entity.getMaxHealth());
}
}
//A fix to make achievemnt announcements not show the healthbar!
@EventHandler(priority=EventPriority.LOW,ignoreCancelled = true)
public void playerGetAchievementEvent(PlayerAchievementAwardedEvent ev) {
final Player p = ev.getPlayer();
@ -4794,6 +4865,37 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}}
,50);
break;
case END:
m.getWorld().playSound(m.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1.0f, 1.0f);
totalexp=ev.getDroppedExp()*40;
ev.setDroppedExp((int)(totalexp*0.75));
final Monster mer4 = m;
final int expdrop4 = totalexp;
droplist.clear(); //Clear the drop list. We are going to delay the drops.
droplist.addAll(originaldroplist);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
if (mer4.getLocation().getBlockY()<48) {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 5.0f, false, true);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 12, 5);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),2);
} else {
mer4.getWorld().createExplosion(mer4.getLocation().getBlockX(), mer4.getLocation().getBlockY(), mer4.getLocation().getBlockZ(), 6.0f, false, false);
GenericFunctions.DealExplosionDamageToEntities(mer4.getLocation(), 12, 6);
GenericFunctions.RandomlyCreateFire(mer4.getLocation(),3);
}
}}
,30);
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
for (int i=0;i<drop.size();i++) {
Item it = deathloc.getWorld().dropItemNaturally(mer4.getLocation(), drop.get(i));
it.setInvulnerable(true);
}
GenericFunctions.spawnXP(mer4.getLocation(), (int)(expdrop4*0.25));
}}
,50);
break;
case ELITE:
totalexp=ev.getDroppedExp()*300;
final Monster mer2 = m;
@ -6478,7 +6580,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
if (PlayerMode.isDefender(p)) {
hp+=10;
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.REGENERATION,60,(p.isBlocking())?1:0,p);
GenericFunctions.logAndApplyPotionEffectToPlayer(PotionEffectType.REGENERATION,60,(p.isBlocking())?1:0,p,false);
}

@ -311,7 +311,7 @@ public class WorldShopManager {
);
}
}
config.delete();
//config.delete();
}
public void Cleanup() {

Loading…
Cancel
Save